From df804b58f6fb0d718faa5cc33c044d4fc543cec2 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 19 Sep 2024 10:09:42 +0530 Subject: [PATCH] Update proto files and regenerate bindings --- proto/cerc/auction/v1/auction.proto | 25 +++++--- proto/cerc/auction/v1/tx.proto | 33 +++++----- src/proto/cerc/auction/v1/auction.ts | 37 ++++++++--- src/proto/cerc/auction/v1/tx.ts | 93 +++++++++++++++------------- 4 files changed, 115 insertions(+), 73 deletions(-) diff --git a/proto/cerc/auction/v1/auction.proto b/proto/cerc/auction/v1/auction.proto index 8f2b74e..7483d1e 100644 --- a/proto/cerc/auction/v1/auction.proto +++ b/proto/cerc/auction/v1/auction.proto @@ -40,7 +40,8 @@ message Params { (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" ]; - // Minimum acceptable bid amount (for vickrey auctions) + // Minimum acceptable bid amount + // Only applicable in vickrey auctions cosmos.base.v1beta1.Coin minimum_bid = 5 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\"" @@ -53,7 +54,7 @@ message Auction { string id = 1; - // Auction's kind (vickrey | provider) + // Auction kind (vickrey | provider) string kind = 2 [ (gogoproto.moretags) = "json:\"kind\" yaml:\"kind\"" ]; string status = 3; @@ -93,34 +94,42 @@ message Auction { (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" ]; - // Minimum acceptable bid amount for a valid commit (for vickrey auctions) + // Minimum acceptable bid amount for a valid commit + // Only applicable in vickrey auctions cosmos.base.v1beta1.Coin minimum_bid = 10 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\"" ]; - // Winner's address for Vickrey auctions, can be multiple for provider auctions + // Addresses of the winners + // (single winner for vickrey auction) + // (multiple winners for provider auctions) repeated string winner_addresses = 11; - // Winning bids, i.e., the best bids + // Winning bids, i.e. the best bids repeated cosmos.base.v1beta1.Coin winning_bids = 12 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"winning_bids\" yaml:\"winning_bids\"" ]; - // Amount the winner pays (vickrey auction) or is paid (provider auction) + // Auction winning price + // vickrey auction: second highest bid, paid by the winner + // provider auction: higest bid amongst winning_bids, paid by auction creator + // to each winner cosmos.base.v1beta1.Coin winning_price = 13 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"winning_price\" yaml:\"winning_price\"" ]; - // Maximum acceptable bid amount (for provider auctions) + // Maximum acceptable bid amount for a valid commit + // Only applicable in provider auctions cosmos.base.v1beta1.Coin max_price = 14 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"max_price\" yaml:\"max_price\"" ]; - // Number of providers to be selected + // Number of desired providers (num of auction winners) + // Only applicable in provider auctions int32 num_providers = 15; } diff --git a/proto/cerc/auction/v1/tx.proto b/proto/cerc/auction/v1/tx.proto index a1054d7..846a57a 100644 --- a/proto/cerc/auction/v1/tx.proto +++ b/proto/cerc/auction/v1/tx.proto @@ -41,52 +41,55 @@ message MsgCreateAuction { option (gogoproto.goproto_getters) = false; option (cosmos.msg.v1.signer) = "signer"; + // Address of the signer + string signer = 1 + [ (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" ]; + + // Auction kind (vickrey | provider) + string kind = 2 [ (gogoproto.moretags) = "json:\"kind\" yaml:\"kind\"" ]; + // Duration of the commits phase in seconds - google.protobuf.Duration commits_duration = 1 [ + google.protobuf.Duration commits_duration = 3 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\"" ]; // Duration of the reveals phase in seconds - google.protobuf.Duration reveals_duration = 2 [ + google.protobuf.Duration reveals_duration = 4 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\"" ]; // Commit fees - cosmos.base.v1beta1.Coin commit_fee = 3 [ + cosmos.base.v1beta1.Coin commit_fee = 5 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\"" ]; // Reveal fees - cosmos.base.v1beta1.Coin reveal_fee = 4 [ + cosmos.base.v1beta1.Coin reveal_fee = 6 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" ]; - // Minimum acceptable bid amount (for vickrey auctions) - cosmos.base.v1beta1.Coin minimum_bid = 5 [ + // Minimum acceptable bid amount + // Only applicable in vickrey auctions + cosmos.base.v1beta1.Coin minimum_bid = 7 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\"" ]; - // Address of the signer - string signer = 6 - [ (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" ]; - - // Auction's kind (vickrey | provider) - string kind = 7 [ (gogoproto.moretags) = "json:\"kind\" yaml:\"kind\"" ]; - - // Maximum acceptable bid amount (for provider auctions) + // Maximum acceptable bid amount + // Only applicable in provider auctions cosmos.base.v1beta1.Coin max_price = 8 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"max_price\" yaml:\"max_price\"" ]; - // Number of providers to be selected + // Number of desired providers (num of auction winners) + // Only applicable in provider auctions int32 num_providers = 9; } diff --git a/src/proto/cerc/auction/v1/auction.ts b/src/proto/cerc/auction/v1/auction.ts index d9c7c8e..9297b28 100644 --- a/src/proto/cerc/auction/v1/auction.ts +++ b/src/proto/cerc/auction/v1/auction.ts @@ -17,14 +17,17 @@ export interface Params { commitFee?: Coin; /** Reveal fees */ revealFee?: Coin; - /** Minimum acceptable bid amount */ + /** + * Minimum acceptable bid amount + * Only applicable in vickrey auctions + */ minimumBid?: Coin; } /** Auction represents a sealed-bid on-chain auction */ export interface Auction { id: string; - /** Auction's kind (vickrey | provider) */ + /** Auction kind (vickrey | provider) */ kind: string; status: string; /** Address of the creator of the auction */ @@ -41,17 +44,35 @@ export interface Auction { */ commitFee?: Coin; revealFee?: Coin; - /** Minimum acceptable bid amount for a valid commit */ + /** + * Minimum acceptable bid amount for a valid commit + * Only applicable in vickrey auctions + */ minimumBid?: Coin; - /** Addresses of the winners (one for vickrey auctions and can be multiple for provider auctions) */ + /** + * Addresses of the winners + * (single winner for vickrey auction) + * (multiple winners for provider auctions) + */ winnerAddresses: string[]; - /** Winning bids, i.e., the best bids */ + /** Winning bids, i.e. the best bids */ winningBids: Coin[]; - /** Amount the winner pays, i.e. the second best bid */ + /** + * Auction winning price + * vickrey auction: second highest bid, paid by the winner + * provider auction: higest bid amongst winning_bids, paid by auction creator + * to each winner + */ winningPrice?: Coin; - /** Maximum acceptable bid amount for a valid commit for service provider auctions */ + /** + * Maximum acceptable bid amount for a valid commit + * Only applicable in provider auctions + */ maxPrice?: Coin; - /** Number of providers to be selected */ + /** + * Number of desired providers (num of auction winners) + * Only applicable in provider auctions + */ numProviders: number; } diff --git a/src/proto/cerc/auction/v1/tx.ts b/src/proto/cerc/auction/v1/tx.ts index c576c51..d165d8b 100644 --- a/src/proto/cerc/auction/v1/tx.ts +++ b/src/proto/cerc/auction/v1/tx.ts @@ -9,6 +9,10 @@ export const protobufPackage = "cerc.auction.v1"; /** MsgCreateAuction defines a create auction message */ export interface MsgCreateAuction { + /** Address of the signer */ + signer: string; + /** Auction kind (vickrey | provider) */ + kind: string; /** Duration of the commits phase in seconds */ commitsDuration?: Duration; /** Duration of the reveals phase in seconds */ @@ -17,15 +21,20 @@ export interface MsgCreateAuction { commitFee?: Coin; /** Reveal fees */ revealFee?: Coin; - /** Minimum acceptable bid amount */ + /** + * Minimum acceptable bid amount + * Only applicable in vickrey auctions + */ minimumBid?: Coin; - /** Address of the signer */ - signer: string; - /** Auction's kind (vickrey | provider) */ - kind: string; - /** Maximum acceptable bid amount (for service provider auctions) */ + /** + * Maximum acceptable bid amount + * Only applicable in provider auctions + */ maxPrice?: Coin; - /** Number of providers to be selected */ + /** + * Number of desired providers (num of auction winners) + * Only applicable in provider auctions + */ numProviders: number; } @@ -90,13 +99,13 @@ export interface MsgUpdateParamsResponse {} function createBaseMsgCreateAuction(): MsgCreateAuction { return { + signer: "", + kind: "", commitsDuration: undefined, revealsDuration: undefined, commitFee: undefined, revealFee: undefined, minimumBid: undefined, - signer: "", - kind: "", maxPrice: undefined, numProviders: 0, }; @@ -107,32 +116,32 @@ export const MsgCreateAuction = { message: MsgCreateAuction, writer: _m0.Writer = _m0.Writer.create() ): _m0.Writer { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.kind !== "") { + writer.uint32(18).string(message.kind); + } if (message.commitsDuration !== undefined) { Duration.encode( message.commitsDuration, - writer.uint32(10).fork() + writer.uint32(26).fork() ).ldelim(); } if (message.revealsDuration !== undefined) { Duration.encode( message.revealsDuration, - writer.uint32(18).fork() + writer.uint32(34).fork() ).ldelim(); } if (message.commitFee !== undefined) { - Coin.encode(message.commitFee, writer.uint32(26).fork()).ldelim(); + Coin.encode(message.commitFee, writer.uint32(42).fork()).ldelim(); } if (message.revealFee !== undefined) { - Coin.encode(message.revealFee, writer.uint32(34).fork()).ldelim(); + Coin.encode(message.revealFee, writer.uint32(50).fork()).ldelim(); } if (message.minimumBid !== undefined) { - Coin.encode(message.minimumBid, writer.uint32(42).fork()).ldelim(); - } - if (message.signer !== "") { - writer.uint32(50).string(message.signer); - } - if (message.kind !== "") { - writer.uint32(58).string(message.kind); + Coin.encode(message.minimumBid, writer.uint32(58).fork()).ldelim(); } if (message.maxPrice !== undefined) { Coin.encode(message.maxPrice, writer.uint32(66).fork()).ldelim(); @@ -151,26 +160,26 @@ export const MsgCreateAuction = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.commitsDuration = Duration.decode(reader, reader.uint32()); - break; - case 2: - message.revealsDuration = Duration.decode(reader, reader.uint32()); - break; - case 3: - message.commitFee = Coin.decode(reader, reader.uint32()); - break; - case 4: - message.revealFee = Coin.decode(reader, reader.uint32()); - break; - case 5: - message.minimumBid = Coin.decode(reader, reader.uint32()); - break; - case 6: message.signer = reader.string(); break; - case 7: + case 2: message.kind = reader.string(); break; + case 3: + message.commitsDuration = Duration.decode(reader, reader.uint32()); + break; + case 4: + message.revealsDuration = Duration.decode(reader, reader.uint32()); + break; + case 5: + message.commitFee = Coin.decode(reader, reader.uint32()); + break; + case 6: + message.revealFee = Coin.decode(reader, reader.uint32()); + break; + case 7: + message.minimumBid = Coin.decode(reader, reader.uint32()); + break; case 8: message.maxPrice = Coin.decode(reader, reader.uint32()); break; @@ -187,6 +196,8 @@ export const MsgCreateAuction = { fromJSON(object: any): MsgCreateAuction { return { + signer: isSet(object.signer) ? String(object.signer) : "", + kind: isSet(object.kind) ? String(object.kind) : "", commitsDuration: isSet(object.commitsDuration) ? Duration.fromJSON(object.commitsDuration) : undefined, @@ -202,8 +213,6 @@ export const MsgCreateAuction = { minimumBid: isSet(object.minimumBid) ? Coin.fromJSON(object.minimumBid) : undefined, - signer: isSet(object.signer) ? String(object.signer) : "", - kind: isSet(object.kind) ? String(object.kind) : "", maxPrice: isSet(object.maxPrice) ? Coin.fromJSON(object.maxPrice) : undefined, @@ -215,6 +224,8 @@ export const MsgCreateAuction = { toJSON(message: MsgCreateAuction): unknown { const obj: any = {}; + message.signer !== undefined && (obj.signer = message.signer); + message.kind !== undefined && (obj.kind = message.kind); message.commitsDuration !== undefined && (obj.commitsDuration = message.commitsDuration ? Duration.toJSON(message.commitsDuration) @@ -235,8 +246,6 @@ export const MsgCreateAuction = { (obj.minimumBid = message.minimumBid ? Coin.toJSON(message.minimumBid) : undefined); - message.signer !== undefined && (obj.signer = message.signer); - message.kind !== undefined && (obj.kind = message.kind); message.maxPrice !== undefined && (obj.maxPrice = message.maxPrice ? Coin.toJSON(message.maxPrice) @@ -250,6 +259,8 @@ export const MsgCreateAuction = { object: I ): MsgCreateAuction { const message = createBaseMsgCreateAuction(); + message.signer = object.signer ?? ""; + message.kind = object.kind ?? ""; message.commitsDuration = object.commitsDuration !== undefined && object.commitsDuration !== null ? Duration.fromPartial(object.commitsDuration) @@ -270,8 +281,6 @@ export const MsgCreateAuction = { object.minimumBid !== undefined && object.minimumBid !== null ? Coin.fromPartial(object.minimumBid) : undefined; - message.signer = object.signer ?? ""; - message.kind = object.kind ?? ""; message.maxPrice = object.maxPrice !== undefined && object.maxPrice !== null ? Coin.fromPartial(object.maxPrice)