/
errors.go
108 lines (84 loc) · 3.97 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package types
import (
fmt "fmt"
"time"
errorsmod "cosmossdk.io/errors"
cltypes "github.com/osmosis-labs/osmosis/v16/x/concentrated-liquidity/types"
)
// x/superfluid module errors.
var (
ErrMultipleCoinsLockupNotSupported = errorsmod.Register(ModuleName, 1, "multiple coins lockup is not supported")
ErrUnbondingLockupNotSupported = errorsmod.Register(ModuleName, 2, "unbonding lockup is not allowed to participate in superfluid staking")
ErrNotEnoughLockupDuration = errorsmod.Register(ModuleName, 3, "lockup does not have enough lock duration")
ErrOsmoEquivalentZeroNotAllowed = errorsmod.Register(ModuleName, 4, "not able to do superfluid staking for zero osmo equivalent")
ErrNotSuperfluidUsedLockup = errorsmod.Register(ModuleName, 5, "lockup is not used for superfluid staking")
ErrSameValidatorRedelegation = errorsmod.Register(ModuleName, 6, "redelegation to the same validator is not allowed")
ErrAlreadyUsedSuperfluidLockup = errorsmod.Register(ModuleName, 7, "lockup is already being used for superfluid staking")
ErrUnbondingSyntheticLockupExists = errorsmod.Register(ModuleName, 8, "unbonding synthetic lockup exists on the validator")
ErrBondingLockupNotSupported = errorsmod.Register(ModuleName, 9, "bonded superfluid stake is not allowed to have underlying lock unlocked")
ErrNonSuperfluidAsset = errorsmod.Register(ModuleName, 10, "provided asset is not supported for superfluid staking")
ErrPoolNotWhitelisted = errorsmod.Register(ModuleName, 41, "pool not whitelisted to unpool")
ErrLockUnpoolNotAllowed = errorsmod.Register(ModuleName, 42, "lock not eligible for unpooling")
ErrLockLengthMismatch = errorsmod.Register(ModuleName, 43, "lock has more than one asset")
)
type PositionNotSuperfluidStakedError struct {
PositionId uint64
}
func (e PositionNotSuperfluidStakedError) Error() string {
return fmt.Sprintf("Cannot add to position ID %d as it is not superfluid staked.", e.PositionId)
}
type LockImproperStateError struct {
LockId uint64
UnbondingDuration string
}
func (e LockImproperStateError) Error() string {
return fmt.Sprintf("lock ID %d must be bonded for %s and not unbonding.", e.LockId, e.UnbondingDuration)
}
type LockOwnerMismatchError struct {
LockId uint64
LockOwner string
ProvidedOwner string
}
func (e LockOwnerMismatchError) Error() string {
return fmt.Sprintf("lock ID %d owner %s does not match provided owner %s.", e.LockId, e.LockOwner, e.ProvidedOwner)
}
type SharesToMigrateDenomPrefixError struct {
Denom string
ExpectedDenomPrefix string
}
func (e SharesToMigrateDenomPrefixError) Error() string {
return fmt.Sprintf("shares to migrate denom %s does not have expected prefix %s.", e.Denom, e.ExpectedDenomPrefix)
}
type MigrateMoreSharesThanLockHasError struct {
SharesToMigrate string
SharesInLock string
}
func (e MigrateMoreSharesThanLockHasError) Error() string {
return fmt.Sprintf("cannot migrate more shares (%s) than lock has (%s)", e.SharesToMigrate, e.SharesInLock)
}
type TwoTokenBalancerPoolError struct {
NumberOfTokens int
}
func (e TwoTokenBalancerPoolError) Error() string {
return fmt.Sprintf("balancer pool must have two tokens, got %d tokens", e.NumberOfTokens)
}
type ConcentratedTickRangeNotFullError struct {
ActualLowerTick int64
ActualUpperTick int64
}
func (e ConcentratedTickRangeNotFullError) Error() string {
return fmt.Sprintf("position must be full range. Lower tick (%d) must be (%d). Upper tick (%d) must be (%d)", e.ActualLowerTick, e.ActualUpperTick, cltypes.MinInitializedTick, cltypes.MaxTick)
}
type NegativeDurationError struct {
Duration time.Duration
}
func (e NegativeDurationError) Error() string {
return fmt.Sprintf("duration cannot be negative (%s)", e.Duration)
}
type UnexpectedDenomError struct {
ExpectedDenom string
ProvidedDenom string
}
func (e UnexpectedDenomError) Error() string {
return fmt.Sprintf("provided denom (%s) was expected to be formatted as follows: %s", e.ProvidedDenom, e.ExpectedDenom)
}