Axelar Integration
Axelar is a decentralized cross-chain communication network. Unlike bridges with multisig validators (Multichain, Ronin), Axelar uses proof-of-stake network with ~75 validators and threshold signatures. Compromise requires controlling 2/3 of validators by stake — significantly higher attack threshold than 5-of-9 multisig.
What Axelar Can Do
GMP (General Message Passing) — transfer arbitrary messages between chains. Not just tokens: can call function in another chain's smart contract with arbitrary data.
Canonical token bridging — standardized token transfer. USDC via Axelar is either Circle's native USDC (via Circle CCTP) or Axelar Wrapped USDC (axlUSDC), depending on configuration.
Squid — DEX aggregator on top of Axelar, allowing cross-chain swaps in one transaction (swap on source chain + bridge + swap on destination).
GMP Integration
Source Chain Contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { AxelarExecutable } from "@axelar-network/axelar-gmp-sdk-solidity/contracts/executable/AxelarExecutable.sol";
import { IAxelarGateway } from "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGateway.sol";
import { IAxelarGasService } from "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGasService.sol";
contract SourceContract {
IAxelarGateway public gateway;
IAxelarGasService public gasService;
constructor(address _gateway, address _gasService) {
gateway = IAxelarGateway(_gateway);
gasService = IAxelarGasService(_gasService);
}
function sendCrossChainMessage(
string calldata destinationChain, // "Polygon", "avalanche", "binance"
string calldata destinationAddress, // recipient contract address
bytes calldata payload
) external payable {
// Pay gas for execution on destination chain
gasService.payNativeGasForContractCall{value: msg.value}(
address(this),
destinationChain,
destinationAddress,
payload,
msg.sender
);
// Send message
gateway.callContract(destinationChain, destinationAddress, payload);
}
}
Destination Chain Contract
contract DestinationContract is AxelarExecutable {
event MessageReceived(string sourceChain, string sourceAddress, bytes payload);
constructor(address gateway) AxelarExecutable(gateway) {}
// Called by Axelar when message delivered
function _execute(
string calldata sourceChain,
string calldata sourceAddress,
bytes calldata payload
) internal override {
// Decode payload
(address recipient, uint256 amount) = abi.decode(payload, (address, uint256));
// Execute business logic
_processMessage(sourceChain, sourceAddress, recipient, amount);
emit MessageReceived(sourceChain, sourceAddress, payload);
}
}
Gas Payment on Destination Chain
Key Axelar GMP detail — Gas Service. User pays gas for both chains in one transaction (on source chain). Axelar Gas Service converts native token and pays relayers on destination chain.
Calculate needed gas via AxelarGMPRecoveryAPI:
import { AxelarQueryAPI, Environment, GasToken } from "@axelar-network/axelarjs-sdk";
const api = new AxelarQueryAPI({ environment: Environment.MAINNET });
const gasEstimate = await api.estimateGasFee(
"Ethereum", // source chain
"Polygon", // destination chain
GasToken.ETH,
300_000, // gas limit on destination
1.1 // 10% buffer
);
// gasEstimate is sum in wei to pass to payNativeGasForContractCall
Token Transfer with GMP
For token transfer + function call on destination chain — use callContractWithToken:
function sendTokenAndCall(
string calldata destinationChain,
string calldata destinationAddress,
bytes calldata payload,
string calldata symbol, // "USDC", "WETH"
uint256 amount
) external payable {
IERC20(gateway.tokenAddresses(symbol)).transferFrom(msg.sender, address(this), amount);
IERC20(gateway.tokenAddresses(symbol)).approve(address(gateway), amount);
gasService.payNativeGasForContractCallWithToken{value: msg.value}(
address(this), destinationChain, destinationAddress, payload, symbol, amount, msg.sender
);
gateway.callContractWithToken(destinationChain, destinationAddress, payload, symbol, amount);
}
Supported Chains
Axelar supports 50+ chains: Ethereum, Polygon, Avalanche, BNB Chain, Fantom, Arbitrum, Optimism, Base, Linea, Scroll, Near, Cosmos ecosystem (via IBC).
Cosmos integration is unique Axelar advantage: only major cross-chain protocol with real EVM ↔ Cosmos connection.
Squid Integration for Cross-Chain Swaps
import { Squid } from "@0xsquid/sdk";
const squid = new Squid({ baseUrl: "https://apiplus.squidrouter.com" });
await squid.init();
const { route } = await squid.getRoute({
fromAddress: userAddress,
fromChain: "1", // Ethereum
fromToken: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", // ETH
fromAmount: "1000000000000000000", // 1 ETH
toChain: "137", // Polygon
toToken: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", // USDC
toAddress: recipientAddress,
slippage: 1.0, // 1%
enableBoost: true,
});
// Execute swap
const tx = await signer.sendTransaction(route.transactionRequest);
Axelar GMP integration — 2-4 weeks. Includes: deploy contracts on several chains, setup gas payment, monitor transaction status via AxelarScan API, testnet testing (Axelar testnet supports all major EVM testnets).







