This project contains a Hyperlane WormholeHook and WormholeISM for sending Hyperlane messages via Wormhole.
The WormholeHook contract inherits Hyperlane's IPostDispatch, and Wormhole's IWormholeRelayer contract. The WormholeISM contract inherits Hyperlane's IInterchainSecurityModule contract, and Wormhole's IWormholeRelayer and IWormholeReceiver contracts.
The WormholeHook.sol
contract has a postDispatch()
function that is intended to be called by a Hyperlane Mailbox contract, passing it a "message" as bytesdata. This function calls the wormholeRelayer.sendPayloadToEvm()
using the message data and sends it to the WormholeISM contract on another chain.
The WormholeISM.sol
contract has a receiveWormholeMessages()
function for receiving messages sent by the Hook contract on the other chain, and emits a MessageReceived
event.
To install the necessary dependencies, first ensure that you have Foundry installed by running the following command:
curl -L https://foundry.paradigm.xyz | bash
Then run the following commands in the project's root directory:
foundryup
forge install
You will need to have a .env
file in each directory with your $PRIVATE_KEY
.
Replace $PRIVATE_KEY
, $SEPOLIA_RPC_URL
and $FUJI_RPC_URL
in the .env
with your respective private key and rpc url.
Deploy the WormholeHook.sol
and WormholeISM.sol
contracts to their chains by running the following commands:
source .env
forge script script/DeployWormholeISM.s.sol --rpc-url $FUJI_RPC_URL --private-key $PRIVATE_KEY --broadcast
Update the deploy script to include the ISM address in the Hook's constructor.
forge script script/DeployWormholeHook.s.sol --rpc-url $GOERLI_RPC_URL --private-key $PRIVATE_KEY --broadcast
This project is licensed under the MIT License.