TempleGold

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

`_canDistribute` can return true even when total amount exceeds `MAX_SUPPLY`

Summary

The _canDistribute function determines if the given amount is mintable and distributable, the logic when handling total supply is incorrect, which can return incorrect result even when the total amount exceeds MAX_SUPPLY.

Vulnerability Details

In the function, we can see:

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

Which in the follow situitation, will return true: when amount is not zero AND, total amount equals to MAX_SUPPLY, or the minted amount is greater than the mininum mint amount. However, when _totalDistributed + mintAmount is greater than MAX_SUPPLY, this can also return true, if mintAmount > MINIMUM_MINT. This should return false, because it will exceed the max supply amount, which is the hard limit of total supply.

Impact

The caller of this function passes the checked value to it, so no core functions will be broken, but the logic is still incorrect, hence low severity.

Tools Used

Manual review

Recommendations

Revert when total amount exceeds MAX_SUPPLY.

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.