Skip to content

Commit

Permalink
fix: fix the results on query
Browse files Browse the repository at this point in the history
  • Loading branch information
gsk967 committed Jun 28, 2024
1 parent 54cacd6 commit c522b68
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions x/auction/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,22 @@ func (q Querier) RewardsAuctions(goCtx context.Context, req *auction.QueryReward
auctions := make([]*auction.QueryRewardsAuctionResponse, 0)

pageRes, err := query.Paginate(rewardsStore, req.Pagination, func(key, value []byte) error {
var rewards *auction.Rewards
var rewards auction.Rewards
err := rewards.Unmarshal(value)
if err != nil {
return err
}

if rewards != nil {
var auctionID *store.Uint32
bz := key[len(keyPrefixRewardsCoins):]
err = auctionID.Unmarshal(bz)
if err != nil {
return err
}
auctions = append(auctions, &auction.QueryRewardsAuctionResponse{
Id: uint32(*auctionID),
Rewards: rewards.Rewards,
EndsAt: rewards.EndsAt,
})
var auctionID store.Uint32
err = auctionID.Unmarshal(key)
if err != nil {
return err
}
auction := &auction.QueryRewardsAuctionResponse{
Id: uint32(auctionID),
}
auction.Rewards = rewards.Rewards
auction.EndsAt = rewards.EndsAt
auctions = append(auctions, auction)
return nil
})

Expand Down

0 comments on commit c522b68

Please sign in to comment.