The _distribute
function in the TempleGold
contract lacks proper validation for underflow conditions when calculating token distribution amounts, potentially leading to unintended behavior or disruptions in contract operations.
The _distribute
function is responsible for distributing newly minted Temple Gold tokens (mintAmount
) to designated recipients based on predefined distribution parameters (params). However, it does not adequately handle scenarios where the calculated distribution amounts result in underflows. The function calculates and distributes tokens to three destinations (staking, escrow, gnosis) based on their respective percentages in params.
If the calculated stakingAmount
or escrowAmount
exceeds mintAmount, an underflow condition may occur when calculating gnosisAmount
. This can lead to unintended token allocations or contract disruptions.
See the following code:
This can lead to DOS and disruptions or invalid states in the TempleGold
contract, affecting its operational reliability.
Manual Review
Implement checks to ensure that calculated distribution amounts (stakingAmount
, escrowAmount
) do not exceed mintAmount
before calculating gnosisAmount
.
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.