Deploy, Issue & Transfer Tokens

The InfraBlockchain network uses the built-in contract applied to the core without deploying the token contract. The sys.tokenabi account contains the ABI of the Built-in Contract.

Every account can use transfer, issue, retire, settokenmeta, txfee action

infra-cli get abi sys.tokenabi

Step 1: Create the Token

To create a new token, call create action with the correct parameters. This action accepts 1 argument, it consists of:

  • An issuer that is an eosio account. In this case, it's systoken.a. This issuer will be the one with the authority to call issue and/or perform other actions such as closing accounts or retiring tokens.

  • An asset type composed of two pieces of data, a floating-point number sets the maximum supply and a symbol in capitalized alpha characters which represents the symbol. For example, "4,DUSD".

Below is a concise way to call this method, using positional arguments:

infra-cli push action systoken.a settokenmeta '{"sym":"4,DUSD","url":"http://sysdepo-a.org","desc":"system depository a"}' -p systoken.a@activeve

Step 2: Issue Tokens

The issuer systoken.a can now issue new tokens. As mentioned earlier only the issuer can do so, therefore, -p systoken.a@active must be provided to authorize the issue action.

infra-cli push action systoken.a issue '[ "systoken.a", "100000000.0000 DUSD", "memo" ]' -p systoken.a@active
executed transaction: d1466bb28eb63a9328d92ddddc660461a16c405dffc500ce4a75a10aa173347a  128 bytes  205 us
#   systoken.a <= systoken.a::issue           {"to":"systoken.a","quantity":"100000000.0000 DUSD","memo":"memo"}
warning: transaction executed locally, but may not be confirmed by the network yet         ]

This time the output contains several actions: one issue action and three transfer actions. While the only action signed was issue, the issue action performed an inline transfer and the inline transfer notified the sender and receiver accounts. The output indicates all the action handlers that were called, the order they were called in, and whether any output was generated by the action.

Step 3: Transfer Tokens

Now that account systoken.a has been issued tokens, transfer some of them to account bob.

infra-cli push action systoken.a transfer '[ "systoken.a", "bob", "25.0000 DUSD", "m" ]' -p systoken.a@active
executed transaction: 800835f28659d405748f4ac0ec9e327335eae579a0d8e8ef6330e78c9ee1b67c  128 bytes  1073 us
#   systoken.a <= systoken.a::transfer        {"from":"systoken.a","to":"bob","quantity":"25.0000 DUSD","memo":"m"}
#           bob <= systoken.a::transfer        {"from":"systoken.a","to":"bob","quantity":"25.0000 DUSD","memo":"m"}
warning: transaction executed locally, but may not be confirmed by the network yet         ]

Now check if bob received the tokens using infra-cli get token balance

infra-cli.sh get token balance systoken.a bob
25.0000 DUSD

Check systoken.a's balance. Notice that tokens were deducted from the account.

infra-cli.sh get token balance systoken.a systoken.a
99999975.0000 SYS

Excellent! Everything adds up.

What's Next?

  • Understanding ABI Files: Introduction to Application Binary Files (ABI) and how the ABI file correlates to the eosio.token contract.

Last updated