Kind Realm (renderable)
Name v1
Namespace gnoswap / halt
Exported functions 32
Module gno.land/r/gnoswap/halt/v1
gno 0.9 getters.gno gno
⧉
1 package halt 2 3 import ( 4 "gno.land/p/onbloc/json/v0" 5 ) 6 7 // IsHalted returns true if any of the specified operation types are halted. 8 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.
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.
// Returns error if any operation type is invalid.
9 //
10 // Parameters:
11 // - opTypes: operation types to inspect; an empty list reports no halted operations
12 //
13 // Returns:
14 // - halted: true when any requested operation is halted; on invalid input it
15 // is also true alongside the error
16 // - error: nil when all requested operation types are valid and inspected;
17 // an invalid-operation or state error otherwise
18 func IsHalted(opTypes ...OpType) ( bool , error ) {
19 for _, op := range opTypes {
20 if !op.IsValid() {
21 return true , makeErrorWithDetails(errInvalidOpType, op.String())
22 }
23
24 halted, err := haltStates.IsOperationHalted(op)
25 if err != nil {
26 return true , err
27 }
28
29 if halted {
30 return true , nil
31 }
32 }
33
34 return false , nil
35 }
36
37 // GetHaltConfig returns a copy of the current halt configuration.
38 //
39 // Returns:
40 // - config: copy of the current halt status keyed by operation type
41 func GetHaltConfig() HaltConfig {
42 return haltStates.ToConfig()
43 }
44
45 // GetHaltConfigJson returns the halt configuration as a JSON string.
46 //
47 // Returns:
48 // - json: JSON object containing each operation type's halt status
49 func GetHaltConfigJson() string {
50 haltConfig := GetHaltConfig()
51
52 statusNodes := make( map [ string ]*json.Node)
53
54 for op, halted := range haltConfig {
55 statusNodes[op.String()] = json.BoolNode(op.String(), halted)
56 }
57
58 objectNode := json.ObjectNode( "status" , statusNodes)
59
60 return objectNode.String()
61 }
62
63 // IsHaltedPool returns true if pool operations are halted.
64 //
65 // Returns:
66 // - halted: true when pool operations are halted; false otherwise
67 func IsHaltedPool() bool {
68 return isHaltedOperation(OpTypePool)
69 }
70
71 // IsHaltedPosition returns true if position operations are halted.
72 //
73 // Returns:
74 // - halted: true when position operations are halted; false otherwise
75 func IsHaltedPosition() bool {
76 return isHaltedOperation(OpTypePosition)
77 }
78
79 // IsHaltedProtocolFee returns true if protocol fee operations are halted.
80 //
81 // Returns:
82 // - halted: true when protocol-fee operations are halted; false otherwise
83 func IsHaltedProtocolFee() bool {
84 return isHaltedOperation(OpTypeProtocolFee)
85 }
86
87 // IsHaltedRouter returns true if router operations are halted.
88 //
89 // Returns:
90 // - halted: true when router operations are halted; false otherwise
91 func IsHaltedRouter() bool {
92 return isHaltedOperation(OpTypeRouter)
93 }
94
95 // IsHaltedStaker returns true if staker operations are halted.
96 //
97 // Returns:
98 // - halted: true when staker operations are halted; false otherwise
99 func IsHaltedStaker() bool {
100 return isHaltedOperation(OpTypeStaker)
101 }
102
103 // IsHaltedLaunchpad returns true if launchpad operations are halted.
104 //
105 // Returns:
106 // - halted: true when launchpad operations are halted; false otherwise
107 func IsHaltedLaunchpad() bool {
108 return isHaltedOperation(OpTypeLaunchpad)
109 }
110
111 // IsHaltedGovernance returns true if governance operations are halted.
112 //
113 // Returns:
114 // - halted: true when governance operations are halted; false otherwise
115 func IsHaltedGovernance() bool {
116 return isHaltedOperation(OpTypeGovernance)
117 }
118
119 // IsHaltedGovStaker returns true if governance staker operations are halted.
120 //
121 // Returns:
122 // - halted: true when governance-staker operations are halted; false otherwise
123 func IsHaltedGovStaker() bool {
124 return isHaltedOperation(OpTypeGovStaker)
125 }
126
127 // IsHaltedXGns returns true if xGNS operations are halted.
128 //
129 // Returns:
130 // - halted: true when xGNS operations are halted; false otherwise
131 func IsHaltedXGns() bool {
132 return isHaltedOperation(OpTypeXGns)
133 }
134
135 // IsHaltedCommunityPool returns true if community pool operations are halted.
136 //
137 // Returns:
138 // - halted: true when community-pool operations are halted; false otherwise
139 func IsHaltedCommunityPool() bool {
140 return isHaltedOperation(OpTypeCommunityPool)
141 }
142
143 // IsHaltedEmission returns true if emission operations are halted.
144 //
145 // Returns:
146 // - halted: true when emission operations are halted; false otherwise
147 func IsHaltedEmission() bool {
148 return isHaltedOperation(OpTypeEmission)
149 }
150
151 // IsHaltedWithdraw returns true if withdraw operations are halted.
152 //
153 // Returns:
154 // - halted: true when withdrawal operations are halted; false otherwise
155 func IsHaltedWithdraw() bool {
156 return isHaltedOperation(OpTypeWithdraw)
157 }
158
159 // isHaltedOperation returns halt status for the specified operation type.
160 // Panics if operation type is invalid.
161 func isHaltedOperation(op OpType) bool {
162 if !op.IsValid() {
163 panic(makeErrorWithDetails(errInvalidOpType, op.String()))
164 }
165
166 halted, err := haltStates.IsOperationHalted(op)
167 if err != nil {
168 panic(err)
169 }
170
171 return halted
172 }
173