From 34cc2622186babb600d1cf1b806814138370220f Mon Sep 17 00:00:00 2001 From: Bipul Prasad Date: Thu, 14 Oct 2021 10:49:37 +0530 Subject: [PATCH] Test cases for auction module (#8) * Adding test cases for auction module * Adding missing test cases and fixing failed ones * Increasing the account balance to prevent test failures * Addressing review comments * Renaming test files as per directory structure * Minor modification as per review comments * Fixing test issues Co-authored-by: bipulprasad --- docs/api/proto-docs.md | 113 ++++- go.mod | 3 +- go.sum | 9 +- proto/vulcanize/auction/v1beta1/query.proto | 19 +- proto/vulcanize/auction/v1beta1/tx.proto | 4 +- x/auction/client/cli/query.go | 31 +- x/auction/client/cli/tx.go | 5 +- x/auction/client/testutil/cli_test.go | 15 + x/auction/client/testutil/common.go | 77 +++ x/auction/client/testutil/grpc.go | 255 ++++++++++ x/auction/client/testutil/query.go | 311 ++++++++++++ x/auction/client/testutil/tx.go | 141 ++++++ x/auction/keeper/grpc_query.go | 29 +- x/auction/keeper/grpc_query_test.go | 355 ++++++++++++++ x/auction/keeper/keeper.go | 38 +- x/auction/keeper/keeper_test.go | 51 ++ x/auction/keeper/msg_server.go | 2 +- x/auction/module_test.go | 24 + x/auction/types/query.pb.go | 503 +++++++++++++++++--- x/auction/types/query.pb.gw.go | 100 +++- x/auction/types/tx.pb.go | 106 +++-- 21 files changed, 2051 insertions(+), 140 deletions(-) create mode 100644 x/auction/client/testutil/cli_test.go create mode 100644 x/auction/client/testutil/common.go create mode 100644 x/auction/client/testutil/grpc.go create mode 100644 x/auction/client/testutil/query.go create mode 100644 x/auction/client/testutil/tx.go create mode 100644 x/auction/keeper/grpc_query_test.go create mode 100644 x/auction/keeper/keeper_test.go create mode 100644 x/auction/module_test.go diff --git a/docs/api/proto-docs.md b/docs/api/proto-docs.md index 4c8d0d86..d797278f 100644 --- a/docs/api/proto-docs.md +++ b/docs/api/proto-docs.md @@ -94,6 +94,8 @@ - [AuctionResponse](#vulcanize.auction.v1beta1.AuctionResponse) - [AuctionsByBidderRequest](#vulcanize.auction.v1beta1.AuctionsByBidderRequest) - [AuctionsByBidderResponse](#vulcanize.auction.v1beta1.AuctionsByBidderResponse) + - [AuctionsByOwnerRequest](#vulcanize.auction.v1beta1.AuctionsByOwnerRequest) + - [AuctionsByOwnerResponse](#vulcanize.auction.v1beta1.AuctionsByOwnerResponse) - [AuctionsRequest](#vulcanize.auction.v1beta1.AuctionsRequest) - [AuctionsResponse](#vulcanize.auction.v1beta1.AuctionsResponse) - [BalanceRequest](#vulcanize.auction.v1beta1.BalanceRequest) @@ -190,9 +192,9 @@ - [QueryResolveWrnResponse](#vulcanize.nameservice.v1beta1.QueryResolveWrnResponse) - [QueryWhoisRequest](#vulcanize.nameservice.v1beta1.QueryWhoisRequest) - [QueryWhoisResponse](#vulcanize.nameservice.v1beta1.QueryWhoisResponse) - + - [Query](#vulcanize.nameservice.v1beta1.Query) - + - [vulcanize/nameservice/v1beta1/tx.proto](#vulcanize/nameservice/v1beta1/tx.proto) - [MsgAssociateBond](#vulcanize.nameservice.v1beta1.MsgAssociateBond) - [MsgAssociateBondResponse](#vulcanize.nameservice.v1beta1.MsgAssociateBondResponse) @@ -1470,6 +1472,36 @@ AuctionsByBidderResponse returns all auctions containing a bidder + + +### AuctionsByOwnerRequest +AuctionsByOwnerRequest is the format for querying all auctions created by an owner + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `owner_address` | [string](#string) | | Address of the owner | + + + + + + + + +### AuctionsByOwnerResponse +AuctionsByOwnerResponse returns all auctions created by an owner + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auctions` | [Auctions](#vulcanize.auction.v1beta1.Auctions) | | List of auctions | + + + + + + ### AuctionsRequest @@ -1629,7 +1661,8 @@ Query defines the gRPC querier interface for the auction module | `GetAuction` | [AuctionRequest](#vulcanize.auction.v1beta1.AuctionRequest) | [AuctionResponse](#vulcanize.auction.v1beta1.AuctionResponse) | GetAuction queries an auction | GET|/vulcanize/auction/v1beta1/auctions/{id}| | `GetBid` | [BidRequest](#vulcanize.auction.v1beta1.BidRequest) | [BidResponse](#vulcanize.auction.v1beta1.BidResponse) | GetBid queries an auction bid | GET|/vulcanize/auction/v1beta1/bids/{auction_id}/{bidder}| | `GetBids` | [BidsRequest](#vulcanize.auction.v1beta1.BidsRequest) | [BidsResponse](#vulcanize.auction.v1beta1.BidsResponse) | GetBids queries all auction bids | GET|/vulcanize/auction/v1beta1/bids/{auction_id}| -| `AuctionsByBidder` | [AuctionsByBidderRequest](#vulcanize.auction.v1beta1.AuctionsByBidderRequest) | [AuctionsByBidderResponse](#vulcanize.auction.v1beta1.AuctionsByBidderResponse) | AuctionsByBidder queries auctions by bidder | GET|/vulcanize/auction/v1beta1/auctions/{bidder_address}| +| `AuctionsByBidder` | [AuctionsByBidderRequest](#vulcanize.auction.v1beta1.AuctionsByBidderRequest) | [AuctionsByBidderResponse](#vulcanize.auction.v1beta1.AuctionsByBidderResponse) | AuctionsByBidder queries auctions by bidder | GET|/vulcanize/auction/v1beta1/by-bidder/{bidder_address}| +| `AuctionsByOwner` | [AuctionsByOwnerRequest](#vulcanize.auction.v1beta1.AuctionsByOwnerRequest) | [AuctionsByOwnerResponse](#vulcanize.auction.v1beta1.AuctionsByOwnerResponse) | AuctionsByOwner queries auctions by owner | GET|/vulcanize/auction/v1beta1/by-owner/{owner_address}| | `QueryParams` | [QueryParamsRequest](#vulcanize.auction.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#vulcanize.auction.v1beta1.QueryParamsResponse) | QueryParams implements the params query command | GET|/vulcanize/auction/v1beta1/params| | `Balance` | [BalanceRequest](#vulcanize.auction.v1beta1.BalanceRequest) | [BalanceResponse](#vulcanize.auction.v1beta1.BalanceResponse) | Balance queries the auction module account balance | GET|/vulcanize/auction/v1beta1/balance| @@ -1669,7 +1702,7 @@ MsgCommitBidResponse returns the state of the auction after the bid creation | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `auction` | [Auction](#vulcanize.auction.v1beta1.Auction) | | Auction details | +| `bid` | [Bid](#vulcanize.auction.v1beta1.Bid) | | Auction details | @@ -2167,31 +2200,41 @@ Msg defines the bond Msg service. ### AuctionBidInfo - AuctionBidInfo + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `auction_id` | [string](#string) | | | | `bidder_address` | [string](#string) | | | + + + + + ### AuthorityEntry - AuthorityEntry defines the nameservice module AuthorityEntries + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `name` | [string](#string) | | | | `entry` | [NameAuthority](#vulcanize.nameservice.v1beta1.NameAuthority) | | | + + + + + ### BlockChangeSet - BlockChangeSet + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `height` | [int64](#int64) | | | @@ -2201,12 +2244,17 @@ BlockChangeSet | `authorities` | [string](#string) | repeated | | | `names` | [string](#string) | repeated | | + + + + + ### NameAuthority - NameAuthority + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `owner_public_key` | [string](#string) | | Owner public key. | @@ -2385,37 +2433,51 @@ GenesisState defines the nameservice module's genesis state. ### AccountBalance - AccountBalance is nameservice module account balance + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `account_name` | [string](#string) | | | | `balance` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + + ### ExpiryQueueRecord - ExpiryQueueRecord + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `id` | [string](#string) | | | | `value` | [string](#string) | repeated | | + + + + + ### GetNameServiceModuleBalanceRequest - GetNameServiceModuleBalanceRequest is request type for nameservice module accounts balance + + + + + ### GetNameServiceModuleBalanceResponse - GetNameServiceModuleBalanceResponse is response type for nameservice module accounts balance + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `balances` | [AccountBalance](#vulcanize.nameservice.v1beta1.AccountBalance) | repeated | | @@ -2544,38 +2606,57 @@ QueryListRecordsResponse is response type for nameservice records list | `records` | [Record](#vulcanize.nameservice.v1beta1.Record) | repeated | | | `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + ### QueryLookupWrn - QueryLookupWrn is request type for LookupWrn + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `wrn` | [string](#string) | | | + + + + + ### QueryLookupWrnResponse - QueryLookupWrnResponse is response type for QueryLookupWrn + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `name` | [NameRecord](#vulcanize.nameservice.v1beta1.NameRecord) | | | + + + + + ### QueryParamsRequest - QueryParamsRequest is request type for nameservice params + + + + + ### QueryParamsResponse - QueryParamsResponse is response type for nameservice params + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `params` | [Params](#vulcanize.nameservice.v1beta1.Params) | | | diff --git a/go.mod b/go.mod index d7c2ebe5..7fe01ea5 100644 --- a/go.mod +++ b/go.mod @@ -37,7 +37,7 @@ require ( golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect golang.org/x/sys v0.0.0-20210903071746-97244b99971b // indirect - google.golang.org/genproto v0.0.0-20211005153810-c76a74d43a8e + google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 gopkg.in/yaml.v2 v2.4.0 @@ -129,6 +129,7 @@ require ( github.com/mtibben/percent v0.2.1 // indirect github.com/multiformats/go-base32 v0.0.3 // indirect github.com/multiformats/go-multibase v0.0.1 // indirect + github.com/multiformats/go-varint v0.0.5 // indirect github.com/mwitkow/go-proto-validators v0.3.2 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml v1.9.3 // indirect diff --git a/go.sum b/go.sum index d466e406..4fbbeb44 100644 --- a/go.sum +++ b/go.sum @@ -760,6 +760,7 @@ github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/g github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= github.com/multiformats/go-multihash v0.0.10 h1:lMoNbh2Ssd9PUF74Nz008KGzGPlfeV6wH3rit5IIGCM= github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= +github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -1562,12 +1563,16 @@ google.golang.org/genproto v0.0.0-20210921142501-181ce0d877f6 h1:2ncG/LajxmrclaZ google.golang.org/genproto v0.0.0-20210921142501-181ce0d877f6/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0 h1:5Tbluzus3QxoAJx4IefGt1W0HQZW4nuMrVk684jI74Q= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20210929214142-896c89f843d2 h1:G7kbolbig6UyfoRItVUeBGV/38VzxjAZYTavVGbYYss= +google.golang.org/genproto v0.0.0-20210929214142-896c89f843d2/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3 h1:+F3FcO6LTrzNq5wp1Z6JtoBvnJzX6euyN70FoyMDXy4= google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9 h1:eF1wcrhdz56Vugf8qNX5dD93ItkrhothojQyHXqloe0= google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211005153810-c76a74d43a8e h1:Im71rbA1N3CbIag/PumYhQcNR8bLNmuOtRIyOnnLsT8= -google.golang.org/genproto v0.0.0-20211005153810-c76a74d43a8e/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211011165927-a5fb3255271e h1:B3r2Cb5u7Od6/WGb95VHDMp99VU/fuqPYZb6VM8IozI= +google.golang.org/genproto v0.0.0-20211011165927-a5fb3255271e/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 h1:NBxB1XxiWpGqkPUiJ9PoBXkHV5A9+GohMOA+EmWoPbU= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.1/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= diff --git a/proto/vulcanize/auction/v1beta1/query.proto b/proto/vulcanize/auction/v1beta1/query.proto index eafb84d6..78c544ad 100644 --- a/proto/vulcanize/auction/v1beta1/query.proto +++ b/proto/vulcanize/auction/v1beta1/query.proto @@ -73,6 +73,18 @@ message AuctionsByBidderResponse { Auctions auctions = 1; } +// AuctionsByOwnerRequest is the format for querying all auctions created by an owner +message AuctionsByOwnerRequest { + // Address of the owner + string owner_address = 1; +} + +// AuctionsByOwnerResponse returns all auctions created by an owner +message AuctionsByOwnerResponse { + // List of auctions + Auctions auctions = 1; +} + // QueryParamsRequest is the format to query the parameters of the auction module message QueryParamsRequest { } @@ -117,7 +129,12 @@ service Query { // AuctionsByBidder queries auctions by bidder rpc AuctionsByBidder(AuctionsByBidderRequest) returns (AuctionsByBidderResponse) { - option (google.api.http).get = "/vulcanize/auction/v1beta1/auctions/{bidder_address}"; + option (google.api.http).get = "/vulcanize/auction/v1beta1/by-bidder/{bidder_address}"; + } + + // AuctionsByOwner queries auctions by owner + rpc AuctionsByOwner(AuctionsByOwnerRequest) returns (AuctionsByOwnerResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/by-owner/{owner_address}"; } // QueryParams implements the params query command diff --git a/proto/vulcanize/auction/v1beta1/tx.proto b/proto/vulcanize/auction/v1beta1/tx.proto index 9fa39312..6904b420 100644 --- a/proto/vulcanize/auction/v1beta1/tx.proto +++ b/proto/vulcanize/auction/v1beta1/tx.proto @@ -94,8 +94,8 @@ message MsgRevealBid { message MsgCommitBidResponse { option (gogoproto.goproto_getters) = false; // Auction details - Auction auction = 1 [ - (gogoproto.moretags) = "json:\"auction\" yaml:\"auction\"" + Bid bid = 1 [ + (gogoproto.moretags) = "json:\"bid\" yaml:\"bid\"" ]; } diff --git a/x/auction/client/cli/query.go b/x/auction/client/cli/query.go index 8419b03c..844f29bc 100644 --- a/x/auction/client/cli/query.go +++ b/x/auction/client/cli/query.go @@ -27,6 +27,7 @@ func GetQueryCmd() *cobra.Command { GetCmdGetBid(), GetCmdGetBids(), GetCmdAuctionsByBidder(), + GetCmdAuctionsByOwner(), GetCmdQueryParams(), GetCmdBalance(), ) @@ -147,6 +148,34 @@ func GetCmdGetAuction() *cobra.Command { // GetCmdAuctionsByBidder queries auctions by bidder. func GetCmdAuctionsByBidder() *cobra.Command { + cmd := &cobra.Command{ + Use: "query-by-bidder [address]", + Short: "Query auctions by bidder.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + address := args[0] + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.AuctionsByBidder(cmd.Context(), &types.AuctionsByBidderRequest{BidderAddress: address}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdAuctionsByOwner queries auctions by owner +func GetCmdAuctionsByOwner() *cobra.Command { cmd := &cobra.Command{ Use: "query-by-owner [address]", Short: "Query auctions by owner/creator.", @@ -160,7 +189,7 @@ func GetCmdAuctionsByBidder() *cobra.Command { address := args[0] queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.AuctionsByBidder(cmd.Context(), &types.AuctionsByBidderRequest{BidderAddress: address}) + res, err := queryClient.AuctionsByOwner(cmd.Context(), &types.AuctionsByOwnerRequest{OwnerAddress: address}) if err != nil { return err } diff --git a/x/auction/client/cli/tx.go b/x/auction/client/cli/tx.go index e363970b..2728716d 100644 --- a/x/auction/client/cli/tx.go +++ b/x/auction/client/cli/tx.go @@ -29,7 +29,6 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - // TODO(ashwin): Add Tx commands. auctionTxCmd.AddCommand( GetCmdCreateAuction(), GetCmdCommitBid(), @@ -92,7 +91,7 @@ func GetCmdCreateAuction() *cobra.Command { }, } - flags.AddQueryFlagsToCmd(cmd) + flags.AddTxFlagsToCmd(cmd) return cmd } @@ -172,8 +171,6 @@ func GetCmdRevealBid() *cobra.Command { return err } - // TODO(ashwin): Before revealing, check if auction is in reveal phase. - msg := types.NewMsgRevealBid(auctionID, hex.EncodeToString(revealBytes), clientCtx.GetFromAddress()) err = msg.ValidateBasic() if err != nil { diff --git a/x/auction/client/testutil/cli_test.go b/x/auction/client/testutil/cli_test.go new file mode 100644 index 00000000..0a1612af --- /dev/null +++ b/x/auction/client/testutil/cli_test.go @@ -0,0 +1,15 @@ +package testutil + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/tharsis/ethermint/testutil/network" +) + +func TestIntegrationTestSuite(t *testing.T) { + cfg := network.DefaultConfig() + cfg.NumValidators = 1 + suite.Run(t, NewIntegrationTestSuite(cfg)) +} diff --git a/x/auction/client/testutil/common.go b/x/auction/client/testutil/common.go new file mode 100644 index 00000000..018bd17a --- /dev/null +++ b/x/auction/client/testutil/common.go @@ -0,0 +1,77 @@ +package testutil + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + banktestutil "github.com/cosmos/cosmos-sdk/x/bank/client/testutil" + "github.com/stretchr/testify/suite" + "github.com/tharsis/ethermint/testutil/network" +) + +type IntegrationTestSuite struct { + suite.Suite + + cfg network.Config + network *network.Network + defaultAuctionID string +} + +var ( + ownerAccount = "owner" + bidderAccount = "bidder" + ownerAddress string + bidderAddress string +) + +func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { + return &IntegrationTestSuite{cfg: cfg} +} + +func (s *IntegrationTestSuite) SetupSuite() { + s.T().Log("setting up integration test suite") + + s.network = network.New(s.T(), s.cfg) + + _, err := s.network.WaitForHeight(1) + s.Require().NoError(err) + + // setting up random owner and bidder accounts + s.createAccountWithBalance(ownerAccount, &ownerAddress) + s.createAccountWithBalance(bidderAccount, &bidderAddress) + + s.defaultAuctionID = s.createAuctionAndBid(true, false) +} + +func (s *IntegrationTestSuite) TearDownSuite() { + s.T().Log("tearing down integration test suite") + s.network.Cleanup() +} + +func (s *IntegrationTestSuite) createAccountWithBalance(accountName string, accountAddress *string) { + val := s.network.Validators[0] + sr := s.Require() + consPrivKey := ed25519.GenPrivKey() + consPubKeyBz, err := s.cfg.Codec.MarshalInterfaceJSON(consPrivKey.PubKey()) + sr.NoError(err) + sr.NotNil(consPubKeyBz) + + info, _, err := val.ClientCtx.Keyring.NewMnemonic(accountName, keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) + sr.NoError(err) + + newAddr := sdk.AccAddress(info.GetPubKey().Address()) + _, err = banktestutil.MsgSendExec( + val.ClientCtx, + val.Address, + newAddr, + sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(200000))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + ) + sr.NoError(err) + *accountAddress = newAddr.String() +} diff --git a/x/auction/client/testutil/grpc.go b/x/auction/client/testutil/grpc.go new file mode 100644 index 00000000..03037a7c --- /dev/null +++ b/x/auction/client/testutil/grpc.go @@ -0,0 +1,255 @@ +package testutil + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/types/rest" + auctiontypes "github.com/tharsis/ethermint/x/auction/types" +) + +const ( + randomAuctionID = "randomAuctionID" + randomBidderAddress = "randomBidderAddress" + randomOwnerAddress = "randomOwnerAddress" +) + +func (suite *IntegrationTestSuite) TestGetAllAuctionsGrpc() { + val := suite.network.Validators[0] + sr := suite.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/auctions", val.APIAddress) + + testCases := []struct { + msg string + url string + errorMsg string + isErrorExpected bool + }{ + { + "invalid request to get all auctions", + reqUrl + randomAuctionID, + "", + true, + }, + { + "valid request to get all auctions", + reqUrl, + "", + false, + }, + } + for _, tc := range testCases { + suite.Run(tc.msg, func() { + resp, err := rest.GetRequest(tc.url) + if tc.isErrorExpected { + sr.Contains(string(resp), tc.errorMsg) + } else { + sr.NoError(err) + var auctions auctiontypes.AuctionsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &auctions) + sr.NotZero(len(auctions.Auctions.Auctions)) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestQueryParamsGrpc() { + val := suite.network.Validators[0] + sr := suite.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/params", val.APIAddress) + + suite.Run("valid request to get auction params", func() { + resp, err := rest.GetRequest(reqUrl) + suite.Require().NoError(err) + + var params auctiontypes.QueryParamsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, ¶ms) + + sr.NoError(err) + sr.Equal(*params.GetParams(), auctiontypes.DefaultParams()) + }) +} + +func (suite *IntegrationTestSuite) TestGetAuctionGrpc() { + val := suite.network.Validators[0] + sr := suite.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/auctions/", val.APIAddress) + + testCases := []struct { + msg string + url string + errorMsg string + isErrorExpected bool + preRun func() string + }{ + { + "invalid request to get an auction", + reqUrl + randomAuctionID, + "", + true, + func() string { return "" }, + }, + { + "valid request to get an auction", + reqUrl, + "", + false, + func() string { return suite.defaultAuctionID }, + }, + } + for _, tc := range testCases { + suite.Run(tc.msg, func() { + auctionID := tc.preRun() + resp, err := rest.GetRequest(tc.url + auctionID) + if tc.isErrorExpected { + sr.Contains(string(resp), tc.errorMsg) + } else { + sr.NoError(err) + var auction auctiontypes.AuctionResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &auction) + sr.NoError(err) + sr.Equal(auctionID, auction.Auction.Id) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetBidsGrpc() { + val := suite.network.Validators[0] + sr := suite.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/bids/", val.APIAddress) + testCases := []struct { + msg string + url string + errorMsg string + isErrorExpected bool + preRun func() string + }{ + { + "invalid request to get all bids", + reqUrl, + "", + true, + func() string { return "" }, + }, + { + "valid request to get all bids", + reqUrl, + "", + false, + func() string { return suite.createAuctionAndBid(false, true) }, + }, + } + + for _, tc := range testCases { + suite.Run(tc.msg, func() { + auctionID := tc.preRun() + tc.url += auctionID + resp, err := rest.GetRequest(tc.url) + if tc.isErrorExpected { + sr.Contains(string(resp), tc.errorMsg) + } else { + sr.NoError(err) + var bids auctiontypes.BidsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bids) + sr.NoError(err) + sr.Equal(auctionID, bids.Bids[0].AuctionId) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetBidGrpc() { + val := suite.network.Validators[0] + sr := suite.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/bids/", val.APIAddress) + testCases := []struct { + msg string + url string + errorMsg string + isErrorExpected bool + }{ + { + "invalid request to get bid", + fmt.Sprintf("%s/%s/", reqUrl, randomAuctionID), + "", + true, + }, + { + "valid request to get bid", + fmt.Sprintf("%s/%s/%s", reqUrl, randomAuctionID, randomBidderAddress), + "", + false, + }, + } + for _, tc := range testCases { + suite.Run(tc.msg, func() { + resp, err := rest.GetRequest(tc.url) + if tc.isErrorExpected { + sr.Contains(string(resp), tc.errorMsg) + } else { + sr.NoError(err) + var bid auctiontypes.BidResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bid) + sr.NoError(err) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetAuctionsByOwnerGrpc() { + val := suite.network.Validators[0] + sr := suite.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/by-owner/", val.APIAddress) + testCases := []struct { + msg string + url string + errorMsg string + isErrorExpected bool + }{ + { + "invalid request to get auctions by owner", + reqUrl, + "", + true, + }, + { + "valid request to get auctions by owner", + fmt.Sprintf("%s/%s", reqUrl, randomOwnerAddress), + "", + false, + }, + } + for _, tc := range testCases { + suite.Run(tc.msg, func() { + resp, err := rest.GetRequest(tc.url) + if tc.isErrorExpected { + sr.Contains(string(resp), tc.errorMsg) + } else { + sr.NoError(err) + var auctions auctiontypes.AuctionsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &auctions) + sr.NoError(err) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestQueryBalanceGrpc() { + val := suite.network.Validators[0] + sr := suite.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/balance", val.APIAddress) + msg := "valid request to get the auction module balance" + + suite.createAuctionAndBid(false, true) + + suite.Run(msg, func() { + resp, err := rest.GetRequest(reqUrl) + sr.NoError(err) + + var response auctiontypes.BalanceResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &response) + + sr.NoError(err) + sr.NotZero(len(response.GetBalance())) + }) +} diff --git a/x/auction/client/testutil/query.go b/x/auction/client/testutil/query.go new file mode 100644 index 00000000..e0ff2495 --- /dev/null +++ b/x/auction/client/testutil/query.go @@ -0,0 +1,311 @@ +package testutil + +import ( + "fmt" + + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tharsis/ethermint/x/auction/client/cli" + "github.com/tharsis/ethermint/x/auction/types" +) + +var queryJSONFlag = []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)} + +func (suite *IntegrationTestSuite) TestGetCmdQueryParams() { + val := suite.network.Validators[0] + sr := suite.Require() + + suite.Run(fmt.Sprintf("Case %s", "fetch query params"), func() { + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdQueryParams(), queryJSONFlag) + sr.NoError(err) + var params types.QueryParamsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), ¶ms) + sr.NoError(err) + sr.Equal(types.DefaultParams(), *params.Params) + }) +} + +func (suite *IntegrationTestSuite) TestGetCmdBalance() { + val := suite.network.Validators[0] + sr := suite.Require() + + testCases := []struct { + msg string + createAuctionAndBid bool + }{ + { + "fetch module balance without creating auction and bid", + false, + }, + { + "fetch module balance with valid auction and bid", + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuctionAndBid { + suite.createAuctionAndBid(false, true) + } + + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdBalance(), queryJSONFlag) + sr.NoError(err) + var balance types.BalanceResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &balance) + sr.NoError(err) + if test.createAuctionAndBid { + sr.NotZero(len(balance.Balance)) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetCmdList() { + val := suite.network.Validators[0] + sr := suite.Require() + + testCases := []struct { + msg string + createAuction bool + }{ + { + "list auctions when no auctions exist", + false, + }, + { + "list auctions after creating an auction", + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdList(), queryJSONFlag) + sr.NoError(err) + var auctions types.AuctionsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &auctions) + sr.NoError(err) + if test.createAuction { + sr.NotZero(len(auctions.Auctions.Auctions)) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetCmdGetBid() { + val := suite.network.Validators[0] + sr := suite.Require() + + testCases := []struct { + msg string + args []string + createAuctionAndBid bool + }{ + { + "get bid without creating auction", + []string{}, + false, + }, + { + "get bid after creating auction and bid", + []string{}, + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuctionAndBid { + auctionID := suite.createAuctionAndBid(false, true) + test.args = append(test.args, auctionID) + getBidsArgs := []string{auctionID, queryJSONFlag[0]} + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdGetBids(), getBidsArgs) + sr.NoError(err) + var bids types.BidsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &bids) + sr.NoError(err) + test.args = append(test.args, bids.GetBids()[0].BidderAddress) + } + + test.args = append(test.args, queryJSONFlag...) + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdGetBid(), test.args) + if test.createAuctionAndBid { + sr.NoError(err) + var bid types.BidResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &bid) + sr.NoError(err) + sr.NotNil(bid.GetBid()) + } else { + sr.Error(err) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetCmdGetBids() { + val := suite.network.Validators[0] + sr := suite.Require() + + testCases := []struct { + msg string + args []string + createAuctionAndBid bool + }{ + { + "get bids without creating auction", + []string{}, + false, + }, + { + "get bids after creating auction and bid", + []string{}, + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuctionAndBid { + auctionID := suite.createAuctionAndBid(false, true) + test.args = append(test.args, auctionID) + } + + test.args = append(test.args, queryJSONFlag...) + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdGetBids(), test.args) + if test.createAuctionAndBid { + sr.NoError(err) + var bids types.BidsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &bids) + sr.NoError(err) + sr.NotZero(len(bids.Bids)) + } else { + sr.Error(err) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetCmdGetAuction() { + val := suite.network.Validators[0] + sr := suite.Require() + + testCases := []struct { + msg string + auctionID string + createAuction bool + }{ + { + "get auction with empty auction ID", + "", + false, + }, + { + "get auction with valid auction ID", + "", + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuction { + test.auctionID = suite.defaultAuctionID + } + + args := []string{test.auctionID, queryJSONFlag[0]} + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdGetAuction(), args) + if test.createAuction { + sr.NoError(err) + var auction types.AuctionResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &auction) + sr.NoError(err) + sr.NotNil(auction.GetAuction()) + sr.Equal(test.auctionID, auction.GetAuction().Id) + } else { + sr.Error(err) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetCmdAuctionsByBidder() { + val := suite.network.Validators[0] + sr := suite.Require() + + testCases := []struct { + msg string + createAuctionAndBid bool + bidderAddress string + }{ + { + "get auctions by bidder without creating auctions", + false, + "", + }, + { + "get auctions by bidder for valid bidder address", + true, + "", + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuctionAndBid { + auctionID := suite.createAuctionAndBid(false, true) + args := []string{auctionID, queryJSONFlag[0]} + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdGetBids(), args) + sr.NoError(err) + var bids types.BidsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &bids) + sr.NoError(err) + test.bidderAddress = bids.Bids[0].BidderAddress + } + + getByBidderArgs := []string{test.bidderAddress, queryJSONFlag[0]} + _, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdAuctionsByBidder(), getByBidderArgs) + if test.createAuctionAndBid { + sr.NoError(err) + } else { + sr.Error(err) + } + }) + } +} + +func (suite IntegrationTestSuite) createAuctionAndBid(createAuction, createBid bool) string { + val := suite.network.Validators[0] + sr := suite.Require() + auctionID := "" + + if createAuction { + auctionArgs := []string{ + sampleCommitTime, sampleRevealTime, + fmt.Sprintf("10%s", suite.cfg.BondDenom), + fmt.Sprintf("10%s", suite.cfg.BondDenom), + fmt.Sprintf("100%s", suite.cfg.BondDenom), + } + + resp, err := suite.executeTx(cli.GetCmdCreateAuction(), auctionArgs, ownerAccount) + sr.NoError(err) + sr.Zero(resp.Code) + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdList(), queryJSONFlag) + sr.NoError(err) + var queryResponse types.AuctionsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + auctionID = queryResponse.Auctions.Auctions[0].Id + } else { + auctionID = suite.defaultAuctionID + } + + if createBid { + bidArgs := []string{auctionID, fmt.Sprintf("200%s", suite.cfg.BondDenom)} + resp, err := suite.executeTx(cli.GetCmdCommitBid(), bidArgs, bidderAccount) + sr.NoError(err) + sr.Zero(resp.Code) + } + + return auctionID +} diff --git a/x/auction/client/testutil/tx.go b/x/auction/client/testutil/tx.go new file mode 100644 index 00000000..21f08554 --- /dev/null +++ b/x/auction/client/testutil/tx.go @@ -0,0 +1,141 @@ +package testutil + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/spf13/cobra" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tharsis/ethermint/x/auction/client/cli" + "github.com/tharsis/ethermint/x/auction/types" +) + +const ( + sampleCommitTime = "90s" + sampleRevealTime = "5s" + placeholderAuctionID = "placeholder_auction_id" +) + +func (suite *IntegrationTestSuite) TestTxCreateAuction() { + sr := suite.Require() + testCases := []struct { + msg string + args []string + expectErr bool + }{ + { + "create auction with missing arguments", + []string{sampleCommitTime, sampleRevealTime}, + true, + }, + { + "create auction with proper arguments", + []string{ + sampleCommitTime, sampleRevealTime, + fmt.Sprintf("10%s", suite.cfg.BondDenom), + fmt.Sprintf("10%s", suite.cfg.BondDenom), + fmt.Sprintf("100%s", suite.cfg.BondDenom), + }, + false, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + resp, err := suite.executeTx(cli.GetCmdCreateAuction(), test.args, ownerAccount) + if test.expectErr { + sr.Error(err) + } else { + sr.NoError(err) + sr.Zero(resp.Code) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestTxCommitBid() { + val := suite.network.Validators[0] + sr := suite.Require() + testCases := []struct { + msg string + args []string + createAuction bool + }{ + { + "commit bid with missing args", + []string{fmt.Sprintf("200%s", suite.cfg.BondDenom)}, + false, + }, + { + "commit bid with valid args", + []string{ + placeholderAuctionID, + fmt.Sprintf("200%s", suite.cfg.BondDenom), + }, + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuction { + auctionArgs := []string{ + sampleCommitTime, sampleRevealTime, + fmt.Sprintf("10%s", suite.cfg.BondDenom), + fmt.Sprintf("10%s", suite.cfg.BondDenom), + fmt.Sprintf("100%s", suite.cfg.BondDenom), + } + _, err := suite.executeTx(cli.GetCmdCreateAuction(), auctionArgs, ownerAccount) + sr.NoError(err) + + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdList(), + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + sr.NoError(err) + var queryResponse types.AuctionsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + sr.NotNil(queryResponse.GetAuctions()) + test.args[0] = queryResponse.GetAuctions().Auctions[0].Id + } + + resp, err := suite.executeTx(cli.GetCmdCommitBid(), test.args, bidderAccount) + if test.createAuction { + sr.NoError(err) + sr.Zero(resp.Code) + } else { + sr.Error(err) + } + }) + } +} + +func (suite *IntegrationTestSuite) executeTx(cmd *cobra.Command, args []string, caller string) (sdk.TxResponse, error) { + val := suite.network.Validators[0] + additionalArgs := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, caller), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", suite.cfg.BondDenom)), + } + args = append(args, additionalArgs...) + + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) + if err != nil { + return sdk.TxResponse{}, err + } + + var resp sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp) + if err != nil { + return sdk.TxResponse{}, err + } + + err = suite.network.WaitForNextBlock() + if err != nil { + return sdk.TxResponse{}, err + } + + return resp, nil +} diff --git a/x/auction/keeper/grpc_query.go b/x/auction/keeper/grpc_query.go index b3585fc7..4cd7370b 100644 --- a/x/auction/keeper/grpc_query.go +++ b/x/auction/keeper/grpc_query.go @@ -4,6 +4,7 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/tharsis/ethermint/x/auction/types" ) @@ -24,6 +25,10 @@ func (q Querier) Auctions(c context.Context, req *types.AuctionsRequest) (*types // GetAuction queries an auction func (q Querier) GetAuction(c context.Context, req *types.AuctionRequest) (*types.AuctionResponse, error) { ctx := sdk.UnwrapSDKContext(c) + if req.Id == "" { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "auction ID is required") + } + resp := q.Keeper.GetAuction(ctx, req.Id) return &types.AuctionResponse{Auction: resp}, nil } @@ -31,6 +36,12 @@ func (q Querier) GetAuction(c context.Context, req *types.AuctionRequest) (*type // GetBid queries and auction bid func (q Querier) GetBid(c context.Context, req *types.BidRequest) (*types.BidResponse, error) { ctx := sdk.UnwrapSDKContext(c) + if req.AuctionId == "" { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "auction ID is required") + } + if req.Bidder == "" { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "bidder address is required") + } resp := q.Keeper.GetBid(ctx, req.AuctionId, req.Bidder) return &types.BidResponse{Bid: &resp}, nil } @@ -38,6 +49,9 @@ func (q Querier) GetBid(c context.Context, req *types.BidRequest) (*types.BidRes // GetBids queries all auction bids func (q Querier) GetBids(c context.Context, req *types.BidsRequest) (*types.BidsResponse, error) { ctx := sdk.UnwrapSDKContext(c) + if req.AuctionId == "" { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "auction ID is required") + } resp := q.Keeper.GetBids(ctx, req.AuctionId) return &types.BidsResponse{Bids: resp}, nil } @@ -45,10 +59,23 @@ func (q Querier) GetBids(c context.Context, req *types.BidsRequest) (*types.Bids // AuctionsByBidder queries auctions by bidder func (q Querier) AuctionsByBidder(c context.Context, req *types.AuctionsByBidderRequest) (*types.AuctionsByBidderResponse, error) { ctx := sdk.UnwrapSDKContext(c) - resp := q.Keeper.QueryAuctionsByOwner(ctx, req.BidderAddress) + if req.BidderAddress == "" { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "bidder address is required") + } + resp := q.Keeper.QueryAuctionsByBidder(ctx, req.BidderAddress) return &types.AuctionsByBidderResponse{Auctions: &types.Auctions{Auctions: resp}}, nil } +// AuctionsByOwner queries auctions by owner +func (q Querier) AuctionsByOwner(c context.Context, req *types.AuctionsByOwnerRequest) (*types.AuctionsByOwnerResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + if req.OwnerAddress == "" { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "owner address is required") + } + resp := q.Keeper.QueryAuctionsByOwner(ctx, req.OwnerAddress) + return &types.AuctionsByOwnerResponse{Auctions: &types.Auctions{Auctions: resp}}, nil +} + // QueryParams implements the params query command func (q Querier) QueryParams(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) diff --git a/x/auction/keeper/grpc_query_test.go b/x/auction/keeper/grpc_query_test.go new file mode 100644 index 00000000..dd3440e3 --- /dev/null +++ b/x/auction/keeper/grpc_query_test.go @@ -0,0 +1,355 @@ +package keeper_test + +import ( + "context" + "fmt" + + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tharsis/ethermint/app" + "github.com/tharsis/ethermint/x/auction/types" +) + +const testCommitHash = "71D8CF34026E32A3A34C2C2D4ADF25ABC8D7943A4619761BE27F196603D91B9D" + +func (suite *KeeperTestSuite) TestGrpcGetAllAuctions() { + client, ctx, k := suite.queryClient, suite.ctx, suite.app.AuctionKeeper + + testCases := []struct { + msg string + req *types.AuctionsRequest + createAuctions bool + auctionCount int + }{ + { + "fetch auctions when no auctions exist", + &types.AuctionsRequest{}, + false, + 0, + }, + + { + "fetch auctions with one auction created", + &types.AuctionsRequest{}, + true, + 1, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuctions { + account := app.CreateRandomAccounts(1)[0] + err := simapp.FundAccount(suite.app.BankKeeper, ctx, account, sdk.NewCoins( + sdk.Coin{Amount: sdk.NewInt(100), Denom: sdk.DefaultBondDenom}, + )) + + _, err = k.CreateAuction(ctx, types.NewMsgCreateAuction(k.GetParams(ctx), account)) + suite.Require().NoError(err) + } + + resp, _ := client.Auctions(context.Background(), test.req) + suite.Require().Equal(test.auctionCount, len(resp.GetAuctions().Auctions)) + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcQueryParams() { + testCases := []struct { + msg string + req *types.QueryParamsRequest + }{ + { + "fetch params", + &types.QueryParamsRequest{}, + }, + } + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + resp, err := suite.queryClient.QueryParams(context.Background(), test.req) + suite.Require().Nil(err) + suite.Require().Equal(*(resp.Params), types.DefaultParams()) + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetAuction() { + testCases := []struct { + msg string + req *types.AuctionRequest + createAuction bool + }{ + { + "fetch auction with empty auction ID", + &types.AuctionRequest{}, + false, + }, + { + "fetch auction with valid auction ID", + &types.AuctionRequest{}, + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuction { + auction, _, err := suite.createAuctionAndCommitBid(false) + suite.Require().NoError(err) + test.req.Id = auction.Id + } + + resp, err := suite.queryClient.GetAuction(context.Background(), test.req) + if test.createAuction { + suite.Require().Nil(err) + suite.Require().NotNil(resp.GetAuction()) + suite.Require().Equal(test.req.Id, resp.GetAuction().Id) + } else { + suite.Require().NotNil(err) + suite.Require().Error(err) + } + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetBids() { + testCases := []struct { + msg string + req *types.BidsRequest + createAuction bool + commitBid bool + bidCount int + }{ + { + "fetch all bids when no auction exists", + &types.BidsRequest{}, + false, + false, + 0, + }, + { + "fetch all bids for valid auction but no added bids", + &types.BidsRequest{}, + true, + false, + 0, + }, + { + "fetch all bids for valid auction and valid bid", + &types.BidsRequest{}, + true, + true, + 1, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuction { + auction, _, err := suite.createAuctionAndCommitBid(test.commitBid) + suite.Require().NoError(err) + test.req.AuctionId = auction.Id + } + + resp, err := suite.queryClient.GetBids(context.Background(), test.req) + if test.createAuction { + suite.Require().Nil(err) + suite.Require().Equal(test.bidCount, len(resp.GetBids())) + } else { + suite.Require().NotNil(err) + suite.Require().Error(err) + } + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetBid() { + testCases := []struct { + msg string + req *types.BidRequest + createAuctionAndBid bool + }{ + { + "fetch bid when bid does not exist", + &types.BidRequest{}, + false, + }, + { + "fetch bid when valid bid exists", + &types.BidRequest{}, + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuctionAndBid { + auction, bid, err := suite.createAuctionAndCommitBid(test.createAuctionAndBid) + suite.Require().NoError(err) + test.req.AuctionId = auction.Id + test.req.Bidder = bid.BidderAddress + } + + resp, err := suite.queryClient.GetBid(context.Background(), test.req) + if test.createAuctionAndBid { + suite.Require().NoError(err) + suite.Require().NotNil(resp.Bid) + suite.Require().Equal(test.req.Bidder, resp.Bid.BidderAddress) + } else { + suite.Require().NotNil(err) + suite.Require().Error(err) + } + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetAuctionsByBidder() { + testCases := []struct { + msg string + req *types.AuctionsByBidderRequest + createAuctionAndCommitBid bool + auctionCount int + }{ + { + "get auctions by bidder with invalid bidder address", + &types.AuctionsByBidderRequest{}, + false, + 0, + }, + { + "get auctions by bidder with valid auction and bid", + &types.AuctionsByBidderRequest{}, + true, + 1, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuctionAndCommitBid { + _, bid, err := suite.createAuctionAndCommitBid(test.createAuctionAndCommitBid) + suite.Require().NoError(err) + test.req.BidderAddress = bid.BidderAddress + } + + resp, err := suite.queryClient.AuctionsByBidder(context.Background(), test.req) + if test.createAuctionAndCommitBid { + suite.Require().NoError(err) + suite.Require().NotNil(resp.Auctions) + suite.Require().Equal(test.auctionCount, len(resp.Auctions.Auctions)) + } else { + suite.Require().NotNil(err) + suite.Require().Error(err) + } + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetAuctionsByOwner() { + testCases := []struct { + msg string + req *types.AuctionsByOwnerRequest + createAuction bool + auctionCount int + }{ + { + "get auctions by owner with invalid owner address", + &types.AuctionsByOwnerRequest{}, + false, + 0, + }, + { + "get auctions by owner with valid auction", + &types.AuctionsByOwnerRequest{}, + true, + 1, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuction { + auction, _, err := suite.createAuctionAndCommitBid(false) + suite.Require().NoError(err) + test.req.OwnerAddress = auction.OwnerAddress + } + + resp, err := suite.queryClient.AuctionsByOwner(context.Background(), test.req) + if test.createAuction { + suite.Require().NoError(err) + suite.Require().NotNil(resp.Auctions) + suite.Require().Equal(test.auctionCount, len(resp.Auctions.Auctions)) + } else { + suite.Require().NotNil(err) + suite.Require().Error(err) + } + }) + } +} + +func (suite KeeperTestSuite) TestGrpcQueryBalance() { + testCases := []struct { + msg string + req *types.BalanceRequest + createAuction bool + auctionCount int + }{ + { + "get balance with no auctions created", + &types.BalanceRequest{}, + false, + 0, + }, + { + "get balance with single auction created", + &types.BalanceRequest{}, + true, + 1, + }, + } + + for _, test := range testCases { + if test.createAuction { + _, _, err := suite.createAuctionAndCommitBid(true) + suite.Require().NoError(err) + } + + resp, err := suite.queryClient.Balance(context.Background(), test.req) + suite.Require().NoError(err) + suite.Require().Equal(test.auctionCount, len(resp.GetBalance())) + } +} + +func (suite *KeeperTestSuite) createAuctionAndCommitBid(commitBid bool) (*types.Auction, *types.Bid, error) { + ctx, k := suite.ctx, suite.app.AuctionKeeper + accCount := 1 + if commitBid { + accCount++ + } + + accounts := app.CreateRandomAccounts(accCount) + for _, account := range accounts { + err := simapp.FundAccount(suite.app.BankKeeper, ctx, account, sdk.NewCoins( + sdk.Coin{Amount: sdk.NewInt(100), Denom: sdk.DefaultBondDenom}, + )) + if err != nil { + return nil, nil, err + } + } + + auction, err := k.CreateAuction(ctx, types.NewMsgCreateAuction(k.GetParams(ctx), accounts[0])) + if err != nil { + return nil, nil, err + } + + if commitBid { + bid, err := k.CommitBid(ctx, types.NewMsgCommitBid(auction.Id, testCommitHash, accounts[1])) + if err != nil { + return nil, nil, err + } + + return auction, bid, nil + } + + return auction, nil, nil +} diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go index 8f0e4caa..97bf8912 100644 --- a/x/auction/keeper/keeper.go +++ b/x/auction/keeper/keeper.go @@ -32,6 +32,9 @@ var prefixOwnerToAuctionsIndex = []byte{0x01} // PrefixAuctionBidsIndex is the prefix for the (auction, bidder) -> Bid index in the KVStore. var PrefixAuctionBidsIndex = []byte{0x02} +// PrefixBidderToAuctionsIndex is the prefix for the Bidder -> [Auction] index in the KVStore. +var PrefixBidderToAuctionsIndex = []byte{0x03} + // Keeper maintains the link to storage and exposes getter/setter methods for the various parts of the state machine type Keeper struct { accountKeeper auth.AccountKeeper @@ -87,6 +90,10 @@ func GetOwnerToAuctionsIndexKey(owner string, auctionID string) []byte { return append(append(prefixOwnerToAuctionsIndex, []byte(owner)...), []byte(auctionID)...) } +func GetBidderToAuctionsIndexKey(bidder string, auctionID string) []byte { + return append(append(PrefixBidderToAuctionsIndex, []byte(bidder)...), []byte(auctionID)...) +} + func GetBidIndexKey(auctionID string, bidder string) []byte { return append(GetAuctionBidsIndexPrefix(auctionID), []byte(bidder)...) } @@ -114,6 +121,7 @@ func (k Keeper) SaveAuction(ctx sdk.Context, auction *types.Auction) { func (k Keeper) SaveBid(ctx sdk.Context, bid *types.Bid) { store := ctx.KVStore(k.storeKey) store.Set(GetBidIndexKey(bid.AuctionId, bid.BidderAddress), k.cdc.MustMarshal(bid)) + store.Set(GetBidderToAuctionsIndexKey(bid.BidderAddress, bid.AuctionId), []byte{}) // Notify interested parties. for _, keeper := range k.usageKeepers { @@ -124,6 +132,7 @@ func (k Keeper) SaveBid(ctx sdk.Context, bid *types.Bid) { func (k Keeper) DeleteBid(ctx sdk.Context, bid types.Bid) { store := ctx.KVStore(k.storeKey) store.Delete(GetBidIndexKey(bid.AuctionId, bid.BidderAddress)) + store.Delete(GetOwnerToAuctionsIndexKey(bid.BidderAddress, bid.AuctionId)) } // HasAuction - checks if a auction by the given Id exists. @@ -169,7 +178,7 @@ func (k Keeper) GetAuction(ctx sdk.Context, id string) *types.Auction { // GetBids gets the auction bids. func (k Keeper) GetBids(ctx sdk.Context, id string) []*types.Bid { store := ctx.KVStore(k.storeKey) - var bids []*types.Bid + bids := []*types.Bid{} itr := sdk.KVStorePrefixIterator(store, GetAuctionBidsIndexPrefix(id)) defer itr.Close() for ; itr.Valid(); itr.Next() { @@ -215,7 +224,7 @@ func (k Keeper) ListAuctions(ctx sdk.Context) []types.Auction { // QueryAuctionsByOwner - query auctions by owner. func (k Keeper) QueryAuctionsByOwner(ctx sdk.Context, ownerAddress string) []types.Auction { - var auctions []types.Auction + auctions := []types.Auction{} ownerPrefix := append(prefixOwnerToAuctionsIndex, []byte(ownerAddress)...) store := ctx.KVStore(k.storeKey) @@ -234,6 +243,27 @@ func (k Keeper) QueryAuctionsByOwner(ctx sdk.Context, ownerAddress string) []typ return auctions } +// QueryAuctionsByBidder - query auctions by bidder +func (k Keeper) QueryAuctionsByBidder(ctx sdk.Context, bidderAddress string) []types.Auction { + auctions := []types.Auction{} + + bidderPrefix := append(PrefixBidderToAuctionsIndex, []byte(bidderAddress)...) + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, []byte(bidderPrefix)) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + auctionID := itr.Key()[len(bidderPrefix):] + bz := store.Get(append(PrefixIDToAuctionIndex, auctionID...)) + if bz != nil { + var obj types.Auction + k.cdc.MustUnmarshal(bz, &obj) + auctions = append(auctions, obj) + } + } + + return auctions +} + // MatchAuctions - get all matching auctions. func (k Keeper) MatchAuctions(ctx sdk.Context, matchFn func(*types.Auction) bool) []*types.Auction { var auctions []*types.Auction @@ -303,7 +333,7 @@ func (k Keeper) CreateAuction(ctx sdk.Context, msg types.MsgCreateAuction) (*typ return &auction, nil } -func (k Keeper) CommitBid(ctx sdk.Context, msg types.MsgCommitBid) (*types.Auction, error) { +func (k Keeper) CommitBid(ctx sdk.Context, msg types.MsgCommitBid) (*types.Bid, error) { if !k.HasAuction(ctx, msg.AuctionId) { return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Auction not found.") } @@ -349,7 +379,7 @@ func (k Keeper) CommitBid(ctx sdk.Context, msg types.MsgCommitBid) (*types.Aucti k.SaveBid(ctx, &bid) - return auction, nil + return &bid, nil } // RevealBid reeals a bid comitted earlier. diff --git a/x/auction/keeper/keeper_test.go b/x/auction/keeper/keeper_test.go new file mode 100644 index 00000000..b94d28fe --- /dev/null +++ b/x/auction/keeper/keeper_test.go @@ -0,0 +1,51 @@ +package keeper_test + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/tharsis/ethermint/app" + auctionkeeper "github.com/tharsis/ethermint/x/auction/keeper" + "github.com/tharsis/ethermint/x/auction/types" +) + +type KeeperTestSuite struct { + suite.Suite + app *app.EthermintApp + ctx sdk.Context + queryClient types.QueryClient +} + +func (suite *KeeperTestSuite) SetupTest() { + testApp := app.Setup(false) + ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) + + querier := auctionkeeper.Querier{Keeper: testApp.AuctionKeeper} + + queryHelper := baseapp.NewQueryServerTestHelper(ctx, testApp.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, querier) + queryClient := types.NewQueryClient(queryHelper) + + suite.app, suite.ctx, suite.queryClient = testApp, ctx, queryClient +} + +func TestParams(t *testing.T) { + testApp := app.Setup(false) + ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) + + expParams := types.DefaultParams() + params := testApp.AuctionKeeper.GetParams(ctx) + require.Equal(t, expParams.CommitsDuration, params.CommitsDuration) + require.Equal(t, expParams.RevealsDuration, params.RevealsDuration) + require.Equal(t, expParams.CommitFee, params.CommitFee) + require.Equal(t, expParams.RevealFee, params.RevealFee) + require.Equal(t, expParams.MinimumBid, params.MinimumBid) +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} diff --git a/x/auction/keeper/msg_server.go b/x/auction/keeper/msg_server.go index c32f7a46..d0c99fbe 100644 --- a/x/auction/keeper/msg_server.go +++ b/x/auction/keeper/msg_server.go @@ -76,7 +76,7 @@ func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types ), }) - return &types.MsgCommitBidResponse{Auction: resp}, nil + return &types.MsgCommitBidResponse{Bid: resp}, nil } //RevealBid is the command for revealing a bid diff --git a/x/auction/module_test.go b/x/auction/module_test.go new file mode 100644 index 00000000..3fa49b78 --- /dev/null +++ b/x/auction/module_test.go @@ -0,0 +1,24 @@ +package auction_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + abcitypes "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + app2 "github.com/tharsis/ethermint/app" + auctiontypes "github.com/tharsis/ethermint/x/auction/types" +) + +func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { + app := app2.Setup(false) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + app.InitChain(abcitypes.RequestInitChain{ + AppStateBytes: []byte("{}"), + ChainId: "test-chain-id", + }) + + acc := app.AccountKeeper.GetModuleAccount(ctx, auctiontypes.ModuleName) + require.NotNil(t, acc) +} diff --git a/x/auction/types/query.pb.go b/x/auction/types/query.pb.go index 91e7ae19..ffd23ebf 100644 --- a/x/auction/types/query.pb.go +++ b/x/auction/types/query.pb.go @@ -509,6 +509,98 @@ func (m *AuctionsByBidderResponse) GetAuctions() *Auctions { return nil } +// AuctionsByOwnerRequest is the format for querying all auctions created by an owner +type AuctionsByOwnerRequest struct { + // Address of the owner + OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` +} + +func (m *AuctionsByOwnerRequest) Reset() { *m = AuctionsByOwnerRequest{} } +func (m *AuctionsByOwnerRequest) String() string { return proto.CompactTextString(m) } +func (*AuctionsByOwnerRequest) ProtoMessage() {} +func (*AuctionsByOwnerRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{10} +} +func (m *AuctionsByOwnerRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionsByOwnerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionsByOwnerRequest.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 *AuctionsByOwnerRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionsByOwnerRequest.Merge(m, src) +} +func (m *AuctionsByOwnerRequest) XXX_Size() int { + return m.Size() +} +func (m *AuctionsByOwnerRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionsByOwnerRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionsByOwnerRequest proto.InternalMessageInfo + +func (m *AuctionsByOwnerRequest) GetOwnerAddress() string { + if m != nil { + return m.OwnerAddress + } + return "" +} + +// AuctionsByOwnerResponse returns all auctions created by an owner +type AuctionsByOwnerResponse struct { + // List of auctions + Auctions *Auctions `protobuf:"bytes,1,opt,name=auctions,proto3" json:"auctions,omitempty"` +} + +func (m *AuctionsByOwnerResponse) Reset() { *m = AuctionsByOwnerResponse{} } +func (m *AuctionsByOwnerResponse) String() string { return proto.CompactTextString(m) } +func (*AuctionsByOwnerResponse) ProtoMessage() {} +func (*AuctionsByOwnerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{11} +} +func (m *AuctionsByOwnerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionsByOwnerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionsByOwnerResponse.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 *AuctionsByOwnerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionsByOwnerResponse.Merge(m, src) +} +func (m *AuctionsByOwnerResponse) XXX_Size() int { + return m.Size() +} +func (m *AuctionsByOwnerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionsByOwnerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionsByOwnerResponse proto.InternalMessageInfo + +func (m *AuctionsByOwnerResponse) GetAuctions() *Auctions { + if m != nil { + return m.Auctions + } + return nil +} + // QueryParamsRequest is the format to query the parameters of the auction module type QueryParamsRequest struct { } @@ -517,7 +609,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_888c39bb00ad61a7, []int{10} + return fileDescriptor_888c39bb00ad61a7, []int{12} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -555,7 +647,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_888c39bb00ad61a7, []int{11} + return fileDescriptor_888c39bb00ad61a7, []int{13} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -599,7 +691,7 @@ func (m *BalanceRequest) Reset() { *m = BalanceRequest{} } func (m *BalanceRequest) String() string { return proto.CompactTextString(m) } func (*BalanceRequest) ProtoMessage() {} func (*BalanceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_888c39bb00ad61a7, []int{12} + return fileDescriptor_888c39bb00ad61a7, []int{14} } func (m *BalanceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -637,7 +729,7 @@ func (m *BalanceResponse) Reset() { *m = BalanceResponse{} } func (m *BalanceResponse) String() string { return proto.CompactTextString(m) } func (*BalanceResponse) ProtoMessage() {} func (*BalanceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_888c39bb00ad61a7, []int{13} + return fileDescriptor_888c39bb00ad61a7, []int{15} } func (m *BalanceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -684,6 +776,8 @@ func init() { proto.RegisterType((*BidsResponse)(nil), "vulcanize.auction.v1beta1.BidsResponse") proto.RegisterType((*AuctionsByBidderRequest)(nil), "vulcanize.auction.v1beta1.AuctionsByBidderRequest") proto.RegisterType((*AuctionsByBidderResponse)(nil), "vulcanize.auction.v1beta1.AuctionsByBidderResponse") + proto.RegisterType((*AuctionsByOwnerRequest)(nil), "vulcanize.auction.v1beta1.AuctionsByOwnerRequest") + proto.RegisterType((*AuctionsByOwnerResponse)(nil), "vulcanize.auction.v1beta1.AuctionsByOwnerResponse") proto.RegisterType((*QueryParamsRequest)(nil), "vulcanize.auction.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "vulcanize.auction.v1beta1.QueryParamsResponse") proto.RegisterType((*BalanceRequest)(nil), "vulcanize.auction.v1beta1.BalanceRequest") @@ -695,56 +789,60 @@ func init() { } var fileDescriptor_888c39bb00ad61a7 = []byte{ - // 775 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xc1, 0x4f, 0x13, 0x4f, - 0x14, 0xc7, 0xbb, 0x85, 0x5f, 0x0b, 0xaf, 0xbf, 0x5f, 0x21, 0xf3, 0x23, 0x0a, 0x8d, 0xae, 0x30, - 0x58, 0x84, 0x82, 0xbb, 0x50, 0x50, 0x63, 0x82, 0x41, 0x96, 0x04, 0x62, 0x62, 0x22, 0xf6, 0xa6, - 0x1e, 0xc8, 0x6e, 0x77, 0x52, 0x26, 0xa1, 0xbb, 0xa5, 0xbb, 0x25, 0x22, 0xe9, 0xc5, 0xb3, 0x07, - 0x12, 0xa3, 0x1e, 0xfc, 0x4b, 0x3c, 0x7b, 0xe1, 0x48, 0xe2, 0xc5, 0x93, 0x31, 0xe0, 0x1f, 0x62, - 0x76, 0xe6, 0xed, 0xd2, 0x42, 0xd8, 0x2e, 0xc6, 0x5b, 0x3b, 0xf3, 0x7d, 0xef, 0xfb, 0x99, 0x99, - 0xf7, 0x5e, 0x16, 0x8a, 0x7b, 0xad, 0x9d, 0xaa, 0xe9, 0xf0, 0x37, 0x4c, 0x37, 0x5b, 0x55, 0x9f, - 0xbb, 0x8e, 0xbe, 0xb7, 0x60, 0x31, 0xdf, 0x5c, 0xd0, 0x77, 0x5b, 0xac, 0xb9, 0xaf, 0x35, 0x9a, - 0xae, 0xef, 0x92, 0xb1, 0x48, 0xa6, 0xa1, 0x4c, 0x43, 0x59, 0x61, 0xa4, 0xe6, 0xd6, 0x5c, 0xa1, - 0xd2, 0x83, 0x5f, 0x32, 0xa0, 0x70, 0xa3, 0xe6, 0xba, 0xb5, 0x1d, 0xa6, 0x9b, 0x0d, 0xae, 0x9b, - 0x8e, 0xe3, 0xfa, 0x66, 0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xa8, - 0x6d, 0x3f, 0x28, 0x00, 0x1b, 0xcc, 0xc7, 0x24, 0x64, 0x26, 0x41, 0xdf, 0x20, 0x53, 0x29, 0x89, - 0x14, 0x91, 0xe6, 0x05, 0x52, 0x89, 0x4c, 0x27, 0x40, 0xd2, 0x0f, 0xb8, 0xdd, 0x26, 0x1f, 0x15, - 0xc8, 0x6c, 0x30, 0xdf, 0xe0, 0x36, 0x29, 0xf6, 0x28, 0x66, 0xe4, 0x99, 0xea, 0x25, 0x43, 0x96, - 0x47, 0x82, 0xe5, 0x01, 0xb9, 0x17, 0xc3, 0x12, 0xb4, 0x87, 0x7e, 0x70, 0xd6, 0x7f, 0x6d, 0xfd, - 0x40, 0x16, 0x7e, 0x3b, 0x78, 0xc3, 0xac, 0x04, 0xf3, 0x48, 0x0f, 0xcb, 0xe8, 0xf9, 0xee, 0xf4, - 0xd4, 0x21, 0xdb, 0x92, 0x60, 0xd3, 0xc8, 0xdc, 0x55, 0xd8, 0xc8, 0x97, 0x8e, 0x81, 0x1e, 0xb6, - 0x21, 0x29, 0x27, 0x28, 0x99, 0x73, 0x5d, 0x5f, 0x58, 0xbc, 0x52, 0x0c, 0x32, 0x2f, 0x0b, 0xe6, - 0xfb, 0x64, 0x29, 0xd1, 0xdb, 0x76, 0x4f, 0x95, 0x36, 0xf9, 0xa4, 0x40, 0xae, 0xa3, 0x9f, 0xc9, - 0xdd, 0x18, 0x84, 0x8b, 0xd3, 0xa0, 0xa0, 0x25, 0x95, 0x23, 0xec, 0x8c, 0x80, 0x9d, 0x24, 0x13, - 0x31, 0xb0, 0x72, 0x2c, 0x90, 0x77, 0x0a, 0x64, 0x71, 0x0a, 0xc4, 0xb6, 0x45, 0xf7, 0xec, 0x88, - 0x6d, 0x8b, 0x73, 0x43, 0x85, 0x96, 0x04, 0xcd, 0x6d, 0x42, 0xe3, 0x9e, 0x5b, 0xc6, 0x18, 0xeb, - 0x47, 0x27, 0xaa, 0x72, 0x7c, 0xa2, 0x2a, 0x3f, 0x4f, 0x54, 0xe5, 0xf0, 0x54, 0x4d, 0x1d, 0x9f, - 0xaa, 0xa9, 0xef, 0xa7, 0x6a, 0xea, 0xe5, 0x5c, 0x8d, 0xfb, 0xdb, 0x2d, 0x4b, 0xab, 0xba, 0x75, - 0xdd, 0xdf, 0x36, 0x9b, 0x1e, 0xf7, 0x74, 0xe6, 0x6f, 0xb3, 0x66, 0x9d, 0x3b, 0xbe, 0xfe, 0x3a, - 0xca, 0x28, 0x3e, 0x2f, 0xac, 0x8c, 0xf8, 0xbe, 0x58, 0xfc, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xc8, - 0x2d, 0x31, 0x68, 0x4a, 0x09, 0x00, 0x00, + // 845 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0xc7, 0xe3, 0xec, 0x92, 0x6c, 0x5e, 0x76, 0xb3, 0xab, 0x61, 0xb5, 0xec, 0x46, 0x60, 0x76, + 0x27, 0x64, 0x69, 0xd3, 0xd6, 0x6e, 0x53, 0x2a, 0x84, 0xa0, 0x2a, 0x75, 0xa5, 0x56, 0x48, 0x48, + 0x2d, 0xb9, 0x51, 0x0e, 0x95, 0x1d, 0x8f, 0xd2, 0x91, 0x1a, 0x3b, 0x8d, 0x9d, 0x42, 0x88, 0x72, + 0xe1, 0xcc, 0xa1, 0x12, 0x02, 0x0e, 0xfc, 0x1d, 0x5c, 0xf8, 0x0b, 0x7a, 0xac, 0xc4, 0x85, 0x13, + 0x42, 0x2d, 0x7f, 0x06, 0x07, 0xe4, 0x99, 0x37, 0xce, 0x8f, 0xaa, 0x8e, 0xb3, 0xea, 0x2d, 0x79, + 0xfe, 0xbe, 0xf7, 0x3e, 0xf3, 0xc6, 0xef, 0x9b, 0x40, 0xf5, 0xac, 0x77, 0xd2, 0xb4, 0x3d, 0xfe, + 0x3d, 0x33, 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0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -769,6 +867,8 @@ type QueryClient interface { GetBids(ctx context.Context, in *BidsRequest, opts ...grpc.CallOption) (*BidsResponse, error) // AuctionsByBidder queries auctions by bidder AuctionsByBidder(ctx context.Context, in *AuctionsByBidderRequest, opts ...grpc.CallOption) (*AuctionsByBidderResponse, error) + // AuctionsByOwner queries auctions by owner + AuctionsByOwner(ctx context.Context, in *AuctionsByOwnerRequest, opts ...grpc.CallOption) (*AuctionsByOwnerResponse, error) // QueryParams implements the params query command QueryParams(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // Balance queries the auction module account balance @@ -828,6 +928,15 @@ func (c *queryClient) AuctionsByBidder(ctx context.Context, in *AuctionsByBidder return out, nil } +func (c *queryClient) AuctionsByOwner(ctx context.Context, in *AuctionsByOwnerRequest, opts ...grpc.CallOption) (*AuctionsByOwnerResponse, error) { + out := new(AuctionsByOwnerResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/AuctionsByOwner", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) QueryParams(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { out := new(QueryParamsResponse) err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/QueryParams", in, out, opts...) @@ -858,6 +967,8 @@ type QueryServer interface { GetBids(context.Context, *BidsRequest) (*BidsResponse, error) // AuctionsByBidder queries auctions by bidder AuctionsByBidder(context.Context, *AuctionsByBidderRequest) (*AuctionsByBidderResponse, error) + // AuctionsByOwner queries auctions by owner + AuctionsByOwner(context.Context, *AuctionsByOwnerRequest) (*AuctionsByOwnerResponse, error) // QueryParams implements the params query command QueryParams(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // Balance queries the auction module account balance @@ -883,6 +994,9 @@ func (*UnimplementedQueryServer) GetBids(ctx context.Context, req *BidsRequest) func (*UnimplementedQueryServer) AuctionsByBidder(ctx context.Context, req *AuctionsByBidderRequest) (*AuctionsByBidderResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AuctionsByBidder not implemented") } +func (*UnimplementedQueryServer) AuctionsByOwner(ctx context.Context, req *AuctionsByOwnerRequest) (*AuctionsByOwnerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuctionsByOwner not implemented") +} func (*UnimplementedQueryServer) QueryParams(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryParams not implemented") } @@ -984,6 +1098,24 @@ func _Query_AuctionsByBidder_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _Query_AuctionsByOwner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuctionsByOwnerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AuctionsByOwner(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/AuctionsByOwner", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AuctionsByOwner(ctx, req.(*AuctionsByOwnerRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_QueryParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryParamsRequest) if err := dec(in); err != nil { @@ -1044,6 +1176,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "AuctionsByBidder", Handler: _Query_AuctionsByBidder_Handler, }, + { + MethodName: "AuctionsByOwner", + Handler: _Query_AuctionsByOwner_Handler, + }, { MethodName: "QueryParams", Handler: _Query_QueryParams_Handler, @@ -1408,6 +1544,71 @@ func (m *AuctionsByBidderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *AuctionsByOwnerRequest) 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 *AuctionsByOwnerRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionsByOwnerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AuctionsByOwnerResponse) 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 *AuctionsByOwnerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionsByOwnerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Auctions != nil { + { + size, err := m.Auctions.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1677,6 +1878,32 @@ func (m *AuctionsByBidderResponse) Size() (n int) { return n } +func (m *AuctionsByOwnerRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *AuctionsByOwnerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Auctions != nil { + l = m.Auctions.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func (m *QueryParamsRequest) Size() (n int) { if m == nil { return 0 @@ -2639,6 +2866,174 @@ func (m *AuctionsByBidderResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *AuctionsByOwnerRequest) 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 ErrIntOverflowQuery + } + 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: AuctionsByOwnerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionsByOwnerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AuctionsByOwnerResponse) 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 ErrIntOverflowQuery + } + 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: AuctionsByOwnerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionsByOwnerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auctions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Auctions == nil { + m.Auctions = &Auctions{} + } + if err := m.Auctions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/auction/types/query.pb.gw.go b/x/auction/types/query.pb.gw.go index 7f1ee808..99f10fd7 100644 --- a/x/auction/types/query.pb.gw.go +++ b/x/auction/types/query.pb.gw.go @@ -305,6 +305,60 @@ func local_request_Query_AuctionsByBidder_0(ctx context.Context, marshaler runti } +func request_Query_AuctionsByOwner_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionsByOwnerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner_address") + } + + protoReq.OwnerAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner_address", err) + } + + msg, err := client.AuctionsByOwner(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AuctionsByOwner_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionsByOwnerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner_address") + } + + protoReq.OwnerAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner_address", err) + } + + msg, err := server.AuctionsByOwner(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_QueryParams_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest var metadata runtime.ServerMetadata @@ -447,6 +501,26 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_AuctionsByOwner_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_AuctionsByOwner_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AuctionsByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -628,6 +702,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_AuctionsByOwner_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_Query_AuctionsByOwner_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AuctionsByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -680,7 +774,9 @@ var ( pattern_Query_GetBids_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "auction", "v1beta1", "bids", "auction_id"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_AuctionsByBidder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "auction", "v1beta1", "auctions", "bidder_address"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_AuctionsByBidder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "auction", "v1beta1", "by-bidder", "bidder_address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_AuctionsByOwner_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "auction", "v1beta1", "by-owner", "owner_address"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_QueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "auction", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(true))) @@ -698,6 +794,8 @@ var ( forward_Query_AuctionsByBidder_0 = runtime.ForwardResponseMessage + forward_Query_AuctionsByOwner_0 = runtime.ForwardResponseMessage + forward_Query_QueryParams_0 = runtime.ForwardResponseMessage forward_Query_Balance_0 = runtime.ForwardResponseMessage diff --git a/x/auction/types/tx.pb.go b/x/auction/types/tx.pb.go index e5de153e..006e4501 100644 --- a/x/auction/types/tx.pb.go +++ b/x/auction/types/tx.pb.go @@ -210,7 +210,7 @@ var xxx_messageInfo_MsgRevealBid proto.InternalMessageInfo // MsgCommitBidResponse returns the state of the auction after the bid creation type MsgCommitBidResponse struct { // Auction details - Auction *Auction `protobuf:"bytes,1,opt,name=auction,proto3" json:"auction,omitempty" json:"auction" yaml:"auction"` + Bid *Bid `protobuf:"bytes,1,opt,name=bid,proto3" json:"bid,omitempty" json:"bid" yaml:"bid"` } func (m *MsgCommitBidResponse) Reset() { *m = MsgCommitBidResponse{} } @@ -299,49 +299,51 @@ func init() { } var fileDescriptor_1684caa22ed7f7bf = []byte{ - // 661 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xcf, 0x4f, 0xd4, 0x40, - 0x14, 0xde, 0xf2, 0x63, 0xcd, 0x0e, 0x1a, 0xc9, 0x86, 0xc3, 0xb2, 0xc6, 0x16, 0x6b, 0x08, 0x18, - 0xb4, 0x13, 0xe0, 0x40, 0x82, 0x27, 0x8b, 0x21, 0x6a, 0xc2, 0xa5, 0x47, 0x2f, 0x9b, 0xb6, 0x3b, - 0xb4, 0x63, 0xb6, 0x1d, 0xec, 0xb4, 0x04, 0x4c, 0x3c, 0x70, 0xf3, 0x68, 0x3c, 0x79, 0xf4, 0xaf, - 0x31, 0x9c, 0x0c, 0x47, 0x4f, 0xab, 0xc2, 0x7f, 0xc0, 0x5f, 0x60, 0x3a, 0xf3, 0xa6, 0xed, 0x16, - 0x65, 0x45, 0x0d, 0xb7, 0x7d, 0x6f, 0xbe, 0xf7, 0xbe, 0xef, 0xbd, 0xf9, 0xba, 0x83, 0xcc, 0xfd, - 0x6c, 0xe0, 0xbb, 0x31, 0x7d, 0x43, 0xb0, 0x9b, 0xf9, 0x29, 0x65, 0x31, 0xde, 0x5f, 0xf5, 0x48, - 0xea, 0xae, 0xe2, 0xf4, 0xc0, 0xda, 0x4b, 0x58, 0xca, 0xda, 0xf3, 0x05, 0xc6, 0x02, 0x8c, 0x05, - 0x98, 0xee, 0x5c, 0xc0, 0x02, 0x26, 0x50, 0x38, 0xff, 0x25, 0x0b, 0xba, 0x7a, 0xc0, 0x58, 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0x07, 0xe3, - 0x55, 0x74, 0xc9, 0xfc, 0xa8, 0x55, 0x4d, 0x07, 0xe0, 0xff, 0x3a, 0xd0, 0x5b, 0x34, 0x57, 0xbd, - 0xb3, 0xeb, 0xf6, 0x8c, 0xa4, 0x2f, 0xd6, 0x79, 0xcd, 0xf4, 0x6b, 0x9f, 0x27, 0xd0, 0xe4, 0x0e, - 0x0f, 0xda, 0xaf, 0xd1, 0xad, 0xd1, 0xff, 0xf3, 0x95, 0x4b, 0xe8, 0xea, 0xdf, 0x59, 0x77, 0xfd, - 0x0a, 0xe0, 0x62, 0x42, 0x82, 0x5a, 0xe5, 0x97, 0xb2, 0x34, 0xa6, 0x83, 0x02, 0x76, 0xf1, 0x1f, - 0x02, 0xab, 0x34, 0xa5, 0x59, 0xc7, 0xd0, 0x14, 0xc0, 0x71, 0x34, 0x17, 0xee, 0xcb, 0xde, 0x3e, - 0x3e, 0xd5, 0xb5, 0x93, 0x53, 0x5d, 0xfb, 0x7e, 0xaa, 0x6b, 0xef, 0xcf, 0xf4, 0xc6, 0xc9, 0x99, - 0xde, 0xf8, 0x7a, 0xa6, 0x37, 0x5e, 0x3e, 0x0c, 0x68, 0x1a, 0x66, 0x9e, 0xe5, 0xb3, 0x08, 0xa7, - 0xa1, 0x9b, 0x70, 0xca, 0x31, 0x49, 0x43, 0x92, 0x44, 0x34, 0x4e, 0xf1, 0x41, 0xf1, 0xd4, 0x8a, - 0x27, 0xd6, 0x6b, 0x8a, 0x07, 0x6a, 0xfd, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x58, 0x59, 0xa1, - 0xc8, 0x21, 0x08, 0x00, 0x00, + // 691 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0x4f, 0x6f, 0xd3, 0x4e, + 0x10, 0x8d, 0x9b, 0x36, 0x3f, 0x65, 0xf3, 0x43, 0x54, 0x51, 0x91, 0xd2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7e, 0xf3, + 0x25, 0xba, 0x36, 0xfe, 0xdf, 0xbd, 0x76, 0x05, 0x5d, 0xf9, 0x9b, 0x6a, 0x6f, 0x4e, 0x01, 0xce, + 0x26, 0x24, 0xa8, 0x9e, 0x7f, 0x15, 0x2b, 0x13, 0x3a, 0x28, 0x60, 0x1b, 0xff, 0x22, 0xb0, 0x48, + 0x93, 0x1b, 0x73, 0x02, 0x4d, 0x06, 0x9c, 0x44, 0x73, 0xe9, 0xbe, 0xec, 0xdd, 0xd3, 0x73, 0x5d, + 0x3b, 0x3b, 0xd7, 0xb5, 0xaf, 0xe7, 0xba, 0xf6, 0xf6, 0x42, 0xaf, 0x9c, 0x5d, 0xe8, 0x95, 0xcf, + 0x17, 0x7a, 0xe5, 0xf9, 0x3d, 0x9f, 0xc6, 0xfd, 0xc4, 0xb3, 0xba, 0x2c, 0xc0, 0x71, 0xdf, 0x8d, + 0x38, 0xe5, 0x98, 0xc4, 0x7d, 0x12, 0x05, 0x34, 0x8c, 0xf1, 0x51, 0xf6, 0xac, 0x8a, 0xe7, 0xd4, + 0xab, 0x89, 0xc7, 0x68, 0xf3, 0x7b, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xa6, 0x65, 0x14, 0x0d, + 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -721,9 +723,9 @@ func (m *MsgCommitBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Auction != nil { + if m.Bid != nil { { - size, err := m.Auction.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Bid.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -866,8 +868,8 @@ func (m *MsgCommitBidResponse) Size() (n int) { } var l int _ = l - if m.Auction != nil { - l = m.Auction.Size() + if m.Bid != nil { + l = m.Bid.Size() n += 1 + l + sovTx(uint64(l)) } return n @@ -1548,7 +1550,7 @@ func (m *MsgCommitBidResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Auction", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Bid", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1575,10 +1577,10 @@ func (m *MsgCommitBidResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Auction == nil { - m.Auction = &Auction{} + if m.Bid == nil { + m.Bid = &Bid{} } - if err := m.Auction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Bid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex