From 8f4c50368db5163c9efb03213fe09f9d9710274c Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Tue, 4 Jun 2024 23:01:45 +0530 Subject: [PATCH] fix: fix the auction creation in every block --- Makefile | 4 ++-- x/auction/keeper/rewards.go | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 273afdb68b..8023d10965 100644 --- a/Makefile +++ b/Makefile @@ -152,7 +152,7 @@ go-mod-tidy: clean: @echo "--> Cleaning..." - @rm -rf $(BUILD_DIR)/** $(DIST_DIR)/** + @rm -rf $(BUILDDIR)/** $(DIST_DIR)/** .PHONY: build build-linux build-experimental build-no_cgo clean go-mod-tidy @@ -237,7 +237,7 @@ test-e2e-clean: docker rm umee0 umee1 umee2 umee-gaia-relayer gaiaval0 umee-price-feeder || true docker network prune -f -test-qa: +test-qa: @go test ./tests/qa/... -timeout 30m -v -tags='test_qa' $(MOCKS_DIR): diff --git a/x/auction/keeper/rewards.go b/x/auction/keeper/rewards.go index ad58713af1..411b35220f 100644 --- a/x/auction/keeper/rewards.go +++ b/x/auction/keeper/rewards.go @@ -18,11 +18,11 @@ import ( func (k Keeper) FinalizeRewardsAuction() error { now := k.ctx.BlockTime() - a, id := k.getRewardsAuction(0) + a, id := k.getRewardsAuction(k.currentRewardsAuctionID()) if a == nil { return k.initNewAuction(id+1, []sdk.Coin{}) } - if !a.EndsAt.After(now) { + if a.EndsAt.After(now) { return nil } @@ -52,6 +52,7 @@ func (k Keeper) FinalizeRewardsAuction() error { func (k Keeper) initNewAuction(id uint32, rewards sdk.Coins) error { store.SetInteger(k.store, keyRewardsCurrentID, id) params := k.GetRewardsParams() + fmt.Println("duration ", time.Duration(params.BidDuration)*time.Second) endsAt := k.ctx.BlockTime().Add(time.Duration(params.BidDuration) * time.Second) return k.storeNewRewardsAuction(id, endsAt, rewards) }