Verified contractPartialMIT
ERC1967Proxy
Address0x443ab500b176bdbcfda01a702e7495c458a62867
- Balance
0 ETH
- Transactions
14,501
- Compiler
solc 0.8.28
- Same code
Only this contract
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- License
- MIT
- Match
- Partialcreation code: no, runtime code: yes
- Verified on Sourcify
- Created in block
- 24,720,119
- Creation transaction
- 0x08ba7db562…9fa21233ce
- Proxy implementation
- 0x86b21fdc…aaddaf0bsource code not verified
30 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.sol45 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
- node_modules/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol4.03 KB
- node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol9.28 KB
- node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol6.57 KB
- node_modules/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol1.19 KB
- node_modules/@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol3.66 KB
- node_modules/@openzeppelin/contracts/interfaces/IERC1967.sol637 B
- node_modules/@openzeppelin/contracts/interfaces/draft-IERC1822.sol882 B
- node_modules/@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol6.24 KB
- node_modules/@openzeppelin/contracts/proxy/beacon/IBeacon.sol473 B
- node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol2.78 KB
- node_modules/@openzeppelin/contracts/utils/Address.sol6 KB
- node_modules/@openzeppelin/contracts/utils/Errors.sol896 B
- node_modules/@openzeppelin/contracts/utils/StorageSlot.sol4.18 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": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 200,
"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.