-
Notifications
You must be signed in to change notification settings - Fork 49
/
types.go
65 lines (54 loc) · 1.99 KB
/
types.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
package types
import (
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
)
var (
// GovernanceAddress used to receive fee of storage system, and pay for the potential debt from late forced settlement
GovernanceAddress = sdk.AccAddress(address.Module(ModuleName, []byte("governance"))[:sdk.EthAddressLength])
ValidatorTaxPoolAddress = sdk.AccAddress(address.Module(ModuleName, []byte("validator-tax-pool"))[:sdk.EthAddressLength])
)
const (
ForceUpdateStreamRecordKey = "force_update_stream_record"
)
const (
// GovernanceAddressLackBalanceLabel is the metrics label to notify that the governance account has no enough balance
GovernanceAddressLackBalanceLabel = "governance_address_lack_balance"
)
type StreamRecordChange struct {
Addr sdk.AccAddress
RateChange sdkmath.Int
StaticBalanceChange sdkmath.Int
LockBalanceChange sdkmath.Int
FrozenRateChange sdkmath.Int
}
func NewDefaultStreamRecordChangeWithAddr(addr sdk.AccAddress) *StreamRecordChange {
return &StreamRecordChange{
Addr: addr,
RateChange: sdkmath.ZeroInt(),
StaticBalanceChange: sdkmath.ZeroInt(),
LockBalanceChange: sdkmath.ZeroInt(),
FrozenRateChange: sdkmath.ZeroInt(),
}
}
func (change *StreamRecordChange) WithRateChange(rateChange sdkmath.Int) *StreamRecordChange {
change.RateChange = rateChange
return change
}
func (change *StreamRecordChange) WithStaticBalanceChange(staticBalanceChange sdkmath.Int) *StreamRecordChange {
change.StaticBalanceChange = staticBalanceChange
return change
}
func (change *StreamRecordChange) WithLockBalanceChange(lockBalanceChange sdkmath.Int) *StreamRecordChange {
change.LockBalanceChange = lockBalanceChange
return change
}
func (change *StreamRecordChange) WithFrozenRateChange(frozenRateChange sdkmath.Int) *StreamRecordChange {
change.FrozenRateChange = frozenRateChange
return change
}
type UserFlows struct {
From sdk.AccAddress
Flows []OutFlow
}