Open devlancer412 opened 1 month ago
@chimera-defi
hmm thats strange. But good find, these are the edge cases we want to detect with the tests.
any ideas for an easy fix? ill spend some time reasoning through it, perhaps its as simple as accounting that there will always be some dust left over, and committing something like 0.001 E in, then running the tests. ? @devlancer412
When get some rewards, it is distributed by linear on next reward cycle.![image](https://github.com/chimera-defi/SharedDeposit/assets/101313445/9c21e0e1-8acf-4295-a41d-5318ec45a976)
so
totalAssets
=storedTotalAssets
+unlockedRewards
But when redeem![image](https://github.com/chimera-defi/SharedDeposit/assets/101313445/4fe5db2f-ddc9-4207-b797-bf164bcb7c93)
storedTotalAssets
-=redeemAmount
If user withdraws all, amount > storedTotalAssets and so it makes panic error https://github.com/chimera-defi/SharedDeposit/blob/1fe4278ab14aac6d9365b102752c130b1256ebee/contracts/lib/xERC4626.sol#L64 https://github.com/chimera-defi/SharedDeposit/blob/1fe4278ab14aac6d9365b102752c130b1256ebee/contracts/lib/xERC4626.sol#L71