This example demonstrates how to relay a message from a source-chain to a destination-chain.
Make sure you've already followed the following steps:
To deploy the contract, use the following command:
npm run deploy evm/call-contract-gas-estimation [local|testnet]
The aforementioned command pertains to specifying the intended environment for a project to execute on. It provides the option to choose between local and testnet environments by appending either local
or testnet
after the command.
An example of its usage is demonstrated as follows: npm run deploy evm/call-contract-gas-estimation local
or npm run deploy evm/call-contract-gas-estimation testnet
.
cd
into evm
folder
Run the command npx hardhat test call-contract-gas-estimation/tests/call-contract-gas-estimation.test.js
To execute the example, use the following command:
npm run execute evm/call-contract-gas-estimation [local|testnet] ${srcChain} ${destChain} ${message}
srcChain
: The blockchain network from which the message will be relayed. Acceptable values include "Moonbeam", "Avalanche", "Fantom", "Ethereum", and "Polygon". Default value is Avalanche.destChain
: The blockchain network to which the message will be relayed. Acceptable values include "Moonbeam", "Avalanche", "Fantom", "Ethereum", and "Polygon". Default value is Fantom.message
: The message to be relayed between the chains. Default value is "Hello World".
This example deploys the contract on a local network and relays a message "Hello World" from Moonbeam to Avalanche.
npm run deploy evm/call-contract-gas-estimation local
npm run execute evm/call-contract-gas-estimation local "Fantom" "Avalanche" "Hello World"
The output will be:
--- Initially ---
value at Avalanche is
--- After ---
value at Avalanche is Hello World