TempleGold.sol::_getMintAmount
Issue: The multiplication of (block.timestamp - _lastMintTimestamp) with MAX_SUPPLY could potentially overflow.
Recommendation: Use SafeMath or Solidity 0.8's built-in overflow checks to ensure safe arithmetic operations.
function _getMintAmount(VestingFactor memory vestingFactorCache) private view returns (uint256 mintAmount) {
uint32 _lastMintTimestamp = lastMintTimestamp;
uint256 totalSupplyCache = _totalDistributed;
if (_lastMintTimestamp == 0) { return 0; }
mintAmount = TempleMath.mulDivRound((block.timestamp - _lastMintTimestamp) * (MAX_SUPPLY), vestingFactorCache.numerator, vestingFactorCache.denominator, false);
if (totalSupplyCache + mintAmount > MAX_SUPPLY) {
unchecked {
mintAmount = MAX_SUPPLY - totalSupplyCache;
}
}
}