Add methods for creating auctions and add auction tests #28
@ -3,50 +3,13 @@ syntax = "proto3";
|
||||
package cerc.auction.v1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
|
||||
option go_package = "git.vdb.to/cerc-io/laconicd/x/auction";
|
||||
|
||||
// Params defines the auction module parameters
|
||||
message Params {
|
||||
// Write custom stringer method
|
||||
option (gogoproto.goproto_stringer) = false;
|
||||
|
||||
// Duration of the commits phase in seconds
|
||||
google.protobuf.Duration commits_duration = 1 [
|
||||
(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 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.stdduration) = true,
|
||||
(gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\""
|
||||
];
|
||||
|
||||
// Commit fees
|
||||
cosmos.base.v1beta1.Coin commit_fee = 3 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\""
|
||||
];
|
||||
|
||||
// Reveal fees
|
||||
cosmos.base.v1beta1.Coin reveal_fee = 4 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
|
||||
];
|
||||
|
||||
// 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\""
|
||||
];
|
||||
}
|
||||
message Params {}
|
||||
|
||||
// Auction represents a sealed-bid on-chain auction
|
||||
message Auction {
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* eslint-disable */
|
||||
import { Duration } from "../../../google/protobuf/duration";
|
||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
||||
import { Timestamp } from "../../../google/protobuf/timestamp";
|
||||
import Long from "long";
|
||||
@ -8,21 +7,7 @@ import _m0 from "protobufjs/minimal";
|
||||
export const protobufPackage = "cerc.auction.v1";
|
||||
|
||||
/** Params defines the auction module parameters */
|
||||
export interface Params {
|
||||
/** Duration of the commits phase in seconds */
|
||||
commitsDuration?: Duration;
|
||||
/** Duration of the reveals phase in seconds */
|
||||
revealsDuration?: Duration;
|
||||
/** Commit fees */
|
||||
commitFee?: Coin;
|
||||
/** Reveal fees */
|
||||
revealFee?: Coin;
|
||||
/**
|
||||
* Minimum acceptable bid amount
|
||||
* Only applicable in vickrey auctions
|
||||
*/
|
||||
minimumBid?: Coin;
|
||||
}
|
||||
export interface Params {}
|
||||
|
||||
/** Auction represents a sealed-bid on-chain auction */
|
||||
export interface Auction {
|
||||
@ -95,41 +80,11 @@ export interface Bid {
|
||||
}
|
||||
|
||||
function createBaseParams(): Params {
|
||||
return {
|
||||
commitsDuration: undefined,
|
||||
revealsDuration: undefined,
|
||||
commitFee: undefined,
|
||||
revealFee: undefined,
|
||||
minimumBid: undefined,
|
||||
};
|
||||
return {};
|
||||
}
|
||||
|
||||
export const Params = {
|
||||
encode(
|
||||
message: Params,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.commitsDuration !== undefined) {
|
||||
Duration.encode(
|
||||
message.commitsDuration,
|
||||
writer.uint32(10).fork()
|
||||
).ldelim();
|
||||
}
|
||||
if (message.revealsDuration !== undefined) {
|
||||
Duration.encode(
|
||||
message.revealsDuration,
|
||||
writer.uint32(18).fork()
|
||||
).ldelim();
|
||||
}
|
||||
if (message.commitFee !== undefined) {
|
||||
Coin.encode(message.commitFee, writer.uint32(26).fork()).ldelim();
|
||||
}
|
||||
if (message.revealFee !== undefined) {
|
||||
Coin.encode(message.revealFee, writer.uint32(34).fork()).ldelim();
|
||||
}
|
||||
if (message.minimumBid !== undefined) {
|
||||
Coin.encode(message.minimumBid, writer.uint32(42).fork()).ldelim();
|
||||
}
|
||||
encode(_: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
||||
return writer;
|
||||
},
|
||||
|
||||
@ -140,21 +95,6 @@ export const Params = {
|
||||
while (reader.pos < end) {
|
||||
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;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
@ -163,73 +103,17 @@ export const Params = {
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Params {
|
||||
return {
|
||||
commitsDuration: isSet(object.commitsDuration)
|
||||
? Duration.fromJSON(object.commitsDuration)
|
||||
: undefined,
|
||||
revealsDuration: isSet(object.revealsDuration)
|
||||
? Duration.fromJSON(object.revealsDuration)
|
||||
: undefined,
|
||||
commitFee: isSet(object.commitFee)
|
||||
? Coin.fromJSON(object.commitFee)
|
||||
: undefined,
|
||||
revealFee: isSet(object.revealFee)
|
||||
? Coin.fromJSON(object.revealFee)
|
||||
: undefined,
|
||||
minimumBid: isSet(object.minimumBid)
|
||||
? Coin.fromJSON(object.minimumBid)
|
||||
: undefined,
|
||||
};
|
||||
fromJSON(_: any): Params {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(message: Params): unknown {
|
||||
toJSON(_: Params): unknown {
|
||||
const obj: any = {};
|
||||
message.commitsDuration !== undefined &&
|
||||
(obj.commitsDuration = message.commitsDuration
|
||||
? Duration.toJSON(message.commitsDuration)
|
||||
: undefined);
|
||||
message.revealsDuration !== undefined &&
|
||||
(obj.revealsDuration = message.revealsDuration
|
||||
? Duration.toJSON(message.revealsDuration)
|
||||
: undefined);
|
||||
message.commitFee !== undefined &&
|
||||
(obj.commitFee = message.commitFee
|
||||
? Coin.toJSON(message.commitFee)
|
||||
: undefined);
|
||||
message.revealFee !== undefined &&
|
||||
(obj.revealFee = message.revealFee
|
||||
? Coin.toJSON(message.revealFee)
|
||||
: undefined);
|
||||
message.minimumBid !== undefined &&
|
||||
(obj.minimumBid = message.minimumBid
|
||||
? Coin.toJSON(message.minimumBid)
|
||||
: undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Params>, I>>(object: I): Params {
|
||||
fromPartial<I extends Exact<DeepPartial<Params>, I>>(_: I): Params {
|
||||
const message = createBaseParams();
|
||||
message.commitsDuration =
|
||||
object.commitsDuration !== undefined && object.commitsDuration !== null
|
||||
? Duration.fromPartial(object.commitsDuration)
|
||||
: undefined;
|
||||
message.revealsDuration =
|
||||
object.revealsDuration !== undefined && object.revealsDuration !== null
|
||||
? Duration.fromPartial(object.revealsDuration)
|
||||
: undefined;
|
||||
message.commitFee =
|
||||
object.commitFee !== undefined && object.commitFee !== null
|
||||
? Coin.fromPartial(object.commitFee)
|
||||
: undefined;
|
||||
message.revealFee =
|
||||
object.revealFee !== undefined && object.revealFee !== null
|
||||
? Coin.fromPartial(object.revealFee)
|
||||
: undefined;
|
||||
message.minimumBid =
|
||||
object.minimumBid !== undefined && object.minimumBid !== null
|
||||
? Coin.fromPartial(object.minimumBid)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user