-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.go
81 lines (65 loc) · 1.98 KB
/
constants.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
package lib
import (
"math"
"math/big"
sdkmath "cosmossdk.io/math"
)
const (
OneMillion = uint32(1_000_000)
TenThousand = uint32(10_000)
OneHundred = uint32(100)
MaxPriceChangePpm = uint32(10_000)
// 10^6 quantums == 1 USD.
QuoteCurrencyAtomicResolution = int32(-6)
ZeroUint64 = uint64(0)
// 10^BaseDenomExponent denotes how much full coin is represented by 1 base denom.
BaseDenomExponent = -18
DefaultBaseDenom = "adv4tnt"
)
// PowerReduction defines the default power reduction value for staking.
// Use 1e18, since default stake denom is assumed to be 1e-18 of a full coin.
var PowerReduction = sdkmath.NewIntFromBigInt(
new(big.Int).SetUint64(1_000_000_000_000_000_000),
)
// BigInt0 returns a `big.Int` that is set to 0.
func BigInt0() *big.Int {
return big.NewInt(0)
}
// BigNegMaxUint64 returns a `big.Int` that is set to -math.MaxUint64.
func BigNegMaxUint64() *big.Int {
return new(big.Int).Neg(
new(big.Int).SetUint64(math.MaxUint64),
)
}
// BigMaxInt32 returns a `big.Int` that represents `MaxInt32`.
func BigMaxInt32() *big.Int {
return big.NewInt(math.MaxInt32)
}
// BigFloat0 returns a `big.Float` that is set to 0.
func BigFloat0() *big.Float {
return big.NewFloat(0)
}
// BigFloatMaxUint64 returns a `big.Float` that is set to MaxUint64.
func BigFloatMaxUint64() *big.Float {
return new(big.Float).SetUint64(math.MaxUint64)
}
// BigIntOneMillion returns a `big.Int` that is set to 1_000_000.
func BigIntOneMillion() *big.Int {
return big.NewInt(1_000_000)
}
// BigIntOneTrillion returns a `big.Int` that is set to 1_000_000_000_000.
func BigIntOneTrillion() *big.Int {
return big.NewInt(1_000_000_000_000)
}
// BigRatOneMillion returns a `big.Rat` that is set to 1_000_000.
func BigRatOneMillion() *big.Rat {
return big.NewRat(1_000_000, 1)
}
// BigRat0 returns a `big.Rat` that is set to 0.
func BigRat0() *big.Rat {
return big.NewRat(0, 1)
}
// BigRat1 returns a `big.Rat` that is set to 1.
func BigRat1() *big.Rat {
return big.NewRat(1, 1)
}