Withdrawals

Exit position in two steps: request & bridge. Funds are unlocked bucket-by-bucket, then bridged back to HyperEVM as USDC.


Withdrawals can only pull from buckets whose 4-day lock has expired. Large exits may span multiple epochs if liquidity is still locked. No withdrawal will take longer than 4 days.


Key On-Chain State

wdrmapping(address ⇒ Wdr)

Tracks each user’s pending withdrawal: USD amount, equity snapshot, stage.

Wdrstruct

{ uint64 usd; uint256 preEq; WdrStage st; } — see enum WdrStage below.

WdrStageenum

NONE · REQUESTED · BRIDGED (two-step process).

withdrawRequest

User burns their tHLP shares and signals intent to exit. Contract gathers unlocked buckets and bridges funds out of HLP.

withdrawRequest.sol
function withdrawRequest(uint256 shares) external nonReentrant;
  • Requires caller to hold at least `shares` and no existing pending withdrawal.
  • Iterates buckets until collected USD ≥ share value (equity-proportional).
  • Splits fee if enabled, burns tHLP, stores Wdr struct, emits WithdrawRequested.

withdrawBridge

Caller completes withdrawal once Hyperliquid transfer arrived — USDC is sent back on HyperEVM and Wdr stage updated.

withdrawBridge.sol
function withdrawBridge() external;
  • Ensures vault equity dropped by requested USD amount (_totalEquity() check).
  • Validates bridge arrival with spotBalance, forwards USDC via IL1Write.sendSpot.
  • Sets stage to BRIDGED and emits WithdrawBridged.