-
Notifications
You must be signed in to change notification settings - Fork 11.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Virtual balanceOf in ERC20 #2400
Comments
It depends on what you want to override it with. There are potential issues integrating with other contracts when |
For the general issue of having virtual view functions see #2154. Closing this issue but let's continue the discussion if you want. |
@frangio There are cases when the balance is changing over time, and to save costs for transactions you can implement the changed balance dynamically. This usually occurs in DeFi when users are getting interests, or there may be cases when the token holders are awarded extra tokens. I have seen this implementation in aave: https://github.com/aave/aave-protocol/blob/f7ef52000af2964046857da7e5fe01894a51f2ab/contracts/tokenization/AToken.sol#L338 But they are using an older version of OpenZeppelin to override the |
@frangio what do you think about this? |
@ebulku We're going to add virtual view functions in the next release (see #2154 (comment)). Whether |
🧐 Motivation
I want to use my own logic behind the
balanceOf()
function for ERC20.📝 Details
Is there any known issue if I change the
balaceOf()
invirtual
inERC20.sol
The text was updated successfully, but these errors were encountered: