Add service provider auctions #59
@ -233,7 +233,8 @@ func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*Au
|
||||
}
|
||||
|
||||
winnerAddresses := make([]*string, len(auction.WinnerAddresses))
|
||||
for i, addr := range auction.WinnerAddresses {
|
||||
for i := range auction.WinnerAddresses {
|
||||
addr := auction.WinnerAddresses[i]
|
||||
winnerAddresses[i] = &addr
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@ import (
|
||||
"cosmossdk.io/math"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
@ -805,7 +804,7 @@ func (k Keeper) pickServiceProviderAuctionWinner(ctx sdk.Context, auction *aucti
|
||||
return err
|
||||
}
|
||||
|
||||
var revealedBids []*auctiontypes.Bid
|
||||
revealedBids := make([]*auctiontypes.Bid, 0, len(bids))
|
||||
for _, bid := range bids {
|
||||
k.Logger(ctx).Info(fmt.Sprintf("Processing bid %s %s", bid.BidderAddress, bid.BidAmount.String()))
|
||||
|
||||
@ -838,7 +837,7 @@ func (k Keeper) pickServiceProviderAuctionWinner(ctx sdk.Context, auction *aucti
|
||||
|
||||
if len(winnerBids) > 0 {
|
||||
winnerAddresses := make([]string, len(winnerBids))
|
||||
winningBids := make([]types.Coin, len(winnerBids))
|
||||
winningBids := make([]sdk.Coin, len(winnerBids))
|
||||
for i, bid := range winnerBids {
|
||||
winnerAddresses[i] = bid.BidderAddress
|
||||
winningBids[i] = bid.BidAmount
|
||||
@ -904,7 +903,12 @@ func (k Keeper) pickServiceProviderAuctionWinner(ctx sdk.Context, auction *aucti
|
||||
|
||||
extraAmountCoin := sdk.NewCoin(auction.MaxPrice.Denom, totalMaxBidAmount.Sub(totalAmountPaid))
|
||||
|
||||
sdkErrCreator := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, auctiontypes.ModuleName, sdk.AccAddress(auction.OwnerAddress), sdk.NewCoins(extraAmountCoin))
|
||||
sdkErrCreator := k.bankKeeper.SendCoinsFromModuleToAccount(
|
||||
ctx,
|
||||
auctiontypes.ModuleName,
|
||||
sdk.AccAddress(auction.OwnerAddress),
|
||||
sdk.NewCoins(extraAmountCoin),
|
||||
)
|
||||
if sdkErrCreator != nil {
|
||||
k.Logger(ctx).Error(fmt.Sprintf("Auction error returning bid amount: %v", sdkErrCreator))
|
||||
panic(sdkErrCreator)
|
||||
|
Loading…
Reference in New Issue
Block a user