TempleGold

TempleDAO
Foundry
25,000 USDC
View results
Submission Details
Severity: low
Invalid

Incorrect minting condition allows exceeding maximum supply

Summary

TempleGold::_canDistribute contains a logical error that could potentially allow the total supply of Temple Gold to exceed the predefined maximum supply (MAX_SUPPLY).

Vulnerability Details

function _canDistribute(uint256 mintAmount) private view returns (bool) {
return mintAmount != 0 && _totalDistributed + mintAmount == MAX_SUPPLY ? true : mintAmount >= MINIMUM_MINT;
}

This condition incorrectly allows minting as long as mintAmount is greater than or equal to MINIMUM_MINT, even if _totalDistributed + mintAmount exceeds MAX_SUPPLY. As a result, the total supply of Temple Gold could exceed the intended maximum limit.

Impact

If this vulnerability is exploited, it could lead to the creation of more tokens than the intended maximum supply (MAX_SUPPLY), which would result in token inflation.

Tools Used

Manual code review

Recommendations

To fix this issue, the condition in the Templegold::_canDistribute function should be modified to ensure that the total distributed tokens do not exceed the MAX_SUPPLY. The corrected function is as follows:

function _canDistribute(uint256 mintAmount) private view returns (bool) {
- return mintAmount != 0 && _totalDistributed + mintAmount == MAX_SUPPLY ? true : mintAmount >= MINIMUM_MINT;
+ return mintAmount != 0 && _totalDistributed + mintAmount <= MAX_SUPPLY && mintAmount >= MINIMUM_MINT;
}

This change ensures that all of the following conditions are fulfilled:

  • The mint amount must be non-zero.

  • The total distributed amount plus the mint amount must not exceed (as opposed to equal) the MAX_SUPPLY.

  • The mint amount must be at least the MINIMUM_MINT.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

`_canDistribute` could return a result breaking the MAX TOTAL SUPPLY of TGLD

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.