In TempleGoldStaking
rewards will be not distributed because wrong address is passed in notifyDistribution
which will always revert and nextRewardAmount
would be not updated which is one of the crucial value when it comes to distribution.
If we inspect the notifyDistribution
function it looks like this:
https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/TempleGoldStaking.sol#L405C2-L414C6
The issue lies in this check
The rewardToken
address is not TempleGold contract it is ERC20 address
The actual contract that is calling this function is TempleGold
(as it is stated in Nat spec above notifyDistribution
also) as we can see here:
https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/TempleGold.sol#L226C1-L231C10
Since Temple Gold contract will mint TGLD tokens to Temple Gold Staking contract before calling notifyDistribution
(as stated and described in the notifyDistribution
function ) the tokens will be sent to the TempleGoldStaking
contract but would be not aware of that because notifyDistribution
will always revert and nextRewardAmount
would not be updated so they would be stuck and not distributed to the stakers.
The functions that rely on nextRewardAmount
are :
distributeRewards
- https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/TempleGoldStaking.sol#L188
The reward tokens would be stuck in the contract, they will be not distributed and the accounting of the contract would be inaccurate which will make it's users (stakers) not receive their promised rewards and lose incentive for staking and possible trust and reliability of the protocol.
Manual Review.
Make sure the msg.sender
in notifyDistribution
is actual temple gold address like this :
As we can see the correct implementation in DaiGoldAuction
.
https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/DaiGoldAuction.sol#L171
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.