Add service provider auctions #59
@ -40,7 +40,7 @@ message Params {
|
|||||||
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
|
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
|
||||||
];
|
];
|
||||||
|
|
||||||
// Minimum acceptable bid amount
|
// Minimum acceptable bid amount (for vickrey auctions)
|
||||||
cosmos.base.v1beta1.Coin minimum_bid = 5 [
|
cosmos.base.v1beta1.Coin minimum_bid = 5 [
|
||||||
(gogoproto.nullable) = false,
|
(gogoproto.nullable) = false,
|
||||||
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
|
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
|
||||||
@ -93,14 +93,13 @@ message Auction {
|
|||||||
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
|
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
|
||||||
];
|
];
|
||||||
|
|
||||||
// Minimum acceptable bid amount for a valid commit
|
// Minimum acceptable bid amount for a valid commit (for vickrey auctions)
|
||||||
cosmos.base.v1beta1.Coin minimum_bid = 10 [
|
cosmos.base.v1beta1.Coin minimum_bid = 10 [
|
||||||
(gogoproto.nullable) = false,
|
(gogoproto.nullable) = false,
|
||||||
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
|
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
|
||||||
];
|
];
|
||||||
|
|
||||||
// Addresses of the winners (one for vickrey auctions and can be multiple for
|
// Winner's address for Vickrey auctions, can be multiple for provider auctions
|
||||||
// provider auctions)
|
|
||||||
repeated string winner_addresses = 11;
|
repeated string winner_addresses = 11;
|
||||||
|
|
||||||
// Winning bids, i.e., the best bids
|
// Winning bids, i.e., the best bids
|
||||||
@ -109,15 +108,13 @@ message Auction {
|
|||||||
(gogoproto.moretags) = "json:\"winning_bids\" yaml:\"winning_bids\""
|
(gogoproto.moretags) = "json:\"winning_bids\" yaml:\"winning_bids\""
|
||||||
];
|
];
|
||||||
|
|
||||||
// Amount the winner pays (vickrey auction) or gets paid (provider auction),
|
// Amount the winner pays (vickrey auction) or is paid (provider auction)
|
||||||
// i.e. the second best bid
|
|
||||||
cosmos.base.v1beta1.Coin winning_price = 13 [
|
cosmos.base.v1beta1.Coin winning_price = 13 [
|
||||||
(gogoproto.nullable) = false,
|
(gogoproto.nullable) = false,
|
||||||
(gogoproto.moretags) = "json:\"winning_price\" yaml:\"winning_price\""
|
(gogoproto.moretags) = "json:\"winning_price\" yaml:\"winning_price\""
|
||||||
];
|
];
|
||||||
|
|
||||||
// Maximum acceptable bid amount for a valid commit for service provider
|
// Maximum acceptable bid amount (for provider auctions)
|
||||||
// auctions
|
|
||||||
cosmos.base.v1beta1.Coin max_price = 14 [
|
cosmos.base.v1beta1.Coin max_price = 14 [
|
||||||
(gogoproto.nullable) = false,
|
(gogoproto.nullable) = false,
|
||||||
(gogoproto.moretags) = "json:\"max_price\" yaml:\"max_price\""
|
(gogoproto.moretags) = "json:\"max_price\" yaml:\"max_price\""
|
||||||
|
@ -67,7 +67,7 @@ message MsgCreateAuction {
|
|||||||
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
|
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
|
||||||
];
|
];
|
||||||
|
|
||||||
// Minimum acceptable bid amount
|
// Minimum acceptable bid amount (for vickrey auctions)
|
||||||
cosmos.base.v1beta1.Coin minimum_bid = 5 [
|
cosmos.base.v1beta1.Coin minimum_bid = 5 [
|
||||||
(gogoproto.nullable) = false,
|
(gogoproto.nullable) = false,
|
||||||
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
|
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
|
||||||
@ -80,7 +80,7 @@ message MsgCreateAuction {
|
|||||||
// Auction's kind (vickrey | provider)
|
// Auction's kind (vickrey | provider)
|
||||||
string kind = 7 [ (gogoproto.moretags) = "json:\"kind\" yaml:\"kind\"" ];
|
string kind = 7 [ (gogoproto.moretags) = "json:\"kind\" yaml:\"kind\"" ];
|
||||||
|
|
||||||
// Maximum acceptable bid amount (for service provider auctions)
|
// Maximum acceptable bid amount (for provider auctions)
|
||||||
cosmos.base.v1beta1.Coin max_price = 8 [
|
cosmos.base.v1beta1.Coin max_price = 8 [
|
||||||
(gogoproto.nullable) = false,
|
(gogoproto.nullable) = false,
|
||||||
(gogoproto.moretags) = "json:\"max_price\" yaml:\"max_price\""
|
(gogoproto.moretags) = "json:\"max_price\" yaml:\"max_price\""
|
||||||
|
@ -849,10 +849,9 @@ func (k Keeper) pickProviderAuctionWinners(ctx sdk.Context, auction *auctiontype
|
|||||||
auction.WinnerAddresses = winnerAddresses
|
auction.WinnerAddresses = winnerAddresses
|
||||||
auction.WinningBids = winningBids
|
auction.WinningBids = winningBids
|
||||||
|
|
||||||
if len(winnerBids) > 0 {
|
// The last best bid is the winning price
|
||||||
// The last best bid is the winning price
|
auction.WinningPrice = winnerBids[len(winnerBids)-1].BidAmount
|
||||||
auction.WinningPrice = winnerBids[len(winnerBids)-1].BidAmount
|
|
||||||
}
|
|
||||||
for _, bid := range winnerBids {
|
for _, bid := range winnerBids {
|
||||||
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner address: %s, bid amount: %s.", auction.Id, bid.BidderAddress, bid.BidAmount.String()))
|
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner address: %s, bid amount: %s.", auction.Id, bid.BidderAddress, bid.BidAmount.String()))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user