-
Notifications
You must be signed in to change notification settings - Fork 28
/
keys.go
76 lines (61 loc) · 2.22 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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
const (
ModuleName = "marketplace"
StoreKey string = ModuleName
QuerierRoute string = ModuleName
RouterKey string = ModuleName
DefaultParamspace = ModuleName
)
var (
PrefixListingId = []byte{0x01}
PrefixListingOwner = []byte{0x02}
PrefixListingsCount = []byte{0x03}
PrefixListingNFTID = []byte{0x04}
PrefixListingPriceDenom = []byte{0x05}
PrefixAuctionId = []byte{0x06}
PrefixAuctionOwner = []byte{0x07}
PrefixAuctionNFTID = []byte{0x08}
PrefixAuctionPriceDenom = []byte{0x09}
PrefixNextAuctionNumber = []byte{0x10}
PrefixBidByAuctionId = []byte{0x11}
PrefixBidByBidder = []byte{0x12}
PrefixInactiveAuction = []byte{0x13}
PrefixActiveAuction = []byte{0x14}
ParamsKey = []byte{0x15}
)
func KeyListingIdPrefix(id string) []byte {
return append(PrefixListingId, []byte(id)...)
}
func KeyListingOwnerPrefix(owner sdk.AccAddress, id string) []byte {
return append(append(PrefixListingOwner, owner.Bytes()...), []byte(id)...)
}
func KeyListingNFTIDPrefix(nftId string) []byte {
return append(PrefixListingNFTID, []byte(nftId)...)
}
func KeyListingPriceDenomPrefix(priceDenom, id string) []byte {
return append(append(PrefixListingPriceDenom, []byte(priceDenom)...), []byte(id)...)
}
func KeyAuctionIdPrefix(id uint64) []byte {
return append(PrefixAuctionId, sdk.Uint64ToBigEndian(id)...)
}
func KeyAuctionOwnerPrefix(owner sdk.AccAddress, id uint64) []byte {
return append(append(PrefixAuctionOwner, owner.Bytes()...), sdk.Uint64ToBigEndian(id)...)
}
func KeyAuctionNFTIDPrefix(nftId string) []byte {
return append(PrefixAuctionNFTID, []byte(nftId)...)
}
func KeyAuctionPriceDenomPrefix(priceDenom string, id uint64) []byte {
return append(append(PrefixAuctionPriceDenom, []byte(priceDenom)...), sdk.Uint64ToBigEndian(id)...)
}
func KeyBidPrefix(id uint64) []byte {
return append(PrefixBidByAuctionId, sdk.Uint64ToBigEndian(id)...)
}
func KeyInActiveAuctionPrefix(id uint64) []byte {
return append(PrefixInactiveAuction, sdk.Uint64ToBigEndian(id)...)
}
func KeyActiveAuctionPrefix(id uint64) []byte {
return append(PrefixActiveAuction, sdk.Uint64ToBigEndian(id)...)
}