Token chain
Prerequisites
- Install Chromia CLI; see Install and configure Chromia CLI. Configure the CLI to use a node in the relevant network.
Account creation strategy
Each project has a pool of CHR on the token chain, which is used to pay for the creation of new accounts. The following strategies can be used: open or based on a minimum amount of token transfers. The token chain will need a list of blockchain RIDs for the chains authorized to create accounts on behalf of the project. Account creation can then be authorized via ICCF.
The fees for account creation are sent to a special account controlled by the Chromia Foundation. Foundation members can then send them back to the EC and allocate them to the resource pool.
Create an account
An account on the token chain can be created by transferring CHR from the economy chain to your own account ID on the token chain. If you don't have an account on the economy chain, you can also create one by transferring from another account on the token chain or by performing a cross-chain transfer from another chain. This process incurs a small fee.
All of this can be done using the Vault UI.
Propose a new token
Anyone can propose a token. The listing fee is charged at the time of proposal submission and will be refunded if the proposal is not accepted. A proposal is retracted after a certain period, allowing the proposer to reclaim the funds. The fee is distributed as follows: 25% burned, 25% allocated to the Chromia Foundation, and 50% directed to the resource pool. Since these accounts exist on the economy chain, users will likely need to complete the payment there and provide proof on the token chain. This proof could be included in the proposal operation or alternatively, the token chain can be notified via ICMF.
A proposal should contain:
- Token name
- Token symbol
- Token decimals
- Token icon
- Minting policies (if any)
- Account creation blockchains
To propose a token on the token chain, you must have sufficient funds to cover the listing fee. You can check the price for listing a token or adding a bridge using the following query:
chr query --blockchain-rid TOKEN_CHAIN_RID get_token_chain_constants
Use Chromia CLI to propose the token (replace the placeholder text with actual values; see more details about minting and account creation below):
chr tx --evm-auth EVM_WALLET_ADDRESS --blockchain-rid TOKEN_CHAIN_RID propose_token NAME SYMBOL DECIMALS ICON [MINTING_POLICY] [ACCOUNT_CREATION_BRIDS]
To check the status of your token proposal:
chr query --blockchain-rid TOKEN_CHAIN_RID get_proposals_by_proposer proposer=YOUR_ACCOUNT_ID
Once approved, you can retrieve the asset ID of your newly created asset:
chr query --blockchain-rid TOKEN_CHAIN_RID ft4.get_assets_by_name name=YOUR_TOKEN_NAME page_size=null page_cursor=null
Propose a bridge for the token
A bridge contract can be linked to your token. The token chain requires a separate event receiver chain.
Use Chromia CLI to propose the token bridge (replace the placeholder text with actual values; see more details about minting and account creation below):
chr tx --evm-auth EVM_WALLET_ADDRESS --blockchain-rid TOKEN_CHAIN_RID propose_token_bridge ASSET_ID [BRIDGE_CONFIGURATION]
Bridge configurations are defined by the following struct:
struct bridge_configuration {
network_id: integer;
bridge_contract: byte_array;
token_contract: byte_array;
eif.hbridge.bridge_mode;
use_snapshots: boolean;
}
You can use the same query listed above to check the status of your proposal.
Minting
The built-in minting functionality in FT4 can be used along with its before and after hooks to enforce minting policies.
A proposal should include:
- Maximum supply (if any)
- Authorized minters
- Minting rate and amount
- Whether the minting rate is accumulative
- Option to specify the rate and max supply per minter
You can define zero or more minting policies for your token. The policy format is as follows:
struct minting_policy {
minters: set<byte_array>;
/** 0 to disable */
max_supply: big_integer;
minting_interval_ms: integer;
minting_amount: big_integer;
accumulating_amount: boolean;
}
If you are an authorized minter and the policy allows it, you can mint new tokens to your account using the following operation:
chr tx --evm-auth EVM_WALLET_ADDRESS --blockchain-rid TOKEN_CHAIN_RID mint_token ASSET_ID AMOUNT
User account creation
You can specify blockchains that are allowed to create accounts on the token chain on your behalf. For more details,
refer to the documentation of the ras_token_iccf
operation.