-
Notifications
You must be signed in to change notification settings - Fork 578
/
errors.go
59 lines (46 loc) · 1.96 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
package types
import (
"fmt"
"time"
poolmanagertypes "github.com/osmosis-labs/osmosis/v20/x/poolmanager/types"
errorsmod "cosmossdk.io/errors"
)
// The following regiisters various pool-incentives errors.
var (
ErrNoGaugeIdExist = errorsmod.Register(ModuleName, 1, "no gauge id exist")
ErrDistrRecordNotPositiveWeight = errorsmod.Register(ModuleName, 2, "weight in record should be positive")
ErrDistrRecordNotRegisteredGauge = errorsmod.Register(ModuleName, 3, "gauge was not registered")
ErrDistrRecordRegisteredGauge = errorsmod.Register(ModuleName, 4, "gauge was already registered")
ErrDistrRecordNotSorted = errorsmod.Register(ModuleName, 5, "gauges are not sorted")
ErrEmptyProposalRecords = errorsmod.Register(ModuleName, 10, "records are empty")
ErrEmptyProposalGaugeIds = errorsmod.Register(ModuleName, 11, "gauge ids are empty")
)
type NoGaugeAssociatedWithPoolError struct {
PoolId uint64
Duration time.Duration
}
func (e NoGaugeAssociatedWithPoolError) Error() string {
return fmt.Sprintf("no gauge associated with pool id (%d) and duration (%d)", e.PoolId, e.Duration)
}
type NoPoolAssociatedWithGaugeError struct {
GaugeId uint64
Duration time.Duration
}
func (e NoPoolAssociatedWithGaugeError) Error() string {
return fmt.Sprintf("no pool associated with gauge id (%d) and duration (%d)", e.GaugeId, e.Duration)
}
type UnsupportedPoolTypeError struct {
PoolID uint64
PoolType poolmanagertypes.PoolType
}
func (e UnsupportedPoolTypeError) Error() string {
return fmt.Sprintf("unsupported pool type for incentives (%d), pool id (%d)", e.PoolType, e.PoolID)
}
type IncentiveRecordContainsNonLockableDurationError struct {
GaugeId uint64
Duration time.Duration
LockableDurations []time.Duration
}
func (e IncentiveRecordContainsNonLockableDurationError) Error() string {
return fmt.Sprintf("gauge %d has duration %s which is not one of the lockable durations %s", e.GaugeId, e.Duration, e.LockableDurations)
}