Your gateway to cross-chain activity.

The GlacisRouter smart contract acts as the on-chain interface for all cross-chain activity with Glacis.

You can discover the source smart contract GlacisRouter.sol in this repository.

The Route Function

The main function in GlacisRouter is route, which sends a cross-chain message. It comes in the following varieties, each which return a bytes32 messageId:

	uint256 chainId,
	address to,
	bytes memory payload,
	uint8[] memory gmps,
	bool retriable)
Parameter NameParameter Description

uint256 chainId

The Glacis ID of the blockchain that you wish to send a message to

address to

The address of the destination contract that you are sending a message to

bytes memory payload

The payload of data that you wish to send to the destination contract

uint8[] memory gmps

An array of that you wish the message to send over (identical messages will be sent over with the same message ID, which helps with redundancy)

bool retriable

Whether to allow the message to be retried (stores owner of the message ID on-chain, slightly more gas expensive)

The Retry Route

There is an additional route function variant that hasn't been mentioned yet:

	uint256 chainId,
	address to,
	bytes memory payload,
	uint8[] memory gmps,
	bytes32 messageId,
	uint256 nonce)

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:

Parameter NameParameter Description

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

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.


These are the read-only functions in GlacisRouter, but most developers won't use them:

Function SignatureFunction Description

glacisAdapters(uint8) returns(address)

Returns the address of the adapter contract for the specific GMP ID input

sourceAdapterToGMP(address) returns(uint8)

Returns the GMP ID of the adapter at the specified address. Returns 0 if no such adapter exists

validateGlacisMessageId(bytes32 messageId, uint256 toChainId, address to, uint256 nonce) returns(bool)

Returns true if the combination of chain ID, address, msg.sender, and message nonce result in the same messageId You can use the JSON-RPC method eth_call to simulate any msg.sender if you wish to use this in your application


Returns the message sender of a specific message ID


It also includes the following errors, some of which you may encounter:

Error NameError Description


Occurs when routing, and the GMP ID provided is not supported on this chain


Occurs when routing, and the adapter of the GMP ID does not exist


Occurs when retrying a message route, when the message ID that is attempting to be retried was not originally sent by the current message sender


Occurs when trying to call a function that only a Glacis GMP Adapter can call


Occurs when retrying a message route, when the message input was not identical to the original


Occurs when a message is received, and the client contract does not accept messages from the sender address, origin chain, and/or GMP

GlacisRouter__ImpossibleGMPId(uint8 gmpId)

Occurs when a message is received, and the GMP ID is not supported


Occurs when a message is received, and the same message has already been received from that GMP


Occurs when a message is received, and the Glacis message ID contained in the header does not pass verification


Last updated