Send and Call Receivers
Learn how tokens are received by the receivers.
The interfaces IERC20SendAndCallReceiver
or INativeSendAndCallReceiver
are used for contracts that handle receiving ERC20 or native tokens of the Interchain Token Transfer protocol. They are similar to the ITeleporterReceiver
interface, but they are specifically designed to handle token transfers.
IERC20SendAndCallReceiver
The receiveTokens
function will be called by the Transferrer bridge contract. The contract must implement this function to receive the tokens and can retrieve all the information about the origin of the tokens, the token, the bridge used, and the amount of tokens transferred from the parameters.
INativeSendAndCallReceiver
The INativeSendAndCallReceiver
interface is used for contracts that handle receiving native tokens of the Interchain Token Transfer protocol. It is similar to the IERC20SendAndCallReceiver
interface, but does not include the token
and amount
parameters. The receiveTokens
is now payable
. There is only a single native token on each chain, so the address is not needed. The amount can be determined from calling msg.value
.