Skip to content

Fix: Potential Overflow in _totalSupply - #259

Open
rickymcalister wants to merge 1 commit into
immutable:mainfrom
rickymcalister:ricky-fix-potential-overflow
Open

Fix: Potential Overflow in _totalSupply#259
rickymcalister wants to merge 1 commit into
immutable:mainfrom
rickymcalister:ricky-fix-potential-overflow

Conversation

@rickymcalister

Copy link
Copy Markdown

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 teamJanuary 11, 2025 05:05
Sign up for freeto 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

@rickymcalister