Token Factory

Overview

The TokenFactory module enables any account to create a new token with the following naming convention: factory/{creator address}/{subdenom}. By namespace-separating tokens with the creator's address, token minting becomes permissionless, eliminating the need to resolve name collisions. A single account can create multiple denominations by providing a unique subdenom for each new denomination. Upon creation, the original creator is granted "admin" privileges over the asset. This allows them to:

  • Mint their denomination to any account

  • Burn their denomination from any account

  • Execute transfers of their denomination between any two accounts

  • Change the admin. In the future, additional admin capabilities may be introduced. Admins can opt to share admin privileges with other accounts using the authz module. The ChangeAdmin functionality allows for changing the master admin account or even setting it to "", indicating that no account has admin privileges over the asset.

Tutorial

Create Denom

Creates a denom of factory/{creator address}/{subdenom} with the given denom creator address and the subdenom. Subdenoms can consist of [a-zA-Z0-9./].

minitiad tx tokenfactory create-denom [sub-denom] \
  --from test-account \
  --gas auto --gas-adjustment 1.5 \
  --gas-prices [gas-price] \
  --node [rpc-url]:[rpc-port] \
  --chain-id [chain-id]

Mint

Minting a specific denom is only allowed for the current admin. Note that the current admin defaults to the creator of the denom.

minitiad tx tokenfactory mint [amount] [to-address] \
  --from test-account \
  --gas auto --gas-adjustment 1.5 \
  --gas-prices [gas-price] \
  --node [rpc-url]:[rpc-port] \
  --chain-id [chain-id]
  
# amount example
# 10000factory/init1.../udenom

Burn

Burning of a specific denom is only allowed for the current admin. Note that the current admin defaults to the creator of the denom.

minitiad tx tokenfactory burn [amount] [burn-from-address] \
  --from test-account \
  --gas auto --gas-adjustment 1.5 \
  --gas-prices [gas-price] \
  --node [rpc-url]:[rpc-port] \
  --chain-id [chain-id]
  
# amount example
# 10000factory/init1.../udenom

ChangeAdmin

Change the admin of a denom. Note that this is only allowed to be called by the current admin of the denom.

minitiad tx tokenfactory change-admin [denom] [new-admin] \
  --from test-account \
  --gas auto --gas-adjustment 1.5 \
  --gas-prices [gas-price] \
  --node [rpc-url]:[rpc-port] \
  --chain-id [chain-id]
  
# denom example
# factory/init1.../udenom

Last updated

Logo

© 2024 Initia Foundation, All rights reserved.