1

I understand that the eosio.token account/contract is used to maintain a 'register' of tokens and also maintains a balance for each user.

Alternatively, I could create my own account and implement the eosio.token contract to that account. I could take the opportunity to modify the eosio.token code to store additional information on each user (e.g. account type, registration date, etc).

If I take the latter approach I can effectively maintain my own version of a token ledger, however I suspect I will lose some functionality. For example, what if an exchange or another user (outside of my system) wants to credit one of my users with an amount of my token?

My question is: should I use the eosio.token account/contract to manage create/issue/transfer of my system's tokens - or should I create my own version?

[I suspect that I will have to use the eosio.token account/contract as that is publicly available, and build any extensions, (e.g. user registration date, account type, etc) in my own multi_index_table]

1

You can't create a token using the eosio.token-account because you would need the authentication of the contract to do so.

void token::create( const name& issuer, const asset& maximum_supply )
{
    require_auth( get_self() );
    ... 
}

Therefore, you have you to deploy your own token-contract.

3
  • Thank you. My follow-on question is: if I deploy a copy of the eosio.token to my own contract and then extend the code (by creating additional attributes in the accounts table, e.g. user role) is that going to break anything? In other words, do exchanges, etc, expect a common interface and table structure if they want to interact with my token?
    – tommccann
    Sep 9 '20 at 2:13
  • I would try not to modify the structures in the Abi, but only add new ones. Therefore I personally would rather add more tables and actions than extend the current ones. Another possibility would be to add a second contract and let it communicate with the token-contract via inline-actions and/or notifications. In most cases, it is possible to extend the contract without modifying any of the models (tables and actions), so that the contract should have a high degree of compatibility.
    – cmadh
    Sep 9 '20 at 10:37
  • Thanks again. I guessed as much, so I left the accounts table as it is and created a new table to deal with the new functionality.
    – tommccann
    Sep 11 '20 at 0:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.