-
Notifications
You must be signed in to change notification settings - Fork 13
/
keys.go
40 lines (32 loc) · 1.01 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
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// constants
const (
ModuleName = "erc20"
// StoreKey to be used when creating the KVStore
StoreKey = ModuleName
// RouterKey to be used for message routing
RouterKey = ModuleName
)
// KVStore key prefixes
var (
KeyPrefixTokenPair = []byte{0x01}
KeyPrefixTokenPairByERC20 = []byte{0x02}
KeyPrefixTokenPairByDenom = []byte{0x03}
KeyPrefixIBCTransfer = []byte{0x04}
KeyPrefixAliasDenom = []byte{0x05}
ParamsKey = []byte{0x06}
KeyPrefixOutgoingTransfer = []byte{0x07}
)
// GetIBCTransferKey [sourceChannel/sequence]
func GetIBCTransferKey(sourceChannel string, sequence uint64) []byte {
key := fmt.Sprintf("%s/%d", sourceChannel, sequence)
return append(KeyPrefixIBCTransfer, []byte(key)...)
}
// GetOutgoingTransferKey [txID]
func GetOutgoingTransferKey(moduleName string, txID uint64) []byte {
return append(append(KeyPrefixOutgoingTransfer, []byte(moduleName)...), sdk.Uint64ToBigEndian(txID)...)
}