Skip to content

Emergency Operations

Overview

King's Vault provides two emergency mechanisms to protect user funds:

  1. Pause — instantly halts all deposits and withdrawals.
  2. Winding Up — full liquidation and orderly shutdown of the vault.

Access Control

Only VaultOwner may invoke pause(), unpause(), closeDown(), and windingUp().


1. Pause / Unpause

Behavior

State Deposit Mint Withdraw Redeem requestRedeem settle
Normal Allowed Allowed Allowed Allowed Allowed Allowed
Paused Blocked Blocked Blocked Blocked Blocked Blocked

Functions

Function Role Description
pause() VaultOwner Sets the contract to paused state. All user-facing operations revert.
unpause() VaultOwner Restores normal operation.

When to Pause

  • Suspected exploit or vulnerability discovered.
  • Underlying protocol (Aave, Morpho, HLP) experiences an incident.
  • CCIP bridge congestion or outage preventing fund movement.
  • Abnormal NAV deviation detected during settlement.

2. Winding Up (Liquidation)

Winding Up is the irreversible process of shutting down the vault, liquidating all positions, and allowing users to exit.

Flow

sequenceDiagram
    actor Owner as VaultOwner
    participant Vault as KingsVault
    participant Port as KPortfolio
    participant Pools as EarnPools
    actor Users as Investors

    Owner->>Vault: closeDown()
    Note over Vault: isShutdown = true<br/>New deposits blocked

    Owner->>Port: withdrawPool(pool_i, all)
    Port->>Pools: withdraw all from each pool
    Pools-->>Port: USDC returned
    Port-->>Vault: All idle USDC consolidated

    Owner->>Vault: windingUp()
    Note over Vault: Final settlement at pro-rata price

    Users->>Vault: emergencyRedeem()
    Note over Vault: Burns all user shares<br/>Returns pro-rata USDC
    Vault-->>Users: USDC distributed

Step-by-Step

Step Actor Action Detail
1 VaultOwner Initiate shutdown. closeDown() — sets isShutdown = true, blocks new deposits.
2 VaultOwner Liquidate positions. Call withdrawPool() for each enabled EarnPool to return all USDC to KPortfolio → KingsVault.
3 VaultOwner Execute winding up. windingUp() — performs final settlement, sets pro-rata redemption price.
4 Users Emergency redeem. emergencyRedeem() — burns all shares and receives proportional USDC. Only available when isShutdown == true.

Errors

Error Trigger
VaultNotShutdown() emergencyRedeem() called when vault is not in shutdown mode.
NoSharesToRedeem() User has zero share balance.

Security Considerations

  1. Centralization Risk: Only VaultOwner can trigger emergency operations. A compromised or unavailable owner wallet could delay critical responses. Multi-sig is strongly recommended.
  2. Irreversibility: windingUp() is a one-way operation. Once initiated, the vault cannot resume normal operations.
  3. Cross-Chain Funds: During winding up, funds deployed on HyperEVM/HyperCore must be manually retrieved via CCIP before they can be distributed to users. This introduces delay.
  4. In-Flight CCIP: Any USDC in transit via CCIP at the time of shutdown must be accounted for to prevent loss.