Compare commits

..

5 Commits

Author SHA1 Message Date
IshaVenikar
5bd048bde1 Fix lint errors 2024-09-02 12:19:47 +05:30
IshaVenikar
864d60200f Add a method to update auction module params 2024-09-02 11:55:34 +05:30
IshaVenikar
50839ebc01 Add a method to update registry module params 2024-09-02 10:37:58 +05:30
0716ec64df Add a method to update bond module params 2024-09-02 10:37:58 +05:30
IshaVenikar
28969fec1d Enable governance module 2024-08-22 15:57:43 +05:30
40 changed files with 2432 additions and 4695 deletions

View File

@ -7,7 +7,7 @@ on:
- release/** - release/**
jobs: jobs:
sdk_tests_authority_auctions: sdk_tests_auctions:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -35,6 +35,6 @@ jobs:
TEST_AUCTION_ENABLED: true TEST_AUCTION_ENABLED: true
run: docker compose up -d run: docker compose up -d
- name: Run authority auction tests - name: Run auction tests
working-directory: tests/sdk_tests working-directory: tests/sdk_tests
run: ./run-tests.sh test:authority-auctions run: ./run-tests.sh test:auctions

View File

@ -19,7 +19,7 @@ FROM ubuntu:22.04
# Install ca-certificates, jq, curl, bash, and other necessary packages # Install ca-certificates, jq, curl, bash, and other necessary packages
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \ ca-certificates \
jq curl netcat bash bc \ jq curl netcat bash \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Copy over binary from the builder # Copy over binary from the builder

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,6 @@ const (
Msg_CommitBid_FullMethodName = "/cerc.auction.v1.Msg/CommitBid" Msg_CommitBid_FullMethodName = "/cerc.auction.v1.Msg/CommitBid"
Msg_RevealBid_FullMethodName = "/cerc.auction.v1.Msg/RevealBid" Msg_RevealBid_FullMethodName = "/cerc.auction.v1.Msg/RevealBid"
Msg_UpdateParams_FullMethodName = "/cerc.auction.v1.Msg/UpdateParams" Msg_UpdateParams_FullMethodName = "/cerc.auction.v1.Msg/UpdateParams"
Msg_ReleaseFunds_FullMethodName = "/cerc.auction.v1.Msg/ReleaseFunds"
) )
// MsgClient is the client API for Msg service. // MsgClient is the client API for Msg service.
@ -39,8 +38,6 @@ type MsgClient interface {
// UpdateParams defines an operation for updating the x/staking module // UpdateParams defines an operation for updating the x/staking module
// parameters. // parameters.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) 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 { type msgClient struct {
@ -87,15 +84,6 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
return out, nil 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. // MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer // All implementations must embed UnimplementedMsgServer
// for forward compatibility // for forward compatibility
@ -109,8 +97,6 @@ type MsgServer interface {
// UpdateParams defines an operation for updating the x/staking module // UpdateParams defines an operation for updating the x/staking module
// parameters. // parameters.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// ReleaseFunds is the command for paying the winners of provider auctions
ReleaseFunds(context.Context, *MsgReleaseFunds) (*MsgReleaseFundsResponse, error)
mustEmbedUnimplementedMsgServer() mustEmbedUnimplementedMsgServer()
} }
@ -130,9 +116,6 @@ func (UnimplementedMsgServer) RevealBid(context.Context, *MsgRevealBid) (*MsgRev
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") 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() {} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
@ -218,24 +201,6 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler) 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. // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
@ -259,10 +224,6 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "UpdateParams", MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler, Handler: _Msg_UpdateParams_Handler,
}, },
{
MethodName: "ReleaseFunds",
Handler: _Msg_ReleaseFunds_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "cerc/auction/v1/tx.proto", Metadata: "cerc/auction/v1/tx.proto",

View File

@ -34,11 +34,7 @@ import (
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
"github.com/cosmos/cosmos-sdk/x/genutil" "github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
@ -53,6 +49,7 @@ import (
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/gov" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects
@ -116,11 +113,6 @@ func AppConfig() depinject.Config {
// supply custom module basics // supply custom module basics
map[string]module.AppModuleBasic{ map[string]module.AppModuleBasic{
genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
govtypes.ModuleName: gov.NewAppModuleBasic(
[]govclient.ProposalHandler{
paramsclient.ProposalHandler,
},
),
}, },
), ),
) )

View File

@ -26,7 +26,7 @@ modules:
- account: not_bonded_tokens_pool - account: not_bonded_tokens_pool
permissions: [burner, staking] permissions: [burner, staking]
- account: gov - account: gov
permissions: [burner] permissions: [burner, staking]
- account: auction - account: auction
- account: auction_burn - account: auction_burn
- account: bond - account: bond

View File

@ -1,7 +1,6 @@
package cmd package cmd
import ( import (
"fmt"
"os" "os"
"time" "time"
@ -21,7 +20,6 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/server"
serverconfig "github.com/cosmos/cosmos-sdk/server/config" 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/module"
"github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/tx" "github.com/cosmos/cosmos-sdk/x/auth/tx"
@ -100,7 +98,7 @@ func NewRootCmd() *cobra.Command {
// overwrite the minimum gas price from the app configuration // overwrite the minimum gas price from the app configuration
srvCfg := serverconfig.DefaultConfig() srvCfg := serverconfig.DefaultConfig()
srvCfg.MinGasPrices = fmt.Sprintf("0%s", sdk.DefaultBondDenom) srvCfg.MinGasPrices = "0alnt"
// overwrite the block timeout // overwrite the block timeout
cmtCfg := cmtcfg.DefaultConfig() cmtCfg := cmtcfg.DefaultConfig()

119
go.mod
View File

@ -13,23 +13,23 @@ replace (
) )
require ( require (
cosmossdk.io/api v0.7.5 cosmossdk.io/api v0.7.2
cosmossdk.io/client/v2 v2.0.0-beta.1 cosmossdk.io/client/v2 v2.0.0-beta.1
cosmossdk.io/collections v0.4.0 cosmossdk.io/collections v0.4.0
cosmossdk.io/core v0.11.1 cosmossdk.io/core v0.11.0
cosmossdk.io/depinject v1.0.0 cosmossdk.io/depinject v1.0.0-alpha.4
cosmossdk.io/errors v1.0.1 cosmossdk.io/errors v1.0.1
cosmossdk.io/log v1.4.1 cosmossdk.io/log v1.3.0
cosmossdk.io/math v1.3.0 cosmossdk.io/math v1.2.0
cosmossdk.io/store v1.1.1 cosmossdk.io/store v1.0.2
cosmossdk.io/tools/confix v0.1.0 cosmossdk.io/tools/confix v0.1.0
github.com/99designs/gqlgen v0.17.22 github.com/99designs/gqlgen v0.17.22
github.com/cometbft/cometbft v0.38.12 github.com/cometbft/cometbft v0.38.2
github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-db v1.0.0
github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.50.10 github.com/cosmos/cosmos-sdk v0.50.3
github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/gogoproto v1.4.11
github.com/deckarep/golang-set v1.8.0 github.com/deckarep/golang-set v1.8.0
github.com/ethereum/go-ethereum v1.14.5 github.com/ethereum/go-ethereum v1.14.5
github.com/gibson042/canonicaljson-go v1.0.3 github.com/gibson042/canonicaljson-go v1.0.3
@ -38,21 +38,21 @@ require (
github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-cid v0.4.1
github.com/ipld/go-ipld-prime v0.21.0 github.com/ipld/go-ipld-prime v0.21.0
github.com/rs/cors v1.11.1 github.com/rs/cors v1.8.3
github.com/spf13/cobra v1.8.1 github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.19.0 github.com/spf13/viper v1.17.0
github.com/statechannels/go-nitro v0.1.2 github.com/statechannels/go-nitro v0.1.2
github.com/stretchr/testify v1.9.0 github.com/stretchr/testify v1.8.4
github.com/vektah/gqlparser/v2 v2.5.11 github.com/vektah/gqlparser/v2 v2.5.11
golang.org/x/sync v0.8.0 golang.org/x/sync v0.7.0
google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f
google.golang.org/grpc v1.64.1 google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.34.2 google.golang.org/protobuf v1.33.0
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
) )
require ( require (
cosmossdk.io/x/tx v0.13.5 // indirect cosmossdk.io/x/tx v0.13.0 // indirect
filippo.io/edwards25519 v1.0.0 // indirect filippo.io/edwards25519 v1.0.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect github.com/99designs/keyring v1.2.1 // indirect
@ -62,24 +62,24 @@ require (
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect github.com/chzyer/readline v1.5.1 // indirect
github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.1 // indirect github.com/cockroachdb/pebble v1.1.0 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft-db v0.11.0 // indirect github.com/cometbft/cometbft-db v0.9.1 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v1.2.0 // indirect github.com/cosmos/iavl v1.0.0 // indirect
github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/creachadair/atomicfile v0.3.1 // indirect github.com/creachadair/atomicfile v0.3.1 // indirect
github.com/creachadair/tomledit v0.0.24 // indirect github.com/creachadair/tomledit v0.0.24 // indirect
@ -91,12 +91,12 @@ require (
github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/emicklei/dot v1.6.1 // indirect github.com/emicklei/dot v1.6.0 // indirect
github.com/fatih/color v1.16.0 // indirect github.com/fatih/color v1.16.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect github.com/getsentry/sentry-go v0.25.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect
@ -111,15 +111,14 @@ require (
github.com/google/orderedcode v0.0.1 // indirect github.com/google/orderedcode v0.0.1 // indirect
github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-metrics v0.5.3 // indirect github.com/hashicorp/go-metrics v0.5.1 // indirect
github.com/hashicorp/go-plugin v1.5.2 // indirect github.com/hashicorp/go-plugin v1.5.2 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect
github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect
@ -129,16 +128,18 @@ require (
github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/compress v1.17.4 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/kr/pretty v0.3.1 // indirect github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.7 // indirect github.com/lib/pq v1.10.7 // indirect
github.com/linxGnu/grocksdb v1.8.14 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/linxGnu/grocksdb v1.8.6 // indirect
github.com/magiconair/properties v1.8.7 // indirect github.com/magiconair/properties v1.8.7 // indirect
github.com/manifoldco/promptui v0.9.0 // indirect github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/minio/highwayhash v1.0.2 // indirect github.com/minio/highwayhash v1.0.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect
@ -150,29 +151,28 @@ require (
github.com/multiformats/go-multibase v0.2.0 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect github.com/multiformats/go-varint v0.0.7 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
github.com/oklog/run v1.1.0 // indirect github.com/oklog/run v1.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/polydawn/refmt v0.89.0 // indirect github.com/polydawn/refmt v0.89.0 // indirect
github.com/prometheus/client_golang v1.20.1 // indirect github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect github.com/prometheus/procfs v0.12.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/zerolog v1.33.0 // indirect github.com/rs/zerolog v1.31.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.11.0 // indirect github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.6.0 // indirect github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
@ -180,22 +180,23 @@ require (
github.com/tidwall/btree v1.7.0 // indirect github.com/tidwall/btree v1.7.0 // indirect
github.com/zondax/hid v0.9.2 // indirect github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect github.com/zondax/ledger-go v0.14.3 // indirect
go.etcd.io/bbolt v1.3.10 // indirect go.etcd.io/bbolt v1.3.8 // indirect
go.uber.org/multierr v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.26.0 // indirect golang.org/x/crypto v0.22.0 // indirect
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/net v0.28.0 // indirect golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.24.0 // indirect golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.23.0 // indirect golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gotest.tools/v3 v3.5.1 // indirect gotest.tools/v3 v3.5.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect nhooyr.io/websocket v1.8.6 // indirect
pgregory.net/rapid v1.1.0 // indirect pgregory.net/rapid v1.1.0 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect sigs.k8s.io/yaml v1.3.0 // indirect
) )
replace github.com/statechannels/go-nitro v0.1.2 => github.com/cerc-io/go-nitro v0.1.3-ts-port-0.1.10 replace github.com/statechannels/go-nitro v0.1.2 => github.com/cerc-io/go-nitro v0.1.3-ts-port-0.1.10

540
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
# cerc-io laconic gql # cerc-io laconic gql
> Browser : <http://localhost:9473> for gql > Browser : http://localhost:9473 for gql
## Run gqlgen ## 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 go get github.com/99designs/gqlgen@v0.17.22
# Generate bindings # Generate bindings
cd gql # In gql
go run github.com/99designs/gqlgen generate go run github.com/99designs/gqlgen generate
``` ```
@ -385,4 +385,4 @@ Query participants:
nitroAddress nitroAddress
} }
} }
``` ```

View File

@ -168,14 +168,10 @@ type Auction {
commitFee: Coin! # Fee required to bid/participate in the 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). revealFee: Coin! # Reveal fee (paid back to bidders only if they unseal/reveal the bid).
minimumBid: Coin! # Minimum bid amount. minimumBid: Coin! # Minimum bid amount.
winnerAddresses: [String!]! # Winner address. winnerAddress: String! # Winner address.
winnerBids: [Coin!]! # The winning bid amount. winnerBid: Coin! # The winning bid amount.
winnerPrice: Coin! # The price that the winner actually pays (2nd highest bid). winnerPrice: Coin! # The price that the winner actually pays (2nd highest bid).
maxPrice: Coin! # Max bid amount for service provider auction. bids: [AuctionBid] # Bids make in the 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. # Record defines the basic properties of an entity in the graph database.
@ -231,7 +227,7 @@ type Query {
getBondsByIds(ids: [String!]): [Bond] getBondsByIds(ids: [String!]): [Bond]
# Query bonds. # Query bonds.
queryBonds: [Bond] queryBonds(attributes: [KeyValueInput!]): [Bond]
# Query bonds by owner. # Query bonds by owner.
queryBondsByOwner(ownerAddresses: [String!]): [OwnerBonds] queryBondsByOwner(ownerAddresses: [String!]): [OwnerBonds]
@ -250,12 +246,6 @@ type Query {
# Whether to query all records, not just named ones (false by default). # Whether to query all records, not just named ones (false by default).
all: Boolean all: Boolean
# Pagination limit
limit: Int
# Pagination offset
offset: Int
): [Record] ): [Record]
# #
@ -263,7 +253,7 @@ type Query {
# #
# Get authorities list. # Get authorities list.
getAuthorities(owner: String): [Authority]! getAuthorities(owner: String): [Authority]
# Lookup authority information. # Lookup authority information.
lookupAuthorities(names: [String!]): [AuthorityRecord]! lookupAuthorities(names: [String!]): [AuthorityRecord]!

View File

@ -61,23 +61,19 @@ type ComplexityRoot struct {
} }
Auction struct { Auction struct {
Bids func(childComplexity int) int Bids func(childComplexity int) int
CommitFee func(childComplexity int) int CommitFee func(childComplexity int) int
CommitsEndTime func(childComplexity int) int CommitsEndTime func(childComplexity int) int
CreateTime func(childComplexity int) int CreateTime func(childComplexity int) int
FundsReleased func(childComplexity int) int ID func(childComplexity int) int
ID func(childComplexity int) int MinimumBid func(childComplexity int) int
Kind func(childComplexity int) int OwnerAddress func(childComplexity int) int
MaxPrice func(childComplexity int) int RevealFee func(childComplexity int) int
MinimumBid func(childComplexity int) int RevealsEndTime func(childComplexity int) int
NumProviders func(childComplexity int) int Status func(childComplexity int) int
OwnerAddress func(childComplexity int) int WinnerAddress func(childComplexity int) int
RevealFee func(childComplexity int) int WinnerBid func(childComplexity int) int
RevealsEndTime func(childComplexity int) int WinnerPrice 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 { AuctionBid struct {
@ -187,9 +183,9 @@ type ComplexityRoot struct {
GetStatus func(childComplexity int) int GetStatus func(childComplexity int) int
LookupAuthorities func(childComplexity int, names []string) int LookupAuthorities func(childComplexity int, names []string) int
LookupNames func(childComplexity int, names []string) int LookupNames func(childComplexity int, names []string) int
QueryBonds func(childComplexity int) int QueryBonds func(childComplexity int, attributes []*KeyValueInput) int
QueryBondsByOwner func(childComplexity int, ownerAddresses []string) int QueryBondsByOwner func(childComplexity int, ownerAddresses []string) int
QueryRecords func(childComplexity int, attributes []*KeyValueInput, all *bool, limit *int, offset *int) int QueryRecords func(childComplexity int, attributes []*KeyValueInput, all *bool) int
ResolveNames func(childComplexity int, names []string) int ResolveNames func(childComplexity int, names []string) int
} }
@ -237,10 +233,10 @@ type QueryResolver interface {
GetStatus(ctx context.Context) (*Status, error) GetStatus(ctx context.Context) (*Status, error)
GetAccounts(ctx context.Context, addresses []string) ([]*Account, error) GetAccounts(ctx context.Context, addresses []string) ([]*Account, error)
GetBondsByIds(ctx context.Context, ids []string) ([]*Bond, error) GetBondsByIds(ctx context.Context, ids []string) ([]*Bond, error)
QueryBonds(ctx context.Context) ([]*Bond, error) QueryBonds(ctx context.Context, attributes []*KeyValueInput) ([]*Bond, error)
QueryBondsByOwner(ctx context.Context, ownerAddresses []string) ([]*OwnerBonds, error) QueryBondsByOwner(ctx context.Context, ownerAddresses []string) ([]*OwnerBonds, error)
GetRecordsByIds(ctx context.Context, ids []string) ([]*Record, error) GetRecordsByIds(ctx context.Context, ids []string) ([]*Record, error)
QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool, limit *int, offset *int) ([]*Record, error) QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool) ([]*Record, error)
GetAuthorities(ctx context.Context, owner *string) ([]*Authority, error) GetAuthorities(ctx context.Context, owner *string) ([]*Authority, error)
LookupAuthorities(ctx context.Context, names []string) ([]*AuthorityRecord, error) LookupAuthorities(ctx context.Context, names []string) ([]*AuthorityRecord, error)
LookupNames(ctx context.Context, names []string) ([]*NameRecord, error) LookupNames(ctx context.Context, names []string) ([]*NameRecord, error)
@ -350,13 +346,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Auction.CreateTime(childComplexity), true 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": case "Auction.id":
if e.complexity.Auction.ID == nil { if e.complexity.Auction.ID == nil {
break break
@ -364,20 +353,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Auction.ID(childComplexity), true 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": case "Auction.minimumBid":
if e.complexity.Auction.MinimumBid == nil { if e.complexity.Auction.MinimumBid == nil {
break break
@ -385,13 +360,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Auction.MinimumBid(childComplexity), true 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": case "Auction.ownerAddress":
if e.complexity.Auction.OwnerAddress == nil { if e.complexity.Auction.OwnerAddress == nil {
break break
@ -420,19 +388,19 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Auction.Status(childComplexity), true return e.complexity.Auction.Status(childComplexity), true
case "Auction.winnerAddresses": case "Auction.winnerAddress":
if e.complexity.Auction.WinnerAddresses == nil { if e.complexity.Auction.WinnerAddress == nil {
break break
} }
return e.complexity.Auction.WinnerAddresses(childComplexity), true return e.complexity.Auction.WinnerAddress(childComplexity), true
case "Auction.winnerBids": case "Auction.winnerBid":
if e.complexity.Auction.WinnerBids == nil { if e.complexity.Auction.WinnerBid == nil {
break break
} }
return e.complexity.Auction.WinnerBids(childComplexity), true return e.complexity.Auction.WinnerBid(childComplexity), true
case "Auction.winnerPrice": case "Auction.winnerPrice":
if e.complexity.Auction.WinnerPrice == nil { if e.complexity.Auction.WinnerPrice == nil {
@ -876,7 +844,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
break break
} }
return e.complexity.Query.QueryBonds(childComplexity), true args, err := ec.field_Query_queryBonds_args(context.TODO(), rawArgs)
if err != nil {
return 0, false
}
return e.complexity.Query.QueryBonds(childComplexity, args["attributes"].([]*KeyValueInput)), true
case "Query.queryBondsByOwner": case "Query.queryBondsByOwner":
if e.complexity.Query.QueryBondsByOwner == nil { if e.complexity.Query.QueryBondsByOwner == nil {
@ -900,7 +873,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return 0, false return 0, false
} }
return e.complexity.Query.QueryRecords(childComplexity, args["attributes"].([]*KeyValueInput), args["all"].(*bool), args["limit"].(*int), args["offset"].(*int)), true return e.complexity.Query.QueryRecords(childComplexity, args["attributes"].([]*KeyValueInput), args["all"].(*bool)), true
case "Query.resolveNames": case "Query.resolveNames":
if e.complexity.Query.ResolveNames == nil { if e.complexity.Query.ResolveNames == nil {
@ -1321,6 +1294,21 @@ func (ec *executionContext) field_Query_queryBondsByOwner_args(ctx context.Conte
return args, nil return args, nil
} }
func (ec *executionContext) field_Query_queryBonds_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
var arg0 []*KeyValueInput
if tmp, ok := rawArgs["attributes"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("attributes"))
arg0, err = ec.unmarshalOKeyValueInput2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐKeyValueInputᚄ(ctx, tmp)
if err != nil {
return nil, err
}
}
args["attributes"] = arg0
return args, nil
}
func (ec *executionContext) field_Query_queryRecords_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { func (ec *executionContext) field_Query_queryRecords_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error var err error
args := map[string]interface{}{} args := map[string]interface{}{}
@ -1342,24 +1330,6 @@ func (ec *executionContext) field_Query_queryRecords_args(ctx context.Context, r
} }
} }
args["all"] = arg1 args["all"] = arg1
var arg2 *int
if tmp, ok := rawArgs["limit"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limit"))
arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
if err != nil {
return nil, err
}
}
args["limit"] = arg2
var arg3 *int
if tmp, ok := rawArgs["offset"]; ok {
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("offset"))
arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
if err != nil {
return nil, err
}
}
args["offset"] = arg3
return args, nil return args, nil
} }
@ -2179,8 +2149,8 @@ func (ec *executionContext) fieldContext_Auction_minimumBid(ctx context.Context,
return fc, nil return fc, nil
} }
func (ec *executionContext) _Auction_winnerAddresses(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { func (ec *executionContext) _Auction_winnerAddress(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Auction_winnerAddresses(ctx, field) fc, err := ec.fieldContext_Auction_winnerAddress(ctx, field)
if err != nil { if err != nil {
return graphql.Null return graphql.Null
} }
@ -2193,7 +2163,7 @@ func (ec *executionContext) _Auction_winnerAddresses(ctx context.Context, field
}() }()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children ctx = rctx // use context from middleware stack in children
return obj.WinnerAddresses, nil return obj.WinnerAddress, nil
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
@ -2205,12 +2175,12 @@ func (ec *executionContext) _Auction_winnerAddresses(ctx context.Context, field
} }
return graphql.Null return graphql.Null
} }
res := resTmp.([]string) res := resTmp.(string)
fc.Result = res fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res) return ec.marshalNString2string(ctx, field.Selections, res)
} }
func (ec *executionContext) fieldContext_Auction_winnerAddresses(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_Auction_winnerAddress(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{ fc = &graphql.FieldContext{
Object: "Auction", Object: "Auction",
Field: field, Field: field,
@ -2223,8 +2193,8 @@ func (ec *executionContext) fieldContext_Auction_winnerAddresses(ctx context.Con
return fc, nil return fc, nil
} }
func (ec *executionContext) _Auction_winnerBids(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { func (ec *executionContext) _Auction_winnerBid(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Auction_winnerBids(ctx, field) fc, err := ec.fieldContext_Auction_winnerBid(ctx, field)
if err != nil { if err != nil {
return graphql.Null return graphql.Null
} }
@ -2237,7 +2207,7 @@ func (ec *executionContext) _Auction_winnerBids(ctx context.Context, field graph
}() }()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children ctx = rctx // use context from middleware stack in children
return obj.WinnerBids, nil return obj.WinnerBid, nil
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
@ -2249,12 +2219,12 @@ func (ec *executionContext) _Auction_winnerBids(ctx context.Context, field graph
} }
return graphql.Null return graphql.Null
} }
res := resTmp.([]*Coin) res := resTmp.(*Coin)
fc.Result = res 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_winnerBids(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_Auction_winnerBid(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{ fc = &graphql.FieldContext{
Object: "Auction", Object: "Auction",
Field: field, Field: field,
@ -2323,185 +2293,6 @@ func (ec *executionContext) fieldContext_Auction_winnerPrice(ctx context.Context
return fc, nil 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) { func (ec *executionContext) _Auction_bids(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Auction_bids(ctx, field) fc, err := ec.fieldContext_Auction_bids(ctx, field)
if err != nil { if err != nil {
@ -2523,14 +2314,11 @@ func (ec *executionContext) _Auction_bids(ctx context.Context, field graphql.Col
return graphql.Null return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null return graphql.Null
} }
res := resTmp.([]*AuctionBid) res := resTmp.([]*AuctionBid)
fc.Result = res fc.Result = res
return ec.marshalNAuctionBid2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuctionBid(ctx, field.Selections, res) return ec.marshalOAuctionBid2ᚕᚖ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) { func (ec *executionContext) fieldContext_Auction_bids(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@ -3356,20 +3144,12 @@ func (ec *executionContext) fieldContext_AuthorityRecord_auction(ctx context.Con
return ec.fieldContext_Auction_revealFee(ctx, field) return ec.fieldContext_Auction_revealFee(ctx, field)
case "minimumBid": case "minimumBid":
return ec.fieldContext_Auction_minimumBid(ctx, field) return ec.fieldContext_Auction_minimumBid(ctx, field)
case "winnerAddresses": case "winnerAddress":
return ec.fieldContext_Auction_winnerAddresses(ctx, field) return ec.fieldContext_Auction_winnerAddress(ctx, field)
case "winnerBids": case "winnerBid":
return ec.fieldContext_Auction_winnerBids(ctx, field) return ec.fieldContext_Auction_winnerBid(ctx, field)
case "winnerPrice": case "winnerPrice":
return ec.fieldContext_Auction_winnerPrice(ctx, field) 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": case "bids":
return ec.fieldContext_Auction_bids(ctx, field) return ec.fieldContext_Auction_bids(ctx, field)
} }
@ -4798,7 +4578,7 @@ func (ec *executionContext) _Query_queryBonds(ctx context.Context, field graphql
}() }()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children ctx = rctx // use context from middleware stack in children
return ec.resolvers.Query().QueryBonds(rctx) return ec.resolvers.Query().QueryBonds(rctx, fc.Args["attributes"].([]*KeyValueInput))
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
@ -4830,6 +4610,17 @@ func (ec *executionContext) fieldContext_Query_queryBonds(ctx context.Context, f
return nil, fmt.Errorf("no field named %q was found under type Bond", field.Name) return nil, fmt.Errorf("no field named %q was found under type Bond", field.Name)
}, },
} }
defer func() {
if r := recover(); r != nil {
err = ec.Recover(ctx, r)
ec.Error(ctx, err)
}
}()
ctx = graphql.WithFieldContext(ctx, fc)
if fc.Args, err = ec.field_Query_queryBonds_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
ec.Error(ctx, err)
return
}
return fc, nil return fc, nil
} }
@ -4975,7 +4766,7 @@ func (ec *executionContext) _Query_queryRecords(ctx context.Context, field graph
}() }()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children ctx = rctx // use context from middleware stack in children
return ec.resolvers.Query().QueryRecords(rctx, fc.Args["attributes"].([]*KeyValueInput), fc.Args["all"].(*bool), fc.Args["limit"].(*int), fc.Args["offset"].(*int)) return ec.resolvers.Query().QueryRecords(rctx, fc.Args["attributes"].([]*KeyValueInput), fc.Args["all"].(*bool))
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
@ -5052,14 +4843,11 @@ func (ec *executionContext) _Query_getAuthorities(ctx context.Context, field gra
return graphql.Null return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null return graphql.Null
} }
res := resTmp.([]*Authority) res := resTmp.([]*Authority)
fc.Result = res fc.Result = res
return ec.marshalNAuthority2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx, field.Selections, res) return ec.marshalOAuthority2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx, field.Selections, res)
} }
func (ec *executionContext) fieldContext_Query_getAuthorities(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_Query_getAuthorities(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@ -5351,20 +5139,12 @@ func (ec *executionContext) fieldContext_Query_getAuctionsByIds(ctx context.Cont
return ec.fieldContext_Auction_revealFee(ctx, field) return ec.fieldContext_Auction_revealFee(ctx, field)
case "minimumBid": case "minimumBid":
return ec.fieldContext_Auction_minimumBid(ctx, field) return ec.fieldContext_Auction_minimumBid(ctx, field)
case "winnerAddresses": case "winnerAddress":
return ec.fieldContext_Auction_winnerAddresses(ctx, field) return ec.fieldContext_Auction_winnerAddress(ctx, field)
case "winnerBids": case "winnerBid":
return ec.fieldContext_Auction_winnerBids(ctx, field) return ec.fieldContext_Auction_winnerBid(ctx, field)
case "winnerPrice": case "winnerPrice":
return ec.fieldContext_Auction_winnerPrice(ctx, field) 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": case "bids":
return ec.fieldContext_Auction_bids(ctx, field) return ec.fieldContext_Auction_bids(ctx, field)
} }
@ -8940,16 +8720,16 @@ func (ec *executionContext) _Auction(ctx context.Context, sel ast.SelectionSet,
if out.Values[i] == graphql.Null { if out.Values[i] == graphql.Null {
invalids++ invalids++
} }
case "winnerAddresses": case "winnerAddress":
out.Values[i] = ec._Auction_winnerAddresses(ctx, field, obj) out.Values[i] = ec._Auction_winnerAddress(ctx, field, obj)
if out.Values[i] == graphql.Null { if out.Values[i] == graphql.Null {
invalids++ invalids++
} }
case "winnerBids": case "winnerBid":
out.Values[i] = ec._Auction_winnerBids(ctx, field, obj) out.Values[i] = ec._Auction_winnerBid(ctx, field, obj)
if out.Values[i] == graphql.Null { if out.Values[i] == graphql.Null {
invalids++ invalids++
@ -8958,31 +8738,6 @@ func (ec *executionContext) _Auction(ctx context.Context, sel ast.SelectionSet,
out.Values[i] = ec._Auction_winnerPrice(ctx, field, obj) 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 { if out.Values[i] == graphql.Null {
invalids++ invalids++
} }
@ -8990,9 +8745,6 @@ func (ec *executionContext) _Auction(ctx context.Context, sel ast.SelectionSet,
out.Values[i] = ec._Auction_bids(ctx, field, obj) out.Values[i] = ec._Auction_bids(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
default: default:
panic("unknown field " + strconv.Quote(field.Name)) panic("unknown field " + strconv.Quote(field.Name))
} }
@ -9829,9 +9581,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
} }
}() }()
res = ec._Query_getAuthorities(ctx, field) res = ec._Query_getAuthorities(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res return res
} }
@ -10647,98 +10396,6 @@ func (ec *executionContext) marshalNAttribute2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋla
return ec._Attribute(ctx, sel, v) 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
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.marshalOAuthority2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx, sel, v[i])
}
if isLen1 {
f(i)
} else {
go f(i)
}
}
wg.Wait()
return ret
}
func (ec *executionContext) marshalNAuthorityRecord2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthorityRecord(ctx context.Context, sel ast.SelectionSet, v []*AuthorityRecord) graphql.Marshaler { func (ec *executionContext) marshalNAuthorityRecord2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthorityRecord(ctx context.Context, sel ast.SelectionSet, v []*AuthorityRecord) graphql.Marshaler {
ret := make(graphql.Array, len(v)) ret := make(graphql.Array, len(v))
var wg sync.WaitGroup var wg sync.WaitGroup
@ -10812,50 +10469,6 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se
return res 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 { 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 v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
@ -11088,38 +10701,6 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S
return res 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 { 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 v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
@ -11602,6 +11183,95 @@ func (ec *executionContext) marshalOAuction2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaco
return ec._Auction(ctx, sel, v) 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
}
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.marshalOAuthority2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx, sel, v[i])
}
if isLen1 {
f(i)
} else {
go f(i)
}
}
wg.Wait()
return ret
}
func (ec *executionContext) marshalOAuthority2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx context.Context, sel ast.SelectionSet, v *Authority) graphql.Marshaler { 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 { if v == nil {
return graphql.Null return graphql.Null

View File

@ -26,23 +26,19 @@ type Attribute struct {
} }
type Auction struct { type Auction struct {
ID string `json:"id"` ID string `json:"id"`
Status string `json:"status"` Status string `json:"status"`
OwnerAddress string `json:"ownerAddress"` OwnerAddress string `json:"ownerAddress"`
CreateTime string `json:"createTime"` CreateTime string `json:"createTime"`
CommitsEndTime string `json:"commitsEndTime"` CommitsEndTime string `json:"commitsEndTime"`
RevealsEndTime string `json:"revealsEndTime"` RevealsEndTime string `json:"revealsEndTime"`
CommitFee *Coin `json:"commitFee"` CommitFee *Coin `json:"commitFee"`
RevealFee *Coin `json:"revealFee"` RevealFee *Coin `json:"revealFee"`
MinimumBid *Coin `json:"minimumBid"` MinimumBid *Coin `json:"minimumBid"`
WinnerAddresses []string `json:"winnerAddresses"` WinnerAddress string `json:"winnerAddress"`
WinnerBids []*Coin `json:"winnerBids"` WinnerBid *Coin `json:"winnerBid"`
WinnerPrice *Coin `json:"winnerPrice"` WinnerPrice *Coin `json:"winnerPrice"`
MaxPrice *Coin `json:"maxPrice"` Bids []*AuctionBid `json:"bids"`
Kind string `json:"kind"`
NumProviders *int `json:"numProviders"`
FundsReleased bool `json:"fundsReleased"`
Bids []*AuctionBid `json:"bids"`
} }
type AuctionBid struct { type AuctionBid struct {

View File

@ -8,7 +8,6 @@ import (
"github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client"
types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
@ -24,9 +23,6 @@ const DefaultLogNumLines = 50
// MaxLogNumLines is the max number of log lines that can be tailed. // MaxLogNumLines is the max number of log lines that can be tailed.
const MaxLogNumLines = 1000 const MaxLogNumLines = 1000
// Whether to use default page limit when pagination args are not passed.
const UseDefaultPagination = false
type Resolver struct { type Resolver struct {
ctx client.Context ctx client.Context
logFile string logFile string
@ -140,34 +136,14 @@ func (q queryResolver) LookupNames(ctx context.Context, names []string) ([]*Name
return gqlResponse, nil return gqlResponse, nil
} }
func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool, limit *int, offset *int) ([]*Record, error) { func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool) ([]*Record, error) {
nsQueryClient := registrytypes.NewQueryClient(q.ctx) nsQueryClient := registrytypes.NewQueryClient(q.ctx)
var pagination *query.PageRequest
// Use defaults only if limit and offset not provided
// and UseDefaultPagination is true
if limit == nil && offset == nil {
if UseDefaultPagination {
pagination = &query.PageRequest{}
}
} else {
pagination = &query.PageRequest{}
if limit != nil {
pagination.Limit = uint64(*limit)
}
if offset != nil {
pagination.Offset = uint64(*offset)
}
}
res, err := nsQueryClient.Records( res, err := nsQueryClient.Records(
context.Background(), context.Background(),
&registrytypes.QueryRecordsRequest{ &registrytypes.QueryRecordsRequest{
Attributes: toRPCAttributes(attributes), Attributes: toRPCAttributes(attributes),
All: (all != nil && *all), All: (all != nil && *all),
Pagination: pagination,
}, },
) )
if err != nil { if err != nil {
@ -320,7 +296,7 @@ func (q *queryResolver) GetBond(ctx context.Context, id string) (*Bond, error) {
return getGQLBond(bondResp.GetBond()) return getGQLBond(bondResp.GetBond())
} }
func (q queryResolver) QueryBonds(ctx context.Context) ([]*Bond, error) { func (q queryResolver) QueryBonds(ctx context.Context, attributes []*KeyValueInput) ([]*Bond, error) {
bondQueryClient := bondtypes.NewQueryClient(q.ctx) bondQueryClient := bondtypes.NewQueryClient(q.ctx)
bonds, err := bondQueryClient.Bonds(context.Background(), &bondtypes.QueryBondsRequest{}) bonds, err := bondQueryClient.Bonds(context.Background(), &bondtypes.QueryBondsRequest{})
if err != nil { if err != nil {

View File

@ -232,25 +232,19 @@ func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*Au
return nil, nil return nil, nil
} }
numProviders := int(auction.NumProviders)
gqlAuction := Auction{ gqlAuction := Auction{
ID: auction.Id, ID: auction.Id,
Status: auction.Status, Status: auction.Status,
OwnerAddress: auction.OwnerAddress, OwnerAddress: auction.OwnerAddress,
CreateTime: auction.GetCreateTime(), CreateTime: auction.GetCreateTime(),
CommitsEndTime: auction.GetCommitsEndTime(), CommitsEndTime: auction.GetCommitsEndTime(),
RevealsEndTime: auction.GetRevealsEndTime(), RevealsEndTime: auction.GetRevealsEndTime(),
CommitFee: getGQLCoin(auction.CommitFee), CommitFee: getGQLCoin(auction.CommitFee),
RevealFee: getGQLCoin(auction.RevealFee), RevealFee: getGQLCoin(auction.RevealFee),
MinimumBid: getGQLCoin(auction.MinimumBid), MinimumBid: getGQLCoin(auction.MinimumBid),
WinnerAddresses: auction.WinnerAddresses, WinnerAddress: auction.WinnerAddress,
WinnerBids: getGQLCoins(auction.WinningBids), WinnerBid: getGQLCoin(auction.WinningBid),
WinnerPrice: getGQLCoin(auction.WinningPrice), WinnerPrice: getGQLCoin(auction.WinningPrice),
MaxPrice: getGQLCoin(auction.MaxPrice),
Kind: auction.Kind,
NumProviders: &numProviders,
FundsReleased: auction.FundsReleased,
} }
auctionBids := make([]*AuctionBid, len(bids)) auctionBids := make([]*AuctionBid, len(bids))

View File

@ -3,44 +3,76 @@ syntax = "proto3";
package cerc.auction.v1; package cerc.auction.v1;
import "gogoproto/gogo.proto"; import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
import "cosmos/base/v1beta1/coin.proto"; import "cosmos/base/v1beta1/coin.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/auction"; option go_package = "git.vdb.to/cerc-io/laconicd/x/auction";
// Params defines the auction module parameters // Params defines the auction module parameters
message Params {} 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\""
];
}
// Auction represents a sealed-bid on-chain auction // Auction represents a sealed-bid on-chain auction
message Auction { message Auction {
option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_getters) = false;
string id = 1; 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 // Address of the creator of the auction
string owner_address = 4; string owner_address = 3;
// Timestamp at which the auction was created // Timestamp at which the auction was created
google.protobuf.Timestamp create_time = 5 [ google.protobuf.Timestamp create_time = 4 [
(gogoproto.stdtime) = true, (gogoproto.stdtime) = true,
(gogoproto.nullable) = false, (gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"create_time\" yaml:\"create_time\"" (gogoproto.moretags) = "json:\"create_time\" yaml:\"create_time\""
]; ];
// Timestamp at which the commits phase concluded // Timestamp at which the commits phase concluded
google.protobuf.Timestamp commits_end_time = 6 [ google.protobuf.Timestamp commits_end_time = 5 [
(gogoproto.stdtime) = true, (gogoproto.stdtime) = true,
(gogoproto.nullable) = false, (gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"commits_end_time\" yaml:\"commits_end_time\"" (gogoproto.moretags) = "json:\"commits_end_time\" yaml:\"commits_end_time\""
]; ];
// Timestamp at which the reveals phase concluded // Timestamp at which the reveals phase concluded
google.protobuf.Timestamp reveals_end_time = 7 [ google.protobuf.Timestamp reveals_end_time = 6 [
(gogoproto.stdtime) = true, (gogoproto.stdtime) = true,
(gogoproto.nullable) = false, (gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"reveals_end_time\" yaml:\"reveals_end_time\"" (gogoproto.moretags) = "json:\"reveals_end_time\" yaml:\"reveals_end_time\""
@ -48,58 +80,35 @@ message Auction {
// Commit and reveal fees must both be paid when committing a bid // Commit and reveal fees must both be paid when committing a bid
// Reveal fee is returned only if the bid is revealed // Reveal fee is returned only if the bid is revealed
cosmos.base.v1beta1.Coin commit_fee = 8 [ cosmos.base.v1beta1.Coin commit_fee = 7 [
(gogoproto.nullable) = false, (gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\"" (gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\""
]; ];
cosmos.base.v1beta1.Coin reveal_fee = 9 [ cosmos.base.v1beta1.Coin reveal_fee = 8 [
(gogoproto.nullable) = false, (gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
]; ];
// Minimum acceptable bid amount for a valid commit // Minimum acceptable bid amount for a valid commit
// Only applicable in vickrey auctions cosmos.base.v1beta1.Coin minimum_bid = 9 [
cosmos.base.v1beta1.Coin minimum_bid = 10 [
(gogoproto.nullable) = false, (gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\"" (gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
]; ];
// Addresses of the winners // Address of the winner
// (single winner for vickrey auction) string winner_address = 10;
// (multiple winners for provider auctions)
repeated string winner_addresses = 11;
// Winning bids, i.e. the best bids // Winning bid, i.e., the highest bid
repeated cosmos.base.v1beta1.Coin winning_bids = 12 [ cosmos.base.v1beta1.Coin winning_bid = 11 [
(gogoproto.nullable) = false, (gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"winning_bids\" yaml:\"winning_bids\"" (gogoproto.moretags) = "json:\"winning_bid\" yaml:\"winning_bid\""
]; ];
// Auction winning price // Amount the winner pays, i.e. the second highest auction
// vickrey auction: second highest bid, paid by the winner cosmos.base.v1beta1.Coin winning_price = 12 [
// 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.nullable) = false,
(gogoproto.moretags) = "json:\"winning_price\" yaml:\"winning_price\"" (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 // Auctions represent all the auctions in the module

View File

@ -34,11 +34,6 @@ service Msg {
// UpdateParams defines an operation for updating the x/staking module // UpdateParams defines an operation for updating the x/staking module
// parameters. // parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); 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 // MsgCreateAuction defines a create auction message
@ -46,56 +41,41 @@ message MsgCreateAuction {
option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "signer"; 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 // Duration of the commits phase in seconds
google.protobuf.Duration commits_duration = 3 [ google.protobuf.Duration commits_duration = 1 [
(gogoproto.nullable) = false, (gogoproto.nullable) = false,
(gogoproto.stdduration) = true, (gogoproto.stdduration) = true,
(gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\"" (gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\""
]; ];
// Duration of the reveals phase in seconds // Duration of the reveals phase in seconds
google.protobuf.Duration reveals_duration = 4 [ google.protobuf.Duration reveals_duration = 2 [
(gogoproto.nullable) = false, (gogoproto.nullable) = false,
(gogoproto.stdduration) = true, (gogoproto.stdduration) = true,
(gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\"" (gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\""
]; ];
// Commit fees // Commit fees
cosmos.base.v1beta1.Coin commit_fee = 5 [ cosmos.base.v1beta1.Coin commit_fee = 3 [
(gogoproto.nullable) = false, (gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\"" (gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\""
]; ];
// Reveal fees // Reveal fees
cosmos.base.v1beta1.Coin reveal_fee = 6 [ cosmos.base.v1beta1.Coin reveal_fee = 4 [
(gogoproto.nullable) = false, (gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\""
]; ];
// Minimum acceptable bid amount // Minimum acceptable bid amount
// Only applicable in vickrey auctions cosmos.base.v1beta1.Coin minimum_bid = 5 [
cosmos.base.v1beta1.Coin minimum_bid = 7 [
(gogoproto.nullable) = false, (gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\"" (gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
]; ];
// Maximum acceptable bid amount // Address of the signer
// Only applicable in provider auctions string signer = 6
cosmos.base.v1beta1.Coin max_price = 8 [ [ (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" ];
(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 // MsgCreateAuctionResponse returns the details of the created auction
@ -177,27 +157,3 @@ message MsgUpdateParams {
// MsgUpdateParamsResponse defines the response structure for executing a // MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message. // MsgUpdateParams message.
message MsgUpdateParamsResponse {}; 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\"" ];
}

View File

@ -209,6 +209,7 @@ message MsgReassociateRecords {
// MsgReassociateRecordsResponse // MsgReassociateRecordsResponse
message MsgReassociateRecordsResponse {} message MsgReassociateRecordsResponse {}
// MsgUpdateParams is the Msg/UpdateParams request type. // MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams { message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority"; option (cosmos.msg.v1.signer) = "authority";

View File

@ -6,12 +6,11 @@ MONIKER=${MONIKER:-"localtestnet"}
KEYRING=${KEYRING:-"test"} KEYRING=${KEYRING:-"test"}
DENOM=${DENOM:-"alnt"} DENOM=${DENOM:-"alnt"}
STAKING_AMOUNT=${STAKING_AMOUNT:-"1000000000000000"} STAKING_AMOUNT=${STAKING_AMOUNT:-"1000000000000000"}
MIN_GAS_PRICE=${MIN_GAS_PRICE:-"0.001"}
LOGLEVEL=${LOGLEVEL:-"info"} LOGLEVEL=${LOGLEVEL:-"info"}
input_genesis_file=${GENESIS_FILE} input_genesis_file=${GENESIS_FILE}
if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data" ]; then if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
# validate dependencies are installed # validate dependencies are installed
command -v jq > /dev/null 2>&1 || { command -v jq > /dev/null 2>&1 || {
echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/" echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"
@ -31,7 +30,7 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data" ]; then
# if $KEY exists it should be deleted # if $KEY exists it should be deleted
laconicd keys add $KEY --keyring-backend $KEYRING laconicd keys add $KEY --keyring-backend $KEYRING
# Set moniker and chain-id # Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
laconicd init $MONIKER --chain-id $CHAINID --default-denom $DENOM laconicd init $MONIKER --chain-id $CHAINID --default-denom $DENOM
if [[ -f ${input_genesis_file} ]]; then if [[ -f ${input_genesis_file} ]]; then
@ -63,7 +62,7 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data" ]; then
fi fi
if [[ "$ONBOARDING_ENABLED" == "true" ]]; then if [[ "$ONBOARDING_ENABLED" == "true" ]]; then
echo "Enabling onboarding." echo "Enabling validator onboarding."
update_genesis '.app_state["onboarding"]["params"]["onboarding_enabled"]=true' update_genesis '.app_state["onboarding"]["params"]["onboarding_enabled"]=true'
fi fi
@ -136,7 +135,7 @@ fi
laconicd start \ laconicd start \
--pruning=nothing \ --pruning=nothing \
--log_level $LOGLEVEL \ --log_level $LOGLEVEL \
--minimum-gas-prices=$MIN_GAS_PRICE$DENOM \ --minimum-gas-prices=1$DENOM \
--api.enable \ --api.enable \
--rpc.laddr="tcp://0.0.0.0:26657" \ --rpc.laddr="tcp://0.0.0.0:26657" \
--gql-server --gql-playground --gql-server --gql-playground

View File

@ -103,13 +103,10 @@ func (ets *E2ETestSuite) createAuctionAndBid(createAuction, createBid bool) stri
if createAuction { if createAuction {
auctionArgs := []string{ auctionArgs := []string{
types.AuctionKindVickrey,
sampleCommitTime, sampleRevealTime, sampleCommitTime, sampleRevealTime,
fmt.Sprintf("10%s", ets.cfg.BondDenom), fmt.Sprintf("10%s", ets.cfg.BondDenom),
fmt.Sprintf("10%s", ets.cfg.BondDenom), fmt.Sprintf("10%s", ets.cfg.BondDenom),
fmt.Sprintf("100%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) resp, err := ets.executeTx(cli.GetCmdCreateAuction(), auctionArgs, ownerAccount)

View File

@ -46,13 +46,10 @@ func (ets *E2ETestSuite) TestTxCommitBid() {
ets.Run(fmt.Sprintf("Case %s", test.msg), func() { ets.Run(fmt.Sprintf("Case %s", test.msg), func() {
if test.createAuction { if test.createAuction {
auctionArgs := []string{ auctionArgs := []string{
auctiontypes.AuctionKindVickrey,
sampleCommitTime, sampleRevealTime, sampleCommitTime, sampleRevealTime,
fmt.Sprintf("10%s", ets.cfg.BondDenom), fmt.Sprintf("10%s", ets.cfg.BondDenom),
fmt.Sprintf("10%s", ets.cfg.BondDenom), fmt.Sprintf("10%s", ets.cfg.BondDenom),
fmt.Sprintf("100%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) resp, err := ets.executeTx(cli.GetCmdCreateAuction(), auctionArgs, ownerAccount)

View File

@ -3,12 +3,9 @@ package keeper_test
import ( import (
"context" "context"
"fmt" "fmt"
"time"
"cosmossdk.io/math" "cosmossdk.io/math"
sdkmath "cosmossdk.io/math"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
integrationTest "git.vdb.to/cerc-io/laconicd/tests/integration" integrationTest "git.vdb.to/cerc-io/laconicd/tests/integration"
types "git.vdb.to/cerc-io/laconicd/x/auction" types "git.vdb.to/cerc-io/laconicd/x/auction"
@ -287,7 +284,6 @@ func (kts *KeeperTestSuite) TestGrpcGetAuctionsByOwner() {
} }
func (kts *KeeperTestSuite) TestGrpcQueryBalance() { func (kts *KeeperTestSuite) TestGrpcQueryBalance() {
testCases := []struct { testCases := []struct {
msg string msg string
req *types.QueryGetAuctionModuleBalanceRequest req *types.QueryGetAuctionModuleBalanceRequest
@ -330,18 +326,12 @@ func (kts *KeeperTestSuite) createAuctionAndCommitBid(commitBid bool) (*types.Au
// Create funded account(s) // Create funded account(s)
accounts := simtestutil.AddTestAddrs(kts.BankKeeper, integrationTest.BondDenomProvider{}, ctx, accCount, math.NewInt(1000000)) accounts := simtestutil.AddTestAddrs(kts.BankKeeper, integrationTest.BondDenomProvider{}, ctx, accCount, math.NewInt(1000000))
auction, err := k.CreateAuction( params, err := k.GetParams(ctx)
ctx, if err != nil {
types.MsgCreateAuction{ return nil, nil, err
Kind: types.AuctionKindVickrey, }
Signer: accounts[0].String(),
CommitsDuration: 5 * time.Minute, auction, err := k.CreateAuction(ctx, types.NewMsgCreateAuction(*params, accounts[0]))
RevealsDuration: 5 * time.Minute,
CommitFee: sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1000)),
RevealFee: sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1000)),
MinimumBid: sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1000000)),
},
)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }

View File

@ -9,6 +9,7 @@ import (
_ "github.com/cosmos/gogoproto/gogoproto" _ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto" proto "github.com/cosmos/gogoproto/proto"
github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types"
_ "google.golang.org/protobuf/types/known/durationpb"
_ "google.golang.org/protobuf/types/known/timestamppb" _ "google.golang.org/protobuf/types/known/timestamppb"
io "io" io "io"
math "math" math "math"
@ -30,11 +31,20 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Params defines the auction module parameters // Params defines the auction module parameters
type Params struct { type Params struct {
// Duration of the commits phase in seconds
CommitsDuration time.Duration `protobuf:"bytes,1,opt,name=commits_duration,json=commitsDuration,proto3,stdduration" json:"commits_duration" json:"commits_duration" yaml:"commits_duration"`
// Duration of the reveals phase in seconds
RevealsDuration time.Duration `protobuf:"bytes,2,opt,name=reveals_duration,json=revealsDuration,proto3,stdduration" json:"reveals_duration" json:"reveals_duration" yaml:"reveals_duration"`
// Commit fees
CommitFee types.Coin `protobuf:"bytes,3,opt,name=commit_fee,json=commitFee,proto3" json:"commit_fee" json:"commit_fee" yaml:"commit_fee"`
// Reveal fees
RevealFee types.Coin `protobuf:"bytes,4,opt,name=reveal_fee,json=revealFee,proto3" json:"reveal_fee" json:"reveal_fee" yaml:"reveal_fee"`
// Minimum acceptable bid amount
MinimumBid types.Coin `protobuf:"bytes,5,opt,name=minimum_bid,json=minimumBid,proto3" json:"minimum_bid" json:"minimum_bid" yaml:"minimum_bid"`
} }
func (m *Params) Reset() { *m = Params{} } func (m *Params) Reset() { *m = Params{} }
func (m *Params) String() string { return proto.CompactTextString(m) } func (*Params) ProtoMessage() {}
func (*Params) ProtoMessage() {}
func (*Params) Descriptor() ([]byte, []int) { func (*Params) Descriptor() ([]byte, []int) {
return fileDescriptor_34b162eb5b365523, []int{0} return fileDescriptor_34b162eb5b365523, []int{0}
} }
@ -65,47 +75,65 @@ func (m *Params) XXX_DiscardUnknown() {
var xxx_messageInfo_Params proto.InternalMessageInfo var xxx_messageInfo_Params proto.InternalMessageInfo
func (m *Params) GetCommitsDuration() time.Duration {
if m != nil {
return m.CommitsDuration
}
return 0
}
func (m *Params) GetRevealsDuration() time.Duration {
if m != nil {
return m.RevealsDuration
}
return 0
}
func (m *Params) GetCommitFee() types.Coin {
if m != nil {
return m.CommitFee
}
return types.Coin{}
}
func (m *Params) GetRevealFee() types.Coin {
if m != nil {
return m.RevealFee
}
return types.Coin{}
}
func (m *Params) GetMinimumBid() types.Coin {
if m != nil {
return m.MinimumBid
}
return types.Coin{}
}
// Auction represents a sealed-bid on-chain auction // Auction represents a sealed-bid on-chain auction
type Auction struct { type Auction struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// Auction kind (vickrey | provider) Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty" json:"kind" yaml:"kind"`
Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
// Address of the creator of the auction // Address of the creator of the auction
OwnerAddress string `protobuf:"bytes,4,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` OwnerAddress string `protobuf:"bytes,3,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"`
// Timestamp at which the auction was created // Timestamp at which the auction was created
CreateTime time.Time `protobuf:"bytes,5,opt,name=create_time,json=createTime,proto3,stdtime" json:"create_time" json:"create_time" yaml:"create_time"` CreateTime time.Time `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3,stdtime" json:"create_time" json:"create_time" yaml:"create_time"`
// Timestamp at which the commits phase concluded // Timestamp at which the commits phase concluded
CommitsEndTime time.Time `protobuf:"bytes,6,opt,name=commits_end_time,json=commitsEndTime,proto3,stdtime" json:"commits_end_time" json:"commits_end_time" yaml:"commits_end_time"` CommitsEndTime time.Time `protobuf:"bytes,5,opt,name=commits_end_time,json=commitsEndTime,proto3,stdtime" json:"commits_end_time" json:"commits_end_time" yaml:"commits_end_time"`
// Timestamp at which the reveals phase concluded // Timestamp at which the reveals phase concluded
RevealsEndTime time.Time `protobuf:"bytes,7,opt,name=reveals_end_time,json=revealsEndTime,proto3,stdtime" json:"reveals_end_time" json:"reveals_end_time" yaml:"reveals_end_time"` RevealsEndTime time.Time `protobuf:"bytes,6,opt,name=reveals_end_time,json=revealsEndTime,proto3,stdtime" json:"reveals_end_time" json:"reveals_end_time" yaml:"reveals_end_time"`
// Commit and reveal fees must both be paid when committing a bid // Commit and reveal fees must both be paid when committing a bid
// Reveal fee is returned only if the bid is revealed // Reveal fee is returned only if the bid is revealed
CommitFee types.Coin `protobuf:"bytes,8,opt,name=commit_fee,json=commitFee,proto3" json:"commit_fee" json:"commit_fee" yaml:"commit_fee"` CommitFee types.Coin `protobuf:"bytes,7,opt,name=commit_fee,json=commitFee,proto3" json:"commit_fee" json:"commit_fee" yaml:"commit_fee"`
RevealFee types.Coin `protobuf:"bytes,9,opt,name=reveal_fee,json=revealFee,proto3" json:"reveal_fee" json:"reveal_fee" yaml:"reveal_fee"` RevealFee types.Coin `protobuf:"bytes,8,opt,name=reveal_fee,json=revealFee,proto3" json:"reveal_fee" json:"reveal_fee" yaml:"reveal_fee"`
// Minimum acceptable bid amount for a valid commit // Minimum acceptable bid amount for a valid commit
// Only applicable in vickrey auctions MinimumBid types.Coin `protobuf:"bytes,9,opt,name=minimum_bid,json=minimumBid,proto3" json:"minimum_bid" json:"minimum_bid" yaml:"minimum_bid"`
MinimumBid types.Coin `protobuf:"bytes,10,opt,name=minimum_bid,json=minimumBid,proto3" json:"minimum_bid" json:"minimum_bid" yaml:"minimum_bid"` // Address of the winner
// Addresses of the winners WinnerAddress string `protobuf:"bytes,10,opt,name=winner_address,json=winnerAddress,proto3" json:"winner_address,omitempty"`
// (single winner for vickrey auction) // Winning bid, i.e., the highest bid
// (multiple winners for provider auctions) WinningBid types.Coin `protobuf:"bytes,11,opt,name=winning_bid,json=winningBid,proto3" json:"winning_bid" json:"winning_bid" yaml:"winning_bid"`
WinnerAddresses []string `protobuf:"bytes,11,rep,name=winner_addresses,json=winnerAddresses,proto3" json:"winner_addresses,omitempty"` // Amount the winner pays, i.e. the second highest auction
// Winning bids, i.e. the best bids WinningPrice types.Coin `protobuf:"bytes,12,opt,name=winning_price,json=winningPrice,proto3" json:"winning_price" json:"winning_price" yaml:"winning_price"`
WinningBids []types.Coin `protobuf:"bytes,12,rep,name=winning_bids,json=winningBids,proto3" json:"winning_bids" json:"winning_bids" yaml:"winning_bids"`
// 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 types.Coin `protobuf:"bytes,13,opt,name=winning_price,json=winningPrice,proto3" json:"winning_price" json:"winning_price" yaml:"winning_price"`
// Maximum acceptable bid amount for a valid commit
// Only applicable in provider auctions
MaxPrice types.Coin `protobuf:"bytes,14,opt,name=max_price,json=maxPrice,proto3" json:"max_price" json:"max_price" yaml:"max_price"`
// 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"`
} }
func (m *Auction) Reset() { *m = Auction{} } func (m *Auction) Reset() { *m = Auction{} }
@ -235,60 +263,57 @@ func init() {
func init() { proto.RegisterFile("cerc/auction/v1/auction.proto", fileDescriptor_34b162eb5b365523) } func init() { proto.RegisterFile("cerc/auction/v1/auction.proto", fileDescriptor_34b162eb5b365523) }
var fileDescriptor_34b162eb5b365523 = []byte{ var fileDescriptor_34b162eb5b365523 = []byte{
// 846 bytes of a gzipped FileDescriptorProto // 798 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0xcd, 0x6e, 0xeb, 0x44, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4d, 0x4f, 0xdb, 0x4a,
0x14, 0xc7, 0xe3, 0x7e, 0xe4, 0x26, 0x27, 0x4d, 0x5a, 0x59, 0x08, 0x4c, 0xd1, 0x8d, 0x43, 0xaa, 0x14, 0x8d, 0x49, 0x08, 0xf1, 0x98, 0xc0, 0x93, 0xf5, 0xf4, 0x94, 0x17, 0x89, 0x04, 0x05, 0x21,
0x8a, 0x54, 0x57, 0xd7,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xb5, 0xd6, 0x13, 0x1a, 0x7d, 0xf2, 0xea, 0x66, 0xe8, 0xbc, 0xbe, 0xfe, 0x08, 0x46, 0x34, 0x21, 0x11, 0xf2, 0xdf, 0xe9, 0xff, 0x12, 0xc3, 0xaa, 0xe8, 0xf3, 0x83,
0x19, 0x3a, 0x7f, 0xde, 0x0c, 0x9d, 0x97, 0xb7, 0xc3, 0xd6, 0xeb, 0xdb, 0x61, 0xeb, 0xf7, 0xdb, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x61, 0xbb, 0x15, 0xc2, 0x47, 0x0a, 0x00, 0x00,
0x61, 0xeb, 0xdb, 0xe3, 0x19, 0x2d, 0x82, 0x05, 0x4e, 0x83, 0x42, 0x84, 0xd5, 0xd4, 0x3f, 0xa7,
0x22, 0x9c, 0xa3, 0x4c, 0x70, 0x9a, 0xe1, 0xf0, 0xda, 0xfe, 0xad, 0x49, 0xdb, 0xea, 0x9d, 0x3f,
0xfa, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xb8, 0x67, 0x62, 0x6b, 0xf8, 0x08, 0x00, 0x00,
} }
func (m *Params) Marshal() (dAtA []byte, err error) { func (m *Params) Marshal() (dAtA []byte, err error) {
@ -311,6 +336,52 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
{
size, err := m.MinimumBid.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
{
size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
{
size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
n4, err4 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.RevealsDuration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.RevealsDuration):])
if err4 != nil {
return 0, err4
}
i -= n4
i = encodeVarintAuction(dAtA, i, uint64(n4))
i--
dAtA[i] = 0x12
n5, err5 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.CommitsDuration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CommitsDuration):])
if err5 != nil {
return 0, err5
}
i -= n5
i = encodeVarintAuction(dAtA, i, uint64(n5))
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
@ -334,33 +405,6 @@ func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if m.FundsReleased {
i--
if m.FundsReleased {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0x80
}
if m.NumProviders != 0 {
i = encodeVarintAuction(dAtA, i, uint64(m.NumProviders))
i--
dAtA[i] = 0x78
}
{
size, err := m.MaxPrice.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x72
{ {
size, err := m.WinningPrice.MarshalToSizedBuffer(dAtA[:i]) size, err := m.WinningPrice.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
@ -370,29 +414,23 @@ func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintAuction(dAtA, i, uint64(size)) i = encodeVarintAuction(dAtA, i, uint64(size))
} }
i-- i--
dAtA[i] = 0x6a dAtA[i] = 0x62
if len(m.WinningBids) > 0 { {
for iNdEx := len(m.WinningBids) - 1; iNdEx >= 0; iNdEx-- { size, err := m.WinningBid.MarshalToSizedBuffer(dAtA[:i])
{ if err != nil {
size, err := m.WinningBids[iNdEx].MarshalToSizedBuffer(dAtA[:i]) return 0, err
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAuction(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x62
} }
i -= size
i = encodeVarintAuction(dAtA, i, uint64(size))
} }
if len(m.WinnerAddresses) > 0 { i--
for iNdEx := len(m.WinnerAddresses) - 1; iNdEx >= 0; iNdEx-- { dAtA[i] = 0x5a
i -= len(m.WinnerAddresses[iNdEx]) if len(m.WinnerAddress) > 0 {
copy(dAtA[i:], m.WinnerAddresses[iNdEx]) i -= len(m.WinnerAddress)
i = encodeVarintAuction(dAtA, i, uint64(len(m.WinnerAddresses[iNdEx]))) copy(dAtA[i:], m.WinnerAddress)
i-- i = encodeVarintAuction(dAtA, i, uint64(len(m.WinnerAddress)))
dAtA[i] = 0x5a i--
} dAtA[i] = 0x52
} }
{ {
size, err := m.MinimumBid.MarshalToSizedBuffer(dAtA[:i]) size, err := m.MinimumBid.MarshalToSizedBuffer(dAtA[:i])
@ -403,7 +441,7 @@ func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintAuction(dAtA, i, uint64(size)) i = encodeVarintAuction(dAtA, i, uint64(size))
} }
i-- i--
dAtA[i] = 0x52 dAtA[i] = 0x4a
{ {
size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i]) size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
@ -413,7 +451,7 @@ func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintAuction(dAtA, i, uint64(size)) i = encodeVarintAuction(dAtA, i, uint64(size))
} }
i-- i--
dAtA[i] = 0x4a dAtA[i] = 0x42
{ {
size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i]) size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
@ -423,50 +461,43 @@ func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintAuction(dAtA, i, uint64(size)) i = encodeVarintAuction(dAtA, i, uint64(size))
} }
i-- i--
dAtA[i] = 0x42
n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.RevealsEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.RevealsEndTime):])
if err6 != nil {
return 0, err6
}
i -= n6
i = encodeVarintAuction(dAtA, i, uint64(n6))
i--
dAtA[i] = 0x3a dAtA[i] = 0x3a
n7, err7 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CommitsEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CommitsEndTime):]) n11, err11 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.RevealsEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.RevealsEndTime):])
if err7 != nil { if err11 != nil {
return 0, err7 return 0, err11
} }
i -= n7 i -= n11
i = encodeVarintAuction(dAtA, i, uint64(n7)) i = encodeVarintAuction(dAtA, i, uint64(n11))
i-- i--
dAtA[i] = 0x32 dAtA[i] = 0x32
n8, err8 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CreateTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CreateTime):]) n12, err12 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CommitsEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CommitsEndTime):])
if err8 != nil { if err12 != nil {
return 0, err8 return 0, err12
} }
i -= n8 i -= n12
i = encodeVarintAuction(dAtA, i, uint64(n8)) i = encodeVarintAuction(dAtA, i, uint64(n12))
i-- i--
dAtA[i] = 0x2a dAtA[i] = 0x2a
n13, err13 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CreateTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CreateTime):])
if err13 != nil {
return 0, err13
}
i -= n13
i = encodeVarintAuction(dAtA, i, uint64(n13))
i--
dAtA[i] = 0x22
if len(m.OwnerAddress) > 0 { if len(m.OwnerAddress) > 0 {
i -= len(m.OwnerAddress) i -= len(m.OwnerAddress)
copy(dAtA[i:], m.OwnerAddress) copy(dAtA[i:], m.OwnerAddress)
i = encodeVarintAuction(dAtA, i, uint64(len(m.OwnerAddress))) i = encodeVarintAuction(dAtA, i, uint64(len(m.OwnerAddress)))
i-- i--
dAtA[i] = 0x22 dAtA[i] = 0x1a
} }
if len(m.Status) > 0 { if len(m.Status) > 0 {
i -= len(m.Status) i -= len(m.Status)
copy(dAtA[i:], m.Status) copy(dAtA[i:], m.Status)
i = encodeVarintAuction(dAtA, i, uint64(len(m.Status))) i = encodeVarintAuction(dAtA, i, uint64(len(m.Status)))
i-- i--
dAtA[i] = 0x1a
}
if len(m.Kind) > 0 {
i -= len(m.Kind)
copy(dAtA[i:], m.Kind)
i = encodeVarintAuction(dAtA, i, uint64(len(m.Kind)))
i--
dAtA[i] = 0x12 dAtA[i] = 0x12
} }
if len(m.Id) > 0 { if len(m.Id) > 0 {
@ -556,12 +587,12 @@ func (m *Bid) MarshalToSizedBuffer(dAtA []byte) (int, error) {
} }
i-- i--
dAtA[i] = 0x42 dAtA[i] = 0x42
n11, err11 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.RevealTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.RevealTime):]) n16, err16 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.RevealTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.RevealTime):])
if err11 != nil { if err16 != nil {
return 0, err11 return 0, err16
} }
i -= n11 i -= n16
i = encodeVarintAuction(dAtA, i, uint64(n11)) i = encodeVarintAuction(dAtA, i, uint64(n16))
i-- i--
dAtA[i] = 0x3a dAtA[i] = 0x3a
{ {
@ -574,12 +605,12 @@ func (m *Bid) MarshalToSizedBuffer(dAtA []byte) (int, error) {
} }
i-- i--
dAtA[i] = 0x32 dAtA[i] = 0x32
n13, err13 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CommitTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CommitTime):]) n18, err18 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CommitTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CommitTime):])
if err13 != nil { if err18 != nil {
return 0, err13 return 0, err18
} }
i -= n13 i -= n18
i = encodeVarintAuction(dAtA, i, uint64(n13)) i = encodeVarintAuction(dAtA, i, uint64(n18))
i-- i--
dAtA[i] = 0x2a dAtA[i] = 0x2a
if len(m.CommitHash) > 0 { if len(m.CommitHash) > 0 {
@ -630,6 +661,16 @@ func (m *Params) Size() (n int) {
} }
var l int var l int
_ = l _ = l
l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CommitsDuration)
n += 1 + l + sovAuction(uint64(l))
l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.RevealsDuration)
n += 1 + l + sovAuction(uint64(l))
l = m.CommitFee.Size()
n += 1 + l + sovAuction(uint64(l))
l = m.RevealFee.Size()
n += 1 + l + sovAuction(uint64(l))
l = m.MinimumBid.Size()
n += 1 + l + sovAuction(uint64(l))
return n return n
} }
@ -643,10 +684,6 @@ func (m *Auction) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovAuction(uint64(l)) n += 1 + l + sovAuction(uint64(l))
} }
l = len(m.Kind)
if l > 0 {
n += 1 + l + sovAuction(uint64(l))
}
l = len(m.Status) l = len(m.Status)
if l > 0 { if l > 0 {
n += 1 + l + sovAuction(uint64(l)) n += 1 + l + sovAuction(uint64(l))
@ -667,28 +704,14 @@ func (m *Auction) Size() (n int) {
n += 1 + l + sovAuction(uint64(l)) n += 1 + l + sovAuction(uint64(l))
l = m.MinimumBid.Size() l = m.MinimumBid.Size()
n += 1 + l + sovAuction(uint64(l)) n += 1 + l + sovAuction(uint64(l))
if len(m.WinnerAddresses) > 0 { l = len(m.WinnerAddress)
for _, s := range m.WinnerAddresses { if l > 0 {
l = len(s) n += 1 + l + sovAuction(uint64(l))
n += 1 + l + sovAuction(uint64(l))
}
}
if len(m.WinningBids) > 0 {
for _, e := range m.WinningBids {
l = e.Size()
n += 1 + l + sovAuction(uint64(l))
}
} }
l = m.WinningBid.Size()
n += 1 + l + sovAuction(uint64(l))
l = m.WinningPrice.Size() l = m.WinningPrice.Size()
n += 1 + l + sovAuction(uint64(l)) n += 1 + l + sovAuction(uint64(l))
l = m.MaxPrice.Size()
n += 1 + l + sovAuction(uint64(l))
if m.NumProviders != 0 {
n += 1 + sovAuction(uint64(m.NumProviders))
}
if m.FundsReleased {
n += 3
}
return n return n
} }
@ -777,6 +800,171 @@ func (m *Params) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CommitsDuration", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAuction
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAuction
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.CommitsDuration, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RevealsDuration", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAuction
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAuction
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.RevealsDuration, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CommitFee", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAuction
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAuction
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.CommitFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RevealFee", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAuction
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAuction
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RevealFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MinimumBid", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAuction
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAuction
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.MinimumBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipAuction(dAtA[iNdEx:]) skippy, err := skipAuction(dAtA[iNdEx:])
@ -860,38 +1048,6 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
m.Id = string(dAtA[iNdEx:postIndex]) m.Id = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthAuction
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthAuction
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Kind = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType)
} }
@ -923,7 +1079,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
} }
m.Status = string(dAtA[iNdEx:postIndex]) m.Status = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 4: case 3:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType)
} }
@ -955,7 +1111,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
} }
m.OwnerAddress = string(dAtA[iNdEx:postIndex]) m.OwnerAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 5: case 4:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CreateTime", wireType) return fmt.Errorf("proto: wrong wireType = %d for field CreateTime", wireType)
} }
@ -988,7 +1144,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 6: case 5:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CommitsEndTime", wireType) return fmt.Errorf("proto: wrong wireType = %d for field CommitsEndTime", wireType)
} }
@ -1021,7 +1177,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 7: case 6:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RevealsEndTime", wireType) return fmt.Errorf("proto: wrong wireType = %d for field RevealsEndTime", wireType)
} }
@ -1054,7 +1210,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 8: case 7:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CommitFee", wireType) return fmt.Errorf("proto: wrong wireType = %d for field CommitFee", wireType)
} }
@ -1087,7 +1243,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 9: case 8:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RevealFee", wireType) return fmt.Errorf("proto: wrong wireType = %d for field RevealFee", wireType)
} }
@ -1120,7 +1276,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 10: case 9:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MinimumBid", wireType) return fmt.Errorf("proto: wrong wireType = %d for field MinimumBid", wireType)
} }
@ -1153,9 +1309,9 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 11: case 10:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field WinnerAddresses", wireType) return fmt.Errorf("proto: wrong wireType = %d for field WinnerAddress", wireType)
} }
var stringLen uint64 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1183,11 +1339,11 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.WinnerAddresses = append(m.WinnerAddresses, string(dAtA[iNdEx:postIndex])) m.WinnerAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 12: case 11:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field WinningBids", wireType) return fmt.Errorf("proto: wrong wireType = %d for field WinningBid", wireType)
} }
var msglen int var msglen int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1214,12 +1370,11 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.WinningBids = append(m.WinningBids, types.Coin{}) if err := m.WinningBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
if err := m.WinningBids[len(m.WinningBids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 13: case 12:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field WinningPrice", wireType) return fmt.Errorf("proto: wrong wireType = %d for field WinningPrice", wireType)
} }
@ -1252,78 +1407,6 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 14:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MaxPrice", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAuction
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAuction
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.MaxPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 15:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field NumProviders", wireType)
}
m.NumProviders = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.NumProviders |= int32(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 16:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field FundsReleased", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAuction
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.FundsReleased = bool(v != 0)
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipAuction(dAtA[iNdEx:]) skippy, err := skipAuction(dAtA[iNdEx:])

View File

@ -4,7 +4,6 @@ import (
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"os" "os"
"strconv"
"time" "time"
"github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client"
@ -13,6 +12,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper"
wnsUtils "git.vdb.to/cerc-io/laconicd/utils" wnsUtils "git.vdb.to/cerc-io/laconicd/utils"
auctiontypes "git.vdb.to/cerc-io/laconicd/x/auction" auctiontypes "git.vdb.to/cerc-io/laconicd/x/auction"
@ -48,16 +48,6 @@ func GetCmdCommitBid() *cobra.Command {
return err return err
} }
// Take chain id passed by user
chainId, _ := cmd.Flags().GetString(flags.FlagChainID)
if chainId == "" {
// Take from config if not provided
chainId = clientCtx.ChainID
}
if chainId == "" {
return fmt.Errorf("--chain-id required")
}
bidAmount, err := sdk.ParseCoinNormalized(args[1]) bidAmount, err := sdk.ParseCoinNormalized(args[1])
if err != nil { if err != nil {
return err return err
@ -68,6 +58,7 @@ func GetCmdCommitBid() *cobra.Command {
return err return err
} }
chainId := viper.GetString("chain-id")
auctionId := args[0] auctionId := args[0]
reveal := map[string]interface{}{ reveal := map[string]interface{}{
@ -141,63 +132,48 @@ func GetCmdRevealBid() *cobra.Command {
func GetCmdCreateAuction() *cobra.Command { func GetCmdCreateAuction() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "create [kind] [commits-duration] [reveals-duration] [commit-fee] [reveal-fee] [minimum-bid] [max-price] [num-providers]", Use: "create [commits-duration] [reveals-duration] [commit-fee] [reveal-fee] [minimum-bid]",
Short: "Create auction.", Short: "Create auction.",
Args: cobra.ExactArgs(8), Args: cobra.ExactArgs(5),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd) clientCtx, err := client.GetClientTxContext(cmd)
if err != nil { if err != nil {
return err return err
} }
kind := args[0] commitsDuration, err := time.ParseDuration(args[0])
commitsDuration, err := time.ParseDuration(args[1])
if err != nil { if err != nil {
return err return err
} }
revealsDuration, err := time.ParseDuration(args[2]) revealsDuration, err := time.ParseDuration(args[1])
if err != nil { if err != nil {
return err return err
} }
commitFee, err := sdk.ParseCoinNormalized(args[3]) commitFee, err := sdk.ParseCoinNormalized(args[2])
if err != nil { if err != nil {
return err return err
} }
revealFee, err := sdk.ParseCoinNormalized(args[4]) revealFee, err := sdk.ParseCoinNormalized(args[3])
if err != nil { if err != nil {
return err return err
} }
minimumBid, err := sdk.ParseCoinNormalized(args[5]) minimumBid, err := sdk.ParseCoinNormalized(args[4])
if err != nil { if err != nil {
return err return err
} }
maxPrice, err := sdk.ParseCoinNormalized(args[6]) params := auctiontypes.Params{
if err != nil { CommitsDuration: commitsDuration,
return err RevealsDuration: revealsDuration,
CommitFee: commitFee,
RevealFee: revealFee,
MinimumBid: minimumBid,
} }
msg := auctiontypes.NewMsgCreateAuction(params, clientCtx.GetFromAddress())
numProviders, err := strconv.ParseInt(args[7], 10, 32)
if err != nil {
return err
}
msg := auctiontypes.NewMsgCreateAuction(
kind,
commitsDuration,
revealsDuration,
commitFee,
revealFee,
minimumBid,
maxPrice,
int32(numProviders),
clientCtx.GetFromAddress(),
)
err = msg.ValidateBasic() err = msg.ValidateBasic()
if err != nil { if err != nil {
return err return err

View File

@ -4,7 +4,6 @@ const (
EventTypeCreateAuction = "create-auction" EventTypeCreateAuction = "create-auction"
EventTypeCommitBid = "commit-bid" EventTypeCommitBid = "commit-bid"
EventTypeRevealBid = "reveal-bid" EventTypeRevealBid = "reveal-bid"
EventTypeReleaseFunds = "release-funds"
AttributeKeyCommitsDuration = "commits-duration" AttributeKeyCommitsDuration = "commits-duration"
AttributeKeyRevealsDuration = "reveals-duration" AttributeKeyRevealsDuration = "reveals-duration"

View File

@ -5,7 +5,6 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"slices"
"time" "time"
"cosmossdk.io/collections" "cosmossdk.io/collections"
@ -13,7 +12,6 @@ import (
storetypes "cosmossdk.io/core/store" storetypes "cosmossdk.io/core/store"
errorsmod "cosmossdk.io/errors" errorsmod "cosmossdk.io/errors"
"cosmossdk.io/log" "cosmossdk.io/log"
"cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
@ -26,7 +24,7 @@ import (
) )
// CompletedAuctionDeleteTimeout => Completed auctions are deleted after this timeout (after reveals end time). // CompletedAuctionDeleteTimeout => Completed auctions are deleted after this timeout (after reveals end time).
const CompletedAuctionDeleteTimeout = 365 * 24 * time.Hour // 1 year const CompletedAuctionDeleteTimeout = time.Hour * 24
type AuctionsIndexes struct { type AuctionsIndexes struct {
Owner *indexes.Multi[string, string, auctiontypes.Auction] Owner *indexes.Multi[string, string, auctiontypes.Auction]
@ -341,18 +339,8 @@ func (k Keeper) CreateAuction(ctx sdk.Context, msg auctiontypes.MsgCreateAuction
commitsEndTime := now.Add(msg.CommitsDuration) commitsEndTime := now.Add(msg.CommitsDuration)
revealsEndTime := now.Add(msg.CommitsDuration + msg.RevealsDuration) revealsEndTime := now.Add(msg.CommitsDuration + msg.RevealsDuration)
if msg.Kind == auctiontypes.AuctionKindProvider {
totalLockedAmount := sdk.NewCoin(msg.MaxPrice.Denom, msg.MaxPrice.Amount.MulRaw(int64(msg.NumProviders)))
sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, signerAddress, auctiontypes.ModuleName, sdk.NewCoins(totalLockedAmount))
if sdkErr != nil {
return nil, errorsmod.Wrap(sdkErr, "Auction error transferring maximum price amount")
}
}
auction := auctiontypes.Auction{ auction := auctiontypes.Auction{
Id: auctionId, Id: auctionId,
Kind: msg.Kind,
Status: auctiontypes.AuctionStatusCommitPhase, Status: auctiontypes.AuctionStatusCommitPhase,
OwnerAddress: signerAddress.String(), OwnerAddress: signerAddress.String(),
CreateTime: now, CreateTime: now,
@ -361,8 +349,6 @@ func (k Keeper) CreateAuction(ctx sdk.Context, msg auctiontypes.MsgCreateAuction
CommitFee: msg.CommitFee, CommitFee: msg.CommitFee,
RevealFee: msg.RevealFee, RevealFee: msg.RevealFee,
MinimumBid: msg.MinimumBid, MinimumBid: msg.MinimumBid,
MaxPrice: msg.MaxPrice,
NumProviders: msg.NumProviders,
} }
// Save auction in store. // Save auction in store.
@ -530,20 +516,14 @@ func (k Keeper) RevealBid(ctx sdk.Context, msg auctiontypes.MsgRevealBid) (*auct
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal bid amount.") return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal bid amount.")
} }
if auction.Kind == auctiontypes.AuctionKindVickrey && bidAmount.IsLT(auction.MinimumBid) { if bidAmount.IsLT(auction.MinimumBid) {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Bid is lower than minimum bid.") return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Bid is lower than minimum bid.")
} }
if auction.Kind == auctiontypes.AuctionKindProvider && auction.MaxPrice.IsLT(bidAmount) {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Bid is higher than max price.")
}
// Lock bid amount. // Lock bid amount.
if auction.Kind == auctiontypes.AuctionKindVickrey { sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, signerAddress, auctiontypes.ModuleName, sdk.NewCoins(bidAmount))
sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, signerAddress, auctiontypes.ModuleName, sdk.NewCoins(bidAmount)) if sdkErr != nil {
if sdkErr != nil { return nil, sdkErr
return nil, sdkErr
}
} }
// Update bid. // Update bid.
@ -626,14 +606,8 @@ func (k Keeper) processAuctionPhases(ctx sdk.Context) error {
// If auction has expired, pick a winner from revealed bids. // If auction has expired, pick a winner from revealed bids.
if auction.Status == auctiontypes.AuctionStatusExpired { if auction.Status == auctiontypes.AuctionStatusExpired {
if auction.Kind == auctiontypes.AuctionKindVickrey { if err = k.pickAuctionWinner(ctx, auction); err != nil {
if err = k.pickAuctionWinner(ctx, auction); err != nil { return err
return err
}
} else {
if err = k.pickProviderAuctionWinners(ctx, auction); err != nil {
return err
}
} }
} }
} }
@ -661,7 +635,6 @@ func (k Keeper) deleteCompletedAuctions(ctx sdk.Context) error {
return nil return nil
} }
// Pick winner for vickrey auction
func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction) error { func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction) error {
k.Logger(ctx).Info(fmt.Sprintf("Picking auction %s winner.", auction.Id)) k.Logger(ctx).Info(fmt.Sprintf("Picking auction %s winner.", auction.Id))
@ -713,17 +686,17 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction
auction.Status = auctiontypes.AuctionStatusCompleted auction.Status = auctiontypes.AuctionStatusCompleted
if highestBid != nil { if highestBid != nil {
auction.WinningBids = []sdk.Coin{highestBid.BidAmount} auction.WinnerAddress = highestBid.BidderAddress
auction.WinnerAddresses = []string{highestBid.BidderAddress} auction.WinningBid = highestBid.BidAmount
// Winner pays 2nd price, if a 2nd price exists. // Winner pays 2nd price, if a 2nd price exists.
auction.WinningPrice = highestBid.BidAmount auction.WinningPrice = highestBid.BidAmount
if secondHighestBid != nil { if secondHighestBid != nil {
auction.WinningPrice = secondHighestBid.BidAmount auction.WinningPrice = secondHighestBid.BidAmount
} }
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner %s.", auction.Id, auction.WinnerAddresses[0])) k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner %s.", auction.Id, auction.WinnerAddress))
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner bid %s.", auction.Id, auction.WinningBids[0].String())) k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner bid %s.", auction.Id, auction.WinningBid.String()))
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winning price %s.", auction.Id, auction.WinningPrice.String())) k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner price %s.", auction.Id, auction.WinningPrice.String()))
} else { } else {
k.Logger(ctx).Info(fmt.Sprintf("Auction %s has no valid revealed bids (no winner).", auction.Id)) k.Logger(ctx).Info(fmt.Sprintf("Auction %s has no valid revealed bids (no winner).", auction.Id))
} }
@ -757,8 +730,8 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction
} }
// Process winner account (if nobody bids, there won't be a winner). // Process winner account (if nobody bids, there won't be a winner).
if len(auction.WinnerAddresses) != 0 { if auction.WinnerAddress != "" {
winnerAddress, err := sdk.AccAddressFromBech32(auction.WinnerAddresses[0]) winnerAddress, err := sdk.AccAddressFromBech32(auction.WinnerAddress)
if err != nil { if err != nil {
k.Logger(ctx).Error(fmt.Sprintf("Invalid winner address. %v", err)) k.Logger(ctx).Error(fmt.Sprintf("Invalid winner address. %v", err))
panic("Invalid winner address.") panic("Invalid winner address.")
@ -800,173 +773,3 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *auctiontypes.Auction
return nil return nil
} }
// Pick winner for provider auction
func (k Keeper) pickProviderAuctionWinners(ctx sdk.Context, auction *auctiontypes.Auction) error {
k.Logger(ctx).Info(fmt.Sprintf("Picking auction %s winners.", auction.Id))
bids, err := k.GetBids(ctx, auction.Id)
if err != nil {
return err
}
revealedBids := make([]*auctiontypes.Bid, 0, len(bids))
for _, bid := range bids {
k.Logger(ctx).Info(fmt.Sprintf("Processing bid %s %s", bid.BidderAddress, bid.BidAmount.String()))
// Only consider revealed bids.
if bid.Status != auctiontypes.BidStatusRevealed {
k.Logger(ctx).Info(fmt.Sprintf("Ignoring unrevealed bid %s %s", bid.BidderAddress, bid.BidAmount.String()))
continue
}
revealedBids = append(revealedBids, bid)
}
// Sort the valid bids
slices.SortStableFunc(revealedBids, func(a, b *auctiontypes.Bid) int {
if a.BidAmount.Amount.LT(b.BidAmount.Amount) {
return -1
} else if a.BidAmount.Amount.GT(b.BidAmount.Amount) {
return 1
}
return 0
})
// Take best min(len(revealedBids), auction.NumProviders) bids
numWinners := int(auction.NumProviders)
if len(revealedBids) < numWinners {
numWinners = len(revealedBids)
}
winnerBids := revealedBids[:numWinners]
auction.Status = auctiontypes.AuctionStatusCompleted
if len(winnerBids) > 0 {
winnerAddresses := make([]string, len(winnerBids))
winningBids := make([]sdk.Coin, len(winnerBids))
for i, bid := range winnerBids {
winnerAddresses[i] = bid.BidderAddress
winningBids[i] = bid.BidAmount
}
auction.WinnerAddresses = winnerAddresses
auction.WinningBids = winningBids
// The last best bid is the winning price
auction.WinningPrice = winnerBids[len(winnerBids)-1].BidAmount
for _, bid := range winnerBids {
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winner address: %s, bid amount: %s.", auction.Id, bid.BidderAddress, bid.BidAmount.String()))
}
k.Logger(ctx).Info(fmt.Sprintf("Auction %s winning price %s.", auction.Id, auction.WinningPrice.String()))
} else {
k.Logger(ctx).Info(fmt.Sprintf("Auction %s has no valid revealed bids (no winner).", auction.Id))
}
if err := k.SaveAuction(ctx, auction); err != nil {
return err
}
for _, bid := range bids {
bidderAddress, err := sdk.AccAddressFromBech32(bid.BidderAddress)
if err != nil {
k.Logger(ctx).Error(fmt.Sprintf("Invalid bidderAddress address. %v", err))
panic("Invalid bidder address.")
}
if bid.Status == auctiontypes.BidStatusRevealed {
// Send reveal fee back to bidders that've revealed the bid.
sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, auctiontypes.ModuleName, bidderAddress, sdk.NewCoins(bid.RevealFee))
if sdkErr != nil {
k.Logger(ctx).Error(fmt.Sprintf("Auction error returning reveal fee: %v", sdkErr))
panic(sdkErr)
}
}
}
// Send back any leftover locked amount to auction creator
// All of it in case of no winners
totalLockedAmount := auction.MaxPrice.Amount.Mul(math.NewInt(int64(auction.NumProviders)))
totalAmountPaid := auction.WinningPrice.Amount.Mul(math.NewInt(int64(len(auction.WinnerAddresses))))
creatorLeftOverAmount := sdk.NewCoin(auction.MaxPrice.Denom, totalLockedAmount.Sub(totalAmountPaid))
ownerAccAddress, err := sdk.AccAddressFromBech32(auction.OwnerAddress)
if err != nil {
k.Logger(ctx).Error(fmt.Sprintf("Invalid auction owner address. %v", err))
panic("Invalid auction owner address.")
}
sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(
ctx,
auctiontypes.ModuleName,
ownerAccAddress,
sdk.NewCoins(creatorLeftOverAmount),
)
if sdkErr != nil {
k.Logger(ctx).Error(fmt.Sprintf("Auction error returning leftover locked amount: %v", sdkErr))
panic(sdkErr)
}
// Notify other modules (hook).
k.Logger(ctx).Info(fmt.Sprintf("Auction %s notifying %d modules.", auction.Id, len(k.usageKeepers)))
for _, keeper := range k.usageKeepers {
k.Logger(ctx).Info(fmt.Sprintf("Auction %s notifying module %s.", auction.Id, keeper.ModuleName()))
keeper.OnAuctionWinnerSelected(ctx, auction.Id)
}
return nil
}
func (k Keeper) ReleaseFunds(ctx sdk.Context, msg auctiontypes.MsgReleaseFunds) (*auctiontypes.Auction, error) {
auction, err := k.GetAuctionById(ctx, msg.AuctionId)
if err != nil {
return nil, err
}
if auction.Kind != auctiontypes.AuctionKindProvider {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Auction kind must be provider.")
}
// Only the auction owner can release funds.
if msg.Signer != auction.OwnerAddress {
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.FundsReleased {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Auction funds already released.")
}
// Mark funds as released in the stored auction
auction.FundsReleased = true
if err = k.SaveAuction(ctx, &auction); err != nil {
return nil, err
}
// Process winner accounts.
for _, winnerAddress := range auction.WinnerAddresses {
winnerAccAddress, err := sdk.AccAddressFromBech32(winnerAddress)
if err != nil {
k.Logger(ctx).Error(fmt.Sprintf("Invalid winner address. %v", err))
panic("Invalid winner address.")
}
// Send winning price to winning bidders
sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(
ctx,
auctiontypes.ModuleName,
winnerAccAddress,
sdk.NewCoins(auction.WinningPrice),
)
if sdkErr != nil {
k.Logger(ctx).Error(fmt.Sprintf("Auction error sending funds to winner: %v", sdkErr))
panic(sdkErr)
}
}
return &auction, err
}

View File

@ -56,6 +56,7 @@ func (ms msgServer) CreateAuction(c context.Context, msg *auctiontypes.MsgCreate
} }
// CommitBid is the command for committing a bid // CommitBid is the command for committing a bid
// nolint: all
func (ms msgServer) CommitBid(c context.Context, msg *auctiontypes.MsgCommitBid) (*auctiontypes.MsgCommitBidResponse, error) { func (ms msgServer) CommitBid(c context.Context, msg *auctiontypes.MsgCommitBid) (*auctiontypes.MsgCommitBidResponse, error) {
if err := msg.ValidateBasic(); err != nil { if err := msg.ValidateBasic(); err != nil {
return nil, err return nil, err
@ -93,6 +94,7 @@ func (ms msgServer) CommitBid(c context.Context, msg *auctiontypes.MsgCommitBid)
} }
// RevealBid is the command for revealing a bid // RevealBid is the command for revealing a bid
// nolint: all
func (ms msgServer) RevealBid(c context.Context, msg *auctiontypes.MsgRevealBid) (*auctiontypes.MsgRevealBidResponse, error) { func (ms msgServer) RevealBid(c context.Context, msg *auctiontypes.MsgRevealBid) (*auctiontypes.MsgRevealBidResponse, error) {
if err := msg.ValidateBasic(); err != nil { if err := msg.ValidateBasic(); err != nil {
return nil, err return nil, err
@ -147,39 +149,3 @@ func (ms msgServer) UpdateParams(c context.Context, msg *auctiontypes.MsgUpdateP
return &auctiontypes.MsgUpdateParamsResponse{}, nil return &auctiontypes.MsgUpdateParamsResponse{}, nil
} }
// ReleaseFunds is the command to pay the winning amounts to provider auction winners
func (ms msgServer) ReleaseFunds(c context.Context, msg *auctiontypes.MsgReleaseFunds) (*auctiontypes.MsgReleaseFundsResponse, error) {
if err := msg.ValidateBasic(); err != nil {
return nil, err
}
ctx := sdk.UnwrapSDKContext(c)
ctx = *utils.CtxWithCustomKVGasConfig(&ctx)
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
if err != nil {
return nil, err
}
resp, err := ms.k.ReleaseFunds(ctx, *msg)
if err != nil {
return nil, err
}
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
auctiontypes.EventTypeReleaseFunds,
sdk.NewAttribute(auctiontypes.AttributeKeyAuctionId, msg.AuctionId),
),
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, auctiontypes.AttributeValueCategory),
sdk.NewAttribute(auctiontypes.AttributeKeySigner, signerAddress.String()),
),
})
utils.LogTxGasConsumed(ctx, ms.k.Logger(ctx), "ReleaseFunds")
return &auctiontypes.MsgReleaseFundsResponse{Auction: resp}, nil
}

View File

@ -81,19 +81,14 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
RpcCommandOptions: []*autocliv1.RpcCommandOptions{ RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{ {
RpcMethod: "CreateAuction", RpcMethod: "CreateAuction",
Use: "create [commits-duration] [reveals-duration] [commit-fee] [reveal-fee]", Use: "create [commits-duration] [reveals-duration] [commit-fee] [reveal-fee] [minimum-bid]",
Short: "Create an auction", Short: "Create an auction",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{ PositionalArgs: []*autocliv1.PositionalArgDescriptor{
{ProtoField: "commits_duration"}, {ProtoField: "commits_duration"},
{ProtoField: "reveals_duration"}, {ProtoField: "reveals_duration"},
{ProtoField: "commit_fee"}, {ProtoField: "commit_fee"},
{ProtoField: "reveal_fee"}, {ProtoField: "reveal_fee"},
}, {ProtoField: "minimum_bid"},
FlagOptions: map[string]*autocliv1.FlagOptions{
"kind": {Name: "kind", DefaultValue: "vickrey", Usage: "Auction kind (vickrey|provider) (default: vickrey)"},
"minimum_bid": {Name: "minimum-bid", Usage: "Minimum bid (required for vickrey auctions)"},
"max_price": {Name: "max-price", Usage: "Max price (required for provider auctions)"},
"num_providers": {Name: "num-providers", Usage: "Number of desired providers (required for provider auctions)"},
}, },
}, },
{ {

View File

@ -1,9 +1,6 @@
package auction package auction
import ( import (
"fmt"
time "time"
errorsmod "cosmossdk.io/errors" errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
@ -16,26 +13,13 @@ var (
) )
// NewMsgCreateAuction is the constructor function for MsgCreateAuction. // NewMsgCreateAuction is the constructor function for MsgCreateAuction.
func NewMsgCreateAuction( func NewMsgCreateAuction(params Params, signer sdk.AccAddress) MsgCreateAuction {
kind string,
commitsDuration time.Duration,
revealsDuration time.Duration,
commitFee sdk.Coin,
revealFee sdk.Coin,
minimumBid sdk.Coin,
maxPrice sdk.Coin,
numProviders int32,
signer sdk.AccAddress,
) MsgCreateAuction {
return MsgCreateAuction{ return MsgCreateAuction{
CommitsDuration: commitsDuration, CommitsDuration: params.CommitsDuration,
RevealsDuration: revealsDuration, RevealsDuration: params.RevealsDuration,
CommitFee: commitFee, CommitFee: params.CommitFee,
RevealFee: revealFee, RevealFee: params.RevealFee,
MinimumBid: minimumBid, MinimumBid: params.MinimumBid,
MaxPrice: maxPrice,
Kind: kind,
NumProviders: numProviders,
Signer: signer.String(), Signer: signer.String(),
} }
} }
@ -49,53 +33,22 @@ func NewMsgCommitBid(auctionId string, commitHash string, signer sdk.AccAddress)
} }
} }
// NewMsgRevealBid is the constructor function for MsgRevealBid.
func NewMsgRevealBid(auctionId string, reveal string, signer sdk.AccAddress) MsgRevealBid {
return MsgRevealBid{
AuctionId: auctionId,
Reveal: reveal,
Signer: signer.String(),
}
}
// NewMsgReleaseFunds is the constructor function for MsgReleaseFunds.
func NewMsgReleaseFunds(auctionId string, signer sdk.AccAddress) MsgReleaseFunds {
return MsgReleaseFunds{
AuctionId: auctionId,
Signer: signer.String(),
}
}
// ValidateBasic Implements Msg. // ValidateBasic Implements Msg.
func (msg MsgCreateAuction) ValidateBasic() error { func (msg MsgCreateAuction) ValidateBasic() error {
if msg.Signer == "" { if msg.Signer == "" {
return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, msg.Signer) return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, msg.Signer)
} }
if msg.Kind != AuctionKindVickrey && msg.Kind != AuctionKindProvider {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("auction kind should be one of %s | %s", AuctionKindVickrey, AuctionKindProvider))
}
if msg.CommitsDuration <= 0 { if msg.CommitsDuration <= 0 {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "commit phase duration invalid") return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "commit phase duration invalid.")
} }
if msg.RevealsDuration <= 0 { if msg.RevealsDuration <= 0 {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "reveal phase duration invalid") return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "reveal phase duration invalid.")
} }
if msg.Kind == AuctionKindVickrey && !msg.MinimumBid.IsPositive() { if !msg.MinimumBid.IsPositive() {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("minimum bid should be greater than zero for %s auction", AuctionKindVickrey)) return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "minimum bid should be greater than zero.")
}
if msg.Kind == AuctionKindProvider {
if !msg.MaxPrice.IsPositive() {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("max price should be greater than zero for %s auction", AuctionKindProvider))
}
if msg.NumProviders <= 0 {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("num providers should be greater than zero for %s auction", AuctionKindProvider))
}
} }
return nil return nil
@ -118,6 +71,15 @@ func (msg MsgCommitBid) ValidateBasic() error {
return nil return nil
} }
// NewMsgRevealBid is the constructor function for MsgRevealBid.
func NewMsgRevealBid(auctionId string, reveal string, signer sdk.AccAddress) MsgRevealBid {
return MsgRevealBid{
AuctionId: auctionId,
Reveal: reveal,
Signer: signer.String(),
}
}
// ValidateBasic Implements Msg. // ValidateBasic Implements Msg.
func (msg MsgRevealBid) ValidateBasic() error { func (msg MsgRevealBid) ValidateBasic() error {
if msg.Signer == "" { if msg.Signer == "" {
@ -134,16 +96,3 @@ func (msg MsgRevealBid) ValidateBasic() error {
return nil return nil
} }
// ValidateBasic Implements Msg.
func (msg MsgReleaseFunds) ValidateBasic() error {
if msg.Signer == "" {
return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer address")
}
if msg.AuctionId == "" {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid auction id")
}
return nil
}

View File

@ -1,11 +1,143 @@
package auction package auction
import (
"errors"
fmt "fmt"
"strings"
time "time"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
)
var (
DefaultCommitsDuration = 5 * time.Minute
DefaultRevealsDuration = 5 * time.Minute
DefaultCommitFee = sdkmath.NewInt(1000) // 10^3 alnt
DefaultRevealFee = sdkmath.NewInt(1000) // 10^3 alnt
DefaultMinimumBid = sdkmath.NewInt(1000000) // 10^6 alnt
)
func NewParams(commitsDuration time.Duration, revealsDuration time.Duration, commitFee sdk.Coin, revealFee sdk.Coin, minimumBid sdk.Coin) Params {
return Params{
CommitsDuration: commitsDuration,
RevealsDuration: revealsDuration,
CommitFee: commitFee,
RevealFee: revealFee,
MinimumBid: minimumBid,
}
}
// DefaultParams returns a default set of parameters. // DefaultParams returns a default set of parameters.
func DefaultParams() Params { func DefaultParams() Params {
return Params{} return Params{
CommitsDuration: DefaultCommitsDuration,
RevealsDuration: DefaultRevealsDuration,
CommitFee: sdk.NewCoin(sdk.DefaultBondDenom, DefaultCommitFee),
RevealFee: sdk.NewCoin(sdk.DefaultBondDenom, DefaultRevealFee),
MinimumBid: sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinimumBid),
}
}
// String returns a human readable string representation of the parameters.
func (p Params) String() string {
var sb strings.Builder
sb.WriteString("Params: \n")
sb.WriteString(fmt.Sprintf("CommitsDuration: %s\n", p.CommitsDuration.String()))
sb.WriteString(fmt.Sprintf("RevealsDuration: %s\n", p.RevealsDuration.String()))
sb.WriteString(fmt.Sprintf("CommitFee: %s\n", p.CommitFee.String()))
sb.WriteString(fmt.Sprintf("RevealFee: %s\n", p.RevealFee.String()))
sb.WriteString(fmt.Sprintf("MinimumBid: %s\n", p.MinimumBid.String()))
return sb.String()
} }
// Validate a set of params. // Validate a set of params.
func (p Params) Validate() error { func (p Params) Validate() error {
if err := validateCommitsDuration(p.CommitsDuration); err != nil {
return err
}
if err := validateRevealsDuration(p.RevealsDuration); err != nil {
return err
}
if err := validateCommitFee(p.CommitFee); err != nil {
return err
}
if err := validateRevealFee(p.RevealFee); err != nil {
return err
}
if err := validateMinimumBid(p.MinimumBid); err != nil {
return err
}
return nil
}
func validateCommitsDuration(i interface{}) error {
v, ok := i.(time.Duration)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if v < 0 {
return errors.New("commits duration cannot be negative")
}
return nil
}
func validateRevealsDuration(i interface{}) error {
v, ok := i.(time.Duration)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if v < 0 {
return errors.New("reveals duration cannot be negative")
}
return nil
}
func validateCommitFee(i interface{}) error {
v, ok := i.(sdk.Coin)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if v.Amount.IsNegative() {
return errors.New("commit fee must be positive")
}
return nil
}
func validateRevealFee(i interface{}) error {
v, ok := i.(sdk.Coin)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if v.Amount.IsNegative() {
return errors.New("reveal fee must be positive")
}
return nil
}
func validateMinimumBid(i interface{}) error {
v, ok := i.(sdk.Coin)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if v.Amount.IsNegative() {
return errors.New("minimum bid must be positive")
}
return nil return nil
} }

View File

@ -38,27 +38,18 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// MsgCreateAuction defines a create auction message // MsgCreateAuction defines a create auction message
type MsgCreateAuction struct { type MsgCreateAuction struct {
// Address of the signer
Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty" json:"signer" yaml:"signer"`
// Auction kind (vickrey | provider)
Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty" json:"kind" yaml:"kind"`
// Duration of the commits phase in seconds // Duration of the commits phase in seconds
CommitsDuration time.Duration `protobuf:"bytes,3,opt,name=commits_duration,json=commitsDuration,proto3,stdduration" json:"commits_duration" json:"commits_duration" yaml:"commits_duration"` CommitsDuration time.Duration `protobuf:"bytes,1,opt,name=commits_duration,json=commitsDuration,proto3,stdduration" json:"commits_duration" json:"commits_duration" yaml:"commits_duration"`
// Duration of the reveals phase in seconds // Duration of the reveals phase in seconds
RevealsDuration time.Duration `protobuf:"bytes,4,opt,name=reveals_duration,json=revealsDuration,proto3,stdduration" json:"reveals_duration" json:"reveals_duration" yaml:"reveals_duration"` RevealsDuration time.Duration `protobuf:"bytes,2,opt,name=reveals_duration,json=revealsDuration,proto3,stdduration" json:"reveals_duration" json:"reveals_duration" yaml:"reveals_duration"`
// Commit fees // Commit fees
CommitFee types.Coin `protobuf:"bytes,5,opt,name=commit_fee,json=commitFee,proto3" json:"commit_fee" json:"commit_fee" yaml:"commit_fee"` CommitFee types.Coin `protobuf:"bytes,3,opt,name=commit_fee,json=commitFee,proto3" json:"commit_fee" json:"commit_fee" yaml:"commit_fee"`
// Reveal fees // Reveal fees
RevealFee types.Coin `protobuf:"bytes,6,opt,name=reveal_fee,json=revealFee,proto3" json:"reveal_fee" json:"reveal_fee" yaml:"reveal_fee"` RevealFee types.Coin `protobuf:"bytes,4,opt,name=reveal_fee,json=revealFee,proto3" json:"reveal_fee" json:"reveal_fee" yaml:"reveal_fee"`
// Minimum acceptable bid amount // Minimum acceptable bid amount
// Only applicable in vickrey auctions MinimumBid types.Coin `protobuf:"bytes,5,opt,name=minimum_bid,json=minimumBid,proto3" json:"minimum_bid" json:"minimum_bid" yaml:"minimum_bid"`
MinimumBid types.Coin `protobuf:"bytes,7,opt,name=minimum_bid,json=minimumBid,proto3" json:"minimum_bid" json:"minimum_bid" yaml:"minimum_bid"` // Address of the signer
// Maximum acceptable bid amount Signer string `protobuf:"bytes,6,opt,name=signer,proto3" json:"signer,omitempty" json:"signer" yaml:"signer"`
// Only applicable in provider auctions
MaxPrice types.Coin `protobuf:"bytes,8,opt,name=max_price,json=maxPrice,proto3" json:"max_price" json:"max_price" yaml:"max_price"`
// Number of desired providers (num of auction winners)
// Only applicable in provider auctions
NumProviders int32 `protobuf:"varint,9,opt,name=num_providers,json=numProviders,proto3" json:"num_providers,omitempty"`
} }
func (m *MsgCreateAuction) Reset() { *m = MsgCreateAuction{} } func (m *MsgCreateAuction) Reset() { *m = MsgCreateAuction{} }
@ -393,87 +384,6 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
// ReleaseFunds defines the message to pay the winners of provider auctions
type MsgReleaseFunds struct {
// Auction id
AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty" json:"auction_id" yaml:"auction_id"`
// Address of the signer
Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty" json:"signer" yaml:"signer"`
}
func (m *MsgReleaseFunds) Reset() { *m = MsgReleaseFunds{} }
func (m *MsgReleaseFunds) String() string { return proto.CompactTextString(m) }
func (*MsgReleaseFunds) ProtoMessage() {}
func (*MsgReleaseFunds) Descriptor() ([]byte, []int) {
return fileDescriptor_70947cda59e835fd, []int{8}
}
func (m *MsgReleaseFunds) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgReleaseFunds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgReleaseFunds.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgReleaseFunds) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgReleaseFunds.Merge(m, src)
}
func (m *MsgReleaseFunds) XXX_Size() int {
return m.Size()
}
func (m *MsgReleaseFunds) XXX_DiscardUnknown() {
xxx_messageInfo_MsgReleaseFunds.DiscardUnknown(m)
}
var xxx_messageInfo_MsgReleaseFunds proto.InternalMessageInfo
// MsgReleaseFundsResponse returns the state of the auction after releasing the
// funds
type MsgReleaseFundsResponse struct {
// Auction details
Auction *Auction `protobuf:"bytes,1,opt,name=auction,proto3" json:"auction,omitempty" json:"auction" yaml:"auction"`
}
func (m *MsgReleaseFundsResponse) Reset() { *m = MsgReleaseFundsResponse{} }
func (m *MsgReleaseFundsResponse) String() string { return proto.CompactTextString(m) }
func (*MsgReleaseFundsResponse) ProtoMessage() {}
func (*MsgReleaseFundsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_70947cda59e835fd, []int{9}
}
func (m *MsgReleaseFundsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgReleaseFundsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgReleaseFundsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgReleaseFundsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgReleaseFundsResponse.Merge(m, src)
}
func (m *MsgReleaseFundsResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgReleaseFundsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgReleaseFundsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgReleaseFundsResponse proto.InternalMessageInfo
func init() { func init() {
proto.RegisterType((*MsgCreateAuction)(nil), "cerc.auction.v1.MsgCreateAuction") proto.RegisterType((*MsgCreateAuction)(nil), "cerc.auction.v1.MsgCreateAuction")
proto.RegisterType((*MsgCreateAuctionResponse)(nil), "cerc.auction.v1.MsgCreateAuctionResponse") proto.RegisterType((*MsgCreateAuctionResponse)(nil), "cerc.auction.v1.MsgCreateAuctionResponse")
@ -483,78 +393,67 @@ func init() {
proto.RegisterType((*MsgRevealBidResponse)(nil), "cerc.auction.v1.MsgRevealBidResponse") proto.RegisterType((*MsgRevealBidResponse)(nil), "cerc.auction.v1.MsgRevealBidResponse")
proto.RegisterType((*MsgUpdateParams)(nil), "cerc.auction.v1.MsgUpdateParams") proto.RegisterType((*MsgUpdateParams)(nil), "cerc.auction.v1.MsgUpdateParams")
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cerc.auction.v1.MsgUpdateParamsResponse") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cerc.auction.v1.MsgUpdateParamsResponse")
proto.RegisterType((*MsgReleaseFunds)(nil), "cerc.auction.v1.MsgReleaseFunds")
proto.RegisterType((*MsgReleaseFundsResponse)(nil), "cerc.auction.v1.MsgReleaseFundsResponse")
} }
func init() { proto.RegisterFile("cerc/auction/v1/tx.proto", fileDescriptor_70947cda59e835fd) } func init() { proto.RegisterFile("cerc/auction/v1/tx.proto", fileDescriptor_70947cda59e835fd) }
var fileDescriptor_70947cda59e835fd = []byte{ var fileDescriptor_70947cda59e835fd = []byte{
// 1025 bytes of a gzipped FileDescriptorProto // 881 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x6f, 0xe3, 0x44, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x41, 0x6f, 0xdc, 0x44,
0x14, 0x8f, 0xdb, 0x34, 0xbb, 0x99, 0x74, 0xe9, 0xca, 0x2a, 0xaa, 0x9b, 0xd2, 0x38, 0x75, 0x55, 0x14, 0x5e, 0x77, 0x93, 0x45, 0x3b, 0x29, 0xa4, 0xb2, 0x82, 0xe2, 0x6c, 0xc9, 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 0x00,
0x00, 0x00,
} }
@ -579,8 +478,6 @@ type MsgClient interface {
// UpdateParams defines an operation for updating the x/staking module // UpdateParams defines an operation for updating the x/staking module
// parameters. // parameters.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) 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 { type msgClient struct {
@ -627,15 +524,6 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
return out, nil 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, "/cerc.auction.v1.Msg/ReleaseFunds", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service. // MsgServer is the server API for Msg service.
type MsgServer interface { type MsgServer interface {
// CreateAuction is the command for creating an auction // CreateAuction is the command for creating an auction
@ -647,8 +535,6 @@ type MsgServer interface {
// UpdateParams defines an operation for updating the x/staking module // UpdateParams defines an operation for updating the x/staking module
// parameters. // parameters.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// ReleaseFunds is the command for paying the winners of provider auctions
ReleaseFunds(context.Context, *MsgReleaseFunds) (*MsgReleaseFundsResponse, error)
} }
// UnimplementedMsgServer can be embedded to have forward compatible implementations. // UnimplementedMsgServer can be embedded to have forward compatible implementations.
@ -667,9 +553,6 @@ func (*UnimplementedMsgServer) RevealBid(ctx context.Context, req *MsgRevealBid)
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
} }
func (*UnimplementedMsgServer) ReleaseFunds(ctx context.Context, req *MsgReleaseFunds) (*MsgReleaseFundsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReleaseFunds not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) { func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv) s.RegisterService(&_Msg_serviceDesc, srv)
@ -747,24 +630,6 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler) 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: "/cerc.auction.v1.Msg/ReleaseFunds",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).ReleaseFunds(ctx, req.(*MsgReleaseFunds))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{ var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cerc.auction.v1.Msg", ServiceName: "cerc.auction.v1.Msg",
HandlerType: (*MsgServer)(nil), HandlerType: (*MsgServer)(nil),
@ -785,10 +650,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "UpdateParams", MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler, Handler: _Msg_UpdateParams_Handler,
}, },
{
MethodName: "ReleaseFunds",
Handler: _Msg_ReleaseFunds_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "cerc/auction/v1/tx.proto", Metadata: "cerc/auction/v1/tx.proto",
@ -814,21 +675,13 @@ func (m *MsgCreateAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if m.NumProviders != 0 { if len(m.Signer) > 0 {
i = encodeVarintTx(dAtA, i, uint64(m.NumProviders)) i -= len(m.Signer)
copy(dAtA[i:], m.Signer)
i = encodeVarintTx(dAtA, i, uint64(len(m.Signer)))
i-- i--
dAtA[i] = 0x48 dAtA[i] = 0x32
} }
{
size, err := m.MaxPrice.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x42
{ {
size, err := m.MinimumBid.MarshalToSizedBuffer(dAtA[:i]) size, err := m.MinimumBid.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
@ -838,7 +691,7 @@ func (m *MsgCreateAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintTx(dAtA, i, uint64(size)) i = encodeVarintTx(dAtA, i, uint64(size))
} }
i-- i--
dAtA[i] = 0x3a dAtA[i] = 0x2a
{ {
size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i]) size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
@ -848,7 +701,7 @@ func (m *MsgCreateAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintTx(dAtA, i, uint64(size)) i = encodeVarintTx(dAtA, i, uint64(size))
} }
i-- i--
dAtA[i] = 0x32 dAtA[i] = 0x22
{ {
size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i]) size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
@ -858,37 +711,23 @@ func (m *MsgCreateAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintTx(dAtA, i, uint64(size)) i = encodeVarintTx(dAtA, i, uint64(size))
} }
i-- i--
dAtA[i] = 0x2a dAtA[i] = 0x1a
n5, err5 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.RevealsDuration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.RevealsDuration):]) n4, err4 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.RevealsDuration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.RevealsDuration):])
if err4 != nil {
return 0, err4
}
i -= n4
i = encodeVarintTx(dAtA, i, uint64(n4))
i--
dAtA[i] = 0x12
n5, err5 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.CommitsDuration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CommitsDuration):])
if err5 != nil { if err5 != nil {
return 0, err5 return 0, err5
} }
i -= n5 i -= n5
i = encodeVarintTx(dAtA, i, uint64(n5)) i = encodeVarintTx(dAtA, i, uint64(n5))
i-- i--
dAtA[i] = 0x22 dAtA[i] = 0xa
n6, err6 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.CommitsDuration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CommitsDuration):])
if err6 != nil {
return 0, err6
}
i -= n6
i = encodeVarintTx(dAtA, i, uint64(n6))
i--
dAtA[i] = 0x1a
if len(m.Kind) > 0 {
i -= len(m.Kind)
copy(dAtA[i:], m.Kind)
i = encodeVarintTx(dAtA, i, uint64(len(m.Kind)))
i--
dAtA[i] = 0x12
}
if len(m.Signer) > 0 {
i -= len(m.Signer)
copy(dAtA[i:], m.Signer)
i = encodeVarintTx(dAtA, i, uint64(len(m.Signer)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
@ -1148,78 +987,6 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *MsgReleaseFunds) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgReleaseFunds) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgReleaseFunds) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Signer) > 0 {
i -= len(m.Signer)
copy(dAtA[i:], m.Signer)
i = encodeVarintTx(dAtA, i, uint64(len(m.Signer)))
i--
dAtA[i] = 0x12
}
if len(m.AuctionId) > 0 {
i -= len(m.AuctionId)
copy(dAtA[i:], m.AuctionId)
i = encodeVarintTx(dAtA, i, uint64(len(m.AuctionId)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgReleaseFundsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgReleaseFundsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgReleaseFundsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Auction != nil {
{
size, err := m.Auction.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int { func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v) offset -= sovTx(v)
base := offset base := offset
@ -1237,14 +1004,6 @@ func (m *MsgCreateAuction) Size() (n int) {
} }
var l int var l int
_ = l _ = l
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Kind)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CommitsDuration) l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CommitsDuration)
n += 1 + l + sovTx(uint64(l)) n += 1 + l + sovTx(uint64(l))
l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.RevealsDuration) l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.RevealsDuration)
@ -1255,10 +1014,9 @@ func (m *MsgCreateAuction) Size() (n int) {
n += 1 + l + sovTx(uint64(l)) n += 1 + l + sovTx(uint64(l))
l = m.MinimumBid.Size() l = m.MinimumBid.Size()
n += 1 + l + sovTx(uint64(l)) n += 1 + l + sovTx(uint64(l))
l = m.MaxPrice.Size() l = len(m.Signer)
n += 1 + l + sovTx(uint64(l)) if l > 0 {
if m.NumProviders != 0 { n += 1 + l + sovTx(uint64(l))
n += 1 + sovTx(uint64(m.NumProviders))
} }
return n return n
} }
@ -1368,36 +1126,6 @@ func (m *MsgUpdateParamsResponse) Size() (n int) {
return n return n
} }
func (m *MsgReleaseFunds) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.AuctionId)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Signer)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgReleaseFundsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Auction != nil {
l = m.Auction.Size()
n += 1 + l + sovTx(uint64(l))
}
return n
}
func sovTx(x uint64) (n int) { func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7 return (math_bits.Len64(x|1) + 6) / 7
} }
@ -1434,70 +1162,6 @@ func (m *MsgCreateAuction) Unmarshal(dAtA []byte) error {
} }
switch fieldNum { switch fieldNum {
case 1: case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Signer = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Kind = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CommitsDuration", wireType) return fmt.Errorf("proto: wrong wireType = %d for field CommitsDuration", wireType)
} }
@ -1530,7 +1194,7 @@ func (m *MsgCreateAuction) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 4: case 2:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RevealsDuration", wireType) return fmt.Errorf("proto: wrong wireType = %d for field RevealsDuration", wireType)
} }
@ -1563,7 +1227,7 @@ func (m *MsgCreateAuction) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 5: case 3:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CommitFee", wireType) return fmt.Errorf("proto: wrong wireType = %d for field CommitFee", wireType)
} }
@ -1596,7 +1260,7 @@ func (m *MsgCreateAuction) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 6: case 4:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RevealFee", wireType) return fmt.Errorf("proto: wrong wireType = %d for field RevealFee", wireType)
} }
@ -1629,7 +1293,7 @@ func (m *MsgCreateAuction) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 7: case 5:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MinimumBid", wireType) return fmt.Errorf("proto: wrong wireType = %d for field MinimumBid", wireType)
} }
@ -1662,11 +1326,11 @@ func (m *MsgCreateAuction) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 8: case 6:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MaxPrice", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
} }
var msglen int var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowTx return ErrIntOverflowTx
@ -1676,44 +1340,24 @@ func (m *MsgCreateAuction) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
msglen |= int(b&0x7F) << shift stringLen |= uint64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if msglen < 0 { intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx return ErrInvalidLengthTx
} }
postIndex := iNdEx + msglen postIndex := iNdEx + intStringLen
if postIndex < 0 { if postIndex < 0 {
return ErrInvalidLengthTx return ErrInvalidLengthTx
} }
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
if err := m.MaxPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { m.Signer = string(dAtA[iNdEx:postIndex])
return err
}
iNdEx = postIndex iNdEx = postIndex
case 9:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field NumProviders", wireType)
}
m.NumProviders = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.NumProviders |= int32(b&0x7F) << shift
if b < 0x80 {
break
}
}
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:]) skippy, err := skipTx(dAtA[iNdEx:])
@ -2450,206 +2094,6 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *MsgReleaseFunds) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgReleaseFunds: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgReleaseFunds: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.AuctionId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Signer = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgReleaseFundsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgReleaseFundsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgReleaseFundsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Auction", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Auction == nil {
m.Auction = &Auction{}
}
if err := m.Auction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) { func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0

View File

@ -141,42 +141,6 @@ func local_request_Msg_RevealBid_0(ctx context.Context, marshaler runtime.Marsha
} }
var (
filter_Msg_ReleaseFunds_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Msg_ReleaseFunds_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq MsgReleaseFunds
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_ReleaseFunds_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ReleaseFunds(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Msg_ReleaseFunds_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq MsgReleaseFunds
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_ReleaseFunds_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.ReleaseFunds(ctx, &protoReq)
return msg, metadata, err
}
// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux".
// UnaryRPC :call MsgServer directly. // UnaryRPC :call MsgServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@ -252,29 +216,6 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server
}) })
mux.Handle("POST", pattern_Msg_ReleaseFunds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Msg_ReleaseFunds_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Msg_ReleaseFunds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
@ -376,26 +317,6 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client
}) })
mux.Handle("POST", pattern_Msg_ReleaseFunds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Msg_ReleaseFunds_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Msg_ReleaseFunds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
@ -405,8 +326,6 @@ var (
pattern_Msg_CommitBid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cerc", "auction", "v1", "commit_bid"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Msg_CommitBid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cerc", "auction", "v1", "commit_bid"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Msg_RevealBid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cerc", "auction", "v1", "reveal_bid"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Msg_RevealBid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cerc", "auction", "v1", "reveal_bid"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Msg_ReleaseFunds_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cerc", "auction", "v1", "release_funds"}, "", runtime.AssumeColonVerbOpt(false)))
) )
var ( var (
@ -415,6 +334,4 @@ var (
forward_Msg_CommitBid_0 = runtime.ForwardResponseMessage forward_Msg_CommitBid_0 = runtime.ForwardResponseMessage
forward_Msg_RevealBid_0 = runtime.ForwardResponseMessage forward_Msg_RevealBid_0 = runtime.ForwardResponseMessage
forward_Msg_ReleaseFunds_0 = runtime.ForwardResponseMessage
) )

View File

@ -29,12 +29,6 @@ const (
BidStatusRevealed = "reveal" BidStatusRevealed = "reveal"
) )
// Auction kinds
const (
AuctionKindVickrey = "vickrey"
AuctionKindProvider = "provider"
)
// AuctionId simplifies generation of auction ids. // AuctionId simplifies generation of auction ids.
type AuctionId struct { type AuctionId struct {
Address sdk.Address Address sdk.Address

View File

@ -80,7 +80,7 @@ func (k Keeper) OnboardParticipant(
} }
if !params.OnboardingEnabled { if !params.OnboardingEnabled {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Onboarding is disabled") return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Validator onboarding is disabled")
} }
message, err := json.Marshal(msg.EthPayload) message, err := json.Marshal(msg.EthPayload)

View File

@ -30,18 +30,11 @@ func (k *Keeper) InitGenesis(ctx sdk.Context, data *registry.GenesisState) error
return err return err
} }
} }
readableRecord := record.ToReadableRecord()
if err := k.processAttributes(ctx, readableRecord.Attributes, record.Id); err != nil {
return err
}
} }
for _, authority := range data.Authorities { for _, authority := range data.Authorities {
// Only import authorities that are marked active. // Only import authorities that are marked active.
if authority.Entry.Status == registry.AuthorityActive { if authority.Entry.Status == registry.AuthorityActive {
// Reset authority height
authority.Entry.Height = uint64(ctx.BlockHeight())
if err := k.SaveNameAuthority(ctx, authority.Name, authority.Entry); err != nil { if err := k.SaveNameAuthority(ctx, authority.Name, authority.Entry); err != nil {
return err return err
} }
@ -69,7 +62,7 @@ func (k *Keeper) ExportGenesis(ctx sdk.Context) (*registry.GenesisState, error)
return nil, err return nil, err
} }
records, _, err := k.PaginatedListRecords(ctx, nil) records, err := k.ListRecords(ctx)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -16,7 +16,6 @@ import (
"github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/legacy"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/query"
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper" auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper" bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/gibson042/canonicaljson-go" "github.com/gibson042/canonicaljson-go"
@ -205,42 +204,23 @@ func (k Keeper) HasRecord(ctx sdk.Context, id string) (bool, error) {
return has, nil return has, nil
} }
// PaginatedListRecords - get all records with optional pagination. // ListRecords - get all records.
func (k Keeper) PaginatedListRecords(ctx sdk.Context, pagination *query.PageRequest) ([]registrytypes.Record, *query.PageResponse, error) { func (k Keeper) ListRecords(ctx sdk.Context) ([]registrytypes.Record, error) {
var records []registrytypes.Record var records []registrytypes.Record
var pageResp *query.PageResponse
if pagination == nil { err := k.Records.Walk(ctx, nil, func(key string, value registrytypes.Record) (bool, error) {
err := k.Records.Walk(ctx, nil, func(key string, value registrytypes.Record) (bool, error) { if err := k.populateRecordNames(ctx, &value); err != nil {
if err := k.populateRecordNames(ctx, &value); err != nil { return true, err
return true, err
}
records = append(records, value)
return false, nil
})
if err != nil {
return nil, nil, err
} }
} else { records = append(records, value)
var err error
records, pageResp, err = query.CollectionPaginate(
ctx,
k.Records,
pagination,
func(key string, value registrytypes.Record) (registrytypes.Record, error) {
if err := k.populateRecordNames(ctx, &value); err != nil {
return registrytypes.Record{}, err
}
return value, nil return false, nil
}) })
if err != nil { if err != nil {
return nil, nil, err return nil, err
}
} }
return records, pageResp, nil return records, nil
} }
// GetRecordById - gets a record from the store. // GetRecordById - gets a record from the store.
@ -281,47 +261,36 @@ func (k Keeper) GetRecordsByBondId(ctx sdk.Context, bondId string) ([]registryty
return records, nil return records, nil
} }
// PaginatedRecordsFromAttributes gets a list of records whose attributes match all provided values // RecordsFromAttributes gets a list of records whose attributes match all provided values
// with optional pagination. func (k Keeper) RecordsFromAttributes(
func (k Keeper) PaginatedRecordsFromAttributes(
ctx sdk.Context, ctx sdk.Context,
attributes []*registrytypes.QueryRecordsRequest_KeyValueInput, attributes []*registrytypes.QueryRecordsRequest_KeyValueInput,
all bool, all bool,
pagination *query.PageRequest, ) ([]registrytypes.Record, error) {
) ([]registrytypes.Record, *query.PageResponse, error) { resultRecordIds := []string{}
var resultRecordIds []string
var pageResp *query.PageResponse
filteredRecordIds := []string{}
for i, attr := range attributes { for i, attr := range attributes {
suffix, err := QueryValueToJSON(attr.Value) suffix, err := QueryValueToJSON(attr.Value)
if err != nil { if err != nil {
return nil, nil, err return nil, err
} }
mapKey := collections.Join(attr.Key, string(suffix)) mapKey := collections.Join(attr.Key, string(suffix))
recordIds, err := k.getAttributeMapping(ctx, mapKey) recordIds, err := k.getAttributeMapping(ctx, mapKey)
if err != nil { if err != nil {
return nil, nil, err return nil, err
} }
if i == 0 { if i == 0 {
filteredRecordIds = recordIds resultRecordIds = recordIds
} else { } else {
filteredRecordIds = getIntersection(recordIds, filteredRecordIds) resultRecordIds = getIntersection(recordIds, resultRecordIds)
} }
} }
if pagination != nil {
resultRecordIds, pageResp = paginate(filteredRecordIds, pagination)
} else {
resultRecordIds = filteredRecordIds
}
records := []registrytypes.Record{} records := []registrytypes.Record{}
for _, id := range resultRecordIds { for _, id := range resultRecordIds {
record, err := k.GetRecordById(ctx, id) record, err := k.GetRecordById(ctx, id)
if err != nil { if err != nil {
return nil, nil, err return nil, err
} }
if record.Deleted { if record.Deleted {
continue continue
@ -332,7 +301,7 @@ func (k Keeper) PaginatedRecordsFromAttributes(
records = append(records, record) records = append(records, record)
} }
return records, pageResp, nil return records, nil
} }
// TODO not recursive, and only should be if we want to support querying with whole sub-objects, // TODO not recursive, and only should be if we want to support querying with whole sub-objects,
@ -748,38 +717,6 @@ func (k Keeper) tryTakeRecordRent(ctx sdk.Context, record registrytypes.Record)
return k.SaveRecord(ctx, record) return k.SaveRecord(ctx, record)
} }
// paginate implements basic pagination over a list of objects
func paginate[T any](data []T, pagination *query.PageRequest) ([]T, *query.PageResponse) {
pageReq := initPageRequestDefaults(pagination)
offset := pageReq.Offset
limit := pageReq.Limit
countTotal := pageReq.CountTotal
totalItems := uint64(len(data))
start := offset
end := offset + limit
if start > totalItems {
if countTotal {
return []T{}, &query.PageResponse{Total: 0}
} else {
return []T{}, nil
}
}
if end > totalItems {
end = totalItems
}
paginatedItems := data[start:end]
if countTotal {
return paginatedItems, &query.PageResponse{Total: totalItems}
} else {
return paginatedItems, nil
}
}
func getIntersection(a []string, b []string) []string { func getIntersection(a []string, b []string) []string {
result := []string{} result := []string{}
if len(a) < len(b) { if len(a) < len(b) {
@ -806,26 +743,3 @@ func contains(arr []string, str string) bool {
} }
return false return false
} }
// https://github.com/cosmos/cosmos-sdk/blob/v0.50.3/types/query/pagination.go#L141
// initPageRequestDefaults initializes a PageRequest's defaults when those are not set.
func initPageRequestDefaults(pageRequest *query.PageRequest) *query.PageRequest {
// if the PageRequest is nil, use default PageRequest
if pageRequest == nil {
pageRequest = &query.PageRequest{}
}
pageRequestCopy := *pageRequest
if len(pageRequestCopy.Key) == 0 {
pageRequestCopy.Key = nil
}
if pageRequestCopy.Limit == 0 {
pageRequestCopy.Limit = query.DefaultLimit
// count total results when the limit is zero/not supplied
pageRequestCopy.CountTotal = true
}
return &pageRequestCopy
}

View File

@ -7,8 +7,6 @@ import (
"strings" "strings"
"time" "time"
"cosmossdk.io/math"
"cosmossdk.io/collections" "cosmossdk.io/collections"
errorsmod "cosmossdk.io/errors" errorsmod "cosmossdk.io/errors"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
@ -287,18 +285,16 @@ func (k Keeper) createAuthority(ctx sdk.Context, name string, owner string, isRo
// Reset bond ID if required. // Reset bond ID if required.
authority.BondId = "" authority.BondId = ""
params := auctiontypes.Params{
CommitsDuration: moduleParams.AuthorityAuctionCommitsDuration,
RevealsDuration: moduleParams.AuthorityAuctionRevealsDuration,
CommitFee: moduleParams.AuthorityAuctionCommitFee,
RevealFee: moduleParams.AuthorityAuctionRevealFee,
MinimumBid: moduleParams.AuthorityAuctionMinimumBid,
}
// Create an auction. // Create an auction.
msg := auctiontypes.NewMsgCreateAuction( msg := auctiontypes.NewMsgCreateAuction(params, ownerAddress)
auctiontypes.AuctionKindVickrey,
moduleParams.AuthorityAuctionCommitsDuration,
moduleParams.AuthorityAuctionRevealsDuration,
moduleParams.AuthorityAuctionCommitFee,
moduleParams.AuthorityAuctionRevealFee,
moduleParams.AuthorityAuctionMinimumBid,
sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(0)),
0,
ownerAddress,
)
auction, sdkErr := k.auctionKeeper.CreateAuction(ctx, msg) auction, sdkErr := k.auctionKeeper.CreateAuction(ctx, msg)
if sdkErr != nil { if sdkErr != nil {

View File

@ -6,7 +6,6 @@ import (
errorsmod "cosmossdk.io/errors" errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/query"
registrytypes "git.vdb.to/cerc-io/laconicd/x/registry" registrytypes "git.vdb.to/cerc-io/laconicd/x/registry"
) )
@ -40,21 +39,20 @@ func (qs queryServer) Records(c context.Context, req *registrytypes.QueryRecords
all := req.GetAll() all := req.GetAll()
var records []registrytypes.Record var records []registrytypes.Record
var pageResp *query.PageResponse
var err error var err error
if len(attributes) > 0 { if len(attributes) > 0 {
records, pageResp, err = qs.k.PaginatedRecordsFromAttributes(ctx, attributes, all, req.Pagination) records, err = qs.k.RecordsFromAttributes(ctx, attributes, all)
if err != nil { if err != nil {
return nil, err return nil, err
} }
} else { } else {
records, pageResp, err = qs.k.PaginatedListRecords(ctx, req.Pagination) records, err = qs.k.ListRecords(ctx)
if err != nil { if err != nil {
return nil, err return nil, err
} }
} }
return &registrytypes.QueryRecordsResponse{Records: records, Pagination: pageResp}, nil return &registrytypes.QueryRecordsResponse{Records: records}, nil
} }
func (qs queryServer) GetRecord(c context.Context, req *registrytypes.QueryGetRecordRequest) (*registrytypes.QueryGetRecordResponse, error) { func (qs queryServer) GetRecord(c context.Context, req *registrytypes.QueryGetRecordRequest) (*registrytypes.QueryGetRecordResponse, error) {

View File

@ -94,9 +94,9 @@ func (rk RecordKeeper) OnAuctionWinnerSelected(ctx sdk.Context, auctionId string
} }
if auctionObj.Status == auctiontypes.AuctionStatusCompleted { if auctionObj.Status == auctiontypes.AuctionStatusCompleted {
if len(auctionObj.WinnerAddresses) != 0 { if auctionObj.WinnerAddress != "" {
// Mark authority owner and change status to active. // Mark authority owner and change status to active.
authority.OwnerAddress = auctionObj.WinnerAddresses[0] authority.OwnerAddress = auctionObj.WinnerAddress
authority.Status = registrytypes.AuthorityActive authority.Status = registrytypes.AuthorityActive
// Reset bond id if required, as owner has changed. // Reset bond id if required, as owner has changed.