Users engaging in leveraged positions expect to retrieve all their remaining collateral after fully repaying their debt.
The unwinding logic calculates the withdrawal amount based on the liquidation threshold risk parameter instead of the user's actual equity, leaving the surplus safety margin permanently locked in the protocol.
Likelihood:
The calculation is hardcoded into the only available unwind function path.
Every user attempting a full unwind will experience this fund lock.
Impact:
Users lose access to significant portions of their principal (often >20%).
The protocol fails to fulfill its primary solvency guarantee of returning user funds.
This test case demonstrates the issue by simulating a full unwind operation. It sets up a scenario with 100 ETH collateral and 50k USDC debt, which is a healthy position. When the user attempts to fully repay the debt, the protocol calculates the withdrawal amount using the flawed formula. The assertion confirms that the actual withdrawn amount (~31.25 ETH) is significantly less than the user's total collateral (100 ETH), effectively locking the remaining ~68.75 ETH.
Remove the restrictive calculation that bases withdrawal on the Liquidation Threshold. Instead, allow the user to specify the amount of collateral they wish to withdraw in unwindParams, or default to withdrawing the full collateral balance when performing a full debt repayment.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.