I'm creating a contract where people transact by using locked ERC20 tokens.

For example - you'd have 500 of token A locked in the DAO contract.

You decide to send 100 of token A to some other account. The transaction fee was set to 2% of the transaction value. So 98 tokens went to the account you sent them to and 2 tokens need to be paid out to DAO holders in proportion to their holding.

Since I'm not allowed to iterate over accounts because of the gas limit - is there any way I can achieve this?

  • Yes, I think I understand what you're saying... Give a few more details though. You are trying to enact a transaction fee on an ERC20 token that is paid out to other ERC20 token holders?
    – Alex
    Nov 27, 2017 at 17:55
  • Yes - but thats not the hard part. The hard part is storing it and giving to all DAO holders without iterating and hitting the gas limit Nov 28, 2017 at 12:49

1 Answer 1


First, understand that if you just "burnt" the tx fee, it would do something similar, by decreasing the total supply, and making everyone's tokens proportionally more valuable. This is probably the easiest way to do it.

Second, yes, you definitely do not want to iterate though each address for every transfer. It would make a simple transfer very expensive (let alone possibly failing because of the gas limit). I would look at modifying an approach like this: ERC20 Token and effective way to store dividends if you really need capability so that DAO holders token count increases over time (if you don't want to go with the tx-fee burning process).

Your Answer

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

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