0

I've issued a token using eosio.token standard contract. I want to prevent transfers to a number of specific accounts, for a limited time. Since it is temporary, I think I can simply hardcode the assertions into the contract, something like:

eosio_assert( to != "thisaccount1"_n, "Transfer prevented" );
eosio_assert( to != "thisaccount2"_n, "Transfer prevented" );
eosio_assert( to != "thisaccount3"_n, "Transfer prevented" );

inside the token::transfer method.

I know it looks quick'n'dirty, but would that work? And could it have any side effects ?

1 Answer 1

1

It would certainly work, but hard-coding the accounts as blacklist may not be the ideal way to do it. Since in order to change them, you would have to redeploy your code everytime you want to modify the list.

I would suggest getting a new table with the blacklist accounts, and modify the details in the table and check it in your contract rather than modifying the token contract itself

2
  • I agree using a table is the right way, but this will only be active for a few days, and then it'll be completely removed, so I'm going with quick'n'dirty.
    – Vaneik
    Dec 20, 2018 at 15:23
  • sounds reasonable enough ;)
    – junep89
    Dec 24, 2018 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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