Chromia
Start Building

04 / 15Module 1: Registering accounts and assetsAdvanced

Register payment token

Your marketplace needs a payment token for buying and selling cards, so you have to register and mint one.

Start by registering the asset that will serve as the payment token. The FT4 library ships with built-in operations for asset registration, so you can rely on it here.

Create the asset with these parameters:

  • Name: Collector Card
  • Symbol: CRD
  • Decimals: 6
  • URL to icon: https://url-to-asset-icon

The asset must be registered as soon as the blockchain is deployed. To do that, declare an object, which acts as a global singleton in your dapp. Because the object is initialized when the blockchain starts, the registration runs at startup.

src/rell_marketplace/module.rell
module;import lib.ft4.assets.{ asset, Unsafe };object dapp_meta {    asset = Unsafe.register_asset("Collector Card", "CRD", 6, chain_context.blockchain_rid, "https://url-to-asset-icon");}

From anywhere in the dapp, you can now reference the asset through dapp_meta.asset when performing transfers.

Written for this site from Chromia’s public course. Code samples are the course’s own.