calculateUnwindParams returns the collateral amount to withdraw when unwinding a position. The function applies a fixed 5% buffer to account for swap slippage before returning collateralToWithdraw.
The slippage buffer is hardcoded and not configurable. In volatile markets, 5% may be insufficient and unwinds can revert or fail. In stable conditions, 5% may be excessive and withdraw more collateral than needed, leaving dust or affecting position health.
Likelihood (low):
Most unwinds use stable pairs (e.g., USDC/WETH) where 5% is often adequate.
Volatile markets or illiquid pairs can experience >5% slippage; the buffer becomes insufficient and the unwind may revert at require(returnAmount >= totalDebt).
Impact (low):
Too tight: unwinds fail in volatile conditions; owner must retry or wait for calmer markets.
Too loose: excess collateral withdrawn; dust left in Aave or suboptimal health factor adjustment.
Severity (low):
Owner calls calculateUnwindParams(USDC, WETH) to get collateralToWithdraw and debtAmount. The function returns collateralToWithdraw with a 5% buffer (e.g., 1050 instead of 1000).
Owner builds 1inch swap for collateralToWithdraw and calls unwindPosition. During a volatile period, the swap returns 4% less than expected due to price movement. The 5% buffer is barely sufficient; in worse conditions (e.g., 6% slippage), the unwind reverts.
Conversely, in stable conditions the swap may return 1% less than nominal. The 5% buffer is excessive; the protocol withdraws more collateral than needed.
Make the slippage buffer configurable. Option A: add a parameter to calculateUnwindParams. Option B: add an owner-set state variable (e.g., unwindSlippageBps).
Add state variable: uint256 public unwindSlippageBps = 500; and setter setUnwindSlippageBps(uint256).
Location: src/Stratax.sol:469-470
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.