generated from evan-gray/multichain-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a46f102
commit a0aa4d4
Showing
17 changed files
with
1,278 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule example-gmp-router
added at
eba0aa
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.4; | ||
|
||
import {WormholeTransceiver} from "../src/WormholeTransceiver.sol"; | ||
import "forge-std/Script.sol"; | ||
|
||
// DeployWormholeTransceiver is a forge script to deploy the WormholeTransceiver contract. Use ./sh/deployWormholeTransceiver.sh to invoke this. | ||
contract DeployWormholeTransceiver is Script { | ||
function dryRun( | ||
uint16 ourChain, | ||
uint256 evmChain, | ||
address admin, | ||
address router, | ||
address wormhole, | ||
uint8 consistencyLevel | ||
) public { | ||
_deploy(ourChain, evmChain, admin, router, wormhole, consistencyLevel); | ||
} | ||
|
||
function run( | ||
uint16 ourChain, | ||
uint256 evmChain, | ||
address admin, | ||
address router, | ||
address wormhole, | ||
uint8 consistencyLevel | ||
) public returns (address deployedAddress) { | ||
vm.startBroadcast(); | ||
(deployedAddress) = _deploy(ourChain, evmChain, admin, router, wormhole, consistencyLevel); | ||
vm.stopBroadcast(); | ||
} | ||
|
||
function _deploy( | ||
uint16 ourChain, | ||
uint256 evmChain, | ||
address admin, | ||
address router, | ||
address wormhole, | ||
uint8 consistencyLevel | ||
) internal returns (address deployedAddress) { | ||
WormholeTransceiver wormholeTransceiver = | ||
new WormholeTransceiver(ourChain, evmChain, admin, router, wormhole, consistencyLevel); | ||
|
||
return (address(wormholeTransceiver)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.4; | ||
|
||
import {WormholeTransceiver} from "../src/WormholeTransceiver.sol"; | ||
import "forge-std/Script.sol"; | ||
import "example-gmp-router/libraries/UniversalAddress.sol"; | ||
|
||
// SetPeer is a forge script to set the peer for a given chain with the WormholeTransceiver contract. Use ./sh/setPeer.sh to invoke this. | ||
contract SetPeer is Script { | ||
function dryRun(address wormholeTransceiver, uint16 peerChain, bytes32 peerAddress) public { | ||
_setPeer(wormholeTransceiver, peerChain, peerAddress); | ||
} | ||
|
||
function run(address wormholeTransceiver, uint16 peerChain, bytes32 peerAddress) public { | ||
vm.startBroadcast(); | ||
_setPeer(wormholeTransceiver, peerChain, peerAddress); | ||
vm.stopBroadcast(); | ||
} | ||
|
||
function _setPeer(address wormholeTransceiver, uint16 peerChain, bytes32 peerAddress) internal { | ||
WormholeTransceiver wormholeTransceiverContract = WormholeTransceiver(wormholeTransceiver); | ||
wormholeTransceiverContract.setPeer(peerChain, peerAddress); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# This script deploys the WormholeTransceiver contract. | ||
# Usage: RPC_URL= MNEMONIC= OUR_CHAIN_ID= EVM_CHAIN_ID= ADMIN= ROUTER= WORMHOLE= CONSISTENCY_LEVEL= ./sh/deployWormholeTransceiver.sh | ||
# tilt: ROUTER=0x1aBE68277AE236083947f2551FEe8b885efCA8f5 ./sh/deployWormholeTransceiver.sh | ||
# | ||
|
||
[[ -z $ROUTER ]] && { echo "Missing ROUTER"; exit 1; } | ||
|
||
if [ "${RPC_URL}X" == "X" ]; then | ||
RPC_URL=http://localhost:8545 | ||
fi | ||
|
||
if [ "${MNEMONIC}X" == "X" ]; then | ||
MNEMONIC=0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d | ||
fi | ||
|
||
if [ "${OUR_CHAIN_ID}X" == "X" ]; then | ||
OUR_CHAIN_ID=2 | ||
fi | ||
|
||
if [ "${EVM_CHAIN_ID}X" == "X" ]; then | ||
EVM_CHAIN_ID=1337 | ||
fi | ||
|
||
if [ "${ADMIN}X" == "X" ]; then | ||
ADMIN=0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1 | ||
fi | ||
|
||
if [ "${WORMHOLE}X" == "X" ]; then | ||
WORMHOLE=0xC89Ce4735882C9F0f0FE26686c53074E09B0D550 | ||
fi | ||
|
||
if [ "${CONSISTENCY_LEVEL}X" == "X" ]; then | ||
CONSISTENCY_LEVEL=200 | ||
fi | ||
|
||
forge script ./script/DeployWormholeTransceiver.s.sol:DeployWormholeTransceiver \ | ||
--sig "run(uint16,uint256,address,address,address,uint8)" $OUR_CHAIN_ID $EVM_CHAIN_ID $ADMIN $ROUTER $WORMHOLE $CONSISTENCY_LEVEL \ | ||
--rpc-url "$RPC_URL" \ | ||
--private-key "$MNEMONIC" \ | ||
--broadcast ${FORGE_ARGS} | ||
|
||
returnInfo=$(cat ./broadcast/DeployWormholeTransceiver.s.sol/$EVM_CHAIN_ID/run-latest.json) | ||
|
||
DEPLOYED_ADDRESS=$(jq -r '.returns.deployedAddress.value' <<< "$returnInfo") | ||
echo "Deployed transceiver address: $DEPLOYED_ADDRESS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# This script sets the peer for a given chain with the WormholeTransceiver contract. | ||
# Usage: RPC_URL= MNEMONIC= WT_ADDR= PEER_CHAIN_ID= PEER_ADDR= ./sh/registerPeer.sh | ||
# tilt: WT_ADDR=0x1aBE68277AE236083947f2551FEe8b885efCA8f5 PEER_CHAIN_ID=4 PEER_ADDR=0x00000000000000000000000090F8bf6A479f320ead074411a4B0e7944Ea8c9C1 ./sh/setPeer.sh | ||
# | ||
|
||
[[ -z $WT_ADDR ]] && { echo "Missing WT_ADDR"; exit 1; } | ||
[[ -z $PEER_CHAIN_ID ]] && { echo "Missing PEER_CHAIN_ID"; exit 1; } | ||
[[ -z $PEER_ADDR ]] && { echo "Missing PEER_ADDR"; exit 1; } | ||
|
||
if [ "${RPC_URL}X" == "X" ]; then | ||
RPC_URL=http://localhost:8545 | ||
fi | ||
|
||
if [ "${MNEMONIC}X" == "X" ]; then | ||
MNEMONIC=0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d | ||
fi | ||
|
||
forge script ./script/SetPeer.s.sol:SetPeer \ | ||
--sig "run(address,uint16,bytes32)" $WT_ADDR $PEER_CHAIN_ID $PEER_ADDR \ | ||
--rpc-url $RPC_URL \ | ||
--private-key $MNEMONIC \ | ||
--broadcast |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.