Insomnia Vault

Insomnia Vault (Core Vault Contract)

Purpose The InsomniaVault serves as the main entry point for users. It is the contract where deposits, withdrawals, and share management take place. By holding vault shares, users gain proportional ownership of the underlying SOM tokens and the rewards generated.

Key Features

  • ERC-20 vault shares with ERC4626-like functionality for standardized interactions

  • Account-based lockup system that supports flexible durations and multipliers

  • Automatic integration with the PointsController for seamless point tracking

  • Configurable Total Value Locked (TVL) caps and early exit fees

  • Emergency pause functionality and strict access controls for risk management

User Interactions

  • depositNative(): Deposit SOM tokens into the vault and receive proportional vault shares

  • withdraw(): Burn vault shares to redeem underlying SOM tokens (subject to lockup rules and potential penalties)

  • Preview Functions: View expected share amounts, withdrawal values, and lockup status before confirming a transaction

The InsomniaVault ensures that all user deposits are secure, transparently managed, and directly linked to both yield generation and airdrop point accumulation.

VaultFactory (Deployment System)

Purpose Standardizes the creation of a complete Insomnia vault stack in a single transaction—deploying and wiring the InsomniaVault, StrategyRouter, and PointsController, and setting initial roles and parameters.

Key Features

  • One-Tx Bootstrapping – Deploys core contracts and connects them correctly.

  • Role Setup – Grants DEFAULT_ADMIN_ROLE and project roles (e.g., GOVERNANCE_ROLE, KEEPER_ROLE, PAUSER_ROLE) to designated addresses.

  • Deterministic Configuration – Applies consistent defaults for fees, caps, lockups, and weights.

  • Event Emission – Announces new deployments for easy indexing and monitoring.

  • Safety by Design – Enforces invariants (e.g., weight sums, nonzero addresses) to prevent misconfiguration.

Deployment Flow

  1. Instantiate Core Contracts – Deploy InsomniaVault, StrategyRouter, and PointsController.

  2. Wire Dependencies

    • Vault ↔ PointsController: share-based accounting for points.

    • Vault ↔ StrategyRouter: deposit/withdraw/allocate routes.

  3. Assign Roles – Grant admin, governance, keeper, and pauser roles to provided addresses.

  4. Initialize Parameters – Set TVL caps, early exit fee BPS, lockup options, and initial strategy set/weights (optional).

  5. Emit Events – Publish VaultCreated and related events with deployed addresses and config.

Roles & Permissions

  • DEFAULT_ADMIN_ROLE: Full administrative control over role grants/revocations.

  • GOVERNANCE_ROLE: Configure vault parameters, strategy weights, and point rates; add/remove adapters.

  • KEEPER_ROLE: Execute operational tasks (allocate, rebalance, harvest).

  • PAUSER_ROLE: Pause critical functions across the stack during emergencies.

Configuration Parameters

  • TVL Cap – Maximum SOM the vault can accept.

  • Early Exit Fee (BPS) – Penalty for withdrawals before lock expiry; sent to Treasury.

  • Lockup Profiles – Durations and multipliers for Standard/Boost vaults.

  • Strategy Weights (BPS) – Initial distribution targets in the router.

  • Treasury Address – Recipient of protocol fees.

  • Points Rates/Multipliers – Per-source base rates and multipliers in the PointsController.

Events & Transparency

  • VaultCreated(vault, router, name, lockup, earlyExitFeeBps) – Announces a new deployment with key parameters.

  • Additional events for role assignments and parameter changes enable off-chain dashboards to index state reliably.

Security & Safeguards

  • Invariants – Validate weight sums (≈ 10000 BPS), nonzero addresses, and sane fee bounds.

  • Access Control – Role-gated configuration and operational calls.

  • Pause Hooks – Ability to pause deposits/allocations during incidents.

  • Upgradeable Posture – Encourages conservative initial configs (caps, minimal strategies) and progressive enablement.

Extensibility & Upgrades

  • New adapters can be registered post-deployment via governance without redeploying the vault.

  • Multiple vault variants (e.g., different lockups/fees) can be launched using the same factory with consistent wiring and policies.

Example Use Cases

  • Launch a Standard Vault (shorter lock, standard rates) and a Boost Vault (longer lock, higher multipliers) for different user preferences.

  • Spin up an experiment vault with a low TVL cap and a single conservative adapter, then expand weights and strategies as audits complete.

Last updated