From f22af662b8c468ec3b4dd7546d3508b0cf99e2fb Mon Sep 17 00:00:00 2001 From: PengDeng Date: Mon, 29 Jan 2024 13:38:24 +0800 Subject: [PATCH] deploy cyberid on op_sepolia --- docs/deploy/op_sepolia-11155420/contract.md | 8 +++ package.json | 1 + script/DeployCyberId.s.sol | 3 +- script/SetCyberIDInitState.s.sol | 1 - script/libraries/DeploySetting.sol | 3 +- script/libraries/LibDeploy.sol | 68 ++++++++------------- 6 files changed, 40 insertions(+), 44 deletions(-) create mode 100755 docs/deploy/op_sepolia-11155420/contract.md diff --git a/docs/deploy/op_sepolia-11155420/contract.md b/docs/deploy/op_sepolia-11155420/contract.md new file mode 100755 index 0000000..fa66f09 --- /dev/null +++ b/docs/deploy/op_sepolia-11155420/contract.md @@ -0,0 +1,8 @@ +| Contract | Address | +| ----------------------- | ------------------------------------------ | +| CyberIdRegistry | 0x5ea688312b97d5f1ed36db65240a2e04f1eb5899 | +| CyberIdPublicResolver | 0x2a40683b8664febdcde113cb890f4ccd9b07f55e | +| CyberIdReverseRegistrar | 0x0d56da4a8cf09bec31e22c66209605ff7dfb8ea2 | +| CyberId(Impl) | 0x96dfc7d8892c1c18aa8c896e17988fcf254a42f3 | +| CyberId(Proxy) | 0x484d1170d28eecda1200c32b186c66be6e0332ec | +| StableFeeMiddleware | 0x1a9ec1ce57616f91367577a8fc85d3f8b1ec8d18 | diff --git a/package.json b/package.json index b5cecc9..682b80a 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "gen_abi": "ts-node misc/gen_abi.ts", "deploy_realmid:mumbai": "source .env.mumbai && forge script script/DeployRealmId.s.sol:DeployRealmId --verify --rpc-url $RPC_URL --legacy --private-key $PRIVATE_KEY --broadcast -vvv", "deploy_cyberid:op_goerli": "source .env.op_goerli && forge script script/DeployCyberId.s.sol:DeployCyberId --verify --rpc-url $RPC_URL --private-key $PRIVATE_KEY --etherscan-api-key $API_KEY --broadcast -vvv", + "deploy_cyberid:op_sepolia": "source .env.op_sepolia.owner && forge script script/DeployCyberId.s.sol:DeployCyberId --verify --rpc-url $RPC_URL --private-key $PRIVATE_KEY --etherscan-api-key $API_KEY --broadcast --slow -vvv", "deploy_cyberid:op": "source .env.op && forge script script/DeployCyberId.s.sol:DeployCyberId --verify --rpc-url $RPC_URL --private-key $PRIVATE_KEY --etherscan-api-key $API_KEY --broadcast -vvv", "deploy_cyberid_stablemw:op_goerli": "source .env.op_goerli && forge script script/DeployCyberIdStableMw.s.sol:DeployCyberIdStableMw --verify --rpc-url $RPC_URL --private-key $PRIVATE_KEY --etherscan-api-key $API_KEY --broadcast -vvv", "deploy_cyberid_stablemw:op": "source .env.op.owner && forge script script/DeployCyberIdStableMw.s.sol:DeployCyberIdStableMw --verify --rpc-url $RPC_URL --private-key $PRIVATE_KEY --etherscan-api-key $API_KEY --broadcast -vvv", diff --git a/script/DeployCyberId.s.sol b/script/DeployCyberId.s.sol index 98c6760..5a7df30 100644 --- a/script/DeployCyberId.s.sol +++ b/script/DeployCyberId.s.sol @@ -13,7 +13,8 @@ contract DeployCyberId is Script, DeploySetting { if ( block.chainid == DeploySetting.OP_GOERLI || - block.chainid == DeploySetting.OP + block.chainid == DeploySetting.OP || + block.chainid == DeploySetting.OP_SEPOLIA ) { LibDeploy.deployCyberId(vm, deployParams); } diff --git a/script/SetCyberIDInitState.s.sol b/script/SetCyberIDInitState.s.sol index 92850af..2048a16 100644 --- a/script/SetCyberIDInitState.s.sol +++ b/script/SetCyberIDInitState.s.sol @@ -18,7 +18,6 @@ contract SetCyberIDInitState is Script, DeploySetting { LibDeploy.setCyberIDInitState( deployParams, 0xe55793f55dF1F1B5037ebA41881663583d4f9B24, // cyber id - 0x3Ec8E19306DF5A262b365E433Dd9A2A137a92FC3, // permissioned stable fee mw 0x5eA688312b97D5F1eD36DB65240a2e04f1Eb5899, // registry 0x2A40683b8664FEBdCDE113cb890F4CCd9B07F55E, // public resolver 0x0D56dA4A8cF09BEC31e22C66209605FF7DFB8ea2 // reverse registrar diff --git a/script/libraries/DeploySetting.sol b/script/libraries/DeploySetting.sol index 4e053d8..9e425b4 100644 --- a/script/libraries/DeploySetting.sol +++ b/script/libraries/DeploySetting.sol @@ -18,6 +18,7 @@ contract DeploySetting { uint256 internal constant MUMBAI = 80001; uint256 internal constant OP_GOERLI = 420; uint256 internal constant OP = 10; + uint256 internal constant OP_SEPOLIA = 11155420; function _setDeployParams() internal { if (block.chainid == BASE_GOERLI) { @@ -31,7 +32,7 @@ contract DeploySetting { deployParams.deployerContract = address( 0xF191131dAB798dD6c500816338d4B6EBC34825C7 ); - } else if (block.chainid == OP_GOERLI) { + } else if (block.chainid == OP_GOERLI || block.chainid == OP_SEPOLIA) { deployParams.deployerContract = address( 0x8eD1282a1aCE084De1E99E9Ce5ed68896C49d65f ); diff --git a/script/libraries/LibDeploy.sol b/script/libraries/LibDeploy.sol index 358f312..014d12f 100644 --- a/script/libraries/LibDeploy.sol +++ b/script/libraries/LibDeploy.sol @@ -34,6 +34,7 @@ library LibDeploy { else if (chainId == 80001) chainName = "mumbai"; else if (chainId == 420) chainName = "op_goerli"; else if (chainId == 10) chainName = "op"; + else if (chainId == 11155420) chainName = "op_sepolia"; else chainName = "unknown"; return string( @@ -86,7 +87,6 @@ library LibDeploy { function setCyberIDInitState( DeploySetting.DeployParameters memory params, address cyberIdProxy, - address permissionedStableFeeMw, address cyberIdRegistry, address cyberIdPublicResolver, address cyberIdReverseRegistrar @@ -95,24 +95,6 @@ library LibDeploy { keccak256(bytes("OPERATOR_ROLE")), params.protocolOwner ); - CyberId(cyberIdProxy).setMiddleware( - permissionedStableFeeMw, - abi.encode( - true, - params.signer, - params.recipient, - [ - uint256(10000 ether), - 2000 ether, - 1000 ether, - 500 ether, - 100 ether, - 50 ether, - 10 ether, - 5 ether - ] - ) - ); CyberId(cyberIdProxy).grantRole( keccak256(bytes("OPERATOR_ROLE")), params.signer @@ -159,7 +141,7 @@ library LibDeploy { Vm vm, DeploySetting.DeployParameters memory params, address cyberIdProxy - ) internal { + ) internal returns (address) { Create2Deployer dc = Create2Deployer(params.deployerContract); address stableFeeMw = address( dc.deploy( @@ -175,6 +157,7 @@ library LibDeploy { ) ); _write(vm, "StableFeeMiddleware", stableFeeMw); + return stableFeeMw; } function deployCyberId( @@ -233,31 +216,34 @@ library LibDeploy { _write(vm, "CyberId(Proxy)", cyberIdProxy); - address stableFeeMw = address( - dc.deploy( - abi.encodePacked( - type(StableFeeMiddleware).creationCode, - abi.encode(params.usdOracle, cyberIdProxy) - ), - SALT - ) + setCyberIDInitState( + params, + cyberIdProxy, + cyberIdRegistry, + cyberIdPublicResolver, + cyberIdReverseRegistrar ); - _write(vm, "StableFeeMiddleware", stableFeeMw); - address permissionedStableFeeMw = address( - dc.deploy( - abi.encodePacked( - type(PermissionedStableFeeMiddleware).creationCode, - abi.encode( - params.usdOracle, - params.tokenReceiver, - cyberIdProxy - ) - ), - SALT + address stableFeeMw = deployCyberIdStableMw(vm, params, cyberIdProxy); + + CyberId(cyberIdProxy).unpause(); + CyberId(cyberIdProxy).setMiddleware( + stableFeeMw, + abi.encode( + true, + params.recipient, + [ + uint256(10000 ether), + 2000 ether, + 1000 ether, + 500 ether, + 100 ether, + 50 ether, + 10 ether, + 5 ether + ] ) ); - _write(vm, "PermissionedStableFeeMiddleware", permissionedStableFeeMw); } function deployRealmId(