diff --git a/evm/README.md b/evm/README.md index 920ba28..0d025d0 100644 --- a/evm/README.md +++ b/evm/README.md @@ -73,6 +73,28 @@ The payload of the Wormhole messages consists of the following fields encoded us bytes32 payloadHash ``` +## Deployment and Administration + +### Deploying the Wormhole Transceiver Contract + +The contract can be deployed using the following command. + +```shell +evm$ RPC_URL= MNEMONIC= OUR_CHAIN_ID= EVM_CHAIN_ID= ADMIN= ROUTER= WORMHOLE= CONSISTENCY_LEVEL= ./sh/deployWormholeTransceiver.sh +``` + +Note that the deploy scripts uses `create2` to generate a deterministic contract address. + +### Configuring Peer Transceivers + +To configure a peer Wormhole Transceiver for a given chain, you can use the following command. + +```shell +evm$ RPC_URL= MNEMONIC=WT_ADDR= PEER_CHAIN_ID= PEER_ADDR= ./sh/setPeer.sh +``` + +Note that `PEER_CHAIN_ID` is a Wormhole CHAIN ID and the `PEER_ADDR` is a `UniversalAddress` expressed as a `bytes32` beginning with `0x`. + ## Development ### Foundry diff --git a/evm/script/DeployWormholeTransceiver.s.sol b/evm/script/DeployWormholeTransceiver.s.sol index f6092e5..efd9e3b 100644 --- a/evm/script/DeployWormholeTransceiver.s.sol +++ b/evm/script/DeployWormholeTransceiver.s.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; -import {WormholeTransceiver} from "../src/WormholeTransceiver.sol"; +import {WormholeTransceiver, wormholeTransceiverVersionString} 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. @@ -40,8 +40,9 @@ contract DeployWormholeTransceiver is Script { address wormhole, uint8 consistencyLevel ) internal returns (address deployedAddress) { + bytes32 salt = keccak256(abi.encodePacked(wormholeTransceiverVersionString)); WormholeTransceiver wormholeTransceiver = - new WormholeTransceiver(ourChain, evmChain, admin, router, wormhole, consistencyLevel); + new WormholeTransceiver{salt: salt}(ourChain, evmChain, admin, router, wormhole, consistencyLevel); return (address(wormholeTransceiver)); } diff --git a/evm/sh/deployWormholeTransceiver.sh b/evm/sh/deployWormholeTransceiver.sh index d09ef3c..b6d6e05 100755 --- a/evm/sh/deployWormholeTransceiver.sh +++ b/evm/sh/deployWormholeTransceiver.sh @@ -3,6 +3,7 @@ # # This script deploys the WormholeTransceiver contract. # Usage: RPC_URL= MNEMONIC= OUR_CHAIN_ID= EVM_CHAIN_ID= ADMIN= ROUTER= WORMHOLE= CONSISTENCY_LEVEL= ./sh/deployWormholeTransceiver.sh +# To verify the contract add: FORGE_ARGS="--verifier-url 'https://api.routescan.io/v2/network/testnet/evm/${EVM_CHAIN_ID}/etherscan' --etherscan-api-key 'verifyContract'" # tilt: ROUTER=0x1aBE68277AE236083947f2551FEe8b885efCA8f5 ./sh/deployWormholeTransceiver.sh # diff --git a/evm/sh/receiveMsg.sh b/evm/sh/receiveMsg.sh index 57a789a..1c6e441 100755 --- a/evm/sh/receiveMsg.sh +++ b/evm/sh/receiveMsg.sh @@ -3,7 +3,7 @@ # # This script submits a message to the WormholeTransceiver contract. # Usage: RPC_URL= MNEMONIC= WT_ADDR= VAA= ./sh/receiveMsg.sh -# tilt: WT_ADDR=0x1aBE68277AE236083947f2551FEe8b885efCA8f5 VAA= ./sh/receiveMsg.sh +# tilt: WT_ADDR=0xdFccc9C59c7361307d47c558ffA75840B32DbA29 VAA= ./sh/receiveMsg.sh # [[ -z $WT_ADDR ]] && { echo "Missing WT_ADDR"; exit 1; } diff --git a/evm/src/WormholeTransceiver.sol b/evm/src/WormholeTransceiver.sol index 57fb1f4..f693bc6 100644 --- a/evm/src/WormholeTransceiver.sol +++ b/evm/src/WormholeTransceiver.sol @@ -9,10 +9,12 @@ import "wormhole-solidity-sdk/interfaces/IWormhole.sol"; import "./interfaces/IWormholeTransceiver.sol"; import "./libraries/TransceiverHelpers.sol"; +string constant wormholeTransceiverVersionString = "WormholeTransceiver-0.0.1"; + contract WormholeTransceiver is IWormholeTransceiver { using BytesParsing for bytes; // Used by _decodePayload - string public constant versionString = "WormholeTransceiver-0.0.1"; + string public constant versionString = wormholeTransceiverVersionString; address public admin; address public pendingAdmin;