1

I want to create an EOSIO token with additional functionality. For example, I want users to be able to claim() an additional token per day (since e.g. account creation date).

Should I create a new contract (e.g. ubi.cpp/ubi.hpp) and use the eosio.token source code as a template (i.e. derive my token class from contract, just like the eosio.token class does), or should I try to have e.g. an "ubi" class that subclasses "eosio.token" instead of "contract?"

I want the custom token to be compatible with all wallets and such, and work everywhere a vanilla eosio.token is expected.

I can't seem to find any tutorial on custom tokens that support additional actions. All token creation tutorials I can find are based on just using the standard eosio.token contract and invoking create/issue/etc to manipulate table entries.

2

Reddit user xxqsgg has answered my question over there: https://www.reddit.com/r/EOSDev/comments/ap2or0/how_to_extend_the_functionality_of_eosiotoken/

Basically, the correct way to do it on EOSIO is the following:

  1. Create an account for the custom token that is going to be created, and deploy the standard eosio.token contract there;

  2. Write a new contract that contains all the extra functionality, and deploy that to a separate account.

The idea is that contract/account #2 above has all the extra actions that users can invoke (e.g. claim() the tokens defined and stored at the #1 account with your standard eosio.contract deployment). Account #2 will probably have the proper permission to manipulate Account #1, i.e. issue extra tokens, etc.

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.