Skip to content

Commit

Permalink
renaming and redeploy on testnet (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
hujw77 authored Feb 2, 2024
1 parent 4c5502d commit a43ccbb
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 36 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Oracle and Relayer based Message Protocol.
|------------|--------------------------------------------|
| ORMP | 0x00000000001523057a05d6293C1e5171eE33eE0A |
| Oracle | 0x00000000046bc530804d66B6b64f7aF69B4E4E81 |
| OracleV2 | 0x0000000004A34ac73374b65a55C93CF9D4Bc3d17 |
| ORMPOracle | 0x000000000DA67291724858F7e759A43B2d23225e |
| Relayer | 0x0000000000808fE9bDCc1d180EfbF5C53552a6b1 |
| MsgDAO | 0x000000000879926D12aF396788C0785B7e581e53 |

Expand Down
4 changes: 2 additions & 2 deletions bin/dao.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ deployer=$(jq -r ".DEPLOYER" $c3)
dao=$(jq -r ".MSGDAO" $c3)
subapi_multisig=$(jq -r ".SUBAPIMULTISIG" $c3)
ormp=$(jq -r ".ORMP_ADDR" $c3)
oracle=$(jq -r ".ORACLEV2_ADDR" $c3)
oracle=$(jq -r ".ORMPORACLE_ADDR" $c3)
relayer=$(jq -r ".RELAYER_ADDR" $c3)

set -x
Expand All @@ -26,6 +26,6 @@ set -x
# seth send -F $deployer $relayer "changeOwner(address)" $dao --chain ethereum

seth send -F $deployer $oracle "changeOwner(address)" $subapi_multisig --chain pangolin
seth send -F $deployer $oracle "changeOwner(address)" $subapi_multisig --chain crab
# seth send -F $deployer $oracle "changeOwner(address)" $subapi_multisig --chain crab
seth send -F $deployer $oracle "changeOwner(address)" $subapi_multisig --chain sepolia
seth send -F $deployer $oracle "changeOwner(address)" $subapi_multisig --chain arbitrum-sepolia
6 changes: 3 additions & 3 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ set -eo pipefail
# forge script script/deploy/Deploy.s.sol:Deploy --chain-id 42161 --broadcast --verify --slow --legacy

forge script script/deploy/Deploy.s.sol:Deploy --chain-id 43 --broadcast --verify --skip-simulation --slow
# forge script script/deploy/Deploy.s.sol:Deploy --chain-id 44 --broadcast --verify --skip-simulation --slow
# forge script script/deploy/Deploy.s.sol:Deploy --chain-id 421614 --broadcast --verify --skip-simulation --slow
# forge script script/deploy/Deploy.s.sol:Deploy --chain-id 11155111 --broadcast --verify --skip-simulation --slow
forge script script/deploy/Deploy.s.sol:Deploy --chain-id 44 --broadcast --verify --skip-simulation --slow
forge script script/deploy/Deploy.s.sol:Deploy --chain-id 421614 --broadcast --verify --skip-simulation --slow
forge script script/deploy/Deploy.s.sol:Deploy --chain-id 11155111 --broadcast --verify --skip-simulation --slow
12 changes: 6 additions & 6 deletions bin/fee.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ set -x

# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 11155111 --chain-id 44 --broadcast --slow
# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 421614 --chain-id 44 --broadcast --slow
# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 421614 --chain-id 11155111 --broadcast --slow
# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 44 --chain-id 11155111 --broadcast --slow
# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 44 --chain-id 421614 --broadcast --skip-simulation --legacy --slow
# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 11155111 --chain-id 421614 --broadcast --skip-simulation --legacy --slow

# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 11155111 --chain-id 43 --broadcast
# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 421614 --chain-id 43 --broadcast
# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 43 --chain-id 11155111 --broadcast --slow
# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 43 --chain-id 421614 --broadcast --skip-simulation --legacy --slow
forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 11155111 --chain-id 43 --broadcast
forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 421614 --chain-id 43 --broadcast
forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 43 --chain-id 11155111 --broadcast --slow
forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 421614 --chain-id 11155111 --broadcast --slow
forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 43 --chain-id 421614 --broadcast --skip-simulation --legacy --slow
forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 11155111 --chain-id 421614 --broadcast --skip-simulation --legacy --slow
8 changes: 4 additions & 4 deletions bin/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ c3=$PWD/script/input/c3.json

deployer=$(jq -r ".DEPLOYER" $c3)
ormp=$(jq -r ".ORMP_ADDR" $c3)
oracle=$(jq -r ".ORACLEV2_ADDR" $c3)
oracle=$(jq -r ".ORMPORACLE_ADDR" $c3)
relayer=$(jq -r ".RELAYER_ADDR" $c3)

verify() {
Expand All @@ -31,9 +31,9 @@ verify() {
# verify $oracle 46 $(cast abi-encode "constructor(address,address)" $deployer $ormp) src/eco/OracleV2.sol:OracleV2
# verify $oracle 42161 $(cast abi-encode "constructor(address,address)" $deployer $ormp) src/eco/OracleV2.sol:OracleV2

verify $oracle 44 $(cast abi-encode "constructor(address,address)" $deployer $ormp) src/eco/OracleV2.sol:OracleV2
verify $oracle 421614 $(cast abi-encode "constructor(address,address)" $deployer $ormp) src/eco/OracleV2.sol:OracleV2
verify $oracle 11155111 $(cast abi-encode "constructor(address,address)" $deployer $ormp) src/eco/OracleV2.sol:OracleV2
verify $oracle 44 $(cast abi-encode "constructor(address,address)" $deployer $ormp) src/eco/ORMPOracle.sol:ORMPOracle
verify $oracle 421614 $(cast abi-encode "constructor(address,address)" $deployer $ormp) src/eco/ORMPOracle.sol:ORMPOracle
verify $oracle 11155111 $(cast abi-encode "constructor(address,address)" $deployer $ormp) src/eco/ORMPOracle.sol:ORMPOracle

# verify $ormp 42161 $(cast abi-encode "constructor(address)" $deployer) src/ORMP.sol:ORMP
# verify $ormp 46 $(cast abi-encode "constructor(address)" $deployer) src/ORMP.sol:ORMP
Expand Down
22 changes: 11 additions & 11 deletions script/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {ScriptTools} from "create3-deploy/script/ScriptTools.sol";

import {ORMP} from "../../src/ORMP.sol";
import {Relayer} from "../../src/eco/Relayer.sol";
import {OracleV2} from "../../src/eco/OracleV2.sol";
import {ORMPOracle} from "../../src/eco/ORMPOracle.sol";

interface III {
function PROTOCOL() external view returns (address);
Expand Down Expand Up @@ -61,8 +61,8 @@ contract Deploy is Common {

ORMP_ADDR = c3.readAddress(".ORMP_ADDR");
ORMP_SALT = c3.readBytes32(".ORMP_SALT");
ORACLE_ADDR = c3.readAddress(".ORACLEV2_ADDR");
ORACLE_SALT = c3.readBytes32(".ORACLEV2_SALT");
ORACLE_ADDR = c3.readAddress(".ORMPORACLE_ADDR");
ORACLE_SALT = c3.readBytes32(".ORMPORACLE_SALT");
RELAYER_ADDR = c3.readAddress(".RELAYER_ADDR");
RELAYER_SALT = c3.readBytes32(".RELAYER_SALT");

Expand All @@ -77,7 +77,7 @@ contract Deploy is Common {
require(deployer == msg.sender, "!deployer");

// deployProtocol();
// deployOralce();
deployOralce();
// deployRelayer();

setConfig();
Expand All @@ -101,7 +101,7 @@ contract Deploy is Common {

/// @notice Deploy the Oracle
function deployOralce() public broadcast returns (address) {
bytes memory byteCode = type(OracleV2).creationCode;
bytes memory byteCode = type(ORMPOracle).creationCode;
bytes memory initCode = bytes.concat(byteCode, abi.encode(deployer, ORMP_ADDR));
address oracle = _deploy3(ORACLE_SALT, initCode);
require(oracle == ORACLE_ADDR, "!oracle");
Expand All @@ -127,13 +127,13 @@ contract Deploy is Common {

/// @notice Set the protocol config
function setConfig() public broadcast {
// ORMP(ORMP_ADDR).setDefaultConfig(ORACLE_ADDR, RELAYER_ADDR);
// (address o, address r) = ORMP(ORMP_ADDR).defaultUC();
// require(o == ORACLE_ADDR, "!oracle");
// require(r == RELAYER_ADDR, "!relayer");
ORMP(ORMP_ADDR).setDefaultConfig(ORACLE_ADDR, RELAYER_ADDR);
(address o, address r) = ORMP(ORMP_ADDR).defaultUC();
require(o == ORACLE_ADDR, "!oracle");
require(r == RELAYER_ADDR, "!relayer");

// III(ORACLE_ADDR).setApproved(oracleOperator, true);
// require(III(ORACLE_ADDR).isApproved(oracleOperator), "!o-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");

Expand Down
2 changes: 1 addition & 1 deletion script/fee/Fee.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ contract Fee is Common {
function run(uint256 chainId) public {
require(dao == msg.sender, "!dao");
setOracleFee(chainId);
setRelayerFee(chainId);
// setRelayerFee(chainId);
}

function setOracleFee(uint256 chainId) public broadcast {
Expand Down
6 changes: 3 additions & 3 deletions script/input/c3.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"DEPLOYER": "0x0f14341A7f464320319025540E8Fe48Ad0fe5aec",
"MSGDAO": "0x000000000879926D12aF396788C0785B7e581e53",
"SUBAPIMULTISIG": "0x0000000004127035e3559B9E3376e9DF07822B1E",
"SUBAPIMULTISIG": "0x000000000d60704384100A29efb6C9cf8cD72820",
"ORMP_ADDR": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"ORMP_SALT": "0x4d629bbdb40d29206f12a51aa81faf14553b218f96845742a89e02e55ecfcef6",
"ORACLEV2_ADDR": "0x0000000004A34ac73374b65a55C93CF9D4Bc3d17",
"ORACLEV2_SALT": "0xdd9400fe0ca3f3183153937a7a1209e1b21fbf038eb74b835dd874301323965e",
"ORMPORACLE_ADDR": "0x000000000DA67291724858F7e759A43B2d23225e",
"ORMPORACLE_SALT": "0xb5616c300c82b5cd3f79afab022c8969a8bcdb7a02fa8c685437c22388e7ea29",
"RELAYER_ADDR": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1",
"RELAYER_SALT": "0x9d38bcb32422a45bc9c08605d4457bcd3dadddfee1573a352ace5f1defa45621"
}
1 change: 1 addition & 0 deletions script/output/11155111/ORMPOracle.v.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion script/output/11155111/deploy.a-latest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"DAO": "0x0f14341A7f464320319025540E8Fe48Ad0fe5aec",
"ORACLE": "0x0000000004A34ac73374b65a55C93CF9D4Bc3d17",
"ORACLE": "0x000000000DA67291724858F7e759A43B2d23225e",
"ORMP": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"RELAYER": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1"
}
1 change: 1 addition & 0 deletions script/output/421614/ORMPOracle.v.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion script/output/421614/deploy.a-latest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"DAO": "0x0f14341A7f464320319025540E8Fe48Ad0fe5aec",
"ORACLE": "0x0000000004A34ac73374b65a55C93CF9D4Bc3d17",
"ORACLE": "0x000000000DA67291724858F7e759A43B2d23225e",
"ORMP": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"RELAYER": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1"
}
2 changes: 1 addition & 1 deletion script/output/43/deploy.a-latest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"DAO": "0x0f14341A7f464320319025540E8Fe48Ad0fe5aec",
"ORACLE": "0x0000000004A34ac73374b65a55C93CF9D4Bc3d17",
"ORACLE": "0x000000000DA67291724858F7e759A43B2d23225e",
"ORMP": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"RELAYER": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1"
}
1 change: 1 addition & 0 deletions script/output/44/ORMPOracle.v.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion script/output/44/deploy.a-latest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"DAO": "0x0f14341A7f464320319025540E8Fe48Ad0fe5aec",
"ORACLE": "0x0000000004A34ac73374b65a55C93CF9D4Bc3d17",
"ORACLE": "0x000000000DA67291724858F7e759A43B2d23225e",
"ORMP": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"RELAYER": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1"
}
7 changes: 6 additions & 1 deletion src/eco/OracleV2.sol → src/eco/ORMPOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pragma solidity 0.8.17;

import "../Verifier.sol";

contract OracleV2 is Verifier {
contract ORMPOracle is Verifier {
event Assigned(bytes32 indexed msgHash, uint256 fee);
event SetFee(uint256 indexed chainId, uint256 fee);
event SetApproved(address operator, bool approve);
Expand Down Expand Up @@ -54,6 +54,11 @@ contract OracleV2 is Verifier {

receive() external payable {}

/// @dev Only could be called by owner.
/// @notice Each channel has a corresponding oracle, and the message root should match with it.
/// @param chainId The source chain id.
/// @param messageIndex The source chain message index corresponds to the respective channel.
/// @param messageRoot The source chain message root corresponding to the channel.
function importMessageRoot(uint256 chainId, uint256 messageIndex, bytes32 messageRoot) external onlyOwner {
rootOf[chainId][messageIndex] = messageRoot;
emit ImportedMessageRoot(chainId, messageIndex, messageRoot);
Expand Down

0 comments on commit a43ccbb

Please sign in to comment.