Skip to content

Commit

Permalink
deploy cyberid on op_sepolia
Browse files Browse the repository at this point in the history
  • Loading branch information
PengDeng-Cyber committed Jan 29, 2024
1 parent abf38c3 commit f22af66
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 44 deletions.
8 changes: 8 additions & 0 deletions docs/deploy/op_sepolia-11155420/contract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
| Contract | Address |
| ----------------------- | ------------------------------------------ |
| CyberIdRegistry | 0x5ea688312b97d5f1ed36db65240a2e04f1eb5899 |
| CyberIdPublicResolver | 0x2a40683b8664febdcde113cb890f4ccd9b07f55e |
| CyberIdReverseRegistrar | 0x0d56da4a8cf09bec31e22c66209605ff7dfb8ea2 |
| CyberId(Impl) | 0x96dfc7d8892c1c18aa8c896e17988fcf254a42f3 |
| CyberId(Proxy) | 0x484d1170d28eecda1200c32b186c66be6e0332ec |
| StableFeeMiddleware | 0x1a9ec1ce57616f91367577a8fc85d3f8b1ec8d18 |
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion script/DeployCyberId.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 0 additions & 1 deletion script/SetCyberIDInitState.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion script/libraries/DeploySetting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
);
Expand Down
68 changes: 27 additions & 41 deletions script/libraries/LibDeploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -86,7 +87,6 @@ library LibDeploy {
function setCyberIDInitState(
DeploySetting.DeployParameters memory params,
address cyberIdProxy,
address permissionedStableFeeMw,
address cyberIdRegistry,
address cyberIdPublicResolver,
address cyberIdReverseRegistrar
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -175,6 +157,7 @@ library LibDeploy {
)
);
_write(vm, "StableFeeMiddleware", stableFeeMw);
return stableFeeMw;
}

function deployCyberId(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit f22af66

Please sign in to comment.