The IBC solidity contracts for Axon is based on yui-ibc-solidity. Most of the instructions, such as registering IBC modules and light client, remain the same.
NOTE: This is pre-beta non-production-quality software, not ready for use in a production environment.
yui-ibc-solidity
is designed to be compatible with the IBC core protocol, most of its implementations are compliant with ICS and ibc-go, while ibc-solidity-contract
goes further by providing additional APIs to support Forcerelay's query and storage demands.
Consequently, the contract size exceeds the limits imposed by standard EVM-compatible chains, such as Arbitrum, Avalanche and BSC. As a result, this project can only be deployed on Axon, taking advantage of Axon's ability to transcend the EVM's constraints.
First, ensure that, Node.js v18 and Yarn are already installed:
$ git clone https://github.com/synapseweb3/ibc-solidity-contract
$ cd ibc-solidity-contract
$ yarn install
$ yarn compile
Creating a .env
file in the project root path:
AXON_HTTP_RPC_URL=http://<AXON_URL>:<HTTP_PORT>
AXON_WS_RPC_URL=ws://<AXON_URL>:<WS_PORT>
Then, use the migration command to deploy the contract and prepare basic settings for Axon:
$ yarn migrate
After deployment, each standalone component in the project has been migrated into Axon and the entry is OwnableIBCHandler
contract, which accepts operations, including registering IBC module and binding channel port.
Registering light client is essential for verifying transactions from the counterparty chain. A mock light client has been registered into OwnableIBCHandler contract during the migration, which acts as an entry for counterparty.
While the official light clients for verifying Cosmos and CKB transactions are in development, you can use a custom light client by the following method
function registerClient(string calldata clientType, ILightClient client)
Note: clientType here can be one of these values: “07-axon”, “07-tendermint”, or “07-ckb4ibc”.
Before binding the IBC Module, please follow the MockModule example to create your custom business module contract. Once you've deployed this contract in Axon, you can register its address within the OwnableIBCHandler
contract by binding it to a channel port:
function bindPort(string calldata portId, address moduleAddress)
To comply with IBC protocol regulations, a channel cannot function until it is paired with a business module through a port.
In the previous migration step, a standard ICS20 transfer module has already been bound at port transfer
by default. Run script scripts/send_erc20_packet.js
to send a standard custom ICS20 packet:
$ yarn send
This is because an IBC packet cannot be sent by directly calling the method in OwnableIBCHandler
contract. Instead, it should be sent by calling a method in the business module, and the handler contract will be invoked subsequently.