Skip to content

Commit

Permalink
Add hyperlane CLI and deploy core + arbiter
Browse files Browse the repository at this point in the history
  • Loading branch information
yorhodes committed Nov 19, 2024
1 parent f32d8cf commit b51bd50
Show file tree
Hide file tree
Showing 9 changed files with 7,775 additions and 1,740 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ docs/

# Dotenv file
.env

node_modules

# hyperlane deployment artifacts
configs/chains/*/addresses.yaml
Binary file modified .yarn/install-state.gz
Binary file not shown.
31 changes: 31 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,37 @@ echo "All contract deployments completed."
# - deploy an AlwaysOKSponsor and deposit some tokens using AlwaysOKAllocator to it

## NOTE: this is where arbiter deployments and test scripts will go!
hyperlane() {
# anvil account (derives to to $DEFAULT_DEPLOYER address)
export HYP_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
export LOG_LEVEL=debug

npx hyperlane core deploy --skip-confirmation --config ./configs/core-config.yaml --registry ./configs --overrides "" --chain l1
MAILBOX_ONE=$(cat ./configs/chains/l1/addresses.yaml | yq '.mailbox')
DOMAIN_ONE=$(cat ./configs/chains/l1/metadata.yaml | yq '.domainId')
ARBITER_ONE=$(forge create HyperlaneArbiter --rpc-url $CHAIN_ONE_RPC --from $DEFAULT_DEPLOYER --unlocked --constructor-args $MAILBOX_ONE $THE_COMPACT_ADDRESS --json | jq '.deployedTo')

npx hyperlane core deploy --skip-confirmation --config ./configs/core-config.yaml --registry ./configs --overrides "" --chain opchaina
MAILBOX_TWO=$(cat ./configs/chains/opchaina/addresses.yaml | yq '.mailbox')
DOMAIN_TWO=$(cat ./configs/chains/opchaina/metadata.yaml | yq '.domainId')
ARBITER_TWO=$(forge create HyperlaneArbiter --rpc-url $CHAIN_TWO_RPC --from $DEFAULT_DEPLOYER --unlocked --constructor-args $MAILBOX_TWO $THE_COMPACT_ADDRESS --json | jq '.deployedTo')

npx hyperlane core deploy --skip-confirmation --config ./configs/core-config.yaml --registry ./configs --overrides "" --chain opchainb
MAILBOX_THREE=$(cat ./configs/chains/opchainb/addresses.yaml | yq '.mailbox')
DOMAIN_THREE=$(cat ./configs/chains/opchainb/metadata.yaml | yq '.domainId')
ARBITER_THREE=$(forge create HyperlaneArbiter --rpc-url $CHAIN_THREE_RPC --from $DEFAULT_DEPLOYER --unlocked --constructor-args $MAILBOX_TWO $THE_COMPACT_ADDRESS --json | jq '.deployedTo')

cast send --unlocked --from $DEFAULT_DEPLOYER --rpc-url $CHAIN_ONE_RPC $ARBITER_ONE "enrollRemoteRouter(uint32,bytes32)" $DOMAIN_TWO $ARBITER_TWO
cast send --unlocked --from $DEFAULT_DEPLOYER --rpc-url $CHAIN_ONE_RPC $ARBITER_ONE "enrollRemoteRouter(uint32,bytes32)" $DOMAIN_THREE $ARBITER_THREE

cast send --unlocked --from $DEFAULT_DEPLOYER --rpc-url $CHAIN_ONE_RPC $ARBITER_TWO "enrollRemoteRouter(uint32,bytes32)" $DOMAIN_ONE $ARBITER_ONE
cast send --unlocked --from $DEFAULT_DEPLOYER --rpc-url $CHAIN_ONE_RPC $ARBITER_TWO "enrollRemoteRouter(uint32,bytes32)" $DOMAIN_THREE $ARBITER_THREE

cast send --unlocked --from $DEFAULT_DEPLOYER --rpc-url $CHAIN_ONE_RPC $ARBITER_THREE "enrollRemoteRouter(uint32,bytes32)" $DOMAIN_ONE $ARBITER_ONE
cast send --unlocked --from $DEFAULT_DEPLOYER --rpc-url $CHAIN_ONE_RPC $ARBITER_THREE "enrollRemoteRouter(uint32,bytes32)" $DOMAIN_TWO $ARBITER_TWO
}

hyperlane

# Wait a moment before switching over to supersim screen
sleep 0.1
Expand Down
7 changes: 7 additions & 0 deletions configs/chains/l1/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
chainId: 900
domainId: 900
name: l1
displayName: L1
protocol: ethereum
rpcUrls:
- http: http://127.0.0.1:8545
7 changes: 7 additions & 0 deletions configs/chains/opchaina/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
chainId: 901
domainId: 901
name: opchaina
displayName: OPChainA
protocol: ethereum
rpcUrls:
- http: http://127.0.0.1:9545
7 changes: 7 additions & 0 deletions configs/chains/opchainb/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
chainId: 902
domainId: 902
name: opchainb
displayName: OPChainB
protocol: ethereum
rpcUrls:
- http: http://127.0.0.1:9546
12 changes: 12 additions & 0 deletions configs/core-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
defaultHook:
type: merkleTreeHook
requiredHook:
beneficiary: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
maxProtocolFee: "100000000000000000"
owner: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
protocolFee: "0"
type: protocolFee
defaultIsm:
relayer: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
type: trustedRelayerIsm
owner: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"dependencies": {
"@hyperlane-xyz/core": "^5.8.0"
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"devDependencies": {
"@hyperlane-xyz/cli": "^7.1.0"
}
}
Loading

0 comments on commit b51bd50

Please sign in to comment.