Add service provider auctions #59
@ -3564,6 +3564,8 @@ type Auction struct {
|
||||
// Number of desired providers (num of auction winners)
|
||||
// Only applicable in provider auctions
|
||||
NumProviders int32 `protobuf:"varint,15,opt,name=num_providers,json=numProviders,proto3" json:"num_providers,omitempty"`
|
||||
// Whether funds have been released to providers
|
||||
// Only applicable in provider auctions
|
||||
FundsReleased bool `protobuf:"varint,16,opt,name=funds_released,json=fundsReleased,proto3" json:"funds_released,omitempty"`
|
||||
}
|
||||
|
||||
|
@ -95,6 +95,8 @@ message Auction {
|
||||
// Only applicable in provider auctions
|
||||
int32 num_providers = 15;
|
||||
|
||||
// Whether funds have been released to providers
|
||||
// Only applicable in provider auctions
|
||||
bool funds_released = 16
|
||||
[ (gogoproto.moretags) =
|
||||
"json:\"funds_released\" yaml:\"funds_released\"" ];
|
||||
|
@ -103,6 +103,8 @@ type Auction struct {
|
||||
// Number of desired providers (num of auction winners)
|
||||
// Only applicable in provider auctions
|
||||
NumProviders int32 `protobuf:"varint,15,opt,name=num_providers,json=numProviders,proto3" json:"num_providers,omitempty"`
|
||||
// Whether funds have been released to providers
|
||||
// Only applicable in provider auctions
|
||||
FundsReleased bool `protobuf:"varint,16,opt,name=funds_released,json=fundsReleased,proto3" json:"funds_released,omitempty" json:"funds_released" yaml:"funds_released"`
|
||||
}
|
||||
|
||||
|
@ -931,14 +931,14 @@ func (k Keeper) ReleaseFunds(ctx sdk.Context, msg auctiontypes.MsgReleaseFunds)
|
||||
|
||||
// Only the auction owner can release funds.
|
||||
if msg.Signer != auction.OwnerAddress {
|
||||
return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Auction owner mismatch.")
|
||||
return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Only auction owner can release funds.")
|
||||
}
|
||||
|
||||
if auction.Status != auctiontypes.AuctionStatusCompleted {
|
||||
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Auction is not completed.")
|
||||
}
|
||||
|
||||
if auction.Status == auctiontypes.AuctionStatusFundsReleased {
|
||||
if auction.FundsReleased {
|
||||
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Auction funds already released.")
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,6 @@ const (
|
||||
|
||||
// Auction has completed (winner selected).
|
||||
AuctionStatusCompleted = "completed"
|
||||
|
||||
// Auction has completed (winner selected).
|
||||
AuctionStatusFundsReleased = "funds_released"
|
||||
)
|
||||
|
||||
// Bid status values.
|
||||
|
Loading…
Reference in New Issue
Block a user