Inadequate check in TempleGold::_canDistribute
function with uint256
signature which can allow the protocol mint less than the MINIMUM_MINT
thereby breaking the protocol.
The TempleGold::_canDistribute
function with uint256
signature implements a logic that is not sound in checking whether or not some TGLD
should be minted. This breaks the protocol rule of not minting less than MINIMUM_MINT
.
The above function can return true
even without checking the condition mintAmount >= MINIMUM_MINT
which is a requirement of the protocol.
Additionally, the condition _totalDistributed + mintAmount == MAX_SUPPLY
can allow the protocol to mint all tokens at the first epoch rather than as specified in the vestingFactor
which will also break the protocol.
The logic in the TempleGold::_canDistribute
function with uint256
signature breaks the protocol either by allowing the minting of tokens less than MINIMUM_MINT
or by forcing the protocol to mint all tokens at the first epoch neglecting the vestingFactor
specified by the protocol. Either way, the protocol breaks.
Using chisel
in foundry
, we can show that the protocol can mint more the MAX_SUPPLY
We can also prove that the TempleGold::_canDistribute
function with uint256
signature can break the protocol by allowing the minting of mintAmount < MINIMUM_MINT
. For this demonstration, let us suppose that the protocol has recorded some epochs and _totalDistributed
is not zero, let us replace zero by 999_999_000
in the function and check if the protocol can mint 1_000
tokens
Protocol returns true
for mintAmount < MINIMUM_MINT
The TempleGold::_canDistribute
function with uint256
signature should be modified as follows
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.