Add service provider auctions #59

Merged
nabarun merged 29 commits from deep-stack/laconicd:iv-service-provider-auction into main 2024-09-25 12:38:50 +00:00
3 changed files with 10 additions and 14 deletions
Showing only changes of commit d44df36445 - Show all commits

View File

@ -40,7 +40,7 @@ message Params {
(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 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
@ -93,14 +93,13 @@ message Auction {
(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 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
];
// Addresses of the winners (one for vickrey auctions and can be multiple for
// provider auctions)
// Winner's address for Vickrey auctions, can be multiple for provider auctions
repeated string winner_addresses = 11;
// Winning bids, i.e., the best bids
@ -109,15 +108,13 @@ message Auction {
(gogoproto.moretags) = "json:\"winning_bids\" yaml:\"winning_bids\""
];
// Amount the winner pays (vickrey auction) or gets paid (provider auction),
// i.e. the second best bid
// Amount the winner pays (vickrey auction) or is paid (provider auction)
cosmos.base.v1beta1.Coin winning_price = 13 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"winning_price\" yaml:\"winning_price\""
];
// Maximum acceptable bid amount for a valid commit for service provider
// auctions
// Maximum acceptable bid amount (for provider auctions)
cosmos.base.v1beta1.Coin max_price = 14 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"max_price\" yaml:\"max_price\""

View File

@ -67,7 +67,7 @@ message MsgCreateAuction {
(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 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
@ -80,7 +80,7 @@ message MsgCreateAuction {
// Auction's kind (vickrey | provider)
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 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"max_price\" yaml:\"max_price\""

View File

@ -849,10 +849,9 @@ func (k Keeper) pickProviderAuctionWinners(ctx sdk.Context, auction *auctiontype
auction.WinnerAddresses = winnerAddresses
auction.WinningBids = winningBids
if len(winnerBids) > 0 {
// The last best bid is the winning price
auction.WinningPrice = winnerBids[len(winnerBids)-1].BidAmount
}
// The last best bid is the winning price
auction.WinningPrice = winnerBids[len(winnerBids)-1].BidAmount
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()))
}