Deploy a Mock Receiver
Learn how to deploy a mock receiver contract.
In this section, you will deploy mock receiver contracts on the Avalanche L1.
Receiver Deployment
You can choose to deploy either the MockERC20SendAndCallReceiver
or the MockNativeSendAndCallReceiver
contract depending your token type.
forge create --rpc-url myblockchain --private-key $PK lib/avalanche-interchain-token-transfer/contracts/src/mocks/MockERC20SendAndCallReceiver.sol:MockERC20SendAndCallReceiver
Save Receiver Address
After deployment, save the Deployed to
address in an environment variable for future use.
export MOCK_RECEIVER_ADDRESS=<address>
Send Tokens
Use the following command to send tokens to the mock receiver contract:
cast send --rpc-url myblockchain --private-key $PK $ERC20_HOME_C_CHAIN \
"sendAndCall((bytes32, address, address, bytes, uint256, uint256, address, address, address, uint256, uint256), uint256)" \
"(${C_CHAIN_BLOCKCHAIN_ID_HEX}, ${ERC20_TOKEN_REMOTE_L1}, ${MOCK_RECEIVER_ADDRESS}, 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2500000, 2000000, 0x0000000000000000000000000000000000000000, ${FUNDED_ADDRESS}, ${ERC20_HOME_C_CHAIN}, 0, 0)" 100000000000000000000
Verify the Results
Check the logs and emitted events to verify that the tokens were received correctly.
TBD: Provide instructions
After successfully deploying the contract, move on to testing the mock receivers.
Edit on GitHub
Last updated on 1/29/2025