Skip to content

Commit

Permalink
OracleV2 on testnet (#107)
Browse files Browse the repository at this point in the history
* fee check

* func order

* redeply o2
  • Loading branch information
hujw77 authored Jan 23, 2024
1 parent 8f45197 commit 9b2451e
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 25 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 | 0x0000000004452056780Ff88Beb91d8FDf6381fc5 |
| OracleV2 | 0x0000000005Be70A35b6534bFBd21eC0c98B27b1f |
| Relayer | 0x0000000000808fE9bDCc1d180EfbF5C53552a6b1 |
| MsgDAO | 0x000000000879926D12aF396788C0785B7e581e53 |

Expand Down
4 changes: 2 additions & 2 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ 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 44 --broadcast --verify --skip-simulation --slow
# forge script script/deploy/Deploy.s.sol:Deploy --chain-id 421614 --broadcast --verify
forge script script/deploy/Deploy.s.sol:Deploy --chain-id 11155111 --broadcast --verify
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
8 changes: 4 additions & 4 deletions bin/fee.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ set -x
# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 46 --chain-id 44 --broadcast --slow --legacy
# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 44 --chain-id 46 --broadcast --slow --legacy

forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 11155111 --chain-id 44 --broadcast
# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 11155111 --chain-id 44 --broadcast
# 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)" 421614 --chain-id 11155111 --broadcast
forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 44 --chain-id 11155111 --broadcast
# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 44 --chain-id 421614 --broadcast --skip-simulation --legacy
# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 11155111 --chain-id 421614 --broadcast --skip-simulation --legacy
# forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 44 --chain-id 11155111 --broadcast
forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 44 --chain-id 421614 --broadcast --skip-simulation --legacy
forge script script/fee/Fee.s.sol:Fee --sig "run(uint256)" 11155111 --chain-id 421614 --broadcast --skip-simulation --legacy
3 changes: 2 additions & 1 deletion bin/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ verify() {
$path > script/output/$chain_id/$name.v.json)
}

# verify $oracle 44 $(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 11155111 $(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 $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
2 changes: 1 addition & 1 deletion script/input/44/fee.c.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ORACLE": {
"46": {
"fee": 75000000000000000000
"fee": 10000000000000000000
},
"421614": {
"fee": 1000000000000000000
Expand Down
4 changes: 2 additions & 2 deletions script/input/c3.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"SUBAPIDAO_ADDR": "0x000000000a0D8ac9cc6CbD817fA77090322FF29d",
"ORMP_ADDR": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"ORMP_SALT": "0x4d629bbdb40d29206f12a51aa81faf14553b218f96845742a89e02e55ecfcef6",
"ORACLEV2_ADDR": "0x0000000004452056780Ff88Beb91d8FDf6381fc5",
"ORACLEV2_SALT": "0x17d97172b76b9959d83665cb2f3d73f1f8a7e4eae6954c8d84ee307840928c02",
"ORACLEV2_ADDR": "0x0000000005Be70A35b6534bFBd21eC0c98B27b1f",
"ORACLEV2_SALT": "0x7c4504befd2e385553429cae4be5837dbcd7532285439afb4aca7808356cc12d",
"RELAYER_ADDR": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1",
"RELAYER_SALT": "0x9d38bcb32422a45bc9c08605d4457bcd3dadddfee1573a352ace5f1defa45621"
}
2 changes: 1 addition & 1 deletion script/output/11155111/OracleV2.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": "0x0000000004452056780Ff88Beb91d8FDf6381fc5",
"ORACLE": "0x0000000005Be70A35b6534bFBd21eC0c98B27b1f",
"ORMP": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"RELAYER": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1"
}
1 change: 1 addition & 0 deletions script/output/421614/OracleV2.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": "0x00000000046bc530804d66B6b64f7aF69B4E4E81",
"ORACLE": "0x0000000005Be70A35b6534bFBd21eC0c98B27b1f",
"ORMP": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"RELAYER": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1"
}
2 changes: 1 addition & 1 deletion script/output/44/OracleV2.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": "0x0000000004452056780Ff88Beb91d8FDf6381fc5",
"ORACLE": "0x0000000005Be70A35b6534bFBd21eC0c98B27b1f",
"ORMP": "0x00000000001523057a05d6293C1e5171eE33eE0A",
"RELAYER": "0x0000000000808fE9bDCc1d180EfbF5C53552a6b1"
}
20 changes: 11 additions & 9 deletions src/eco/OracleV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@ contract OracleV2 is Verifier {
emit ImportedMessageRoot(chainId, blockNumber, messageRoot);
}

function withdraw(address to, uint256 amount) external onlyApproved {
(bool success,) = to.call{value: amount}("");
require(success, "!withdraw");
}

function changeOwner(address owner_) external onlyOwner {
owner = owner_;
}

function setApproved(address operator, bool approve) external onlyOwner {
approvedOf[operator] = approve;
emit SetApproved(operator, approve);
}

function isApproved(address operator) public view returns (bool) {
return approvedOf[operator];
}

function setApproved(address operator, bool approve) external onlyOwner {
approvedOf[operator] = approve;
emit SetApproved(operator, approve);
function withdraw(address to, uint256 amount) external onlyApproved {
(bool success,) = to.call{value: amount}("");
require(success, "!withdraw");
}

function setFee(uint256 chainId, uint256 fee_) external onlyApproved {
Expand All @@ -82,7 +82,9 @@ contract OracleV2 is Verifier {
}

function fee(uint256 toChainId, address /*ua*/ ) public view returns (uint256) {
return feeOf[toChainId];
uint256 f = feeOf[toChainId];
require(f != 0, "!fee");
return f;
}

function assign(bytes32 msgHash) external payable {
Expand Down

0 comments on commit 9b2451e

Please sign in to comment.