4. Currency token
I want to start from myself and present you a token, I’ve been working on for some time now, that (at least in
my opinion) should represent a currency really well.
https://github.com/seniorjoinu/tokens/tree/master/currency-token
Take a look at it and let me know what you think! I see this repository as a library of different tokens which you
could clone, modify and use in your projects.
Here I’m going to tease some of its core features and new concepts.
Overview
service : (InitRequest) -> {
"mint" : (TransferRequest) -> ();
"transfer" : (TransferRequest) -> ();
"burn" : (BurnRequest) -> ();
"get_balance_of" : (GetBalanceOfRequest) -> (GetBalanceOfResponse) query;
"get_total_supply" : () -> (GetTotalSupplyResponse) query;
"get_info" : () -> (GetInfoResponse) query;
"update_info" : (UpdateInfoRequest) -> (UpdateInfoResponse);
"get_controllers" : () -> (GetControllersResponse) query;
"update_info_controller" : (UpdateControllersRequest) -> (UpdateControllersResponse);
"update_mint_controller" : (UpdateControllersRequest) -> (UpdateControllersResponse);
"dequeue_recurrent_transfer_tasks" : (DequeueRecurrentTaskRequest) -> (DequeueRecurrentTaskResponse);
"get_recurrent_transfer_tasks" : (GetRecurrentTransferTasksRequest) -> (GetRecurrentTransferTasksResponse) query;
"dequeue_recurrent_mint_tasks" : (DequeueRecurrentTaskRequest) -> (DequeueRecurrentTaskResponse);
"get_recurrent_mint_tasks" : () -> (GetRecurrentMintTasksResponse) query;
}
The main signature of this actor is based on what we’ve seen in almost any fungible token before. We have same mint
,
transfer
, burn
, balance_of
and total_supply
functions and their core idea stayed the same - these are a basic
functions which any developer should find familiar themselves with.
The only difference here is that instead of separate name
, symbol
and decimals
fields, we have a single field
info
that incorporates all this data inside it. This is done for encapsulation purposes. Fewer details, more could fit
inside.