gpu-compute-chain/x/colinearcore/keeper/next_auction.go

35 lines
991 B
Go
Raw Permalink Normal View History

package keeper
import (
2022-09-06 15:18:09 -07:00
"colinear/x/colinearcore/types"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// SetNextAuction set nextAuction in the store
func (k Keeper) SetNextAuction(ctx sdk.Context, nextAuction types.NextAuction) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NextAuctionKey))
b := k.cdc.MustMarshal(&nextAuction)
store.Set([]byte{0}, b)
}
// GetNextAuction returns nextAuction
func (k Keeper) GetNextAuction(ctx sdk.Context) (val types.NextAuction, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NextAuctionKey))
b := store.Get([]byte{0})
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
// RemoveNextAuction removes nextAuction from the store
func (k Keeper) RemoveNextAuction(ctx sdk.Context) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NextAuctionKey))
store.Delete([]byte{0})
}