Skip to main content

Use token contract

First action that must be executed is create function in order for currency to exist Second, creator must issue tokens and after new currency token is ready to be used in transfer

Create currency

 cline push action token22 create '["token22", "10000.0000 TST"]' -p token22

output:

executed transaction: 8492c49f08d37a5522409ccbd73b7c3f61751639cad08d981135936dd61567aa 120 bytes 163 us # token22 <= token22::create {"issuer":"token22","maximum_supply":"10000.0000 TST"}

This will create new currency with TST as symbol and 10000 of maximum tokens

Issue token

 cline push action token22 issue '["token22", "1000.0000 TST", "memo for issuing"]' -p token22

output :

executed transaction: a62c24d015c0d5df43fba6e1b0d4d638f83d2fc49d4e2243e3142956902e9b55 136 bytes 205 us # token22 <= token22::issue {"to":"token22","quantity":"1000.0000 TST","memo":"memo for issuing"}

Here, we issued 1000 TST tokens, 10% of maximum supply. Those 1000 tokens are now in cicrcualtion and could be transfered between acount's

Transfer

 cline push action token22 transfer '["token22", "test22", "1.0000 TST", "Here you go 1 TST :) "]' -p token22

output:

executed transaction: 5c820fef47c42a5b056d1b60741000aa90b621e89edf621bbf35c1263b9a460e 136 bytes 223 us # token22 <= token22::transfer {"from":"token22","to":"test22","quantity":"1.0000 TST","memo":"memo"} # test22 <= token22::transfer {"from":"token22","to":"test22","quantity":"1.0000 TST","memo":"memo"}

Check balance

Check balance of TST token for account's

  • Get balance of TST token for contract account token22
 cline get currency balance token22 token22 TST

output :

999.0000 TST

  • Check balance of TST token for test22 account
 cline get currency balance token22 test22 TST

output :

1.000 TST