From 799bfa16c7f09e38ecaf4531b578ebe3fd2c1c6c Mon Sep 17 00:00:00 2001 From: vuong177 Date: Wed, 6 Nov 2024 09:56:46 +0700 Subject: [PATCH] nits --- x/auction/keeper/genesis.go | 2 +- x/auction/keeper/keeper.go | 4 ++-- x/auction/keeper/liquidate.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/x/auction/keeper/genesis.go b/x/auction/keeper/genesis.go index 0e9aa5c..1baed16 100644 --- a/x/auction/keeper/genesis.go +++ b/x/auction/keeper/genesis.go @@ -10,7 +10,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { if err := k.SetParams(ctx, genState.Params); err != nil { panic(err) } - err := k.LastestAuctionPeriods.Set(ctx, "LastestAuctionPeriods", ctx.BlockTime().Unix()) + err := k.LastestAuctionPeriods.Set(ctx, ctx.BlockTime().Unix()) if err != nil { panic(err) } diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go index d12a98b..c461403 100644 --- a/x/auction/keeper/keeper.go +++ b/x/auction/keeper/keeper.go @@ -31,7 +31,7 @@ type ( authority string // timestamp of lastest auction period (Unix timestamp) - LastestAuctionPeriods collections.Map[string, int64] + LastestAuctionPeriods collections.Item[int64] AuctionIdSeq collections.Sequence @@ -75,7 +75,7 @@ func NewKeeper( vaultKeeper: vk, OracleKeeper: ok, AuctionIdSeq: collections.NewSequence(sb, types.AuctionIdSeqPrefix, "auction_id_sequence"), - LastestAuctionPeriods: collections.NewMap(sb, types.LastestAuctionPeriodPrefix, "lastestAuctionPeriods", collections.StringKey, collections.Int64Value), + LastestAuctionPeriods: collections.NewItem(sb, types.LastestAuctionPeriodPrefix, "lastestAuctionPeriods", collections.Int64Value), BidIdSeq: collections.NewMap(sb, types.BidIdSeqPrefix, "bid_id_sequence", collections.Uint64Key, collections.Uint64Value), Auctions: collections.NewMap(sb, types.AuctionsPrefix, "auctions", collections.Uint64Key, codec.CollValue[types.Auction](cdc)), Bids: collections.NewMap(sb, types.BidsPrefix, "bids", collections.Uint64Key, codec.CollValue[types.BidQueue](cdc)), diff --git a/x/auction/keeper/liquidate.go b/x/auction/keeper/liquidate.go index c3c2a4d..da014f8 100644 --- a/x/auction/keeper/liquidate.go +++ b/x/auction/keeper/liquidate.go @@ -14,7 +14,7 @@ func (k Keeper) handleLiquidation(ctx context.Context, mintDenom string) error { params := k.GetParams(ctx) currentTime := sdk.UnwrapSDKContext(ctx).BlockHeader().Time - lastestAuctionPeriod, err := k.LastestAuctionPeriods.Get(ctx, "LastestAuctionPeriods") + lastestAuctionPeriod, err := k.LastestAuctionPeriods.Get(ctx) if err != nil { return err } @@ -22,7 +22,7 @@ func (k Keeper) handleLiquidation(ctx context.Context, mintDenom string) error { // check if has reached the next auction periods if lastAuctionPeriods.Add(params.AuctionPeriods).Before(currentTime) { // update latest auction period - err = k.LastestAuctionPeriods.Set(ctx, "LastestAuctionPeriods", lastAuctionPeriods.Add(params.AuctionPeriods).Unix()) + err = k.LastestAuctionPeriods.Set(ctx, lastAuctionPeriods.Add(params.AuctionPeriods).Unix()) if err != nil { return err }