In the previous implementation
when stakingContract.totalAllocPoint = 0
stakingContract.withdraw() and stakingContract.deposit() will div 0 , revert
This results in StargateRewardableWrapper no longer being able to execute StargateRewardableWrapper.withdraw()
The userβs token is locked
PR 896
Add determine if poolInfo.allocPoint is equal to 0.
If equal to 0, use stakingContract.emergencyWithdraw() instead of stakingContract.deposit() to avoid revert
the mitigation resolved the original issue.
Since allocPoint==0 is used instead of totalAllocPoint==0
there may be a case where allocPoint == 0 but totalAllocPoint> 0.
But the modified version still uses stakingContract.emergencyWithdraw(), which discards all rewards.
It is recommended that if totalAllocPoint> 0 ,we can execute the
stakingContract.deposit(0) to retrieve the reward first, then execute stakingContract.emergencyWithdraw().
The text was updated successfully, but these errors were encountered:
All reactions