-
Notifications
You must be signed in to change notification settings - Fork 28
/
key.go
33 lines (26 loc) · 849 Bytes
/
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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
const (
ModuleName = "itc"
StoreKey string = ModuleName
QuerierRoute string = ModuleName
RouterKey string = ModuleName
)
var (
PrefixCampaignId = []byte{0x01}
PrefixCampaignCreator = []byte{0x02}
PrefixNextCampaignNumber = []byte{0x03}
PrefixClaimByNftId = []byte{0x11}
ParamsKey = []byte{0x12}
)
func KeyCampaignIdPrefix(id uint64) []byte {
return append(PrefixCampaignId, sdk.Uint64ToBigEndian(id)...)
}
func KeyCampaignCreatorPrefix(creator sdk.AccAddress, id uint64) []byte {
return append(append(PrefixCampaignCreator, creator.Bytes()...), sdk.Uint64ToBigEndian(id)...)
}
func KeyClaimByNftIdPrefix(id uint64, nftId string) []byte {
return append(append(PrefixClaimByNftId, sdk.Uint64ToBigEndian(id)...), []byte(nftId)...)
}