Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

README.md

2.73 Kb · 97 lines

Halt

Emergency pause mechanism for protocol safety.

Overview

Halt system provides granular control over protocol operations for emergency response and beta safety mode. The initial halt level is NONE; an authorized caller must explicitly select another level.

Configuration

Halt Levels

  • NONE: All operations enabled (normal operation)
  • SAFE_MODE: All operations enabled except withdrawals (must be explicitly configured)
  • EMERGENCY: Only governance and withdrawal operations enabled (crisis response)
  • COMPLETE: All operations disabled (full system halt)

Controllable Operations (OpTypes)

  • pool: Pool creation and liquidity operations
  • position: Position NFT minting and management
  • protocol_fee: Fee collection and distribution
  • router: Swap routing and execution
  • staker: Liquidity staking and rewards
  • launchpad: Token distribution projects
  • governance: Proposal creation and voting
  • gov_staker: GNS staking for xGNS
  • xgns: xGNS token operations
  • community_pool: Treasury management
  • emission: GNS emission and distribution
  • withdraw: Withdrawal operations (LP, rewards, etc.)

Key Functions

SetHaltLevel

Sets system-wide halt level.

SetOperationStatus

Controls individual operation types.

IsHalted

Checks if operation is halted.

Usage

 1// Set system to safe mode explicitly when needed
 2SetHaltLevel(cross(cur), HaltLevelSafeMode)
 3
 4// Enable emergency mode
 5SetHaltLevel(cross(cur), HaltLevelEmergency)
 6
 7// Halt specific operation
 8SetOperationStatus(cross(cur), OpTypeRouter, true)
 9
10// Resume specific operation
11SetOperationStatus(cross(cur), OpTypeRouter, false)
12
13// Check before operation
14halted, err := IsHalted(OpTypeWithdraw)
15if err != nil {
16    panic(err)
17}
18if halted {
19    panic("withdrawals halted")
20}

Halt Level Behaviors

NONE (Normal Operation)

  • All contracts fully operational
  • No restrictions applied

SAFE_MODE (Explicitly Configured)

  • All operations enabled except withdrawals
  • Used when explicitly selected during initial mainnet launch or another controlled window
  • Allows trading but prevents fund extraction

EMERGENCY (Crisis Response)

  • Only governance and withdrawals enabled
  • Allows users to exit positions
  • Governance can still execute proposals

COMPLETE (Full Halt)

  • All operations disabled
  • Complete system freeze
  • Recovery requires admin/governance action
  • Governance can still propose, vote on, and execute proposals that only target the halt realm, so it can recover on its own

Security

  • Admin/governance control only
  • The system initializes at NONE; SAFE_MODE is not enabled by default
  • Granular operation control
  • Event emission for transparency
  • Emergency response capability