Locking
Last updated
Last updated
As afETH is composed of 70% sfrxETH and 30% vlCVX, 30% of user deposits are locked for up to 16 weeks.
When a deposit is made the incoming ETH is swapped for CVX and locked. When a withdrawal is requested the contract first checks whether sufficient CVX is unlocked to cover other pending withdrawals plus the new request, if so the CVX is immediately swapped for ETH and given to the user. Otherwise, a pending withdrawal is created.
Before locking new CVX the contract checks that it's not locking any CVX that is needed to cover pending withdrawals.
To efficiently track the priority of different withdrawals and provide unique IDs for different withdrawals the strategy tracks cumulative unlocked and unlock obligation amounts. The current total obligations is the difference between the two values. Unlike the total obligations the cumulative total obligations never goes down, meaning it can act as a useful pending withdrawal ID and indicate the ordering of when a withdrawal can be processed, independently of whether higher priority withdrawals have been processed.
This system efficiently allows for users to withdraw prior to the maximum 16-week locking period.