TempleGold

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

Error checking in the `TempleGold::_canDistribute` allows token to be distributed even when MAXSUPPLY is reached

Summary

Error checking in the TempleGold::_canDistribute allows token to be distributed even when MAXSUPPLY is reached

Vulnerability Details

https://github.com/Cyfrin/2024-07-templegold/blob/main/protocol/contracts/templegold/TempleGold.sol#L188-L190

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

Impact

When _totalDistributed + mintAmount > MAX_SUPPLY, as long as mintAmount >= MINIMUM_MINT, _canDistribute can still return true, which makes the distributed tokens exceed MAX_SUPPLY and does not meet the definition of MAX_SUPPLY

Tools Used

Manual review

Recommendations

_totalDistributed + mintAmount > MAX_SUPPLY should return false

Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months 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.