Skip to content

Fix: Potential Overflow in _totalSupply #259

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rickymcalister
Copy link

Leverage Solidity's built-in overflow/underflow checks (Solidity 0.8.0) to avoid any potential overflows and revert the transaction if one occurs.

If an overflow occurs, _totalSupply would wrap around to a small value, leading to incorrect accounting of the total supply of tokens.

The best way to prevent this is to use Solidity's built-in overflow/underflow checks by using the += operator instead of =, Solidity will automatically revert the transaction if an overflow occurs.

… 0.8.0) to avoid any potential overflows and revert the transaction if one occurs
@rickymcalister rickymcalister requested a review from a team as a code owner January 11, 2025 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant