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

halt source realm

Package halt holds the halt switches shared by the GnoSwap order realms (gno.land/r/gnoswap/order/...).

Overview

Package halt holds the halt switches shared by the GnoSwap order realms (gno.land/r/gnoswap/order/...).

Each target (an order type such as "dca" or "limit") has a switch per operation. Admin or governance turns a switch on for one target, or for every target with TargetAll, and can add targets for new order realms. Order realms check IsHalted with their own target, which reports the operation halted when either switch is on, and decide which entry points each operation guards.

Operations:

  • OperationExecute: creating or executing orders
  • OperationWithdraw: executing orders, paying out or refunding funds

The switches are independent of the GnoSwap protocol halt levels.

Constants 3

const TargetDCA, TargetLimit

1const (
2	TargetDCA   = "dca"
3	TargetLimit = "limit"
4)
source

Targets registered at deployment; more are added with AddTarget.

const TargetAll

1const TargetAll = "all"
source

TargetAll addresses every target at once.

Functions 6

func AddTarget

crossing Action
1func AddTarget(cur realm, target string)
source

AddTarget registers a target, e.g. for a new order realm. Admin or governance only.

A target is 1 to 32 characters of lowercase letters, digits, '_', or '-', and cannot be TargetAll.

func GetHaltedJSON

Action
1func GetHaltedJSON(target string) string
source

GetHaltedJSON returns, as JSON, whether each operation is halted for target, including the TargetAll switches.

func GetTargets

Action
1func GetTargets() []string
source

GetTargets returns the registered targets, in registration order.

func IsHalted

Action
1func IsHalted(target string, operation string) bool
source

IsHalted reports whether operation is halted for target, by its own switch or by the TargetAll switch. It panics on an unknown target or operation.

func SetHalted

crossing Action
1func SetHalted(cur realm, target string, operation string, isHalted bool)
source

SetHalted halts or resumes operation for target. Admin or governance only.

Parameters:

  • target: a registered target, or TargetAll for every target.
  • operation: OperationExecute or OperationWithdraw.

Dependencies

Source Files 5