# CW20 Tokens

Paloma.py enables developers to create and interact with CW20 tokens (opens new window) without knowing Rust. The SDK allows you to bypass learning CosmWasm and simply staying in Python.

There are 4 functions for CW20 that are implemented in paloma.py.

# instantiate()

Create a new CW20 by instantiating a CW20 smart contract. You'll need the the code id of a deployed CW20 compatible wasm code. You can find the deployed CW20 compatible contracts in the resource section. You may also upload your own contract and use that instead. See the smart contract documentation for more details. As CW20 creator, you'll choose the name, symbol and the total supply amount which is minted to deployer wallet.


  • wallet (Paloma address): CW20 deployer wallet address
  • code_id (int): Code_id of CW20 wasm code
  • name (str): CW20 token name
  • symbol (str): CW20 token symbol
  • decimals (int): CW20 token decimals
  • total_supply (int): CW20 token total supply

Returns: BlockTxBroadcastResult: Transaction Broadcast Result

# send()

This function allows you to send an amount of an existing CW20 token to a CW20 compatible contract along with a message.


  • wallet (Paloma address): CW20 sender wallet address
  • token (str): CW20 token address
  • contract (str): token receiver contract address
  • amount (str): send amount
  • msg (str): base64 encoded message

Returns: BlockTxBroadcastResult: Transaction Broadcast Result

# transfer()

With the transfer function, you can send any amount of an existing CW20 token to another wallet address.


  • wallet (Paloma address): CW20 sender wallet
  • token (str): CW20 token address
  • recipient (str): token receiver address
  • amount (str): send amount

Returns: BlockTxBroadcastResult: Transaction Broadcast Result

# burn()

This removes amount CW20 tokens from the balance of the specified wallet and reduces the total supply by the same amount.


  • wallet (Paloma Address): wallet from which the tokens should be removed
  • token (str): CW20 token address
  • amount (str): amount to be burnt

Returns: BlockTxBroadcastResult: Transaction Broadcast Result

# Example

See the example below for a sample use of the available functions.

import asyncio
from pathlib import Path

import uvloop
from terra_proto.cosmwasm.wasm.v1 import AccessType
from paloma_sdk.client.lcd import AsyncLCDClient
from paloma_sdk.client.lcd.api.tx import CreateTxOptions
from paloma_sdk.core.wasm import MsgStoreCode
from paloma_sdk.key.mnemonic import MnemonicKey
from paloma_sdk.core.wasm.data import AccessConfig
from paloma_sdk.util.contract import get_code_id, read_file_as_b64

async def main():
    paloma = AsyncLCDClient(url="https://lcd.testnet.palomaswap.com/", chain_id="paloma-testnet-13")
    paloma.gas_prices = "0.01ugrain"

    acc = MnemonicKey(
        mnemonic="notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius"

    acc2 = MnemonicKey(
        mnemonic="index light average senior silent limit usual local involve delay update rack cause inmate wall render magnet common feature laundry exact casual resource hundred"
    test1 = paloma.wallet(acc)
    test2 = paloma.wallet(acc2)

    store_code_tx = await test1.create_and_sign_tx(
                    read_file_as_b64(Path(__file__).parent / "./cw20_base.wasm"),
                    AccessConfig(AccessType.ACCESS_TYPE_EVERYBODY, ""),
    store_code_tx_result = await paloma.tx.broadcast(store_code_tx)

    code_id = get_code_id(store_code_tx_result)


    result = await paloma.cw20.instantiate(
        test1, code_id, "CW20 Token", "CWFT", 9, 1_000_000_000_000_000
    contract_address = result.logs[0].events_by_type["instantiate"][

    result = await paloma.cw20.transfer(
        test1, contract_address, test2.key.acc_address, 1_000_000_000

    result = await paloma.cw20.burn(
        test1, contract_address, 500_000_000

    await paloma.session.close()