In TempleGoldStaking.sol
contract is a fork of the Synthetix contract, with slight modifications. The code special-cases the scenario where there are no users, by not updating the cumulative rate when the _totalSupply
is zero, but it does not include such a condition for the tracking of the timestamp
Because of this, even when there are no users staking, the accounting logic still thinks funds were being dispersed during that timeframe (because the starting timestamp is updated),
As a result if the distributeRewards()
function is called prior to there being any users staking, the funds that should have gone to the first stakers will instead accrue to nobody, and be locked in the contract forever.
Non-distributed rewards remain locked within the contract.
Here's an example scenario:
Alice is distributionStarter and Bob is a person who wants to stake Temple.
Alice calls the distributeRewards() function to mint TGLD for this contract. Let's suppose the minted TGLD is 7*86400 ether to calculate simply.
Then rewardRate becomes 1 ether.
After 24 hours, Bob stakes 10000 TGLD into the contract.
After 6 days, Bob withdraw all staked TGLD and claim rewards. Then he gets 6*86400 ether.
As a result, 86400 ether is locked in the contract.
Manual, Foundry
In the function distributeRewards()
, check if there are enough reward tokens already in the contract.
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.