This example demonstrates how to mint tokens on a source-chain and transfer them 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/cross-chain-token [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/cross-chain-token local
or npm run deploy evm/cross-chain-token testnet
.
To execute the example, use the following command:
npm run execute evm/cross-chain-token [local|testnet] ${srcChain} ${destChain} ${amount}
Default Values:
srcChain
isAvalanche
. Valid values are Moonbeam, Avalanche, Fantom, Ethereum, and PolygondestChain
isFantom
. Valid values are Moonbeam, Avalanche, Fantom, Ethereum, and Polygonamount
is10
This example deploys the contract on a local network, mints 1 token on the Ethereum chain and transfers it to the Fantom chain.
npm run deploy evm/cross-chain-token local
npm run execute evm/cross-chain-token local "Avalanche" "Fantom" 1
The output will be:
--- Initially ---
Balance at Ethereum is 0
Balance at Fantom is 0
--- After getting some token on the source chain ---
Balance at Ethereum is 1
Balance at Fantom is 0
--- After ---
Balance at Ethereum is 0
Balance at Fantom is 1