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

assert.gno

2.26 Kb · 73 lines
 1package halt
 2
 3// AssertIsNotHaltedPool panics if pool operations are halted.
 4func AssertIsNotHaltedPool() {
 5	AssertIsNotHaltedOperation(OpTypePool)
 6}
 7
 8// AssertIsNotHaltedPosition panics if position operations are halted.
 9func AssertIsNotHaltedPosition() {
10	AssertIsNotHaltedOperation(OpTypePosition)
11}
12
13// AssertIsNotHaltedProtocolFee panics if protocol fee operations are halted.
14func AssertIsNotHaltedProtocolFee() {
15	AssertIsNotHaltedOperation(OpTypeProtocolFee)
16}
17
18// AssertIsNotHaltedRouter panics if router operations are halted.
19func AssertIsNotHaltedRouter() {
20	AssertIsNotHaltedOperation(OpTypeRouter)
21}
22
23// AssertIsNotHaltedStaker panics if staker operations are halted.
24func AssertIsNotHaltedStaker() {
25	AssertIsNotHaltedOperation(OpTypeStaker)
26}
27
28// AssertIsNotHaltedLaunchpad panics if launchpad operations are halted.
29func AssertIsNotHaltedLaunchpad() {
30	AssertIsNotHaltedOperation(OpTypeLaunchpad)
31}
32
33// AssertIsNotHaltedGovernance panics if governance operations are halted.
34func AssertIsNotHaltedGovernance() {
35	AssertIsNotHaltedOperation(OpTypeGovernance)
36}
37
38// AssertIsNotHaltedGovStaker panics if governance staker operations are halted.
39func AssertIsNotHaltedGovStaker() {
40	AssertIsNotHaltedOperation(OpTypeGovStaker)
41}
42
43// AssertIsNotHaltedXGns panics if xGNS operations are halted.
44func AssertIsNotHaltedXGns() {
45	AssertIsNotHaltedOperation(OpTypeXGns)
46}
47
48// AssertIsNotHaltedCommunityPool panics if community pool operations are halted.
49func AssertIsNotHaltedCommunityPool() {
50	AssertIsNotHaltedOperation(OpTypeCommunityPool)
51}
52
53// AssertIsNotHaltedEmission panics if emission operations are halted.
54func AssertIsNotHaltedEmission() {
55	AssertIsNotHaltedOperation(OpTypeEmission)
56}
57
58// AssertIsNotHaltedWithdraw panics if withdraw operations are halted.
59func AssertIsNotHaltedWithdraw() {
60	AssertIsNotHaltedOperation(OpTypeWithdraw)
61}
62
63// AssertIsNotHaltedOperation panics if the specified operation type is halted.
64// Panics with error details including operation type name.
65//
66// Parameters:
67//   - op: valid operation type whose halt status must permit execution; invalid
68//     operation types panic with an invalid-operation error.
69func AssertIsNotHaltedOperation(op OpType) {
70	if halted := isHaltedOperation(op); halted {
71		panic(makeErrorWithDetails(errHalted, op.String()))
72	}
73}