CW20

Requires a localnet to be running.

Download contract bytecode

curl -Lso cw20_base.wasm \
https://github.com/CosmWasm/cw-plus/releases/download/v2.0.0/cw20_base.wasm

Store contract

Upload the contract bytecode so that it can be instantiated (next step).

FROM=nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl

nibid tx wasm store cw20_base.wasm \
--from $FROM \
--gas auto \
--gas-adjustment 1.5 \
--gas-prices 0.025unibi \
--yes | tx

Take note of the code id for the next step, e.g.

{
  "type": "store_code",
  "attributes": [
    {
      "key": "code_checksum",
      "value": "4d8e90dd340993033f1b9e8e3a3ee7f8673c582ca9bcdd8c8cf3c7470d6537d5",
      "index": true
    },
    {
      "key": "code_id",
      "value": "2", // <-- take note of this
      "index": true
    }
  ]
}

Instantiate cw4 contract

Create a contract instance from the uploaded bytecode. Use the code id from the previous step.

Save the contract address for the next steps, e.g.

(Optional) Queries

Query token info

Output:

Query minter info

Mint some tokens

Only nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl can mint tokens because we specified that address in the instantiation step. If no minter were specified, no tokens can ever be minted.

Example output

Query balance

Output:

Transfer tokens

Example output

Query balances

The first user's balance should be 85

The second user's balance should be 15

Last updated

Was this helpful?