1package halt23import (4 "chain"5 "strconv"67 "gno.land/r/gnoswap/access/v1"8)910var haltStates HaltStateManager1112func init() {13 haltStates = newHaltStateManagerByConfig(newNoneConfig())14}1516// SetHaltLevel sets the global halt level.17//18// Parameters:19// - cur: Current realm context; callers use cross(cur) when crossing into this realm.20// - level: halt level to apply (None, SafeMode, Emergency, or Complete).21//22// Only callable by admin or governance.23func SetHaltLevel(cur realm, level HaltLevel) {24 caller := cur.Previous().Address()25 access.AssertIsAdminOrGovernance(caller)2627 err := setHaltLevel(level)28 if err != nil {29 panic(err)30 }3132 chain.Emit(33 "SetHaltLevel",34 "level", level.String(),35 "description", level.Description(),36 "caller", caller.String(),37 )38}3940// SetOperationStatus sets the halt status for a specific operation.41//42// Parameters:43// - cur: Current realm context; callers use cross(cur) when crossing into this realm.44// - op: operation type whose halt status is changed.45// - halted: true to block the operation, false to allow it.46//47// Only callable by admin or governance.48func SetOperationStatus(cur realm, op OpType, halted bool) {49 caller := cur.Previous().Address()50 access.AssertIsAdminOrGovernance(caller)5152 if !op.IsValid() {53 panic(makeErrorWithDetails(errInvalidOpType, op.String()))54 }5556 err := haltStates.setOperationHalted(op, halted)57 if err != nil {58 panic(err)59 }6061 chain.Emit(62 "SetOperationStatus",63 "operation", string(op),64 "halted", strconv.FormatBool(halted),65 "caller", caller.String(),66 )67}6869// setHaltLevel applies predefined halt level configuration.70func setHaltLevel(level HaltLevel) error {71 var config HaltConfig7273 switch level {74 case HaltLevelNone:75 config = newNoneConfig()76 case HaltLevelSafeMode:77 config = newSafeModeConfig()78 case HaltLevelEmergency:79 config = newEmergencyConfig()80 case HaltLevelComplete:81 config = newCompleteConfig()82 default:83 return makeErrorWithDetails(errInvalidHaltLevel, level.String())84 }8586 return haltStates.updateOperationHaltsByConfig(config)87}88AssertIsNotHaltedCommunityPool()
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.
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.