A Game player will suffer loss while calling rebalanceBasket() between step 6 and step 8
Summary
While step 6 pushAllocationsToVaults() is end, isXChainRebalancing is been set to false, but settleRewardsInt() is called untill step 8. A Game player will suffer loss while calling rebalanceBasket() during this period.
Vulnerability Detail
As shown on L324 of Game contract, rebalanceBasket() can be called while isXChainRebalancing == false which is set on L476 of pushAllocationsToVaults(). But rewardPerLockedToken of current rebalance period will be 0 until settleRewardsInt() is called.
KingNFT
medium
A
Game
player will suffer loss while callingrebalanceBasket()
betweenstep 6
andstep 8
Summary
While step 6
pushAllocationsToVaults()
is end,isXChainRebalancing
is been set tofalse
, butsettleRewardsInt()
is called untill step 8. AGame
player will suffer loss while callingrebalanceBasket()
during this period.Vulnerability Detail
As shown on L324 of
Game
contract,rebalanceBasket()
can be called whileisXChainRebalancing == false
which is set on L476 ofpushAllocationsToVaults()
. ButrewardPerLockedToken
of current rebalance period will be 0 untilsettleRewardsInt()
is called.If the basket owner call
rebalanceBasket()
during this period, will suffer loss.Impact
A
Game
player will suffer loss while callingrebalanceBasket()
betweenstep 6
andstep 8
.Code Snippet
https://github.com/sherlock-audit/2023-01-derby/blob/main/derby-yield-optimiser/contracts/Game.sol#L318
Tool used
Manual Review
Recommendation
Don't allow users to call
rebalanceBasket()
during this period