PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/r/gnoswap/halt/v1

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
v1
Namespace
gnoswap / halt
Files
11 (README)(gnomod.toml)
Exported functions
32
Module
gno.land/r/gnoswap/halt/v1
gno
0.9

Files (11)

  • README.mdmarkdown
  • gnomod.tomltoml
  • assert.gnogno
  • config.gnogno
  • doc.gnogno
  • errors.gnogno
  • getters.gnogno
  • halt_state.gnogno
  • halt.gnogno
  • render.gnogno
  • types.gnogno
  • types.gnogno
    1package halt23// Halt levels define different states of system operation restriction.4const (5	HaltLevelNone      HaltLevel = "NONE"      // All operations enabled.6	HaltLevelSafeMode  HaltLevel = "SAFE_MODE" // All operations enabled except withdrawals.7

    Functions

    • AssertIsNotHaltedCommunityPool()

    • AssertIsNotHaltedEmission()

    • AssertIsNotHaltedGovernance()

    • AssertIsNotHaltedGovStaker()

    • AssertIsNotHaltedLaunchpad()

    • AssertIsNotHaltedOperation(op string)

    • AssertIsNotHaltedPool()

    • AssertIsNotHaltedPosition()

    • AssertIsNotHaltedProtocolFee()

    • AssertIsNotHaltedRouter()

    • AssertIsNotHaltedStaker()

    • AssertIsNotHaltedWithdraw()

    • AssertIsNotHaltedXGns()

    • GetHaltConfig() map[gno.land/r/gnoswap/halt/v1.OpType]bool

    • GetHaltConfigJson() string

    • IsHalted(opTypes ...gno.land/r/gnoswap/halt/v1.OpType) (bool, interface {Error func() string})

    • IsHaltedCommunityPool() bool

    • IsHaltedEmission() bool

    • IsHaltedGovernance() bool

    • IsHaltedGovStaker() bool

    • IsHaltedLaunchpad() bool

    • IsHaltedPool() bool

    • IsHaltedPosition() bool

    • IsHaltedProtocolFee() bool

    • IsHaltedRouter() bool

    • IsHaltedStaker() bool

    • IsHaltedWithdraw() bool

    • IsHaltedXGns() bool

    • OpTypes() []gno.land/r/gnoswap/halt/v1.OpType

    • Render(path string) string

    • SetHaltLevel(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, level string)

    • SetOperationStatus(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, op string, halted bool)

    Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

    Rendered

    RenderedRawgnoweb ↗

    vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.

    HaltLevelEmergency HaltLevel = "EMERGENCY" // Only governance and withdrawal operations enabled.
    8 HaltLevelComplete HaltLevel = "COMPLETE" // All operations disabled.
    9)
    10
    11// Operation types representing individual contracts.
    12const (
    13 OpTypePool OpType = "pool"
    14 OpTypePosition OpType = "position"
    15 OpTypeProtocolFee OpType = "protocol_fee"
    16 OpTypeRouter OpType = "router"
    17 OpTypeStaker OpType = "staker"
    18 OpTypeLaunchpad OpType = "launchpad"
    19 OpTypeGovernance OpType = "governance"
    20 OpTypeGovStaker OpType = "gov_staker"
    21 OpTypeXGns OpType = "xgns"
    22 OpTypeCommunityPool OpType = "community_pool"
    23 OpTypeEmission OpType = "emission"
    24 OpTypeWithdraw OpType = "withdraw"
    25)
    26
    27// HaltLevel represents current system halt state.
    28type HaltLevel string
    29
    30// String returns the string representation of the halt level.
    31//
    32// Returns:
    33// - text: exact string value represented by the halt level
    34func (h HaltLevel) String() string {
    35 return string(h)
    36}
    37
    38// Description returns a human-readable description of the halt level.
    39//
    40// Returns:
    41// - description: human-readable policy description; "Unknown halt level" for
    42// an unrecognized value
    43func (h HaltLevel) Description() string {
    44 haltLevelDescriptions := map[HaltLevel]string{
    45 HaltLevelNone: "All operations enabled",
    46 HaltLevelSafeMode: "All operations enabled except withdrawals",
    47 HaltLevelEmergency: "Only governance and withdrawal operations enabled",
    48 HaltLevelComplete: "All operations disabled",
    49 }
    50
    51 desc, ok := haltLevelDescriptions[h]
    52 if !ok {
    53 return "Unknown halt level"
    54 }
    55
    56 return desc
    57}
    58
    59// IsValid returns true if the halt level is valid.
    60//
    61// Returns:
    62// - valid: true for one of the defined halt levels; false otherwise
    63func (h HaltLevel) IsValid() bool {
    64 switch h {
    65 case HaltLevelNone, HaltLevelSafeMode, HaltLevelEmergency, HaltLevelComplete:
    66 return true
    67 default:
    68 return false
    69 }
    70}
    71
    72// OpType represents operation types that can be controlled independently.
    73type OpType string
    74
    75var opTypes = map[OpType]bool{
    76 OpTypePool: true,
    77 OpTypePosition: true,
    78 OpTypeProtocolFee: true,
    79 OpTypeRouter: true,
    80 OpTypeStaker: true,
    81 OpTypeLaunchpad: true,
    82 OpTypeGovernance: true,
    83 OpTypeGovStaker: true,
    84 OpTypeXGns: true,
    85 OpTypeCommunityPool: true,
    86 OpTypeEmission: true,
    87 OpTypeWithdraw: true,
    88}
    89
    90// String returns the string representation of the operation type.
    91//
    92// Returns:
    93// - text: exact string value represented by the operation type
    94func (o OpType) String() string {
    95 return string(o)
    96}
    97
    98// IsValid returns true if the operation type is valid.
    99//
    100// Returns:
    101// - valid: true when the operation type is defined; false otherwise
    102func (o OpType) IsValid() bool {
    103 _, ok := opTypes[o]
    104
    105 return ok
    106}
    107
    108// OpTypes returns all operation types currently supported by the halt
    109// configuration.
    110//
    111// Returns:
    112// - operationTypes: slice containing each defined operation type in map iteration order
    113func OpTypes() []OpType {
    114 allOpTypes := make([]OpType, 0, len(opTypes))
    115
    116 for op := range opTypes {
    117 allOpTypes = append(allOpTypes, op)
    118 }
    119
    120 return allOpTypes
    121}
    122