mirror of
https://github.com/colinear-labs/chain.git
synced 2026-03-05 03:44:26 -08:00
finish ongoing auction info q implementation
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"colinear/x/colinearcore/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
@@ -2,8 +2,11 @@ package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"colinear/x/colinearcore/memdb"
|
||||
"colinear/x/colinearcore/types"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
@@ -16,8 +19,26 @@ func (k Keeper) AuctionInfo(goCtx context.Context, req *types.QueryAuctionInfoRe
|
||||
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
|
||||
// TODO: Process the query
|
||||
_ = ctx
|
||||
if exp, err := k.AuctionIsExpired(ctx, req.AuctionId); err != nil {
|
||||
return nil, fmt.Errorf("unable to check auction expiry status: %s", err)
|
||||
} else {
|
||||
if exp {
|
||||
return nil, fmt.Errorf("auction %s is finalized", req.AuctionId)
|
||||
}
|
||||
}
|
||||
|
||||
return &types.QueryAuctionInfoResponse{}, nil
|
||||
bids, err := memdb.AuctionDB.GetBids(req.AuctionId)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to get bids for auction %s: %s", req.AuctionId, err)
|
||||
}
|
||||
|
||||
vProviders, err := memdb.AuctionDB.GetVerifiedProviders(req.AuctionId)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to get verified providers for auction %s: %s", req.AuctionId, err)
|
||||
}
|
||||
|
||||
return &types.QueryAuctionInfoResponse{
|
||||
Bids: bids,
|
||||
VerifiedProviders: vProviders,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user