Penalties

Penalties in Withdrawal

The flowchart illustrates how penalties are applied during the withdrawal process in the InsomniaVault.

Key Logic

  1. Lockup Check

    • When a user initiates a withdrawal, the system checks: Now < unlockAt[user]?

    • If true, the withdrawal happens before the lockup period ends, and an early exit penalty is applied.

    • If false, no penalty is charged.

  2. Penalty Calculation

    • If locked:

      • Compute penalty = withdraw amount × configured early exit fee (basis points).

    • If unlocked:

      • Penalty = 0.

  3. Liquidity Check

    • If vault balance is sufficient, the withdrawal is processed directly.

    • If not, the vault requests the StrategyRouter to unwind funds from strategies until the required amount is available.

  4. User Payout

    • The vault transfers (withdraw amount - penalty) to the user.

  5. Treasury Allocation

    • If a penalty > 0 exists, the penalty portion is transferred to the Treasury.

  6. Finalization

    • A Withdraw event is emitted, ensuring transparency for users and off-chain indexers.

Purpose of Penalties

  • Encourage Commitment: Reward long-term holders by discouraging premature exits.

  • Sustain Protocol: Penalty fees flow into the Treasury to support ecosystem development and security.

  • Balance Liquidity: Prevent sudden capital flight that may destabilize strategies or vault balances.

Last updated