/
keeper.go
63 lines (54 loc) · 1.73 KB
/
keeper.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
package keeper
import (
"fmt"
"github.com/tendermint/tendermint/libs/log"
"github.com/EG-easy/affondra/x/affondra/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/cosmos/modules/incubator/nft"
)
// Keeper of the affondra store
type Keeper struct {
CoinKeeper bank.Keeper
storeKey sdk.StoreKey
cdc *codec.Codec
// paramspace types.ParamSubspace
// add NFTKeeper
NFTKeeper nft.Keeper
}
// NewKeeper creates a affondra keeper
func NewKeeper(coinKeeper bank.Keeper, nftKeeper nft.Keeper, cdc *codec.Codec, key sdk.StoreKey) Keeper {
keeper := Keeper{
CoinKeeper: coinKeeper,
storeKey: key,
cdc: cdc,
// paramspace: paramspace.WithKeyTable(types.ParamKeyTable()),
NFTKeeper: nftKeeper,
}
return keeper
}
// Logger returns a module-specific logger.
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
}
// Get returns the pubkey from the adddress-pubkey relation
// func (k Keeper) Get(ctx sdk.Context, key string) (/* TODO: Fill out this type */, error) {
// store := ctx.KVStore(k.storeKey)
// var item /* TODO: Fill out this type */
// byteKey := []byte(key)
// err := k.cdc.UnmarshalBinaryLengthPrefixed(store.Get(byteKey), &item)
// if err != nil {
// return nil, err
// }
// return item, nil
// }
// func (k Keeper) set(ctx sdk.Context, key string, value /* TODO: fill out this type */ ) {
// store := ctx.KVStore(k.storeKey)
// bz := k.cdc.MustMarshalBinaryLengthPrefixed(value)
// store.Set([]byte(key), bz)
// }
// func (k Keeper) delete(ctx sdk.Context, key string) {
// store := ctx.KVStore(k.storeKey)
// store.Delete([]byte(key))
// }