đAxelar Transfer
Smart contracts for bridging from Agoric to Ethereum & Avalanche
Limited Developer Support
All assets represented in this library are community built, which means limited support from the Agoric OpCo development team. Please use components, APIs, and front-ends with caution.
Summary
Sending cross-chain messages from Agoric
Details
The Axelar protocol enables decentralised cross-chain communication between different networks, allowing to send arbitrary data and/or tokens.
Axelar decentralisation is achieved by its own proof-of-stake blockchain network built using Cosmos SDK with permissionless set of validators, which constantly produce blocks containing cross-chain transactions info.
This component relies on Pegasus package that enables pegging of Agoric ERTP assets to or from remote assets. This is achieved by using the IBC (Inter-Blockchain Communication) protocol supported by Agoric.
This component allows tokens and/or arbitrary data to EVM chains. This enables a lot of use cases, like token/information bridging, response to Agoric on-chain events on EVM chain and etc.
Check the list of supported EVM chains here.
Dependencies
There are some previous considerations to have before instantiating the Axelar transfer contract.
The first one is related to the agoric-sdk version used, you should use this version of Agoric SDK.
In order to start an instance of the Axelar-Transfer contract it is not required any issuerKeywordRecord, terms, or privateArgs. Only the installation reference. Although, there is a need to establish an IBC and Pegasus transfer channel between the Agoric and Axelar, prior to the execution of the contract methods.
Contract Facets
The publicFacet
of the contract contains only setupAxelar
method that runs the Axelar setup process and returns a function sendGMP
that can be used to send arbitrary data to EVM chains. The creator facet is empty and has no methods.
setupAxelar
requires pegaus
parameter, which is pegasus service instance.
Functionalities
sendGMP
This function will trigger cross-chain call to EVM chain with specified target address, value and payload. Metadata object should contain information about destination chain, address and payload that will be passed to EVM contract as calldata.
sendGMP
function creates an invitation to transfer assets over network with all cross-chain info included. The Pegasus package is modified in the required version of Agoric SDK so that it could accept additional sender
parameter for the Axelar protocol. The offer then is issued and then sendGMP
returns an offer result.
For sending only messages without tokens to the remote chain, use "type": 1
in metadata:
For sending tokens and the payload to the remote chain, use "type": 2
in metadata:
For sending only tokens without payload, use "type": 3
in metadata and set "payload": null
:
Usage and Integration
The initialisation and setup guide can be found in README.md file in project repository. Also check the unit test for the contract to find the testing setup process for sendGMP
function.
Be aware of specifics of calling EVM contracts - the payload that will be passed to the contract must be decodable by recipient contract. If you are attempting to call a specific function of the contract, make sure to correctly encode the function selector and the function arguments. Otherwise, your payload has to be handled and decoded manually by the fallback()
function. Check the official Solidity documentation for more info about the encoding:
Explore on GitHub
Last updated