You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some tokens that will be added to the variable _rewardsSwapAmountInOverride due to the fact that it needs to be re-tried since it failed to swap (maybe cause the DEX didn't have enough liquidity etc etc)
However, we can see that setShares does not attempt to re-try the amounts sitting there atleast once.
Impact
Alice is a shareholder of TokenRewards.sol
Rewards come in and it is attempted to be swapped
The swap failed due to lack of liqudity from the DEX, and the token amounts are sent to _rewardsSwapAmountInOverride
Some time passes (and now maybe the DEX has sufficient liquidity)
Bob becomes a shareholder of TokenRewards.sol through setShares
Since setShares does not retry the amounts sitting in _rewardsSwapAmountInOverride atleast once at the start, Bob's shares will now include the value of the rewards, unfairly dilutiing Alice's shares of the rewards.
Recommendation
At the starting of setShares, retry _rewardsSwapAmountInOverride once.
The text was updated successfully, but these errors were encountered:
Rich Grey Crocodile
Medium
Tokens waiting in
_rewardsSwapAmountInOverride
to be re-tried is not re-tried beforesetShares
inTokenRewards.sol
Vulnerability Details
https://github.com/sherlock-audit/2025-01-peapods-finance/blob/d28eb19f4b39d3db7997477460f9f9c76839cb0c/contracts/contracts/TokenRewards.sol#L292-L319
Whenever the reward tokens come in to
TokenRewards.sol
:There are some tokens that will be added to the variable
_rewardsSwapAmountInOverride
due to the fact that it needs to be re-tried since it failed to swap (maybe cause the DEX didn't have enough liquidity etc etc)However, we can see that
setShares
does not attempt to re-try the amounts sitting there atleast once.Impact
_rewardsSwapAmountInOverride
setShares
Since
setShares
does not retry the amounts sitting in_rewardsSwapAmountInOverride
atleast once at the start, Bob's shares will now include the value of the rewards, unfairly dilutiing Alice's shares of the rewards.Recommendation
At the starting of
setShares
, retry_rewardsSwapAmountInOverride
once.The text was updated successfully, but these errors were encountered: