Search code examples
ethereumblockchaincosmosaxelar

CW20 vs. ERC20 For Interchain Transactions


When sending cosmos tokens to evm chains. How are Cosmos specific tokens for example CW20s (not the same as an ERC20, but similar) handled? It can't exist on the EVM chain, so if the CW20 is on your DEX (evm and Cosmos), how is the EVM chain going to update when the Cosmos chain makes a transfer, swap, etc?

I do not understand how this works these are two different token standards that are supposedly now interconnected how can two different standards be compatible.


Solution

  • Axelar provides a secure interchain communication platform that allows for token transfers across different chains, regardless of their consensus mechanism or message payload. This includes the ability to transfer tokens between Cosmos and EVM chains.

    When transferring tokens from a Cosmos-based chain to an EVM chain, the asset will arrive as an ERC-20 asset. This is facilitated by the AxelarJS SDK, which provides a method for generating a deposit address for the transfer. Here's an example of how this can be done:

    const sdk = new AxelarAssetTransfer({ environment: "testnet" });
    
    const fromChain = CHAINS.TESTNET.OSMOSIS,
    toChain = CHAINS.TESTNET.AVALANCHE,
    destinationAddress = "0xF16DfB26e1FEc993E085092563ECFAEaDa7eD7fD",
    asset = "uausdc"; // denom of asset. See note (2) below
    
    const depositAddress = await sdk.getDepositAddress({
    fromChain,
    toChain,
    destinationAddress,
    asset
    });
    

    More info here: