GlacisTokenMediator
Last updated
Last updated
Your gateway to cross-chain token activity.
The GlacisTokenMediator smart contract acts as the on-chain interface for all token cross-chain activity with Glacis.
You can discover the source smart contract GlacisTokenMediator.sol
in this repository.
The main function in GlacisTokenMediator is route, which sends a cross-chain message and/or tokens. Using the GlacisTokenMediator to send tokens will always have retryable be enabled.
Internally this function is in charge of populating GlacisTokenData, adding it to the payload and finally routing it to the GlacisRouter
Here is a detailed description of function parameters.
Parameter Name | Parameter Description |
---|---|
An additional route is provided, which doesn't send a new message and/or tokens. Instead, it allows resending of a previous message and/or tokens so long as it receives identical input.
This route cannot be used for original cross-chain messages. Instead, it is used to retry a cross-chain message with an identical message ID and identical data (but potentially through a different GMP). This can be helpful in cases where a message is somehow lost by a GMP's consensus mechanism or its relayers. An identical message would be sent, and whichever message arrives after the first will revert.
Two additional parameters are required with this function:
Only the original message sender can retry a message, no other address can do it on their behalf. Also note that identical data must be provided.
It also includes the following errors, some of which you may encounter:
Parameter Name | Parameter Description |
---|---|
Error Name | Error Description |
---|---|
uint256 chainId
The Glacis ID of the blockchain that you wish to send a message and/or tokens to
bytes32 to
The address of the destination contract that you are sending a message and/or tokens to
bytes memory payload
The payload (message) of data that you wish to send to the destination contract
address[] memory adapters
GlacisRouter.CrossChainGas[] memory fees
An array of fees that correspond to the amount provided to each adapter. This is a parallel array to the adapters parameter. The sum of the "nativeCurrencyValue" must be equal to the value sent with this function
address refundAddress
The address to which excess native currency is sent to if an adapter deems that the user overpaid
address token
The address of the XERC20 token you wish to send to the destination contract
uint256 tokenAmount
The amount of XERC20 tokens you wish to send to the destination contract
bytes32 messageId
The Glacis message ID of the original message
uint256 nonce
The nonce of the message, which can be retrieved in the original message's event log
GlacisTokenMediator__OnlyTokenRouterAllowed
Occurs when routing, and the from address of the receiving payload is not the same token router on the remote chain