Skip to content

hoanm/evm-cosmos-gmp-sample

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

EVM <-> Cosmos General Message Passing Demo

Axelar supports pass general message from EVM chains to Cosmos chains. Axelar confirms the message from a EVM chain, and forward the message as memo field via ICS20 packet.

It currently supports two integration methods:

  • Native chain: Axelar confirms and forward arbitrary payload to the destination cosmos chian. The receiver chain needs to add a middleware and implement a customize handler to decode and process the payload.
  • CosmWasm: For chains who enabled wasm module, and installed general purpose ibc hook middleware, Axelar supports call a Cosmwasm contract from an EVM smart contract. The message sender can either encodes the payload in Axelar defined schema . Axelar confirms the payload and translates to wasm execute message.

This repo contains examples for both native and wasm integration.

  • multi send is a native integration example, it sends token to multiple recipients from evm chain to a cosmos chain.
  • swap and forward sends token and calls a CosmWasm swap contract on Osmosis

EVM

Developer needs to deploy a smart contract that calls Axelar gateway to send cross-chain message, and decode message upon receiving the payload from a remote chain.

MultiSend.sol is a sample contract.

deploy.js and interact.js are scripts to deploy and interact with the sample contract.

Cosmos Native Integration

A Cosmos chain can integrate cross chain message passing by adding an IBC middleware, and a handler that implements GeneralMessageHandler interface to decode the paylod. MultiSendHandler is a sample implementation.

MultiSend is a sample transaction that sends payload to an EVM chain.

Wasm Integration

The smart contract needs to encode the payload in the following format in order to call a wasm contract

 bytes memory argValue = abi.encode(arg1, arg2, arg3...)

 bytes memory payload = abi.encode(
    wasm contract method name,
    argument name list,
    argument type list,
    argValue bytes
)

Axelar also reserves source_chain and source_address keywords in wasm contract argument name. Axelar replaces with its canonical chain and sender info if the contract call contains these arguments.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 36.1%
  • Rust 24.9%
  • Solidity 20.2%
  • JavaScript 18.8%