Add methods for creating auctions and add auction tests #28
@ -53,7 +53,7 @@ message Auction {
|
||||
|
||||
string id = 1;
|
||||
|
||||
// Auction's kind (vickrey | service_provider)
|
||||
// Auction's kind (vickrey | provider)
|
||||
string kind = 2 [
|
||||
(gogoproto.moretags) = "json:\"kind\" yaml:\"kind\""
|
||||
];
|
||||
@ -101,7 +101,7 @@ message Auction {
|
||||
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
|
||||
];
|
||||
|
||||
// Addresses of the winners (one for vickrey and can be multiple for service_provider)
|
||||
// Addresses of the winners (one for vickrey auctions and can be multiple for provider auctions)
|
||||
repeated string winner_addresses = 11;
|
||||
|
||||
// Winning bids, i.e., the best bids
|
||||
|
@ -77,7 +77,7 @@ message MsgCreateAuction {
|
||||
string signer = 6
|
||||
[ (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" ];
|
||||
|
||||
// Auction's kind (vickrey | service_provider)
|
||||
// Auction's kind (vickrey | provider)
|
||||
string kind = 7 [
|
||||
(gogoproto.moretags) = "json:\"kind\" yaml:\"kind\""
|
||||
];
|
||||
|
@ -71,7 +71,6 @@ const createAuctionTests = () => {
|
||||
commitFee,
|
||||
revealFee,
|
||||
minimumBid,
|
||||
kind: 'vickrey',
|
||||
signer: auctionCreatorAccount.address
|
||||
},
|
||||
auctionCreatorAccount.privateKey, fee);
|
||||
@ -174,13 +173,12 @@ const createSPAuctionTests = () => {
|
||||
amount: '100000000'
|
||||
};
|
||||
|
||||
const auction = await registry.createServiceProviderAuction({
|
||||
const auction = await registry.createProviderAuction({
|
||||
commitsDuration,
|
||||
revealsDuration,
|
||||
commitFee,
|
||||
revealFee,
|
||||
signer: auctionCreatorAccount.address,
|
||||
kind: 'service_provider',
|
||||
maxPrice,
|
||||
numProviders: 3
|
||||
},
|
||||
|
13
src/index.ts
13
src/index.ts
@ -23,6 +23,7 @@ import {
|
||||
import {
|
||||
MessageMsgCommitBid,
|
||||
MessageMsgRevealBid,
|
||||
MsgCreateProviderAuction,
|
||||
MsgCreateVickreyAuction
|
||||
} from './types/cerc/auction/message';
|
||||
import { MessageMsgSendCoins } from './types/cosmos/bank/message';
|
||||
@ -508,8 +509,7 @@ export class Registry {
|
||||
commitFee,
|
||||
revealFee,
|
||||
minimumBid,
|
||||
signer,
|
||||
kind
|
||||
signer
|
||||
}: MsgCreateVickreyAuction,
|
||||
privateKey: string,
|
||||
fee: StdFee | number = DEFAULT_GAS_ESTIMATION_MULTIPLIER): Promise<MsgCreateAuctionResponse> {
|
||||
@ -524,7 +524,7 @@ export class Registry {
|
||||
revealFee,
|
||||
minimumBid,
|
||||
signer,
|
||||
kind,
|
||||
'vickrey',
|
||||
undefined,
|
||||
0,
|
||||
fee,
|
||||
@ -532,16 +532,15 @@ export class Registry {
|
||||
);
|
||||
}
|
||||
|
||||
async createServiceProviderAuction ({
|
||||
async createProviderAuction ({
|
||||
commitsDuration,
|
||||
revealsDuration,
|
||||
commitFee,
|
||||
revealFee,
|
||||
signer,
|
||||
kind,
|
||||
maxPrice,
|
||||
numProviders
|
||||
}: MsgCreateAuction,
|
||||
}: MsgCreateProviderAuction,
|
||||
privateKey: string,
|
||||
fee: StdFee | number = DEFAULT_GAS_ESTIMATION_MULTIPLIER): Promise<MsgCreateAuctionResponse> {
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
@ -555,7 +554,7 @@ export class Registry {
|
||||
revealFee,
|
||||
undefined,
|
||||
signer,
|
||||
kind,
|
||||
'provider',
|
||||
maxPrice,
|
||||
numProviders,
|
||||
fee,
|
||||
|
@ -24,7 +24,7 @@ export interface Params {
|
||||
/** Auction represents a sealed-bid on-chain auction */
|
||||
export interface Auction {
|
||||
id: string;
|
||||
/** Auction's kind (vickrey | service_provider) */
|
||||
/** Auction's kind (vickrey | provider) */
|
||||
kind: string;
|
||||
status: string;
|
||||
/** Address of the creator of the auction */
|
||||
@ -43,7 +43,7 @@ export interface Auction {
|
||||
revealFee?: Coin;
|
||||
/** Minimum acceptable bid amount for a valid commit */
|
||||
minimumBid?: Coin;
|
||||
/** Addresses of the winners (one for vickrey and can be multiple for service_provider) */
|
||||
/** Addresses of the winners (one for vickrey auctions and can be multiple for provider auctions) */
|
||||
winnerAddresses: string[];
|
||||
/** Winning bids, i.e., the best bids */
|
||||
winningBids: Coin[];
|
||||
|
@ -21,7 +21,7 @@ export interface MsgCreateAuction {
|
||||
minimumBid?: Coin;
|
||||
/** Address of the signer */
|
||||
signer: string;
|
||||
/** Auction's kind (vickrey | service_provider) */
|
||||
/** Auction's kind (vickrey | provider) */
|
||||
kind: string;
|
||||
/** Maximum acceptable bid amount (for service provider auctions) */
|
||||
maxPrice?: Coin;
|
||||
|
@ -46,11 +46,20 @@ export interface MessageMsgRevealBid {
|
||||
}
|
||||
|
||||
export interface MsgCreateVickreyAuction {
|
||||
commitsDuration?: Duration;
|
||||
revealsDuration?: Duration;
|
||||
commitFee?: Coin;
|
||||
revealFee?: Coin;
|
||||
minimumBid?: Coin;
|
||||
commitsDuration: Duration;
|
||||
revealsDuration: Duration;
|
||||
commitFee: Coin;
|
||||
revealFee: Coin;
|
||||
minimumBid: Coin;
|
||||
signer: string;
|
||||
}
|
||||
|
||||
export interface MsgCreateProviderAuction {
|
||||
commitsDuration: Duration;
|
||||
revealsDuration: Duration;
|
||||
commitFee: Coin;
|
||||
revealFee: Coin;
|
||||
maxPrice: Coin;
|
||||
numProviders: number;
|
||||
signer: string;
|
||||
kind: string;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user