Verified contractPartialMIT
ERC1967Proxy
Address0xe8df1b50729dde80bc238123f958d4c0107bf62c
- Balance
0 ETH
- Transactions
37
- Compiler
solc 0.8.28
- Same code
36 more contracts
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- Yes, 1 runs
- EVM version
- cancun
- Via IR
- yes
- License
- MIT
- Match
- Partialcreation code: no, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,288,503
- Creation transaction
- 0xd84899dba1…617275c8a5
- Proxy implementation
- 0x6bf33760…57c3d88dsource code not verified
- Main copy (most transactions)
- 0x3c015862…06370f29
17 files
The source code is large: one file is shown at a time. Choose a file in the list.
- script/Deploy.s.solmain2.31 KB
- contracts/MSPGamePlatform.sol97.08 KB
- lib/forge-std/src/Base.sol2.23 KB
- lib/forge-std/src/Script.sol881 B
- lib/forge-std/src/StdChains.sol14.27 KB
- lib/forge-std/src/StdCheats.sol31.81 KB
- lib/forge-std/src/StdConstants.sol1.87 KB
- lib/forge-std/src/StdJson.sol9.7 KB
- lib/forge-std/src/StdMath.sol1.36 KB
- lib/forge-std/src/StdStorage.sol17.84 KB
- lib/forge-std/src/StdStyle.sol10.46 KB
- lib/forge-std/src/StdUtils.sol9.9 KB
- lib/forge-std/src/Vm.sol130.77 KB
- lib/forge-std/src/console.sol69.27 KB
- lib/forge-std/src/console2.sol117 B
- lib/forge-std/src/interfaces/IMulticall3.sol2.19 KB
- lib/forge-std/src/safeconsole.sol427.54 KB
script/Deploy.s.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import "forge-std/Script.sol";
import "../contracts/MSPGamePlatform.sol";
contract DeployScript is Script {
function run() external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
address deployer = vm.addr(deployerPrivateKey);
console.log("Deploying with account:", deployer);
console.log("Account balance:", deployer.balance);
vm.startBroadcast(deployerPrivateKey);
// 部署实现合约
MSPGamePlatform implementation = new MSPGamePlatform();
console.log("Implementation deployed at:", address(implementation));
// 部署代理合约
bytes memory initData = abi.encodeWithSelector(
MSPGamePlatform.initialize.selector,
deployer
);
ERC1967Proxy proxy = new ERC1967Proxy(
address(implementation),
initData
);
console.log("Proxy deployed at:", address(proxy));
console.log("Owner:", deployer);
vm.stopBroadcast();
// 部署信息会自动保存在 broadcast/ 目录的 JSON 文件中
console.log("\n=== Deployment Complete ===");
console.log("Check broadcast/ directory for deployment details");
}
}
// ERC1967Proxy 合约
contract ERC1967Proxy {
bytes32 private constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
constructor(address implementation, bytes memory data) {
assembly {
sstore(IMPLEMENTATION_SLOT, implementation)
}
if (data.length > 0) {
(bool success, ) = implementation.delegatecall(data);
require(success, "Initialization failed");
}
}
fallback() external payable {
assembly {
let impl := sload(IMPLEMENTATION_SLOT)
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
receive() external payable {}
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 1,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@openzeppelin/=node_modules/@openzeppelin/",
"eth-gas-reporter/=node_modules/eth-gas-reporter/",
"forge-std/=lib/forge-std/src/",
"hardhat/=node_modules/hardhat/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.