/r/gnoswap/halt
Directory ยท 10 Files
Halt
Emergency pause mechanism for protocol safety.
Overview
Halt system provides granular control over protocol operations for emergency response and beta safety mode.
Configuration
Halt Levels
- NONE: All operations enabled (normal operation)
- SAFE_MODE: All operations enabled except withdrawals (beta mainnet default)
- 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 (beta mainnet)
2SetHaltLevel(HaltLevelSafeMode)
3
4// Enable emergency mode
5SetHaltLevel(HaltLevelEmergency)
6
7// Halt specific operation
8SetOperationStatus(OpTypeRouter, true)
9
10// Resume specific operation
11SetOperationStatus(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 (Beta Mainnet)
- All operations enabled except withdrawals
- Used during initial mainnet launch
- 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
Security
- Admin/governance control only
- Beta mainnet starts in SAFE_MODE
- Granular operation control
- Event emission for transparency
- Emergency response capability