/
keys.go
134 lines (99 loc) · 5.1 KB
/
keys.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package types
import (
"strconv"
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
)
const (
// ModuleName defines the module name
ModuleName = "lscosmos"
// StoreKey defines the primary module store key
StoreKey = ModuleName
// RouterKey is the message route for slashing
RouterKey = ModuleName
// QuerierRoute defines the module's query routing key
QuerierRoute = ModuleName
// MemStoreKey defines the in-memory store key
MemStoreKey = "mem_lscosmos"
// MsgTypeLiquidStake is the type of message to liquid stake
MsgTypeLiquidStake = "msg_liquid_stake"
// MsgTypeLiquidUnstake is the type of message liquid unstake
MsgTypeLiquidUnstake = "msg_liquid_unstake"
// MsgTypeRedeem is the type of message redeem
MsgTypeRedeem = "msg_redeem"
// MsgTypeClaim is the type of message claim
MsgTypeClaim = "msg_claim"
// MsgTypeRecreateICA is the type of message RecreateICA
MsgTypeRecreateICA = "msg_recreate_ica"
// MsgTypeJumpStart is the type of message Jump start
MsgTypeJumpStart = "msg_jump_start"
// MsgTypeChangeModuleState is the type of message Change Module State
MsgTypeChangeModuleState = "msg_change_module_state"
// MsgTypeReportSlashing is the type of message Report Slashing
MsgTypeReportSlashing = "msg_report_slashing"
// DepositModuleAccount DepositModuleAccountName
DepositModuleAccount = ModuleName + "_gstake_deposit_account"
// DelegationModuleAccount DelegationModuleAccountName
DelegationModuleAccount = ModuleName + "_gstake_delegation_account"
// RewardModuleAccount RewardModuleAccountName
RewardModuleAccount = ModuleName + "_gstake_reward_account"
// UndelegationModuleAccount UndelegationModuleAccountName,
// This account will not be a part of maccPerms - Deny list, since it receives undelegated tokens.
UndelegationModuleAccount = ModuleName + "_gstake_undelegation_account"
// RewardBoosterModuleAccount RewardBoosterModuleAccountName //legacy, required to be blocklisted
RewardBoosterModuleAccount = ModuleName + "_reward_booster_account"
// DelegationEpochIdentifier is the identifier for delegation epoch
DelegationEpochIdentifier = "day"
// RewardEpochIdentifier is the identifier for rewards epoch
RewardEpochIdentifier = "day"
// UndelegationEpochIdentifier is the identifier for undelegation epoch
UndelegationEpochIdentifier = "day"
// UndelegationEpochNumberFactor is the undelegation epoch number factor
UndelegationEpochNumberFactor int64 = 4
// UndelegationCompletionTimeBuffer is the undeleagation completion time buffer
UndelegationCompletionTimeBuffer = time.Second * 60 //Does tendermint still have time drifts?
// IBCTimeoutHeightIncrement is the IBC timeout height incerement
IBCTimeoutHeightIncrement uint64 = 1000
// ICATimeoutTimestamp is the ICA timeout time stamp
ICATimeoutTimestamp = 15 * time.Minute
// CosmosValOperPrefix is the prefix for cosmos validator address
CosmosValOperPrefix = "cosmosvaloper"
LiquidStakedDenomPrefix = "stk"
)
// fee limits
var (
MaxPstakeDepositFee = sdk.MustNewDecFromStr("0.5")
MaxPstakeRestakeFee = sdk.MustNewDecFromStr("0.2")
MaxPstakeUnstakeFee = sdk.MustNewDecFromStr("0.5")
MaxPstakeRedemptionFee = sdk.MustNewDecFromStr("0.2")
MaxCValue = sdk.MustNewDecFromStr("1.1")
RestakeCapPerDay = sdk.MustNewDecFromStr("0.00069") //0.25185 or ~25% APY
)
var (
// PortKey defines the key to store the port ID in store
ModuleEnableKey = []byte{0x01} // key for module state
HostChainParamsKey = []byte{0x02} // key for host chain params
AllowListedValidatorsKey = []byte{0x03} // key for allow listed validators
DelegationStateKey = []byte{0x04} // key for delegation state
HostChainRewardAddressKey = []byte{0x05} // key for host chain address
IBCTransientStoreKey = []byte{0x06} // key for IBC transient store
UnbondingEpochCValueKey = []byte{0x07} // prefix for unbodning epoch c value store
DelegatorUnbondingEpochEntryKey = []byte{0x08} // prefix for delegator unbonding epoch entry
HostAccountsKey = []byte{0x09} // key for host accounts
)
// GetUnbondingEpochCValueKey returns a slice of byte made of UnbondingEpochCValueKey and epoch number
// converted to bytes
func GetUnbondingEpochCValueKey(epochNumber int64) []byte {
return append(UnbondingEpochCValueKey, []byte(strconv.FormatInt(epochNumber, 10))...)
}
// GetDelegatorUnbondingEpochEntryKey returns a slice of byte made of DelegatorUnbondingEpochEntryKey,
// delegator address as bytes and epoch number converted to bytes
func GetDelegatorUnbondingEpochEntryKey(delegatorAddress sdk.AccAddress, epochNumber int64) []byte {
return append(append(DelegatorUnbondingEpochEntryKey, address.MustLengthPrefix(delegatorAddress)...), []byte(strconv.FormatInt(epochNumber, 10))...)
}
// GetPartialDelegatorUnbondingEpochEntryKey returns a slice of byte made of DelegatorUnbondingEpochEntryKey
// and delegator address as bytes
func GetPartialDelegatorUnbondingEpochEntryKey(delegatorAddress sdk.AccAddress) []byte {
return append(DelegatorUnbondingEpochEntryKey, address.MustLengthPrefix(delegatorAddress)...)
}