-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Fix ERC20._update #3921
Fix ERC20._update #3921
Conversation
ERC20Snapshot should also be updated. Should that be done in a separate PR? |
It will be done here. |
We should merge master into next-5.0. This will enable hardhat-exposed, removing the needs for mocks. |
Co-authored-by: Francisco <frangio.1@gmail.com>
Co-authored-by: Francisco <frangio.1@gmail.com>
Really confused by why the linter is still failing. It doesn't show any errors locally. |
same here |
contracts/token/ERC20/ERC20.sol
Outdated
} | ||
|
||
if (to == address(0)) { | ||
_totalSupply -= amount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding unchecked
here is the only pending item for this PR.
I was somehow able to fix linting by running the latest version of Prettier with the new configuration. |
is it possible that github action has a cache with the old version ? |
I tried deleting the caches and it didn't make a difference. |
Note that linting of the mocks is irrelevant as they will be deleted when we merge master. |
There is a risk with the current implementation of the
_update
function of altering the tokens total supply when sending the zero address as thefrom
andto
parameters.If someone does
_update(address(0), address(0), amount)
, this will go intoif (from == address(0)) { ... }
that will increase the total supply and mint tokens to address(0), then because of the
else
it will not go intoelse if (to == address(0)) { ... }
so the total supply amount would remain unbalanced.
PR Checklist