Init and test locally
git clone https://github.com/wormhole-foundation/hello-wormhole.git
cd hello-wormhole
There is a bug in the package json, change
"typechain": "typechain --target ethers-v5 --out-dir ./ts-scripts/ethers-contracts ./out/**/*.json"
Into
"typechain": "typechain --target ethers-v5 --out-dir ./ts-scripts/ethers-contracts ./out/**/*.sol/*.json"
npm run build
forge test
Deploy to testnet
EVM_PRIVATE_KEY=your_wallet_private_key npm run deploy
Explanation of the HelloWormhole Cross-chain Contract
In the source chain’s contract, you need to have these codes that send message to the wormholeRelayer
wormholeRelayer.sendPayloadToEvm{value: cost}(
targetChain,
targetAddress,
payload,
0, // no receiver value needed
GAS_LIMIT
);
In the target chain, wormhole relayer will find the targetAddress contract and call it’s receiveWormholeMessages
method to send message to the target contract address on the target chain.
refs
https://docs.wormhole.com/wormhole/quick-start/tutorials/hello-wormhole