Submitted by deadrxsezzz
Within a withdraw batch, all users within said batch are paid equally - at the same rate, despite what exactly was the rate when each individual one created their withdraw.
While this usually is not a problem as it is a way to reward users who queue the withdrawal and start the expiry cooldown, it creates a problematic situation when the market is closed with an outstanding expiry batch.
The problem is that up until the expiry timestamp comes, all new withdraw requests are added to this old batch where the rate of the previous requests drags the overall withdraw rate down.
Consider the following scenario:
This creates a very unpleasant situation as the users have an incentive to hold their funds within the contract, despite not providing any value.
Looked from slightly different POV, these early withdraw requesters force everyone else to lock their funds for additional 6 months, for the APY they shouldve usually received for just holding up until now.
After closing a market and filling the current expiry, delete it from pendingWithdrawalExpiry. Introduce a closedExpiry variable so you later make sure a future expiry is not made at that same timestamp to avoid collision.
d1ll0n (Wildcat) confirmed and commented:
laurenceday (Wildcat) commented:
