This PR has added the method setRewardTokens to modify rewardTokens[].
But the current implementation has a problem, it doesn't transfer the old rewardTokens[] first
so that if rewardTokens[] is changed from more to less. (convex is possible to become less)
Since the transfer of the old rewardTokens[] is not triggered, the token to be removed may have already been generated and stored in the contract
When new tokens are set, transferReward() does not transfer the old token.(Although the owner can take it out by recoverToken, maybe the owner doesn't even notice it)
So it is recommended to trigger the transfer of the old rewardTokens[] first
Lines of code
https://github.com/code-423n4/2023-05-xeth/commit/1f714868f193cdeb472ec097110901a997d87ec4#L1
Vulnerability details
The lack of a mechanism to modify rewardTokens[] If convex adds new extraRewards CVXStaker.sol cannot transfer the added token
Mitigation
https://github.com/code-423n4/2023-05-xeth/commit/1f714868f193cdeb472ec097110901a997d87ec4
This PR has added the method
setRewardTokens
to modifyrewardTokens[]
.But the current implementation has a problem, it doesn't transfer the old
rewardTokens[]
first so that ifrewardTokens[]
is changed from more to less. (convex is possible to become less) Since the transfer of the oldrewardTokens[]
is not triggered, thetoken
to be removed may have already been generated and stored in the contract When newtokens
are set,transferReward()
does not transfer the old token.(Although the owner can take it out byrecoverToken
, maybe theowner
doesn't even notice it) So it is recommended to trigger the transfer of the oldrewardTokens[]
firstAssessed type
Context