The removeStrategy
function in the StakingPool
contract fails to update the totalStaked
variable after withdrawing deposits from the strategy being removed.
After the strategy.withdraw
call, the totalStaked
variable should be decreased by the totalStrategyDeposits
amount to maintain consistency. However, this update is missing, causing the totalStaked
value to remain inflated.
The removeStrategy
function allows the owner to remove a strategy from the pool. When a strategy is removed, all the deposits from that strategy are withdrawn using the strategy.withdraw
function. However, the totalStaked
variable, which represents the total amount of tokens staked in the pool, is not updated to reflect the withdrawal of deposits from the removed strategy.
The inflated totalStaked
value provides an inaccurate representation of the total staked amount in the pool. This can mislead users and other contracts that rely on this value for decision-making or calculations.
In the code where deposits are withdrawn from the strategy being removed. After the strategy.withdraw
call, totalStaked
should be decreased by the totalStrategyDeposits
amount to maintain consistency with the actual total staked amount in the pool. However, this update is missing, causing totalStaked
to remain inflated even after the deposits are withdrawn.
Manual Review
The removeStrategy
function should be updated to properly adjust the totalStaked
value after withdrawing deposits from the removed strategy. By subtracting the totalStrategyDeposits
from totalStaked
after the strategy.withdraw
call, the totalStaked
value will be correctly updated to reflect the withdrawal of deposits from the removed strategy. This ensures that totalStaked
remains consistent with the actual total staked amount in the pool.
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.