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

halt source realm

Package halt provides functionality for managing protocol halt levels and operations.

Overview

Package halt provides functionality for managing protocol halt levels and operations.

Constants 2

const HaltLevelNone, HaltLevelSafeMode, HaltLevelEmergency, HaltLevelComplete

1const (
2	HaltLevelNone      HaltLevel = "NONE"      // All operations enabled.
3	HaltLevelSafeMode  HaltLevel = "SAFE_MODE" // All operations enabled except withdrawals.
4	HaltLevelEmergency HaltLevel = "EMERGENCY" // Only governance and withdrawal operations enabled.
5	HaltLevelComplete  HaltLevel = "COMPLETE"  // All operations disabled.
6)
source

Halt levels define different states of system operation restriction.

const OpTypePool, OpTypePosition, OpTypeProtocolFee, OpTypeRouter, OpTypeStaker, OpTypeLaunchpad, OpTypeGovernance, OpTypeGovStaker, OpTypeXGns, OpTypeCommunityPool, OpTypeEmission, OpTypeWithdraw

 1const (
 2	OpTypePool          OpType = "pool"
 3	OpTypePosition      OpType = "position"
 4	OpTypeProtocolFee   OpType = "protocol_fee"
 5	OpTypeRouter        OpType = "router"
 6	OpTypeStaker        OpType = "staker"
 7	OpTypeLaunchpad     OpType = "launchpad"
 8	OpTypeGovernance    OpType = "governance"
 9	OpTypeGovStaker     OpType = "gov_staker"
10	OpTypeXGns          OpType = "xgns"
11	OpTypeCommunityPool OpType = "community_pool"
12	OpTypeEmission      OpType = "emission"
13	OpTypeWithdraw      OpType = "withdraw"
14)
source

Operation types representing individual contracts.

Functions 31

func AssertIsNotHaltedOperation

Action
1func AssertIsNotHaltedOperation(op OpType)
source

AssertIsNotHaltedOperation panics if the specified operation type is halted. Panics with error details including operation type name.

func IsHalted

Action
1func IsHalted(opTypes ...OpType) (bool, error)
source

IsHalted returns true if any of the specified operation types are halted. Returns error if any operation type is invalid.

func SetHaltLevel

crossing Action
1func SetHaltLevel(cur realm, level HaltLevel)
source

SetHaltLevel sets the global halt level.

Parameters:

  • level: halt level to apply (None, SafeMode, Emergency, Complete)

Only callable by admin or governance.

func SetOperationStatus

crossing Action
1func SetOperationStatus(cur realm, op OpType, halted bool)
source

SetOperationStatus sets halt status for a specific operation.

Parameters:

  • op: operation type
  • halted: true to halt, false to resume

Only callable by admin or governance.

Types 4

type HaltConfig

map
1type HaltConfig map[OpType]bool
source

HaltConfig stores halt state for each operation type.

Methods on HaltConfig

func Clone

method on HaltConfig
1func (c HaltConfig) Clone() HaltConfig
source

Clone creates a deep copy of the halt configuration and returns it.

func IsHalted

method on HaltConfig
1func (c HaltConfig) IsHalted(op OpType) bool
source

IsHalted returns true if the specified operation is halted, false otherwise. Returns false if operation type is not found in configuration.

type HaltLevel

ident
1type HaltLevel string
source

HaltLevel represents current system halt state.

Methods on HaltLevel

func Description

method on HaltLevel
1func (h HaltLevel) Description() string
source

Description returns a human-readable description of the halt level.

func IsValid

method on HaltLevel
1func (h HaltLevel) IsValid() bool
source

IsValid returns true if the halt level is valid.

func String

method on HaltLevel
1func (h HaltLevel) String() string
source

String returns the string representation of the halt level.

type HaltStateManager

map
1type HaltStateManager map[OpType]bool
source

Methods on HaltStateManager

func IsOperationHalted

method on HaltStateManager
1func (h HaltStateManager) IsOperationHalted(op OpType) (bool, error)
source

func ToConfig

method on HaltStateManager
1func (h HaltStateManager) ToConfig() HaltConfig
source

ToConfig converts the `HaltStateManager` to a HaltConfig.

type OpType

ident
1type OpType string
source

OpType represents operation types that can be controlled independently.

Methods on OpType

func IsValid

method on OpType
1func (o OpType) IsValid() bool
source

IsValid returns true if the operation type is valid.

func String

method on OpType
1func (o OpType) String() string
source

String returns the string representation of the operation type.

Imports 5

Source Files 9