Add service provider auctions (#59)
Some checks failed
Integration Tests / test-integration (push) Successful in 2m29s
E2E Tests / test-e2e (push) Successful in 4m6s
Unit Tests / test-unit (push) Successful in 2m3s
SDK Tests / sdk_tests_authority_auctions (push) Failing after 6m31s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m11s
SDK Tests / sdk_tests (push) Failing after 10m14s
Some checks failed
Integration Tests / test-integration (push) Successful in 2m29s
E2E Tests / test-e2e (push) Successful in 4m6s
Unit Tests / test-unit (push) Successful in 2m3s
SDK Tests / sdk_tests_authority_auctions (push) Failing after 6m31s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 9m11s
SDK Tests / sdk_tests (push) Failing after 10m14s
Part of [Service provider auctions](https://www.notion.so/Service-provider-auctions-a7b63697d818479493ec145ea6ea3c1c) - Add a new type of auction for service providers - Add a command to release provider auction funds - Remove unused auction module params Co-authored-by: IshaVenikar <ishavenikar7@gmail.com> Co-authored-by: Isha Venikar <ishavenikar@Ishas-MacBook-Air.local> Reviewed-on: #59 Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
parent
df43322ef3
commit
52e8d322fa
@ -7,7 +7,7 @@ on:
|
||||
- release/**
|
||||
|
||||
jobs:
|
||||
sdk_tests_auctions:
|
||||
sdk_tests_authority_auctions:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@ -35,6 +35,6 @@ jobs:
|
||||
TEST_AUCTION_ENABLED: true
|
||||
run: docker compose up -d
|
||||
|
||||
- name: Run auction tests
|
||||
- name: Run authority auction tests
|
||||
working-directory: tests/sdk_tests
|
||||
run: ./run-tests.sh test:auctions
|
||||
run: ./run-tests.sh test:authority-auctions
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -23,6 +23,7 @@ const (
|
||||
Msg_CommitBid_FullMethodName = "/cerc.auction.v1.Msg/CommitBid"
|
||||
Msg_RevealBid_FullMethodName = "/cerc.auction.v1.Msg/RevealBid"
|
||||
Msg_UpdateParams_FullMethodName = "/cerc.auction.v1.Msg/UpdateParams"
|
||||
Msg_ReleaseFunds_FullMethodName = "/cerc.auction.v1.Msg/ReleaseFunds"
|
||||
)
|
||||
|
||||
// MsgClient is the client API for Msg service.
|
||||
@ -38,6 +39,8 @@ type MsgClient interface {
|
||||
// UpdateParams defines an operation for updating the x/staking module
|
||||
// parameters.
|
||||
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
|
||||
// ReleaseFunds is the command for paying the winners of provider auctions
|
||||
ReleaseFunds(ctx context.Context, in *MsgReleaseFunds, opts ...grpc.CallOption) (*MsgReleaseFundsResponse, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
@ -84,6 +87,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) ReleaseFunds(ctx context.Context, in *MsgReleaseFunds, opts ...grpc.CallOption) (*MsgReleaseFundsResponse, error) {
|
||||
out := new(MsgReleaseFundsResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_ReleaseFunds_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
// All implementations must embed UnimplementedMsgServer
|
||||
// for forward compatibility
|
||||
@ -97,6 +109,8 @@ type MsgServer interface {
|
||||
// UpdateParams defines an operation for updating the x/staking module
|
||||
// parameters.
|
||||
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
|
||||
// ReleaseFunds is the command for paying the winners of provider auctions
|
||||
ReleaseFunds(context.Context, *MsgReleaseFunds) (*MsgReleaseFundsResponse, error)
|
||||
mustEmbedUnimplementedMsgServer()
|
||||
}
|
||||
|
||||
@ -116,6 +130,9 @@ func (UnimplementedMsgServer) RevealBid(context.Context, *MsgRevealBid) (*MsgRev
|
||||
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) ReleaseFunds(context.Context, *MsgReleaseFunds) (*MsgReleaseFundsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ReleaseFunds not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
|
||||
|
||||
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
|
||||
@ -201,6 +218,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_ReleaseFunds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgReleaseFunds)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).ReleaseFunds(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_ReleaseFunds_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).ReleaseFunds(ctx, req.(*MsgReleaseFunds))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@ -224,6 +259,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "UpdateParams",
|
||||
Handler: _Msg_UpdateParams_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ReleaseFunds",
|
||||
Handler: _Msg_ReleaseFunds_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cerc/auction/v1/tx.proto",
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
@ -20,6 +21,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
"github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/tx"
|
||||
@ -98,7 +100,7 @@ func NewRootCmd() *cobra.Command {
|
||||
|
||||
// overwrite the minimum gas price from the app configuration
|
||||
srvCfg := serverconfig.DefaultConfig()
|
||||
srvCfg.MinGasPrices = "0alnt"
|
||||
srvCfg.MinGasPrices = fmt.Sprintf("0%s", sdk.DefaultBondDenom)
|
||||
|
||||
// overwrite the block timeout
|
||||
cmtCfg := cmtcfg.DefaultConfig()
|
||||
|
@ -1,6 +1,6 @@
|
||||
# cerc-io laconic gql
|
||||
|
||||
> Browser : http://localhost:9473 for gql
|
||||
> Browser : <http://localhost:9473> for gql
|
||||
|
||||
## Run gqlgen
|
||||
|
||||
@ -13,7 +13,7 @@ On having some change in the GQL schema (for example: adding a new query) update
|
||||
go get github.com/99designs/gqlgen@v0.17.22
|
||||
|
||||
# Generate bindings
|
||||
# In gql
|
||||
cd gql
|
||||
go run github.com/99designs/gqlgen generate
|
||||
```
|
||||
|
||||
@ -385,4 +385,4 @@ Query participants:
|
||||
nitroAddress
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
@ -168,10 +168,14 @@ type Auction {
|
||||
commitFee: Coin! # Fee required to bid/participate in the auction.
|
||||
revealFee: Coin! # Reveal fee (paid back to bidders only if they unseal/reveal the bid).
|
||||
minimumBid: Coin! # Minimum bid amount.
|
||||
winnerAddress: String! # Winner address.
|
||||
winnerBid: Coin! # The winning bid amount.
|
||||
winnerAddresses: [String!]! # Winner address.
|
||||
winnerBids: [Coin!]! # The winning bid amount.
|
||||
winnerPrice: Coin! # The price that the winner actually pays (2nd highest bid).
|
||||
bids: [AuctionBid] # Bids make in the auction.
|
||||
maxPrice: Coin! # Max bid amount for service provider auction.
|
||||
kind: String! # Auction kind.
|
||||
numProviders: Int # Number of service providers
|
||||
fundsReleased: Boolean! # Whether funds have been released to providers
|
||||
bids: [AuctionBid!]! # Bids made in the auction.
|
||||
}
|
||||
|
||||
# Record defines the basic properties of an entity in the graph database.
|
||||
|
524
gql/generated.go
524
gql/generated.go
@ -61,19 +61,23 @@ type ComplexityRoot struct {
|
||||
}
|
||||
|
||||
Auction struct {
|
||||
Bids func(childComplexity int) int
|
||||
CommitFee func(childComplexity int) int
|
||||
CommitsEndTime func(childComplexity int) int
|
||||
CreateTime func(childComplexity int) int
|
||||
ID func(childComplexity int) int
|
||||
MinimumBid func(childComplexity int) int
|
||||
OwnerAddress func(childComplexity int) int
|
||||
RevealFee func(childComplexity int) int
|
||||
RevealsEndTime func(childComplexity int) int
|
||||
Status func(childComplexity int) int
|
||||
WinnerAddress func(childComplexity int) int
|
||||
WinnerBid func(childComplexity int) int
|
||||
WinnerPrice func(childComplexity int) int
|
||||
Bids func(childComplexity int) int
|
||||
CommitFee func(childComplexity int) int
|
||||
CommitsEndTime func(childComplexity int) int
|
||||
CreateTime func(childComplexity int) int
|
||||
FundsReleased func(childComplexity int) int
|
||||
ID func(childComplexity int) int
|
||||
Kind func(childComplexity int) int
|
||||
MaxPrice func(childComplexity int) int
|
||||
MinimumBid func(childComplexity int) int
|
||||
NumProviders func(childComplexity int) int
|
||||
OwnerAddress func(childComplexity int) int
|
||||
RevealFee func(childComplexity int) int
|
||||
RevealsEndTime func(childComplexity int) int
|
||||
Status func(childComplexity int) int
|
||||
WinnerAddresses func(childComplexity int) int
|
||||
WinnerBids func(childComplexity int) int
|
||||
WinnerPrice func(childComplexity int) int
|
||||
}
|
||||
|
||||
AuctionBid struct {
|
||||
@ -346,6 +350,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Auction.CreateTime(childComplexity), true
|
||||
|
||||
case "Auction.fundsReleased":
|
||||
if e.complexity.Auction.FundsReleased == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Auction.FundsReleased(childComplexity), true
|
||||
|
||||
case "Auction.id":
|
||||
if e.complexity.Auction.ID == nil {
|
||||
break
|
||||
@ -353,6 +364,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Auction.ID(childComplexity), true
|
||||
|
||||
case "Auction.kind":
|
||||
if e.complexity.Auction.Kind == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Auction.Kind(childComplexity), true
|
||||
|
||||
case "Auction.maxPrice":
|
||||
if e.complexity.Auction.MaxPrice == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Auction.MaxPrice(childComplexity), true
|
||||
|
||||
case "Auction.minimumBid":
|
||||
if e.complexity.Auction.MinimumBid == nil {
|
||||
break
|
||||
@ -360,6 +385,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Auction.MinimumBid(childComplexity), true
|
||||
|
||||
case "Auction.numProviders":
|
||||
if e.complexity.Auction.NumProviders == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Auction.NumProviders(childComplexity), true
|
||||
|
||||
case "Auction.ownerAddress":
|
||||
if e.complexity.Auction.OwnerAddress == nil {
|
||||
break
|
||||
@ -388,19 +420,19 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Auction.Status(childComplexity), true
|
||||
|
||||
case "Auction.winnerAddress":
|
||||
if e.complexity.Auction.WinnerAddress == nil {
|
||||
case "Auction.winnerAddresses":
|
||||
if e.complexity.Auction.WinnerAddresses == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Auction.WinnerAddress(childComplexity), true
|
||||
return e.complexity.Auction.WinnerAddresses(childComplexity), true
|
||||
|
||||
case "Auction.winnerBid":
|
||||
if e.complexity.Auction.WinnerBid == nil {
|
||||
case "Auction.winnerBids":
|
||||
if e.complexity.Auction.WinnerBids == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Auction.WinnerBid(childComplexity), true
|
||||
return e.complexity.Auction.WinnerBids(childComplexity), true
|
||||
|
||||
case "Auction.winnerPrice":
|
||||
if e.complexity.Auction.WinnerPrice == nil {
|
||||
@ -2147,8 +2179,8 @@ func (ec *executionContext) fieldContext_Auction_minimumBid(ctx context.Context,
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Auction_winnerAddress(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Auction_winnerAddress(ctx, field)
|
||||
func (ec *executionContext) _Auction_winnerAddresses(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Auction_winnerAddresses(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
@ -2161,7 +2193,7 @@ func (ec *executionContext) _Auction_winnerAddress(ctx context.Context, field gr
|
||||
}()
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.WinnerAddress, nil
|
||||
return obj.WinnerAddresses, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
@ -2173,12 +2205,12 @@ func (ec *executionContext) _Auction_winnerAddress(ctx context.Context, field gr
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(string)
|
||||
res := resTmp.([]string)
|
||||
fc.Result = res
|
||||
return ec.marshalNString2string(ctx, field.Selections, res)
|
||||
return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Auction_winnerAddress(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
func (ec *executionContext) fieldContext_Auction_winnerAddresses(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "Auction",
|
||||
Field: field,
|
||||
@ -2191,8 +2223,8 @@ func (ec *executionContext) fieldContext_Auction_winnerAddress(ctx context.Conte
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Auction_winnerBid(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Auction_winnerBid(ctx, field)
|
||||
func (ec *executionContext) _Auction_winnerBids(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Auction_winnerBids(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
@ -2205,7 +2237,7 @@ func (ec *executionContext) _Auction_winnerBid(ctx context.Context, field graphq
|
||||
}()
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.WinnerBid, nil
|
||||
return obj.WinnerBids, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
@ -2217,12 +2249,12 @@ func (ec *executionContext) _Auction_winnerBid(ctx context.Context, field graphq
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(*Coin)
|
||||
res := resTmp.([]*Coin)
|
||||
fc.Result = res
|
||||
return ec.marshalNCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx, field.Selections, res)
|
||||
return ec.marshalNCoin2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoinᚄ(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Auction_winnerBid(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
func (ec *executionContext) fieldContext_Auction_winnerBids(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "Auction",
|
||||
Field: field,
|
||||
@ -2291,6 +2323,185 @@ func (ec *executionContext) fieldContext_Auction_winnerPrice(ctx context.Context
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Auction_maxPrice(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Auction_maxPrice(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.MaxPrice, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(*Coin)
|
||||
fc.Result = res
|
||||
return ec.marshalNCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Auction_maxPrice(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "Auction",
|
||||
Field: field,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
switch field.Name {
|
||||
case "type":
|
||||
return ec.fieldContext_Coin_type(ctx, field)
|
||||
case "quantity":
|
||||
return ec.fieldContext_Coin_quantity(ctx, field)
|
||||
}
|
||||
return nil, fmt.Errorf("no field named %q was found under type Coin", field.Name)
|
||||
},
|
||||
}
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Auction_kind(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Auction_kind(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.Kind, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(string)
|
||||
fc.Result = res
|
||||
return ec.marshalNString2string(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Auction_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "Auction",
|
||||
Field: field,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
return nil, errors.New("field of type String does not have child fields")
|
||||
},
|
||||
}
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Auction_numProviders(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Auction_numProviders(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.NumProviders, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(*int)
|
||||
fc.Result = res
|
||||
return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Auction_numProviders(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "Auction",
|
||||
Field: field,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
return nil, errors.New("field of type Int does not have child fields")
|
||||
},
|
||||
}
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Auction_fundsReleased(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Auction_fundsReleased(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.FundsReleased, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(bool)
|
||||
fc.Result = res
|
||||
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Auction_fundsReleased(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "Auction",
|
||||
Field: field,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
return nil, errors.New("field of type Boolean does not have child fields")
|
||||
},
|
||||
}
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Auction_bids(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Auction_bids(ctx, field)
|
||||
if err != nil {
|
||||
@ -2312,11 +2523,14 @@ func (ec *executionContext) _Auction_bids(ctx context.Context, field graphql.Col
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.([]*AuctionBid)
|
||||
fc.Result = res
|
||||
return ec.marshalOAuctionBid2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBid(ctx, field.Selections, res)
|
||||
return ec.marshalNAuctionBid2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBidᚄ(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Auction_bids(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
@ -3142,12 +3356,20 @@ func (ec *executionContext) fieldContext_AuthorityRecord_auction(ctx context.Con
|
||||
return ec.fieldContext_Auction_revealFee(ctx, field)
|
||||
case "minimumBid":
|
||||
return ec.fieldContext_Auction_minimumBid(ctx, field)
|
||||
case "winnerAddress":
|
||||
return ec.fieldContext_Auction_winnerAddress(ctx, field)
|
||||
case "winnerBid":
|
||||
return ec.fieldContext_Auction_winnerBid(ctx, field)
|
||||
case "winnerAddresses":
|
||||
return ec.fieldContext_Auction_winnerAddresses(ctx, field)
|
||||
case "winnerBids":
|
||||
return ec.fieldContext_Auction_winnerBids(ctx, field)
|
||||
case "winnerPrice":
|
||||
return ec.fieldContext_Auction_winnerPrice(ctx, field)
|
||||
case "maxPrice":
|
||||
return ec.fieldContext_Auction_maxPrice(ctx, field)
|
||||
case "kind":
|
||||
return ec.fieldContext_Auction_kind(ctx, field)
|
||||
case "numProviders":
|
||||
return ec.fieldContext_Auction_numProviders(ctx, field)
|
||||
case "fundsReleased":
|
||||
return ec.fieldContext_Auction_fundsReleased(ctx, field)
|
||||
case "bids":
|
||||
return ec.fieldContext_Auction_bids(ctx, field)
|
||||
}
|
||||
@ -5129,12 +5351,20 @@ func (ec *executionContext) fieldContext_Query_getAuctionsByIds(ctx context.Cont
|
||||
return ec.fieldContext_Auction_revealFee(ctx, field)
|
||||
case "minimumBid":
|
||||
return ec.fieldContext_Auction_minimumBid(ctx, field)
|
||||
case "winnerAddress":
|
||||
return ec.fieldContext_Auction_winnerAddress(ctx, field)
|
||||
case "winnerBid":
|
||||
return ec.fieldContext_Auction_winnerBid(ctx, field)
|
||||
case "winnerAddresses":
|
||||
return ec.fieldContext_Auction_winnerAddresses(ctx, field)
|
||||
case "winnerBids":
|
||||
return ec.fieldContext_Auction_winnerBids(ctx, field)
|
||||
case "winnerPrice":
|
||||
return ec.fieldContext_Auction_winnerPrice(ctx, field)
|
||||
case "maxPrice":
|
||||
return ec.fieldContext_Auction_maxPrice(ctx, field)
|
||||
case "kind":
|
||||
return ec.fieldContext_Auction_kind(ctx, field)
|
||||
case "numProviders":
|
||||
return ec.fieldContext_Auction_numProviders(ctx, field)
|
||||
case "fundsReleased":
|
||||
return ec.fieldContext_Auction_fundsReleased(ctx, field)
|
||||
case "bids":
|
||||
return ec.fieldContext_Auction_bids(ctx, field)
|
||||
}
|
||||
@ -8710,16 +8940,16 @@ func (ec *executionContext) _Auction(ctx context.Context, sel ast.SelectionSet,
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "winnerAddress":
|
||||
case "winnerAddresses":
|
||||
|
||||
out.Values[i] = ec._Auction_winnerAddress(ctx, field, obj)
|
||||
out.Values[i] = ec._Auction_winnerAddresses(ctx, field, obj)
|
||||
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "winnerBid":
|
||||
case "winnerBids":
|
||||
|
||||
out.Values[i] = ec._Auction_winnerBid(ctx, field, obj)
|
||||
out.Values[i] = ec._Auction_winnerBids(ctx, field, obj)
|
||||
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
@ -8728,6 +8958,31 @@ func (ec *executionContext) _Auction(ctx context.Context, sel ast.SelectionSet,
|
||||
|
||||
out.Values[i] = ec._Auction_winnerPrice(ctx, field, obj)
|
||||
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "maxPrice":
|
||||
|
||||
out.Values[i] = ec._Auction_maxPrice(ctx, field, obj)
|
||||
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "kind":
|
||||
|
||||
out.Values[i] = ec._Auction_kind(ctx, field, obj)
|
||||
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "numProviders":
|
||||
|
||||
out.Values[i] = ec._Auction_numProviders(ctx, field, obj)
|
||||
|
||||
case "fundsReleased":
|
||||
|
||||
out.Values[i] = ec._Auction_fundsReleased(ctx, field, obj)
|
||||
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
@ -8735,6 +8990,9 @@ func (ec *executionContext) _Auction(ctx context.Context, sel ast.SelectionSet,
|
||||
|
||||
out.Values[i] = ec._Auction_bids(ctx, field, obj)
|
||||
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
default:
|
||||
panic("unknown field " + strconv.Quote(field.Name))
|
||||
}
|
||||
@ -10389,6 +10647,60 @@ func (ec *executionContext) marshalNAttribute2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋla
|
||||
return ec._Attribute(ctx, sel, v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNAuctionBid2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBidᚄ(ctx context.Context, sel ast.SelectionSet, v []*AuctionBid) graphql.Marshaler {
|
||||
ret := make(graphql.Array, len(v))
|
||||
var wg sync.WaitGroup
|
||||
isLen1 := len(v) == 1
|
||||
if !isLen1 {
|
||||
wg.Add(len(v))
|
||||
}
|
||||
for i := range v {
|
||||
i := i
|
||||
fc := &graphql.FieldContext{
|
||||
Index: &i,
|
||||
Result: &v[i],
|
||||
}
|
||||
ctx := graphql.WithFieldContext(ctx, fc)
|
||||
f := func(i int) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = nil
|
||||
}
|
||||
}()
|
||||
if !isLen1 {
|
||||
defer wg.Done()
|
||||
}
|
||||
ret[i] = ec.marshalNAuctionBid2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBid(ctx, sel, v[i])
|
||||
}
|
||||
if isLen1 {
|
||||
f(i)
|
||||
} else {
|
||||
go f(i)
|
||||
}
|
||||
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
for _, e := range ret {
|
||||
if e == graphql.Null {
|
||||
return graphql.Null
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNAuctionBid2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBid(ctx context.Context, sel ast.SelectionSet, v *AuctionBid) graphql.Marshaler {
|
||||
if v == nil {
|
||||
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
return ec._AuctionBid(ctx, sel, v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNAuthority2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx context.Context, sel ast.SelectionSet, v []*Authority) graphql.Marshaler {
|
||||
ret := make(graphql.Array, len(v))
|
||||
var wg sync.WaitGroup
|
||||
@ -10500,6 +10812,50 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se
|
||||
return res
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNCoin2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoinᚄ(ctx context.Context, sel ast.SelectionSet, v []*Coin) graphql.Marshaler {
|
||||
ret := make(graphql.Array, len(v))
|
||||
var wg sync.WaitGroup
|
||||
isLen1 := len(v) == 1
|
||||
if !isLen1 {
|
||||
wg.Add(len(v))
|
||||
}
|
||||
for i := range v {
|
||||
i := i
|
||||
fc := &graphql.FieldContext{
|
||||
Index: &i,
|
||||
Result: &v[i],
|
||||
}
|
||||
ctx := graphql.WithFieldContext(ctx, fc)
|
||||
f := func(i int) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = nil
|
||||
}
|
||||
}()
|
||||
if !isLen1 {
|
||||
defer wg.Done()
|
||||
}
|
||||
ret[i] = ec.marshalNCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx, sel, v[i])
|
||||
}
|
||||
if isLen1 {
|
||||
f(i)
|
||||
} else {
|
||||
go f(i)
|
||||
}
|
||||
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
for _, e := range ret {
|
||||
if e == graphql.Null {
|
||||
return graphql.Null
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx context.Context, sel ast.SelectionSet, v *Coin) graphql.Marshaler {
|
||||
if v == nil {
|
||||
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||
@ -10732,6 +11088,38 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S
|
||||
return res
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalNString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) {
|
||||
var vSlice []interface{}
|
||||
if v != nil {
|
||||
vSlice = graphql.CoerceList(v)
|
||||
}
|
||||
var err error
|
||||
res := make([]string, len(vSlice))
|
||||
for i := range vSlice {
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
|
||||
res[i], err = ec.unmarshalNString2string(ctx, vSlice[i])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler {
|
||||
ret := make(graphql.Array, len(v))
|
||||
for i := range v {
|
||||
ret[i] = ec.marshalNString2string(ctx, sel, v[i])
|
||||
}
|
||||
|
||||
for _, e := range ret {
|
||||
if e == graphql.Null {
|
||||
return graphql.Null
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNSyncInfo2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐSyncInfo(ctx context.Context, sel ast.SelectionSet, v *SyncInfo) graphql.Marshaler {
|
||||
if v == nil {
|
||||
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||
@ -11214,54 +11602,6 @@ func (ec *executionContext) marshalOAuction2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaco
|
||||
return ec._Auction(ctx, sel, v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalOAuctionBid2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBid(ctx context.Context, sel ast.SelectionSet, v []*AuctionBid) graphql.Marshaler {
|
||||
if v == nil {
|
||||
return graphql.Null
|
||||
}
|
||||
ret := make(graphql.Array, len(v))
|
||||
var wg sync.WaitGroup
|
||||
isLen1 := len(v) == 1
|
||||
if !isLen1 {
|
||||
wg.Add(len(v))
|
||||
}
|
||||
for i := range v {
|
||||
i := i
|
||||
fc := &graphql.FieldContext{
|
||||
Index: &i,
|
||||
Result: &v[i],
|
||||
}
|
||||
ctx := graphql.WithFieldContext(ctx, fc)
|
||||
f := func(i int) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = nil
|
||||
}
|
||||
}()
|
||||
if !isLen1 {
|
||||
defer wg.Done()
|
||||
}
|
||||
ret[i] = ec.marshalOAuctionBid2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBid(ctx, sel, v[i])
|
||||
}
|
||||
if isLen1 {
|
||||
f(i)
|
||||
} else {
|
||||
go f(i)
|
||||
}
|
||||
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalOAuctionBid2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBid(ctx context.Context, sel ast.SelectionSet, v *AuctionBid) graphql.Marshaler {
|
||||
if v == nil {
|
||||
return graphql.Null
|
||||
}
|
||||
return ec._AuctionBid(ctx, sel, v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalOAuthority2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx context.Context, sel ast.SelectionSet, v *Authority) graphql.Marshaler {
|
||||
if v == nil {
|
||||
return graphql.Null
|
||||
|
@ -26,19 +26,23 @@ type Attribute struct {
|
||||
}
|
||||
|
||||
type Auction struct {
|
||||
ID string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
OwnerAddress string `json:"ownerAddress"`
|
||||
CreateTime string `json:"createTime"`
|
||||
CommitsEndTime string `json:"commitsEndTime"`
|
||||
RevealsEndTime string `json:"revealsEndTime"`
|
||||
CommitFee *Coin `json:"commitFee"`
|
||||
RevealFee *Coin `json:"revealFee"`
|
||||
MinimumBid *Coin `json:"minimumBid"`
|
||||
WinnerAddress string `json:"winnerAddress"`
|
||||
WinnerBid *Coin `json:"winnerBid"`
|
||||
WinnerPrice *Coin `json:"winnerPrice"`
|
||||
Bids []*AuctionBid `json:"bids"`
|
||||
ID string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
OwnerAddress string `json:"ownerAddress"`
|
||||
CreateTime string `json:"createTime"`
|
||||
CommitsEndTime string `json:"commitsEndTime"`
|
||||
RevealsEndTime string `json:"revealsEndTime"`
|
||||
CommitFee *Coin `json:"commitFee"`
|
||||
RevealFee *Coin `json:"revealFee"`
|
||||
MinimumBid *Coin `json:"minimumBid"`
|
||||
WinnerAddresses []string `json:"winnerAddresses"`
|
||||
WinnerBids []*Coin `json:"winnerBids"`
|
||||
WinnerPrice *Coin `json:"winnerPrice"`
|
||||
MaxPrice *Coin `json:"maxPrice"`
|
||||
Kind string `json:"kind"`
|
||||
NumProviders *int `json:"numProviders"`
|
||||
FundsReleased bool `json:"fundsReleased"`
|
||||
Bids []*AuctionBid `json:"bids"`
|
||||
}
|
||||
|
||||
type AuctionBid struct {
|
||||
|
30
gql/util.go
30
gql/util.go
@ -232,19 +232,25 @@ func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*Au
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
numProviders := int(auction.NumProviders)
|
||||
|
||||
gqlAuction := Auction{
|
||||
ID: auction.Id,
|
||||
Status: auction.Status,
|
||||
OwnerAddress: auction.OwnerAddress,
|
||||
CreateTime: auction.GetCreateTime(),
|
||||
CommitsEndTime: auction.GetCommitsEndTime(),
|
||||
RevealsEndTime: auction.GetRevealsEndTime(),
|
||||
CommitFee: getGQLCoin(auction.CommitFee),
|
||||
RevealFee: getGQLCoin(auction.RevealFee),
|
||||
MinimumBid: getGQLCoin(auction.MinimumBid),
|
||||
WinnerAddress: auction.WinnerAddress,
|
||||
WinnerBid: getGQLCoin(auction.WinningBid),
|
||||
WinnerPrice: getGQLCoin(auction.WinningPrice),
|
||||
ID: auction.Id,
|
||||
Status: auction.Status,
|
||||
OwnerAddress: auction.OwnerAddress,
|
||||
CreateTime: auction.GetCreateTime(),
|
||||
CommitsEndTime: auction.GetCommitsEndTime(),
|
||||
RevealsEndTime: auction.GetRevealsEndTime(),
|
||||
CommitFee: getGQLCoin(auction.CommitFee),
|
||||
RevealFee: getGQLCoin(auction.RevealFee),
|
||||
MinimumBid: getGQLCoin(auction.MinimumBid),
|
||||
WinnerAddresses: auction.WinnerAddresses,
|
||||
WinnerBids: getGQLCoins(auction.WinningBids),
|
||||
WinnerPrice: getGQLCoin(auction.WinningPrice),
|
||||
MaxPrice: getGQLCoin(auction.MaxPrice),
|
||||
Kind: auction.Kind,
|
||||
NumProviders: &numProviders,
|
||||
FundsReleased: auction.FundsReleased,
|
||||
}
|
||||
|
||||
auctionBids := make([]*AuctionBid, len(bids))
|
||||
|
@ -3,76 +3,44 @@ 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
|
||||
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 {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
string id = 1;
|
||||
string status = 2;
|
||||
|
||||
// Auction kind (vickrey | provider)
|
||||
string kind = 2 [ (gogoproto.moretags) = "json:\"kind\" yaml:\"kind\"" ];
|
||||
|
||||
string status = 3;
|
||||
|
||||
// Address of the creator of the auction
|
||||
string owner_address = 3;
|
||||
string owner_address = 4;
|
||||
|
||||
// Timestamp at which the auction was created
|
||||
google.protobuf.Timestamp create_time = 4 [
|
||||
google.protobuf.Timestamp create_time = 5 [
|
||||
(gogoproto.stdtime) = true,
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"create_time\" yaml:\"create_time\""
|
||||
];
|
||||
|
||||
// Timestamp at which the commits phase concluded
|
||||
google.protobuf.Timestamp commits_end_time = 5 [
|
||||
google.protobuf.Timestamp commits_end_time = 6 [
|
||||
(gogoproto.stdtime) = true,
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"commits_end_time\" yaml:\"commits_end_time\""
|
||||
];
|
||||
|
||||
// Timestamp at which the reveals phase concluded
|
||||
google.protobuf.Timestamp reveals_end_time = 6 [
|
||||
google.protobuf.Timestamp reveals_end_time = 7 [
|
||||
(gogoproto.stdtime) = true,
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"reveals_end_time\" yaml:\"reveals_end_time\""
|
||||
@ -80,35 +48,58 @@ message Auction {
|
||||
|
||||
// Commit and reveal fees must both be paid when committing a bid
|
||||
// Reveal fee is returned only if the bid is revealed
|
||||
cosmos.base.v1beta1.Coin commit_fee = 7 [
|
||||
cosmos.base.v1beta1.Coin commit_fee = 8 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\""
|
||||
];
|
||||
cosmos.base.v1beta1.Coin reveal_fee = 8 [
|
||||
cosmos.base.v1beta1.Coin reveal_fee = 9 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
|
||||
];
|
||||
|
||||
// Minimum acceptable bid amount for a valid commit
|
||||
cosmos.base.v1beta1.Coin minimum_bid = 9 [
|
||||
// Only applicable in vickrey auctions
|
||||
cosmos.base.v1beta1.Coin minimum_bid = 10 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
|
||||
];
|
||||
|
||||
// Address of the winner
|
||||
string winner_address = 10;
|
||||
// Addresses of the winners
|
||||
// (single winner for vickrey auction)
|
||||
// (multiple winners for provider auctions)
|
||||
repeated string winner_addresses = 11;
|
||||
|
||||
// Winning bid, i.e., the highest bid
|
||||
cosmos.base.v1beta1.Coin winning_bid = 11 [
|
||||
// Winning bids, i.e. the best bids
|
||||
repeated cosmos.base.v1beta1.Coin winning_bids = 12 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.moretags) = "json:\"winning_bid\" yaml:\"winning_bid\""
|
||||
(gogoproto.moretags) = "json:\"winning_bids\" yaml:\"winning_bids\""
|
||||
];
|
||||
|
||||
// Amount the winner pays, i.e. the second highest auction
|
||||
cosmos.base.v1beta1.Coin winning_price = 12 [
|
||||
// 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 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 desired providers (num of auction winners)
|
||||
// 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\"" ];
|
||||
}
|
||||
|
||||
// Auctions represent all the auctions in the module
|
||||
|
@ -34,6 +34,11 @@ service Msg {
|
||||
// UpdateParams defines an operation for updating the x/staking module
|
||||
// parameters.
|
||||
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
|
||||
|
||||
// ReleaseFunds is the command for paying the winners of provider auctions
|
||||
rpc ReleaseFunds(MsgReleaseFunds) returns (MsgReleaseFundsResponse) {
|
||||
option (google.api.http).post = "/cerc/auction/v1/release_funds";
|
||||
};
|
||||
}
|
||||
|
||||
// MsgCreateAuction defines a create auction message
|
||||
@ -41,41 +46,56 @@ 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
|
||||
cosmos.base.v1beta1.Coin minimum_bid = 5 [
|
||||
// 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\"" ];
|
||||
// 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 desired providers (num of auction winners)
|
||||
// Only applicable in provider auctions
|
||||
int32 num_providers = 9;
|
||||
}
|
||||
|
||||
// MsgCreateAuctionResponse returns the details of the created auction
|
||||
@ -157,3 +177,27 @@ message MsgUpdateParams {
|
||||
// MsgUpdateParamsResponse defines the response structure for executing a
|
||||
// MsgUpdateParams message.
|
||||
message MsgUpdateParamsResponse {};
|
||||
|
||||
// ReleaseFunds defines the message to pay the winners of provider auctions
|
||||
message MsgReleaseFunds {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
option (cosmos.msg.v1.signer) = "signer";
|
||||
|
||||
// Auction id
|
||||
string auction_id = 1
|
||||
[ (gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\"" ];
|
||||
|
||||
// Address of the signer
|
||||
string signer = 2
|
||||
[ (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" ];
|
||||
}
|
||||
|
||||
// MsgReleaseFundsResponse returns the state of the auction after releasing the
|
||||
// funds
|
||||
message MsgReleaseFundsResponse {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// Auction details
|
||||
Auction auction = 1
|
||||
[ (gogoproto.moretags) = "json:\"auction\" yaml:\"auction\"" ];
|
||||
}
|
||||
|
@ -103,10 +103,13 @@ func (ets *E2ETestSuite) createAuctionAndBid(createAuction, createBid bool) stri
|
||||
|
||||
if createAuction {
|
||||
auctionArgs := []string{
|
||||
types.AuctionKindVickrey,
|
||||
sampleCommitTime, sampleRevealTime,
|
||||
fmt.Sprintf("10%s", ets.cfg.BondDenom),
|
||||
fmt.Sprintf("10%s", ets.cfg.BondDenom),
|
||||
fmt.Sprintf("100%s", ets.cfg.BondDenom),
|
||||
fmt.Sprintf("0%s", ets.cfg.BondDenom),
|
||||
"0",
|
||||
}
|
||||
|
||||
resp, err := ets.executeTx(cli.GetCmdCreateAuction(), auctionArgs, ownerAccount)
|
||||
|
@ -46,10 +46,13 @@ func (ets *E2ETestSuite) TestTxCommitBid() {
|
||||
ets.Run(fmt.Sprintf("Case %s", test.msg), func() {
|
||||
if test.createAuction {
|
||||
auctionArgs := []string{
|
||||
auctiontypes.AuctionKindVickrey,
|
||||
sampleCommitTime, sampleRevealTime,
|
||||
fmt.Sprintf("10%s", ets.cfg.BondDenom),
|
||||
fmt.Sprintf("10%s", ets.cfg.BondDenom),
|
||||
fmt.Sprintf("100%s", ets.cfg.BondDenom),
|
||||
fmt.Sprintf("0%s", ets.cfg.BondDenom),
|
||||
"0",
|
||||
}
|
||||
|
||||
resp, err := ets.executeTx(cli.GetCmdCreateAuction(), auctionArgs, ownerAccount)
|
||||
|
@ -3,9 +3,12 @@ package keeper_test
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
sdkmath "cosmossdk.io/math"
|
||||
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
integrationTest "git.vdb.to/cerc-io/laconicd/tests/integration"
|
||||
types "git.vdb.to/cerc-io/laconicd/x/auction"
|
||||
@ -284,6 +287,7 @@ func (kts *KeeperTestSuite) TestGrpcGetAuctionsByOwner() {
|
||||
}
|
||||
|
||||
func (kts *KeeperTestSuite) TestGrpcQueryBalance() {
|
||||
|
||||
testCases := []struct {
|
||||
msg string
|
||||
req *types.QueryGetAuctionModuleBalanceRequest
|
||||
@ -326,12 +330,18 @@ func (kts *KeeperTestSuite) createAuctionAndCommitBid(commitBid bool) (*types.Au
|
||||
// Create funded account(s)
|
||||
accounts := simtestutil.AddTestAddrs(kts.BankKeeper, integrationTest.BondDenomProvider{}, ctx, accCount, math.NewInt(1000000))
|
||||
|
||||
params, err := k.GetParams(ctx)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
auction, err := k.CreateAuction(ctx, types.NewMsgCreateAuction(*params, accounts[0]))
|
||||
auction, err := k.CreateAuction(
|
||||