Example cross-chain dApps using GMP

The axelar-examples repo has an array of examples to show the ease of integrating Axelar’s GMP protocol into any dApp to bring it cross-chain. The examples range in use cases and complexity but ultimately leverage the two fundamental building blocks for GMP:

  • callContract
  • callContractWithToken
ℹ️

NOTE: Due to recent Solidity language upgrades, the PUSH0 opcode is now generated in some of the example contracts upon compilation with the Shanghai version of the EVM. This opcode is currently only available on the Ethereum blockchain and its testnets. Any EVM blockchain that is not Ethereum may throw an error on deployment if the examples contracts being used are running Solidity version 0.8.20 or higher. To avoid any errors on non-Ethereum chains, either make sure your Solidity code is running version 0.8.19 or below, or if you choose to run 0.8.20, rollback your EVM version to London instead of Shanghai.

“Hello World!”

Say hello to your first dApp on Axelar. The dApp sends a message — “Hello World” — from a source to a destination chain using the callContract function.

Source code | Deploy instructions

Airdrop

Send axlUSDC from a source chain to a list of recipients on a destination chain using the callContractWithToken function. Each recipient will receive an equal portion of the total tokens sent.

Source code | Deploy instructions

Watch Axelar engineers demo an end-to-end walkthrough of our Airdrop example, which sends axlUSDC from a source chain to a list of recipients on a destination chain using the callContractWithToken function. The full-stack example includes running the examples locally, deploying to testnet, and reviewing analytics tools in testnet … all run with a simple bootstrapped front end.


Mint tokens and send cross-chain

Mints some amount of ERC-20 tokens at a source chain and sends it using the callContract function to a destination chain. Tokens are burned on the source-chain contract and minted on the destination-chain contract.

Source code | Deploy instructions

NFT linker

Send an NFT on a source chain to a recipient on a destination chain using the callContract function. If the source chain is where the NFT was originally created, the NFT gets locked in the contract and minted on the destination chain; in the reverse direction, the NFT is burned and transferred to its final recipient on the destination (/original home) chain.

Source code | Deploy instructions


Two-way example: send back

A two-way example using callContract in both directions where a message is sent from a source chain to a destination chain, and an “executed” acknowledgement is sent back to the source chain.

Source code | Deploy instructions

Composable USDC

For a more complex example of using native USDC cross-chain, check out our Composable USDC Example.

Edit this page