-
Notifications
You must be signed in to change notification settings - Fork 12
/
key.go
66 lines (52 loc) · 1.87 KB
/
key.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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common"
)
const (
// ModuleName is the name of the module
ModuleName = "migrate"
// StoreKey to be used when creating the KVStore
StoreKey = ModuleName
// RouterKey is the module name router key
RouterKey = ModuleName
)
const (
prefixMigratedRecord = iota + 1
prefixMigratedDirectionFrom
prefixMigratedDirectionTo
)
const (
MigrateAccountSignaturePrefix = "MigrateAccount:"
EventTypeMigrate = "migrate"
AttributeKeyFrom = "from"
AttributeKeyTo = "to"
EventTypeMigrateBankSend = "migrate_bank_send"
EventTypeMigrateStakingDelegate = "migrate_staking_delegate"
EventTypeMigrateStakingUndelegate = "migrate_staking_undelegate"
EventTypeMigrateStakingRedelegate = "migrate_staking_redelegate"
EventTypeMigrateGovDeposit = "migrate_gov_deposit"
EventTypeMigrateGovVote = "migrate_gov_vote"
AttributeKeyValidatorAddr = "validator_address"
AttributeKeyValidatorSrcAddr = "validator_src_address"
AttributeKeyValidatorDstAddr = "validator_dst_address"
AttributeKeyProposalId = "proposal_id"
AttributeKeyVoteOption = "vote_option"
)
var (
KeyPrefixMigratedRecord = []byte{prefixMigratedRecord}
KeyPrefixMigratedDirectionFrom = []byte{prefixMigratedDirectionFrom}
KeyPrefixMigratedDirectionTo = []byte{prefixMigratedDirectionTo}
ValuePrefixMigrateFromFlag = []byte{0x1}
ValuePrefixMigrateToFlag = []byte{0x2}
)
// GetMigratedRecordKey returns the following key format
func GetMigratedRecordKey(addr []byte) []byte {
return append(KeyPrefixMigratedRecord, addr...)
}
func GetMigratedDirectionFrom(addr sdk.AccAddress) []byte {
return append(KeyPrefixMigratedDirectionFrom, addr.Bytes()...)
}
func GetMigratedDirectionTo(addr common.Address) []byte {
return append(KeyPrefixMigratedDirectionTo, addr.Bytes()...)
}