From 9fe8ae3d26362238e448a19d7532a121c36dc6c6 Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 31 Oct 2023 17:18:23 +0800 Subject: [PATCH 1/4] salt --- script/deploy/Deploy.s.sol | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/script/deploy/Deploy.s.sol b/script/deploy/Deploy.s.sol index 83d406b..dae26ef 100644 --- a/script/deploy/Deploy.s.sol +++ b/script/deploy/Deploy.s.sol @@ -29,12 +29,14 @@ contract Deploy is Common { using stdJson for string; using ScriptTools for string; - address immutable ORMP_ADDR = 0x0034607daf9c1dc6628f6e09E81bB232B6603A89; - bytes32 immutable ORMP_SALT = 0x4a177511c10933b157108cb8d40e2cbeeccafdec51c3445d5e117ac1981285be; - address immutable ORACLE_ADDR = 0x0002396F1D52323fcd1ae8079b38808F046882c3; - bytes32 immutable ORACLE_SALT = 0x4988d5215faf6ade0dcd51066e709ccb81edc58914ea7a60b0afa1f3a01c71f3; - address immutable RELAYER_ADDR = 0x007EED6207c9AF3715964Fb7f8B5f44E002a3498; - bytes32 immutable RELAYER_SALT = 0xcd9f567f57f0c293ba969f9c702f7684bb9e758d3a6bb88da8c99e6f1e851e5d; + address immutable ORMP_ADDR = 0x009D223Aad560e72282db9c0438Ef1ef2bf7703D; + bytes32 immutable ORMP_SALT = 0x0a68f3af806b448a1e6e4b5b2fced6f144cff5e1bfd733bcb51916a6d696e7aa; + + address immutable ORACLE_ADDR = 0x00BD655DDfA7aFeF4BB109FE1F938724527B49D8; + bytes32 immutable ORACLE_SALT = 0xfbb782802ad938a1df1c89407273c248c1d7af7b4f9e94704564a4ca792a4296; + + address immutable RELAYER_ADDR = 0x0065a081a11cc1f6e1692c2A08E9AF36b17973eC; + bytes32 immutable RELAYER_SALT = 0x5f1532f1a200d9076629b2691489b82712c30ba913251eae5871243a0faa5062; string config; string instanceId; From 638185f14daa6c47194409397af96902aaf31ad4 Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 31 Oct 2023 17:18:38 +0800 Subject: [PATCH 2/4] upgrade lib creat3 --- lib/create3-deploy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/create3-deploy b/lib/create3-deploy index c20e83a..7b367e5 160000 --- a/lib/create3-deploy +++ b/lib/create3-deploy @@ -1 +1 @@ -Subproject commit c20e83a1a8a98bac66299cafe611760553fcaab2 +Subproject commit 7b367e5f85cd726ce04d2425069dc32c39ab4365 From 4b2eee728e1c57496eff3b5f52154c1ef5b260cf Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 31 Oct 2023 17:35:46 +0800 Subject: [PATCH 3/4] redeploy --- README.md | 6 +-- bin/verify.sh | 6 +-- script/deploy/Deploy.s.sol | 59 +++++++++++------------ script/output/421614/deploy.a-latest.json | 8 +-- script/output/44/deploy.a-latest.json | 8 +-- 5 files changed, 43 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 4d1d5a9..59ca1e3 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ Oracle and Relayer based Message Protocol. ### Canonical Cross-chain Deployment Addresses | Contract | Canonical Cross-chain Deployment Address | |------------|--------------------------------------------| -| ORMP | 0x0034607daf9c1dc6628f6e09E81bB232B6603A89 | -| Oracle | 0x0002396F1D52323fcd1ae8079b38808F046882c3 | -| Relayer | 0x007EED6207c9AF3715964Fb7f8B5f44E002a3498 | +| ORMP | 0x009D223Aad560e72282db9c0438Ef1ef2bf7703D | +| Oracle | 0x00BD655DDfA7aFeF4BB109FE1F938724527B49D8 | +| Relayer | 0x0065a081a11cc1f6e1692c2A08E9AF36b17973eC | ## Usage To install with [**Foundry**](https://github.com/gakonst/foundry): diff --git a/bin/verify.sh b/bin/verify.sh index 2d1515a..c452536 100755 --- a/bin/verify.sh +++ b/bin/verify.sh @@ -3,9 +3,9 @@ set -eo pipefail deployer=0x0f14341A7f464320319025540E8Fe48Ad0fe5aec -ormp=0x0034607daf9c1dc6628f6e09E81bB232B6603A89 -oracle=0x0002396F1D52323fcd1ae8079b38808F046882c3 -relayer=0x007EED6207c9AF3715964Fb7f8B5f44E002a3498 +ormp=0x009D223Aad560e72282db9c0438Ef1ef2bf7703D +oracle=0x00BD655DDfA7aFeF4BB109FE1F938724527B49D8 +relayer=0x0065a081a11cc1f6e1692c2A08E9AF36b17973eC verify() { local addr; addr=$1 diff --git a/script/deploy/Deploy.s.sol b/script/deploy/Deploy.s.sol index dae26ef..5b1584f 100644 --- a/script/deploy/Deploy.s.sol +++ b/script/deploy/Deploy.s.sol @@ -7,7 +7,7 @@ import {console2 as console} from "forge-std/console2.sol"; import {Common} from "create3-deploy/script/Common.s.sol"; import {ScriptTools} from "create3-deploy/script/ScriptTools.sol"; -import "../../src/ORMP.sol"; +import {ORMP} from "../../src/ORMP.sol"; import {Relayer} from "../../src/eco/Relayer.sol"; import {Oracle} from "../../src/eco/Oracle.sol"; @@ -69,17 +69,16 @@ contract Deploy is Common { function run() public { require(deployer == msg.sender, "!deployer"); - address ormp = deployProtocol(); + deployProtocol(); + deployOralce(); + deployRelayer(); - address oracle = deployOralce(ormp); - address relayer = deployRelayer(ormp); - - setConfig(ormp, oracle, relayer); + setConfig(); ScriptTools.exportContract(outputName, "DAO", dao); - ScriptTools.exportContract(outputName, "ORMP", ormp); - ScriptTools.exportContract(outputName, "ORACLE", oracle); - ScriptTools.exportContract(outputName, "RELAYER", relayer); + ScriptTools.exportContract(outputName, "ORMP", ORMP_ADDR); + ScriptTools.exportContract(outputName, "ORACLE", ORMP_ADDR); + ScriptTools.exportContract(outputName, "RELAYER", RELAYER_ADDR); } /// @notice Deploy the protocol @@ -94,50 +93,50 @@ contract Deploy is Common { } /// @notice Deploy the Oracle - function deployOralce(address ormp) public broadcast returns (address) { + function deployOralce() public broadcast returns (address) { bytes memory byteCode = type(Oracle).creationCode; - bytes memory initCode = bytes.concat(byteCode, abi.encode(deployer, ormp)); + bytes memory initCode = bytes.concat(byteCode, abi.encode(deployer, ORMP_ADDR)); address oracle = _deploy3(ORACLE_SALT, initCode); require(oracle == ORACLE_ADDR, "!oracle"); require(III(oracle).owner() == deployer); - require(III(oracle).PROTOCOL() == ormp); + require(III(oracle).PROTOCOL() == ORMP_ADDR); console.log("Oracle deployed at: %s", oracle); return oracle; } /// @notice Deploy the Relayer - function deployRelayer(address ormp) public broadcast returns (address) { + function deployRelayer() public broadcast returns (address) { bytes memory byteCode = type(Relayer).creationCode; - bytes memory initCode = bytes.concat(byteCode, abi.encode(deployer, ormp)); + bytes memory initCode = bytes.concat(byteCode, abi.encode(deployer, ORMP_ADDR)); address relayer = _deploy3(RELAYER_SALT, initCode); require(relayer == RELAYER_ADDR, "!relayer"); require(III(relayer).owner() == deployer); - require(III(relayer).PROTOCOL() == ormp); + require(III(relayer).PROTOCOL() == ORMP_ADDR); console.log("Relayer deployed at: %s", relayer); return relayer; } /// @notice Set the protocol config - function setConfig(address ormp, address oracle, address relayer) public broadcast { - ORMP(ormp).setDefaultConfig(oracle, relayer); - Config memory cfg = ORMP(ormp).getDefaultConfig(); - require(cfg.oracle == oracle, "!oracle"); - require(cfg.relayer == relayer, "!relayer"); + function setConfig() public broadcast { + ORMP(ORMP_ADDR).setDefaultConfig(ORACLE_ADDR, RELAYER_ADDR); + Config memory cfg = ORMP(ORMP_ADDR).getDefaultConfig(); + require(cfg.oracle == ORACLE_ADDR, "!oracle"); + require(cfg.relayer == RELAYER_ADDR, "!relayer"); - III(oracle).setApproved(oracleOperator, true); - require(III(oracle).isApproved(oracleOperator), "!o-operator"); - III(relayer).setApproved(relayerOperator, true); - require(III(relayer).isApproved(relayerOperator), "!r-operator"); + III(ORACLE_ADDR).setApproved(oracleOperator, true); + require(III(ORACLE_ADDR).isApproved(oracleOperator), "!o-operator"); + III(RELAYER_ADDR).setApproved(relayerOperator, true); + require(III(RELAYER_ADDR).isApproved(relayerOperator), "!r-operator"); - III(ormp).changeSetter{gas: 200000}(dao); - require(III(ormp).setter() == dao, "!dao"); + III(ORMP_ADDR).changeSetter(dao); + require(III(ORMP_ADDR).setter() == dao, "!dao"); - III(oracle).changeOwner(dao); - require(III(oracle).owner() == dao, "!dao"); + III(ORACLE_ADDR).changeOwner(dao); + require(III(ORACLE_ADDR).owner() == dao, "!dao"); - III(relayer).changeOwner(dao); - require(III(relayer).owner() == dao, "!dao"); + III(RELAYER_ADDR).changeOwner(dao); + require(III(RELAYER_ADDR).owner() == dao, "!dao"); } } diff --git a/script/output/421614/deploy.a-latest.json b/script/output/421614/deploy.a-latest.json index 643c0a3..0a4ab58 100644 --- a/script/output/421614/deploy.a-latest.json +++ b/script/output/421614/deploy.a-latest.json @@ -1,6 +1,6 @@ { "DAO": "0x0f14341A7f464320319025540E8Fe48Ad0fe5aec", - "ORACLE": "0x0002396F1D52323fcd1ae8079b38808F046882c3", - "RELAYER": "0x007EED6207c9AF3715964Fb7f8B5f44E002a3498", - "ORMP": "0x0034607daf9c1dc6628f6e09E81bB232B6603A89" -} + "ORACLE": "0x00BD655DDfA7aFeF4BB109FE1F938724527B49D8", + "ORMP": "0x009D223Aad560e72282db9c0438Ef1ef2bf7703D", + "RELAYER": "0x0065a081a11cc1f6e1692c2A08E9AF36b17973eC" +} \ No newline at end of file diff --git a/script/output/44/deploy.a-latest.json b/script/output/44/deploy.a-latest.json index 643c0a3..0a4ab58 100644 --- a/script/output/44/deploy.a-latest.json +++ b/script/output/44/deploy.a-latest.json @@ -1,6 +1,6 @@ { "DAO": "0x0f14341A7f464320319025540E8Fe48Ad0fe5aec", - "ORACLE": "0x0002396F1D52323fcd1ae8079b38808F046882c3", - "RELAYER": "0x007EED6207c9AF3715964Fb7f8B5f44E002a3498", - "ORMP": "0x0034607daf9c1dc6628f6e09E81bB232B6603A89" -} + "ORACLE": "0x00BD655DDfA7aFeF4BB109FE1F938724527B49D8", + "ORMP": "0x009D223Aad560e72282db9c0438Ef1ef2bf7703D", + "RELAYER": "0x0065a081a11cc1f6e1692c2A08E9AF36b17973eC" +} \ No newline at end of file From 95017a7bbf14a0c1d8932a0825fc1c26c2a91288 Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 31 Oct 2023 18:06:00 +0800 Subject: [PATCH 4/4] redeploy --- bin/fee.sh | 2 +- script/deploy/Deploy.s.sol | 16 ++++++++-------- script/input/421614/oracle.c.json | 2 +- script/input/44/oracle.c.json | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bin/fee.sh b/bin/fee.sh index 1372a96..d45bbb9 100755 --- a/bin/fee.sh +++ b/bin/fee.sh @@ -4,4 +4,4 @@ set -eo pipefail set -x forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 421614 --chain-id 44 --broadcast -forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 44 --chain-id 421614 --broadcast --skip-simulation +forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 44 --chain-id 421614 --broadcast # --skip-simulation diff --git a/script/deploy/Deploy.s.sol b/script/deploy/Deploy.s.sol index 5b1584f..b1e472b 100644 --- a/script/deploy/Deploy.s.sol +++ b/script/deploy/Deploy.s.sol @@ -7,7 +7,7 @@ import {console2 as console} from "forge-std/console2.sol"; import {Common} from "create3-deploy/script/Common.s.sol"; import {ScriptTools} from "create3-deploy/script/ScriptTools.sol"; -import {ORMP} from "../../src/ORMP.sol"; +import {Config, ORMP} from "../../src/ORMP.sol"; import {Relayer} from "../../src/eco/Relayer.sol"; import {Oracle} from "../../src/eco/Oracle.sol"; @@ -69,16 +69,16 @@ contract Deploy is Common { function run() public { require(deployer == msg.sender, "!deployer"); - deployProtocol(); - deployOralce(); - deployRelayer(); + // deployProtocol(); + // deployOralce(); + // deployRelayer(); setConfig(); - ScriptTools.exportContract(outputName, "DAO", dao); - ScriptTools.exportContract(outputName, "ORMP", ORMP_ADDR); - ScriptTools.exportContract(outputName, "ORACLE", ORMP_ADDR); - ScriptTools.exportContract(outputName, "RELAYER", RELAYER_ADDR); + // ScriptTools.exportContract(outputName, "DAO", dao); + // ScriptTools.exportContract(outputName, "ORMP", ORMP_ADDR); + // ScriptTools.exportContract(outputName, "ORACLE", ORMP_ADDR); + // ScriptTools.exportContract(outputName, "RELAYER", RELAYER_ADDR); } /// @notice Deploy the protocol diff --git a/script/input/421614/oracle.c.json b/script/input/421614/oracle.c.json index 402e1f8..834982c 100644 --- a/script/input/421614/oracle.c.json +++ b/script/input/421614/oracle.c.json @@ -1,3 +1,3 @@ { - "44": "0x00945C032A37454333d7044a52a5A42Aa0f6c608" + "44": "0x00d917EC19A6b8837ADFcF8adE3D6faF62e0F587" } diff --git a/script/input/44/oracle.c.json b/script/input/44/oracle.c.json index 12416d9..c028813 100644 --- a/script/input/44/oracle.c.json +++ b/script/input/44/oracle.c.json @@ -1,3 +1,3 @@ { - "421614": "0x00945C032A37454333d7044a52a5A42Aa0f6c608" + "421614": "0x00d917EC19A6b8837ADFcF8adE3D6faF62e0F587" }