Проверенный контрактЧастичноеMIT
ERC1967Proxy
Адрес0x443ab500b176bdbcfda01a702e7495c458a62867
- Баланс
0 ETH
- Транзакций
14 501
- Компилятор
solc 0.8.28
- Тот же код
Только этот контракт
Подробности
- Компилятор
- solc 0.8.28+commit.7893614a
- Язык
- solidity
- Оптимизация
- Да, 200 прогонов
- Версия EVM
- cancun
- Лицензия
- MIT
- Совпадение
- Частичноекод создания: нет, код в сети: да
- Проверен на Sourcify
- Создан в блоке
- 24 720 119
- Транзакция создания
- 0x08ba7db562…9fa21233ce
- Реализация прокси
- 0x86b21fdc…aaddaf0bисходник не проверен
30 файлов
Исходный код большой: показывается один файл. Выберите файл в списке.
- script/Deploy.s.solглавный2,31 КБ
- contracts/MSPGamePlatform.sol45 КБ
- lib/forge-std/src/Base.sol2,23 КБ
- lib/forge-std/src/Script.sol881 Б
- lib/forge-std/src/StdChains.sol14,27 КБ
- lib/forge-std/src/StdCheats.sol31,81 КБ
- lib/forge-std/src/StdConstants.sol1,87 КБ
- lib/forge-std/src/StdJson.sol9,7 КБ
- lib/forge-std/src/StdMath.sol1,36 КБ
- lib/forge-std/src/StdStorage.sol17,84 КБ
- lib/forge-std/src/StdStyle.sol10,46 КБ
- lib/forge-std/src/StdUtils.sol9,9 КБ
- lib/forge-std/src/Vm.sol130,77 КБ
- lib/forge-std/src/console.sol69,27 КБ
- lib/forge-std/src/console2.sol117 Б
- lib/forge-std/src/interfaces/IMulticall3.sol2,19 КБ
- lib/forge-std/src/safeconsole.sol427,54 КБ
- node_modules/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol4,03 КБ
- node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol9,28 КБ
- node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol6,57 КБ
- node_modules/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol1,19 КБ
- node_modules/@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol3,66 КБ
- node_modules/@openzeppelin/contracts/interfaces/IERC1967.sol637 Б
- node_modules/@openzeppelin/contracts/interfaces/draft-IERC1822.sol882 Б
- node_modules/@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol6,24 КБ
- node_modules/@openzeppelin/contracts/proxy/beacon/IBeacon.sol473 Б
- node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol2,78 КБ
- node_modules/@openzeppelin/contracts/utils/Address.sol6 КБ
- node_modules/@openzeppelin/contracts/utils/Errors.sol896 Б
- node_modules/@openzeppelin/contracts/utils/StorageSlot.sol4,18 КБ
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 {}
}
Настройки компилятораПоказать
{
"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/"
]
}Исходный код и метаданные: Sourcify.
Исходный код принадлежит авторам контракта.