Skip to content

Commit

Permalink
Support Ethereum (#34)
Browse files Browse the repository at this point in the history
* deploy on ethereum

* set airnode fee

* update fee

* config
  • Loading branch information
hujw77 authored Dec 12, 2023
1 parent 20f3c73 commit 8d53810
Show file tree
Hide file tree
Showing 18 changed files with 128 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
.env
/docs
/out
Expand Down
2 changes: 1 addition & 1 deletion bin/beacon/add-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eo pipefail

# . $(dirname $0)/add-beacon-guantong.sh
. $(dirname $0)/add-beacon-guantong.sh
. $(dirname $0)/add-beacon-aki.sh
. $(dirname $0)/add-beacon-yalin.sh
. $(dirname $0)/add-beacon-echo.sh
Expand Down
48 changes: 34 additions & 14 deletions bin/beacon/add-beacon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,43 @@ sponsorWallet=${3:?}
c3=$PWD/script/input/c3.json

subapi=$(jq -r ".SUBAPI_ADDR" $c3)
sig=$(cast sig "addBeacon(uint256,(uint256,address,bytes32,address,address))")

add_beacon() {
local chain; chain=${1:?}
local endpointId; endpointId=${2:?}
local fromChain; fromChain=${3:?}
local chainId; chainId=$(seth --to-uint256 $(seth chain-id --chain $fromChain))
local data;
data=$(set -x; ethabi encode params \
-v "(uint256,uint256,address,bytes32,address,address)" \
"(${chainId:2},${chainId:2},${airnode:2},${endpointId:2},${sponsor:2},${sponsorWallet:2})")
# (set -x; seth send $subapi $sig$data --chain $chain)
}

# chain=darwinia
# fromChain=arbitrum
# endpointId=0x18905d41e909c79069d74843dc474d0809df62b5bc555ea272b0cc49ff3fa924
# add_beacon $chain $endpointId $fromChain

# fromChain=ethereum
# endpointId=0xd3b815c7ac0ba9242a379bdc8a2f94d609e64239c6c85ac27e244828d6f48815
# add_beacon $chain $endpointId $fromChain

chain=arbitrum
fromChain=darwinia
endpointId=0x45189e2288f2d2e384c9e3be7c3c6cef65a553341ca8580e1ed3516725112bb4
add_beacon $chain $endpointId $fromChain

data=$(set -x; ethabi encode params \
-v "(address,bytes32,address,address)" \
"(${airnode:2},${endpointId:2},${sponsor:2},${sponsorWallet:2})")
fromChain=ethereum
endpointId=0xd3b815c7ac0ba9242a379bdc8a2f94d609e64239c6c85ac27e244828d6f48815
add_beacon $chain $endpointId $fromChain

sig=$(cast sig "addBeacon((address,bytes32,address,address))")
(set -x; seth send $subapi $sig$data --chain $chain)
# chain=ethereum
# fromChain=darwinia
# endpointId=0x45189e2288f2d2e384c9e3be7c3c6cef65a553341ca8580e1ed3516725112bb4
# add_beacon $chain $endpointId $fromChain


chain=darwinia
endpointId=0x18905d41e909c79069d74843dc474d0809df62b5bc555ea272b0cc49ff3fa924

data=$(set -x; ethabi encode params \
-v "(address,bytes32,address,address)" \
"(${airnode:2},${endpointId:2},${sponsor:2},${sponsorWallet:2})")

(set -x; seth send $subapi $sig$data --chain $chain)
# fromChain=arbitrum
# endpointId=0x18905d41e909c79069d74843dc474d0809df62b5bc555ea272b0cc49ff3fa924
# add_beacon $chain $endpointId $fromChain
7 changes: 4 additions & 3 deletions bin/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ set -eo pipefail

# forge script script/Config.s.sol:Config --chain-id 46 --broadcast --slow
# forge script script/Config.s.sol:Config --chain-id 42161 --broadcast --slow --legacy
# forge script script/Config.s.sol:Config --chain-id 1 --broadcast --slow --legacy --resume

forge script script/Config.s.sol:Config --chain-id 44 --broadcast
forge script script/Config.s.sol:Config --chain-id 421614 --broadcast
forge script script/Config.s.sol:Config --chain-id 11155111 --broadcast
# forge script script/Config.s.sol:Config --chain-id 44 --broadcast
# forge script script/Config.s.sol:Config --chain-id 421614 --broadcast
# forge script script/Config.s.sol:Config --chain-id 11155111 --broadcast
1 change: 1 addition & 0 deletions bin/dao.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ dao=$(jq -r ".SUBAPIDAO" $c3)

seth send -F $deployer $subapi "transferOwnership(address)" $dao --chain darwinia
seth send -F $deployer $subapi "transferOwnership(address)" $dao --chain arbitrum
seth send -F $deployer $subapi "transferOwnership(address)" $dao --chain ethereum
7 changes: 4 additions & 3 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ set -eo pipefail

# forge script script/Deploy.s.sol:Deploy --chain-id 46 --broadcast --verify --slow
# forge script script/Deploy.s.sol:Deploy --chain-id 42161 --broadcast --verify --slow --legacy
# forge script script/Deploy.s.sol:Deploy --chain-id 1 --broadcast --verify --slow --legacy

forge script script/Deploy.s.sol:Deploy --chain-id 44 --broadcast --verify
forge script script/Deploy.s.sol:Deploy --chain-id 421614 --broadcast --verify
forge script script/Deploy.s.sol:Deploy --chain-id 11155111 --broadcast --verify
# forge script script/Deploy.s.sol:Deploy --chain-id 44 --broadcast --verify
# forge script script/Deploy.s.sol:Deploy --chain-id 421614 --broadcast --verify
# forge script script/Deploy.s.sol:Deploy --chain-id 11155111 --broadcast --verify
2 changes: 1 addition & 1 deletion bin/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ verify() {
$path > script/output/$chain_id/$name.v.json)
}

verify $subapi 421614 $(cast abi-encode "constructor(address,address,address)" $deployer $rrp $ormp) src/SubAPI.sol:SubAPI
verify $subapi 1 $(cast abi-encode "constructor(address,address,address)" $deployer $rrp $ormp) src/SubAPI.sol:SubAPI
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ crab = "https://crab-rpc.darwinia.network"
darwinia = "https://rpc.darwinia.network"
arbitrum = "https://arb1.arbitrum.io/rpc"
sepolia = "https://sepolia.infura.io/v3/${INFURA_KEY}"
ethereum = "https://mainnet.infura.io/v3/${INFURA_KEY}"

[etherscan]
arbitrum = { key = "${ETHERSCAN_ARBITRUM_KEY}" }
Expand Down
3 changes: 3 additions & 0 deletions script/input/1/config.c.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"fee": 12000000000000000
}
5 changes: 5 additions & 0 deletions script/input/1/deploy.c.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"DAO": "0x0f14341A7f464320319025540E8Fe48Ad0fe5aec",
"DEPLOYER": "0x0f14341A7f464320319025540E8Fe48Ad0fe5aec",
"AIRNODE_RRP": "0xa0AD79D995DdeeB18a14eAef56A549A04e3Aa1Bd"
}
1 change: 0 additions & 1 deletion script/input/42161/config.c.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"name": "Darwinia ORMP msgroot SubAPI",
"fee": 500000000000000
}
3 changes: 1 addition & 2 deletions script/input/46/config.c.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"name": "Arbitrum ORMP msgroot SubAPI",
"fee": 100000000000000000
"fee": 1000000000000000000
}
64 changes: 64 additions & 0 deletions script/output/1/SubAPI.v.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions script/output/1/deploy.a-latest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"DAO": "0x0f14341A7f464320319025540E8Fe48Ad0fe5aec",
"SUBAPI": "0x00000000096c285629Fe3EAb3dd042c27b9dcBa6"
}
2 changes: 1 addition & 1 deletion script/output/42161/SubAPI.v.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion script/output/42161/deploy.a-latest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"DAO": "0x0f14341A7f464320319025540E8Fe48Ad0fe5aec",
"SUBAPI": "0x00000000007317c91F57D86A410934A490E62E1E"
"SUBAPI": "0x00000000096c285629Fe3EAb3dd042c27b9dcBa6"
}
2 changes: 1 addition & 1 deletion script/output/46/SubAPI.v.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion script/output/46/deploy.a-latest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"DAO": "0x0f14341A7f464320319025540E8Fe48Ad0fe5aec",
"SUBAPI": "0x00000000007317c91F57D86A410934A490E62E1E"
"SUBAPI": "0x00000000096c285629Fe3EAb3dd042c27b9dcBa6"
}

0 comments on commit 8d53810

Please sign in to comment.