0

Here is a use case,

There is an interest generating ERC20, where each address may have increasing balances for each blocks from earning interest. Usually, one would need to send a non-standard payInterest() transaction in order to trigger Transfer event so that balanceOf could reflect the increased balance. But imagine if the ERC20.balanceOf function is modified in such way that the accumulating interest is taken into account without actual Transfer events recorded on chain.

The question is: is such behavior of ERC20.balanceOf acceptable, and are there undesired side effects using ERC20 wallets because of this.

1

Events are not detectable within smart contracts - they are meant only for backend systems to notice some events happening inside the blockchain. So unless a backend system is monitoring for such events and then calling the contract to increase balances that event is irrelevant here. Other parts of the called function should perform the actual functionality.

That being said you are, in theory, quite free to implement the ERC20 token in almost whatever way as long as it implements all the required function signatures in some way.

If you have some strange behaviour in your token you will probably face problems whenever you want other parties to start using the token - for example exchanges. They will most likely want to see the contract's source code to make sure that the contract is not vulnerable to any attacks and/or (intentional or unintentional) bugs.

| improve this answer | |
  • Yes, I'm more concerned about the wallet implementations that might have some assumption and monitors the Transfer event. – Miao ZhiCheng Aug 20 '19 at 7:36
  • emitting proper Transfer events is quite universally accepted and desired so if those are not emitted it will definitely create some problems somewhere – Lauri Peltonen Aug 20 '19 at 8:19

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.