diff --git a/Makefile b/Makefile index 14df4445..c21b08c6 100755 --- a/Makefile +++ b/Makefile @@ -587,3 +587,4 @@ release: release --rm-dist --skip-validate .PHONY: release-dry-run release + diff --git a/app/app.go b/app/app.go index 3a463cf1..051d5aec 100644 --- a/app/app.go +++ b/app/app.go @@ -2,9 +2,6 @@ package app import ( "encoding/json" - "github.com/tharsis/ethermint/x/bond" - bondkeeper "github.com/tharsis/ethermint/x/bond/keeper" - bondtypes "github.com/tharsis/ethermint/x/bond/types" "io" "net/http" "os" @@ -101,6 +98,12 @@ import ( "github.com/tharsis/ethermint/app/ante" srvflags "github.com/tharsis/ethermint/server/flags" ethermint "github.com/tharsis/ethermint/types" + "github.com/tharsis/ethermint/x/auction" + auctionkeeper "github.com/tharsis/ethermint/x/auction/keeper" + auctiontypes "github.com/tharsis/ethermint/x/auction/types" + "github.com/tharsis/ethermint/x/bond" + bondkeeper "github.com/tharsis/ethermint/x/bond/keeper" + bondtypes "github.com/tharsis/ethermint/x/bond/types" "github.com/tharsis/ethermint/x/evm" evmrest "github.com/tharsis/ethermint/x/evm/client/rest" evmkeeper "github.com/tharsis/ethermint/x/evm/keeper" @@ -151,6 +154,7 @@ var ( transfer.AppModuleBasic{}, vesting.AppModuleBasic{}, // Ethermint modules + auction.AppModuleBasic{}, evm.AppModuleBasic{}, feemarket.AppModuleBasic{}, // DXNS modules @@ -159,15 +163,17 @@ var ( // module account permissions maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, - distrtypes.ModuleName: nil, - minttypes.ModuleName: {authtypes.Minter}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - govtypes.ModuleName: {authtypes.Burner}, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account - bondtypes.ModuleName: nil, + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + auctiontypes.ModuleName: nil, + auctiontypes.AuctionBurnModuleAccountName: nil, + bondtypes.ModuleName: nil, } // module accounts that are allowed to receive tokens @@ -221,6 +227,7 @@ type EthermintApp struct { ScopedTransferKeeper capabilitykeeper.ScopedKeeper // Ethermint keepers + AuctionKeeper auctionkeeper.Keeper EvmKeeper *evmkeeper.Keeper FeeMarketKeeper feemarketkeeper.Keeper @@ -278,6 +285,7 @@ func NewEthermintApp( // ethermint keys evmtypes.StoreKey, feemarkettypes.StoreKey, // dxns keys + auctiontypes.StoreKey, bondtypes.StoreKey, ) @@ -349,6 +357,11 @@ func NewEthermintApp( tracer := cast.ToString(appOpts.Get(srvflags.EVMTracer)) // Create Ethermint keepers + app.AuctionKeeper = auctionkeeper.NewKeeper( + app.AccountKeeper, app.BankKeeper, keys[auctiontypes.StoreKey], + appCodec, app.GetSubspace(auctiontypes.ModuleName), + ) + app.EvmKeeper = evmkeeper.NewKeeper( appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], app.GetSubspace(evmtypes.ModuleName), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, @@ -440,6 +453,7 @@ func NewEthermintApp( ibc.NewAppModule(app.IBCKeeper), transferModule, // Ethermint app modules + auction.NewAppModule(appCodec, app.AuctionKeeper), evm.NewAppModule(app.EvmKeeper, app.AccountKeeper), feemarket.NewAppModule(app.FeeMarketKeeper), // DXNs modules @@ -463,7 +477,7 @@ func NewEthermintApp( // NOTE: fee market module must go last in order to retrieve the block gas used. app.mm.SetOrderEndBlockers( crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, - evmtypes.ModuleName, feemarkettypes.ModuleName, + evmtypes.ModuleName, feemarkettypes.ModuleName, auctiontypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -480,6 +494,7 @@ func NewEthermintApp( // Ethermint modules evmtypes.ModuleName, feemarkettypes.ModuleName, // DXNS modules + auctiontypes.ModuleName, bondtypes.ModuleName, // NOTE: crisis module must go at the end to check for invariants on each module @@ -721,6 +736,7 @@ func initParamsKeeper( paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) // ethermint subspaces + paramsKeeper.Subspace(auctiontypes.ModuleName) paramsKeeper.Subspace(evmtypes.ModuleName) paramsKeeper.Subspace(feemarkettypes.ModuleName) // dxns subspaces diff --git a/docs/api/proto-docs.md b/docs/api/proto-docs.md index c9983d0c..1e14acf5 100644 --- a/docs/api/proto-docs.md +++ b/docs/api/proto-docs.md @@ -80,6 +80,43 @@ - [ethermint/types/v1/web3.proto](#ethermint/types/v1/web3.proto) - [ExtensionOptionsWeb3Tx](#ethermint.types.v1.ExtensionOptionsWeb3Tx) +- [vulcanize/auction/v1beta1/types.proto](#vulcanize/auction/v1beta1/types.proto) + - [Auction](#vulcanize.auction.v1beta1.Auction) + - [Auctions](#vulcanize.auction.v1beta1.Auctions) + - [Bid](#vulcanize.auction.v1beta1.Bid) + - [Params](#vulcanize.auction.v1beta1.Params) + +- [vulcanize/auction/v1beta1/genesis.proto](#vulcanize/auction/v1beta1/genesis.proto) + - [GenesisState](#vulcanize.auction.v1beta1.GenesisState) + +- [vulcanize/auction/v1beta1/query.proto](#vulcanize/auction/v1beta1/query.proto) + - [AuctionRequest](#vulcanize.auction.v1beta1.AuctionRequest) + - [AuctionResponse](#vulcanize.auction.v1beta1.AuctionResponse) + - [AuctionsByBidderRequest](#vulcanize.auction.v1beta1.AuctionsByBidderRequest) + - [AuctionsByBidderResponse](#vulcanize.auction.v1beta1.AuctionsByBidderResponse) + - [AuctionsRequest](#vulcanize.auction.v1beta1.AuctionsRequest) + - [AuctionsResponse](#vulcanize.auction.v1beta1.AuctionsResponse) + - [BalanceRequest](#vulcanize.auction.v1beta1.BalanceRequest) + - [BalanceResponse](#vulcanize.auction.v1beta1.BalanceResponse) + - [BidRequest](#vulcanize.auction.v1beta1.BidRequest) + - [BidResponse](#vulcanize.auction.v1beta1.BidResponse) + - [BidsRequest](#vulcanize.auction.v1beta1.BidsRequest) + - [BidsResponse](#vulcanize.auction.v1beta1.BidsResponse) + - [QueryParamsRequest](#vulcanize.auction.v1beta1.QueryParamsRequest) + - [QueryParamsResponse](#vulcanize.auction.v1beta1.QueryParamsResponse) + + - [Query](#vulcanize.auction.v1beta1.Query) + +- [vulcanize/auction/v1beta1/tx.proto](#vulcanize/auction/v1beta1/tx.proto) + - [MsgCommitBid](#vulcanize.auction.v1beta1.MsgCommitBid) + - [MsgCommitBidResponse](#vulcanize.auction.v1beta1.MsgCommitBidResponse) + - [MsgCreateAuction](#vulcanize.auction.v1beta1.MsgCreateAuction) + - [MsgCreateAuctionResponse](#vulcanize.auction.v1beta1.MsgCreateAuctionResponse) + - [MsgRevealBid](#vulcanize.auction.v1beta1.MsgRevealBid) + - [MsgRevealBidResponse](#vulcanize.auction.v1beta1.MsgRevealBidResponse) + + - [Msg](#vulcanize.auction.v1beta1.Msg) + - [vulcanize/bond/v1beta1/bond.proto](#vulcanize/bond/v1beta1/bond.proto) - [Bond](#vulcanize.bond.v1beta1.Bond) - [Params](#vulcanize.bond.v1beta1.Params) @@ -1167,6 +1204,498 @@ authtypes.BaseAccount type. It is compatible with the auth AccountKeeper. + +

Top

+ +## vulcanize/auction/v1beta1/types.proto + + + + + +### Auction +Auction represents a sealed-bid on-chain auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | | +| `status` | [string](#string) | | | +| `owner_address` | [string](#string) | | Address of the creator of the auction | +| `create_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | Timestamp at which the auction was created | +| `commits_end_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | Timestamp at which the commits phase concluded | +| `reveals_end_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | Timestamp at which the reveals phase concluded | +| `commit_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Commit and reveal fees must both be paid when committing a bid Reveal fee is returned only if the bid is revealed | +| `reveal_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `minimum_bid` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Minimum acceptable bid amount for a valid commit | +| `winner_address` | [string](#string) | | Address of the winner | +| `winning_bid` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Winning bid, i.e., the highest bid | +| `winning_price` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Amount the winner pays, i.e. the second highest auction | + + + + + + + + +### Auctions + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auctions` | [Auction](#vulcanize.auction.v1beta1.Auction) | repeated | | + + + + + + + + +### Bid +Bid represents a sealed bid (commit) made during the auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction_id` | [string](#string) | | | +| `bidder_address` | [string](#string) | | | +| `status` | [string](#string) | | | +| `commit_hash` | [string](#string) | | | +| `commit_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `commit_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `reveal_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `reveal_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `bid_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + + + + + + + + +### Params +Params defines the auction module parameters + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `commits_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | Duration of the commits phase in seconds | +| `reveals_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | Duration of the reveals phase in seconds | +| `commit_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Commit fees | +| `reveal_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Reveal fees | +| `minimum_bid` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Minimum acceptable bid amount | + + + + + + + + + + + + + + + + +

Top

+ +## vulcanize/auction/v1beta1/genesis.proto + + + + + +### GenesisState +GenesisState defines the genesis state of the auction module + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#vulcanize.auction.v1beta1.Params) | | | +| `auctions` | [Auction](#vulcanize.auction.v1beta1.Auction) | repeated | | + + + + + + + + + + + + + + + + +

Top

+ +## vulcanize/auction/v1beta1/query.proto + + + + + +### AuctionRequest +AuctionRequest is the format for querying a specific auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | Auction ID | + + + + + + + + +### AuctionResponse +AuctionResponse returns the details of the queried auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction` | [Auction](#vulcanize.auction.v1beta1.Auction) | | Auction details | + + + + + + + + +### AuctionsByBidderRequest +AuctionsByBidderRequest is the format for querying all auctions containing a bidder address + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `bidder_address` | [string](#string) | | Address of the bidder | + + + + + + + + +### AuctionsByBidderResponse +AuctionsByBidderResponse returns all auctions containing a bidder + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auctions` | [Auctions](#vulcanize.auction.v1beta1.Auctions) | | List of auctions | + + + + + + + + +### AuctionsRequest +AuctionsRequest is the format for querying all the auctions + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination info for the next request | + + + + + + + + +### AuctionsResponse +AuctionsResponse returns the list of all auctions + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auctions` | [Auctions](#vulcanize.auction.v1beta1.Auctions) | | List of auctions | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination info for the next request | + + + + + + + + +### BalanceRequest +BalanceRequest is the format to fetch all balances + + + + + + + + +### BalanceResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `balance` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Set of all balances within the auction | + + + + + + + + +### BidRequest +BidRequest is the format for querying a specific bid in an auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction_id` | [string](#string) | | Auction ID | +| `bidder` | [string](#string) | | Bidder address | + + + + + + + + +### BidResponse +BidResponse returns the details of the queried bid + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `bid` | [Bid](#vulcanize.auction.v1beta1.Bid) | | Bid details | + + + + + + + + +### BidsRequest +BidsRequest is the format for querying all bids in an auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction_id` | [string](#string) | | Auction ID | + + + + + + + + +### BidsResponse +BidsResponse returns details of all bids in an auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `bids` | [Bid](#vulcanize.auction.v1beta1.Bid) | repeated | List of bids in the auction | + + + + + + + + +### QueryParamsRequest +QueryParamsRequest is the format to query the parameters of the auction module + + + + + + + + +### QueryParamsResponse +QueryParamsResponse returns parameters of the auction module + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#vulcanize.auction.v1beta1.Params) | | | + + + + + + + + + + + + + + +### Query +Query defines the gRPC querier interface for the auction module + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `Auctions` | [AuctionsRequest](#vulcanize.auction.v1beta1.AuctionsRequest) | [AuctionsResponse](#vulcanize.auction.v1beta1.AuctionsResponse) | Auctions queries all auctions | GET|/vulcanize/auction/v1beta1/auctions| +| `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}| +| `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| + + + + + + +

Top

+ +## vulcanize/auction/v1beta1/tx.proto + + + + + +### MsgCommitBid +CommitBid defines the message to commit a bid + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction_id` | [string](#string) | | Auction ID | +| `commit_hash` | [string](#string) | | Commit Hash | +| `signer` | [string](#string) | | Address of the signer | + + + + + + + + +### MsgCommitBidResponse +MsgCommitBidResponse returns the state of the auction after the bid creation + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction` | [Auction](#vulcanize.auction.v1beta1.Auction) | | Auction details | + + + + + + + + +### MsgCreateAuction +MsgCreateAuction defines a create auction message + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `commits_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | Duration of the commits phase in seconds | +| `reveals_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | Duration of the reveals phase in seconds | +| `commit_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Commit fees | +| `reveal_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Reveal fees | +| `minimum_bid` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Minimum acceptable bid amount | +| `signer` | [string](#string) | | Address of the signer | + + + + + + + + +### MsgCreateAuctionResponse +MsgCreateAuctionResponse returns the details of the created auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction` | [Auction](#vulcanize.auction.v1beta1.Auction) | | Auction details | + + + + + + + + +### MsgRevealBid +RevealBid defines the message to reveal a bid + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction_id` | [string](#string) | | Auction ID | +| `reveal` | [string](#string) | | Commit Hash | +| `signer` | [string](#string) | | Address of the signer | + + + + + + + + +### MsgRevealBidResponse +MsgRevealBidResponse returns the state of the auction after the bid reveal + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction` | [Auction](#vulcanize.auction.v1beta1.Auction) | | Auction details | + + + + + + + + + + + + + + +### Msg +Tx defines the gRPC tx interface + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `CreateAuction` | [MsgCreateAuction](#vulcanize.auction.v1beta1.MsgCreateAuction) | [MsgCreateAuctionResponse](#vulcanize.auction.v1beta1.MsgCreateAuctionResponse) | CreateAuction is the command for creating an auction | | +| `CommitBid` | [MsgCommitBid](#vulcanize.auction.v1beta1.MsgCommitBid) | [MsgCommitBidResponse](#vulcanize.auction.v1beta1.MsgCommitBidResponse) | CommitBid is the command for committing a bid | | +| `RevealBid` | [MsgRevealBid](#vulcanize.auction.v1beta1.MsgRevealBid) | [MsgRevealBidResponse](#vulcanize.auction.v1beta1.MsgRevealBidResponse) | RevealBid is the command for revealing a bid | | + + + + +

Top

diff --git a/go.mod b/go.mod index 1ece54d8..2fe5baa2 100644 --- a/go.mod +++ b/go.mod @@ -8,14 +8,18 @@ require ( github.com/cosmos/cosmos-sdk v0.44.0 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/ibc-go v1.2.0 + github.com/deckarep/golang-set v1.7.1 github.com/ethereum/go-ethereum v1.10.3 + github.com/gibson042/canonicaljson-go v1.0.3 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 github.com/gorilla/websocket v1.4.2 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/improbable-eng/grpc-web v0.14.1 + github.com/ipfs/go-ipld-cbor v0.0.4 github.com/miguelmota/go-ethereum-hdwallet v0.0.1 + github.com/multiformats/go-multihash v0.0.14 github.com/palantir/stacktrace v0.0.0-20161112013806-78658fd2d177 github.com/pkg/errors v0.9.1 github.com/rakyll/statik v0.1.7 @@ -34,23 +38,20 @@ 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-20210928142010-c7af6a1a74c9 + google.golang.org/genproto v0.0.0-20210929214142-896c89f843d2 google.golang.org/grpc v1.40.0 + google.golang.org/protobuf v1.27.1 gopkg.in/yaml.v2 v2.4.0 ) require ( filippo.io/edwards25519 v1.0.0-beta.2 // indirect github.com/99designs/keyring v1.1.6 // indirect - github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect + github.com/ChainSafe/go-schnorrkel v0.0.0-20200626160457-b38283118816 // indirect github.com/DataDog/zstd v1.4.8 // indirect - github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver v1.5.0 // indirect - github.com/Masterminds/sprig v2.22.0+incompatible // indirect github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect github.com/VictoriaMetrics/fastcache v1.5.7 // indirect github.com/Workiva/go-datastructures v1.0.52 // indirect - github.com/aokoli/goutils v1.1.1 // indirect github.com/armon/go-metrics v0.3.9 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect @@ -61,9 +62,8 @@ require ( github.com/cosmos/iavl v0.16.0 // indirect github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect github.com/cosmos/ledger-go v0.9.2 // indirect - github.com/danieljoos/wincred v1.0.2 // indirect + github.com/danieljoos/wincred v1.1.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.2 // indirect github.com/dgraph-io/ristretto v0.0.3 // indirect @@ -72,7 +72,6 @@ require ( github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25 // indirect - github.com/envoyproxy/protoc-gen-validate v0.6.1 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect @@ -97,13 +96,15 @@ require ( github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.1.1 // indirect - github.com/huandu/xstrings v1.3.2 // indirect github.com/huin/goupnp v1.0.1-0.20210310174557-0ca763054c88 // indirect - github.com/imdario/mergo v0.3.12 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/ipfs/go-block-format v0.0.2 // indirect + github.com/ipfs/go-cid v0.0.3 // indirect + github.com/ipfs/go-ipfs-util v0.0.1 // indirect + github.com/ipfs/go-ipld-format v0.0.1 // indirect github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect + github.com/keybase/go-keychain v0.0.0-20200502122510-cda31fe0c86d // indirect github.com/klauspost/compress v1.11.9 // indirect github.com/libp2p/go-buffer-pool v0.0.2 // indirect github.com/magiconair/properties v1.8.5 // indirect @@ -111,27 +112,30 @@ require ( github.com/mattn/go-runewidth v0.0.9 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect + github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect github.com/minio/highwayhash v1.0.1 // indirect - github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771 // indirect github.com/mitchellh/mapstructure v1.4.1 // indirect - github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/mr-tron/base58 v1.1.3 // indirect github.com/mtibben/percent v0.2.1 // indirect - github.com/mwitkow/go-proto-validators v0.3.2 // 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/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml v1.9.3 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992 // indirect github.com/prometheus/client_golang v1.11.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.29.0 // indirect github.com/prometheus/procfs v0.6.0 // indirect github.com/prometheus/tsdb v0.7.1 // indirect - github.com/pseudomuto/protoc-gen-doc v1.5.0 // indirect - github.com/pseudomuto/protokit v0.2.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rjeczalik/notify v0.9.1 // indirect github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.6.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect @@ -143,11 +147,12 @@ require ( github.com/tendermint/go-amino v0.16.0 // indirect github.com/tklauser/go-sysconf v0.3.5 // indirect github.com/tklauser/numcpus v0.2.2 // indirect + github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158 // indirect github.com/zondax/hid v0.9.0 // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect golang.org/x/text v0.3.6 // indirect - google.golang.org/protobuf v1.27.1 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect gopkg.in/ini.v1 v1.62.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6 // indirect diff --git a/go.sum b/go.sum index f5562c55..6996599f 100644 --- a/go.sum +++ b/go.sum @@ -61,8 +61,9 @@ github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6L github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200626160457-b38283118816 h1:X5jJ3e/jgFSnSoYOep/mf6pF1RuLZfvF1ts8NZIyzqE= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200626160457-b38283118816/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= @@ -71,14 +72,6 @@ github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t github.com/DataDog/zstd v1.4.8 h1:Rpmta4xZ/MgZnriKNd24iZMhGpP5dvUcs/uqfBapKZY= github.com/DataDog/zstd v1.4.8/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= -github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= -github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= -github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.5.0 h1:Elr9Wn+sGKPlkaBvwu4mTrxtmOp3F3yV9qhaHbXGjwU= github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= @@ -113,9 +106,6 @@ github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKS github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ= -github.com/aokoli/goutils v1.1.1 h1:/hA+Ywo3AxoDZY5ZMnkiEkUvkK4BPp927ax110KCqqg= -github.com/aokoli/goutils v1.1.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= @@ -251,16 +241,17 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= -github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= +github.com/danieljoos/wincred v1.1.0 h1:3RNcEpBg4IhIChZdFRSdlQt1QjCp1sMAPIrOnm7Yf8g= +github.com/danieljoos/wincred v1.1.0/go.mod h1:XYlo+eRTsVA9aHGp7NGjFkPla4m+DCL7hqDjlFjiygg= github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= -github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea h1:j4317fAZh7X6GqbFowYdYdI0L9bwxL07jyPZIdepyZ0= github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= +github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ= +github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= @@ -302,9 +293,6 @@ github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25 h1:2vLKys4RBU4 github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25/go.mod h1:hTr8+TLQmkUkgcuh3mcr5fjrT9c64ZzsBCdCEC6UppY= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.3.0-java/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.6.1 h1:4CF52PCseTFt4bE+Yk3dIpdVi7XWuPVMhPtm4FaIJPM= -github.com/envoyproxy/protoc-gen-validate v0.6.1/go.mod h1:txg5va2Qkip90uYoSKH+nkAAmXrb2j3iq4FLwdrCbXQ= github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= github.com/ethereum/go-ethereum v1.10.1/go.mod h1:E5e/zvdfUVr91JZ0AwjyuJM3x+no51zZJRz61orLLSk= github.com/ethereum/go-ethereum v1.10.3 h1:SEYOYARvbWnoDl1hOSks3ZJQpRiiRJe8ubaQGJQwq0s= @@ -336,6 +324,8 @@ github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05 github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gibson042/canonicaljson-go v1.0.3 h1:EAyF8L74AWabkyUmrvEFHEt/AGFQeD6RfwbAuf0j1bI= +github.com/gibson042/canonicaljson-go v1.0.3/go.mod h1:DsLpJTThXyGNO+KZlI85C1/KDcImpP67k/RKVjcaEqo= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= @@ -464,7 +454,6 @@ github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/protobuf v3.14.0+incompatible/go.mod h1:lUQ9D1ePzbH2PrIS7ob/bjm9HXyH5WHB0Akwh7URreM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -514,6 +503,8 @@ github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= +github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= @@ -553,21 +544,14 @@ github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iU github.com/holiman/uint256 v1.1.1 h1:4JywC80b+/hSfljFlEBLHrrh+CIONLDz9NuFl0af4Mw= github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= -github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= -github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= github.com/huin/goupnp v1.0.1-0.20200620063722-49508fba0031/go.mod h1:nNs7wvRfN1eKaMknBydLNQU6146XQim8t4h+q90biWo= github.com/huin/goupnp v1.0.1-0.20210310174557-0ca763054c88 h1:bcAj8KroPf552TScjFPIakjH2/tdIrIH8F+cc4v4SRo= github.com/huin/goupnp v1.0.1-0.20210310174557-0ca763054c88/go.mod h1:nNs7wvRfN1eKaMknBydLNQU6146XQim8t4h+q90biWo= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/iancoleman/strcase v0.0.0-20180726023541-3605ed457bf7/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/improbable-eng/grpc-web v0.14.0/go.mod h1:6hRR09jOEG81ADP5wCQju1z71g6OL4eEvELdran/3cs= github.com/improbable-eng/grpc-web v0.14.1 h1:NrN4PY71A6tAz2sKDvC5JCauENWp0ykG8Oq1H3cpFvw= github.com/improbable-eng/grpc-web v0.14.1/go.mod h1:zEjGHa8DAlkoOXmswrNvhUGEYQA9UI7DhrGeHR1DMGU= @@ -584,6 +568,17 @@ github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19y github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= +github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= +github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= +github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= +github.com/ipfs/go-cid v0.0.3 h1:UIAh32wymBpStoe83YCzwVQQ5Oy/H0FdxvUS6DJDzms= +github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= +github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= +github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= +github.com/ipfs/go-ipld-cbor v0.0.4 h1:Aw3KPOKXjvrm6VjwJvFf1F1ekR/BH3jdof3Bk7OTiSA= +github.com/ipfs/go-ipld-cbor v0.0.4/go.mod h1:BkCduEx3XBCO6t2Sfo5BaHzuok7hbhdMm9Oh8B2Ftq4= +github.com/ipfs/go-ipld-format v0.0.1 h1:HCu4eB/Gh+KD/Q0M8u888RFkorTWNIL3da4oc5dwc80= +github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms= github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458 h1:6OvNmYgJyexcZ3pYbTI9jWx5tHo1Dee/tWbLMfPe2TA= github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= @@ -615,6 +610,7 @@ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= +github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -624,8 +620,10 @@ github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356 h1:I/yrLt2WilKxlQKCM52clh5rGzTKpVctGT1lH4Dc8Jw= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= +github.com/keybase/go-keychain v0.0.0-20200502122510-cda31fe0c86d h1:gVjhBCfVGl32RIBooOANzfw+0UqX8HU+yPlMv8vypcg= +github.com/keybase/go-keychain v0.0.0-20200502122510-cda31fe0c86d/go.mod h1:W6EbaYmb4RldPn0N3gvVHjY1wmU59kbymhW9NATWhwY= +github.com/keybase/go.dbus v0.0.0-20200324223359-a94be52c0b03/go.mod h1:a8clEhrrGV/d76/f9r2I41BwANMihfZYV9C223vaxqE= github.com/kilic/bls12-381 v0.0.0-20201226121925-69dacb279461/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -669,7 +667,6 @@ github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoR github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= -github.com/lyft/protoc-gen-star v0.5.1/go.mod h1:9toiA3cC7z5uVbODF7kEQ91Xn7XNFkVUl+SrEe+ZORU= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= @@ -701,11 +698,14 @@ github.com/miguelmota/go-ethereum-hdwallet v0.0.1 h1:DWqgZtKWTGcHR5QsprMJItZiJ2x github.com/miguelmota/go-ethereum-hdwallet v0.0.1/go.mod h1:iowKavXnc0NVNiv/UKYYBo3SjADph5PUvYQTjOIV9as= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= +github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771 h1:MHkK1uRtFbVqvAgvWxafZe54+5uBxLluGylDiKgdhwo= +github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= -github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= @@ -716,8 +716,6 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= -github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= @@ -725,16 +723,27 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= +github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mr-tron/base58 v1.1.3 h1:v+sk57XuaCKGXpWtVBX8YJzO7hMGx4Aajh4TQbdEFdc= +github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= +github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= +github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= +github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= +github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= +github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= +github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= +github.com/multiformats/go-multihash v0.0.14 h1:QoBceQYQQtNUuf6s7wHxnE2c8bhbMqhfGzNI032se/I= +github.com/multiformats/go-multihash v0.0.14/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= +github.com/multiformats/go-varint v0.0.5 h1:XVZwSo04Cs3j/jS0uAEPpT3JY6DzMcVLLoWOSnCxOjg= +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= -github.com/mwitkow/go-proto-validators v0.0.0-20180403085117-0950a7990007/go.mod h1:m2XC9Qq0AlmmVksL6FktJCdTYyLk7V3fKyp0sl1yWQo= -github.com/mwitkow/go-proto-validators v0.3.2 h1:qRlmpTzm2pstMKKzTdvwPCF5QfBNURSlAgN/R+qbKos= -github.com/mwitkow/go-proto-validators v0.3.2/go.mod h1:ej0Qp0qMgHN/KtDyUt+Q1/tA7a5VarXUOUxD+oeD30w= github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= @@ -831,9 +840,10 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= -github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992 h1:bzMe+2coZJYHnhGgVlcQKuRy4FSny4ds8dLQjw5P1XE= +github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= @@ -880,10 +890,6 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1 github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/pseudomuto/protoc-gen-doc v1.5.0 h1:pHZp0MEiT68jrZV8js8BS7E9ZEnlSLegoQbbtXj5lfo= -github.com/pseudomuto/protoc-gen-doc v1.5.0/go.mod h1:exDTOVwqpp30eV/EDPFLZy3Pwr2sn6hBC1WIYH/UbIg= -github.com/pseudomuto/protokit v0.2.0 h1:hlnBDcy3YEDXH7kc9gV+NLaN0cDzhDvD1s7Y6FZ8RpM= -github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= @@ -937,6 +943,7 @@ github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= @@ -946,8 +953,6 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= -github.com/spf13/afero v1.3.4/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -987,7 +992,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/testify v0.0.0-20170130113145-4d4bfba8f1d1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -1053,6 +1057,10 @@ github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYp github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= github.com/vmihailenco/msgpack/v5 v5.1.4/go.mod h1:C5gboKD0TJPqWDTVTtrQNfRbiBwHZGo8UTqP/9/XvLI= github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436 h1:qOpVTI+BrstcjTZLm2Yz/3sOnqkzj3FQoh0g+E5s3Gc= +github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= +github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158 h1:WXhVOwj2USAXB5oMDwRl3piOux2XMV9TANaYxXHdkoE= +github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI= github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= @@ -1101,14 +1109,15 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180501155221-613d6eafa307/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -1116,6 +1125,7 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -1128,8 +1138,6 @@ golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210920023735-84f357641f63 h1:kETrAMYZq6WVGPa8IIixL0CaEcIUNi+1WX7grUoi3y8= -golang.org/x/crypto v0.0.0-20210920023735-84f357641f63/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1247,7 +1255,6 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1267,6 +1274,7 @@ golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1466,7 +1474,6 @@ google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181107211654-5fc9ac540362/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1515,14 +1522,8 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4 h1:ysnBoUyeL/H6RCvNRhWHjKoDEmguI+mPU+qHgK8qv/w= -google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210921142501-181ce0d877f6 h1:2ncG/LajxmrclaZH+ppVi02rQxz4eXYJzGHdFN4Y9UA= -google.golang.org/genproto v0.0.0-20210921142501-181ce0d877f6/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20210927142257-433400c27d05 h1:6/1QShroBaS9sY9NbPquolxRETG6PZhfv8ohdbLieBg= -google.golang.org/genproto v0.0.0-20210927142257-433400c27d05/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9 h1:XTH066D35LyHehRwlYhoK3qA+Hcgvg5xREG4kFQEW1Y= -google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9/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/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/genesis.proto b/proto/vulcanize/auction/v1beta1/genesis.proto new file mode 100644 index 00000000..0b49ba63 --- /dev/null +++ b/proto/vulcanize/auction/v1beta1/genesis.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package vulcanize.auction.v1beta1; + +import "gogoproto/gogo.proto"; +import "vulcanize/auction/v1beta1/types.proto"; + +option go_package = "github.com/tharsis/ethermint/x/auction/types"; + +// GenesisState defines the genesis state of the auction module +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false]; + repeated Auction auctions = 2 [ + (gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\"" + ]; +} diff --git a/proto/vulcanize/auction/v1beta1/query.proto b/proto/vulcanize/auction/v1beta1/query.proto new file mode 100644 index 00000000..eafb84d6 --- /dev/null +++ b/proto/vulcanize/auction/v1beta1/query.proto @@ -0,0 +1,132 @@ +syntax = "proto3"; +package vulcanize.auction.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "vulcanize/auction/v1beta1/types.proto"; + +option go_package = "github.com/tharsis/ethermint/x/auction/types"; + +// AuctionsRequest is the format for querying all the auctions +message AuctionsRequest { + // pagination defines an optional pagination info for the next request + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// AuctionsResponse returns the list of all auctions +message AuctionsResponse { + // List of auctions + Auctions auctions = 1; + // pagination defines an optional pagination info for the next request + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// AuctionRequest is the format for querying a specific auction +message AuctionRequest { + // Auction ID + string id = 1; +} + +// AuctionResponse returns the details of the queried auction +message AuctionResponse { + // Auction details + Auction auction = 1; +} + +// BidRequest is the format for querying a specific bid in an auction +message BidRequest { + // Auction ID + string auction_id = 1; + // Bidder address + string bidder = 2; +} + +// BidResponse returns the details of the queried bid +message BidResponse { + // Bid details + Bid bid = 1; +} + +// BidsRequest is the format for querying all bids in an auction +message BidsRequest { + // Auction ID + string auction_id = 1; +} + +// BidsResponse returns details of all bids in an auction +message BidsResponse { + // List of bids in the auction + repeated Bid bids = 1; +} + +// AuctionsByBidderRequest is the format for querying all auctions containing a bidder address +message AuctionsByBidderRequest { + // Address of the bidder + string bidder_address = 1; +} + +// AuctionsByBidderResponse returns all auctions containing a bidder +message AuctionsByBidderResponse { + // List of auctions + Auctions auctions = 1; +} + +// QueryParamsRequest is the format to query the parameters of the auction module +message QueryParamsRequest { +} + +// QueryParamsResponse returns parameters of the auction module +message QueryParamsResponse { + Params params = 1; +} + +// BalanceRequest is the format to fetch all balances +message BalanceRequest { +} + +message BalanceResponse { + // Set of all balances within the auction + repeated cosmos.base.v1beta1.Coin balance = 1 [ + (gogoproto.nullable) = false + ]; +} + +// Query defines the gRPC querier interface for the auction module +service Query { + // Auctions queries all auctions + rpc Auctions(AuctionsRequest) returns (AuctionsResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/auctions"; + } + + // GetAuction queries an auction + rpc GetAuction(AuctionRequest) returns (AuctionResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/auctions/{id}"; + } + + // GetBid queries an auction bid + rpc GetBid(BidRequest) returns (BidResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/bids/{auction_id}/{bidder}"; + } + + // GetBids queries all auction bids + rpc GetBids(BidsRequest) returns (BidsResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/bids/{auction_id}"; + } + + // AuctionsByBidder queries auctions by bidder + rpc AuctionsByBidder(AuctionsByBidderRequest) returns (AuctionsByBidderResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/auctions/{bidder_address}"; + } + + // QueryParams implements the params query command + rpc QueryParams(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/params"; + } + + // Balance queries the auction module account balance + rpc Balance(BalanceRequest) returns (BalanceResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/balance"; + } +} diff --git a/proto/vulcanize/auction/v1beta1/tx.proto b/proto/vulcanize/auction/v1beta1/tx.proto new file mode 100644 index 00000000..9fa39312 --- /dev/null +++ b/proto/vulcanize/auction/v1beta1/tx.proto @@ -0,0 +1,122 @@ +syntax = "proto3"; +package vulcanize.auction.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "vulcanize/auction/v1beta1/types.proto"; + +option go_package = "github.com/tharsis/ethermint/x/auction/types"; + +// MsgCreateAuction defines a create auction message +message MsgCreateAuction { + option (gogoproto.goproto_getters) = 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\"" + ]; + // Address of the signer + string signer = 6 [ + (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" + ]; +} + +// MsgCreateAuctionResponse returns the details of the created auction +message MsgCreateAuctionResponse { + option (gogoproto.goproto_getters) = false; + // Auction details + Auction auction = 1 [ + (gogoproto.moretags) = "json:\"auction\" yaml:\"auction\"" + ]; +} + +// CommitBid defines the message to commit a bid +message MsgCommitBid { + option (gogoproto.goproto_getters) = false; + + // Auction ID + string auction_id = 1 [ + (gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\"" + ]; + // Commit Hash + string commit_hash = 2 [ + (gogoproto.moretags) = "json:\"commit_hash\" yaml:\"commit_hash\"" + ]; + // Address of the signer + string signer = 3 [ + (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" + ]; +} + +// RevealBid defines the message to reveal a bid +message MsgRevealBid { + option (gogoproto.goproto_getters) = false; + + // Auction ID + string auction_id = 1 [ + (gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\"" + ]; + // Commit Hash + string reveal = 2 [ + (gogoproto.moretags) = "json:\"reveal\" yaml:\"reveal\"" + ]; + // Address of the signer + string signer = 3 [ + (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" + ]; +} + +// MsgCommitBidResponse returns the state of the auction after the bid creation +message MsgCommitBidResponse { + option (gogoproto.goproto_getters) = false; + // Auction details + Auction auction = 1 [ + (gogoproto.moretags) = "json:\"auction\" yaml:\"auction\"" + ]; +} + +// MsgRevealBidResponse returns the state of the auction after the bid reveal +message MsgRevealBidResponse { + option (gogoproto.goproto_getters) = false; + // Auction details + Auction auction = 1 [ + (gogoproto.moretags) = "json:\"auction\" yaml:\"auction\"" + ]; +} + +// Tx defines the gRPC tx interface +service Msg { + // CreateAuction is the command for creating an auction + rpc CreateAuction(MsgCreateAuction) returns (MsgCreateAuctionResponse); + + // CommitBid is the command for committing a bid + rpc CommitBid(MsgCommitBid) returns (MsgCommitBidResponse); + + //RevealBid is the command for revealing a bid + rpc RevealBid(MsgRevealBid) returns (MsgRevealBidResponse); +} + diff --git a/proto/vulcanize/auction/v1beta1/types.proto b/proto/vulcanize/auction/v1beta1/types.proto new file mode 100644 index 00000000..d02ced6e --- /dev/null +++ b/proto/vulcanize/auction/v1beta1/types.proto @@ -0,0 +1,135 @@ +syntax = "proto3"; +package vulcanize.auction.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/tharsis/ethermint/x/auction/types"; + +// Params defines the auction module parameters +message Params { + 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 +message Auction { + option (gogoproto.goproto_getters) = false; + + string id = 1; + string status = 2; + // Address of the creator of the auction + string owner_address = 3; + // Timestamp at which the auction was created + google.protobuf.Timestamp create_time = 4 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"create_time\" yaml:\"create_time\"" + ]; + // Timestamp at which the commits phase concluded + google.protobuf.Timestamp commits_end_time = 5 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"commits_end_time\" yaml:\"commits_end_time\"" + ]; + // Timestamp at which the reveals phase concluded + google.protobuf.Timestamp reveals_end_time = 6 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"reveals_end_time\" yaml:\"reveals_end_time\"" + ]; + // Commit and reveal fees must both be paid when committing a bid + // Reveal fee is returned only if the bid is revealed + cosmos.base.v1beta1.Coin commit_fee = 7 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\"" + ]; + cosmos.base.v1beta1.Coin reveal_fee = 8 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" + ]; + // Minimum acceptable bid amount for a valid commit + cosmos.base.v1beta1.Coin minimum_bid = 9 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\"" + ]; + // Address of the winner + string winner_address = 10; + // Winning bid, i.e., the highest bid + cosmos.base.v1beta1.Coin winning_bid = 11 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"winning_bid\" yaml:\"winning_bid\"" + ]; + // Amount the winner pays, i.e. the second highest auction + cosmos.base.v1beta1.Coin winning_price = 12 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"winning_price\" yaml:\"winning_price\"" + ]; +} + +message Auctions { + option (gogoproto.goproto_getters) = false; + + repeated Auction auctions = 1 [(gogoproto.nullable) = false]; +} + +// Bid represents a sealed bid (commit) made during the auction +message Bid { + option (gogoproto.goproto_getters) = false; + + string auction_id = 1; + string bidder_address = 2; + string status = 3; + string commit_hash = 4; + google.protobuf.Timestamp commit_time = 5 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"commit_time\" yaml:\"commit_time\"" + ]; + cosmos.base.v1beta1.Coin commit_fee = 6 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\"" + ]; + google.protobuf.Timestamp reveal_time = 7 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"reveal_time\" yaml:\"reveal_time\"" + ]; + cosmos.base.v1beta1.Coin reveal_fee = 8 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" + ]; + cosmos.base.v1beta1.Coin bid_amount = 9 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"bid_amount\" yaml:\"bid_amount\"" + ];; +} diff --git a/utils/json.go b/utils/json.go new file mode 100644 index 00000000..b6faafe2 --- /dev/null +++ b/utils/json.go @@ -0,0 +1,52 @@ +// +// Copyright 2020 Wireline, Inc. +// + +package utils + +import ( + "bytes" + "errors" + + canonicalJson "github.com/gibson042/canonicaljson-go" + cbor "github.com/ipfs/go-ipld-cbor" + mh "github.com/multiformats/go-multihash" +) + +// GenerateHash returns the hash of the canonicalized JSON input. +func GenerateHash(json map[string]interface{}) (string, []byte, error) { + content, err := canonicalJson.Marshal(json) + if err != nil { + return "", nil, err + } + + cid, err := CIDFromJSONBytes(content) + if err != nil { + return "", nil, err + } + + return cid, content, nil +} + +// CIDFromJSONBytes returns CID (cbor) for json (as bytes). +func CIDFromJSONBytes(content []byte) (string, error) { + cid, err := cbor.FromJSON(bytes.NewReader(content), mh.SHA2_256, -1) + if err != nil { + return "", err + } + + return cid.String(), nil +} + +// GetAttributeAsString returns a map attribute as string, if possible. +func GetAttributeAsString(obj map[string]interface{}, attr string) (string, error) { + if value, ok := obj[attr]; ok { + if valueStr, ok := value.(string); ok { + return valueStr, nil + } + + return "", errors.New("attribute not of string type") + } + + return "", errors.New("attribute not found") +} diff --git a/utils/mnemonic.go b/utils/mnemonic.go new file mode 100644 index 00000000..80dce1ac --- /dev/null +++ b/utils/mnemonic.go @@ -0,0 +1,25 @@ +// +// Copyright 2020 Wireline, Inc. +// + +package utils + +import "github.com/cosmos/go-bip39" + +const ( + mnemonicEntropySize = 256 +) + +func GenerateMnemonic() (string, error) { + entropySeed, err := bip39.NewEntropy(mnemonicEntropySize) + if err != nil { + return "", err + } + + mnemonic, err := bip39.NewMnemonic(entropySeed[:]) + if err != nil { + return "", err + } + + return mnemonic, nil +} diff --git a/utils/types.go b/utils/types.go new file mode 100644 index 00000000..51e42acd --- /dev/null +++ b/utils/types.go @@ -0,0 +1,52 @@ +// +// Copyright 2020 Wireline, Inc. +// + +package utils + +import ( + "bytes" + "encoding/binary" + "sort" + + set "github.com/deckarep/golang-set" +) + +func Int64ToBytes(num int64) []byte { + buf := new(bytes.Buffer) + binary.Write(buf, binary.BigEndian, num) + return buf.Bytes() +} + +func SetToSlice(set set.Set) []string { + names := []string{} + + for name := range set.Iter() { + if name, ok := name.(string); ok && name != "" { + names = append(names, name) + } + } + + sort.SliceStable(names, func(i, j int) bool { return names[i] < names[j] }) + + return names +} + +func SliceToSet(names []string) set.Set { + set := set.NewThreadUnsafeSet() + + for _, name := range names { + if name != "" { + set.Add(name) + } + } + + return set +} + +func AppendUnique(list []string, element string) []string { + set := SliceToSet(list) + set.Add(element) + + return SetToSlice(set) +} diff --git a/x/auction/README.md b/x/auction/README.md new file mode 100644 index 00000000..75f1a4a7 --- /dev/null +++ b/x/auction/README.md @@ -0,0 +1,295 @@ +# Auction Module CLI Commands + +## Build the Chain + +The following command builds the Ethermint daemon and places the binary in the `build` directory +``` +make build + +``` + +## Setup the Chain + +The following steps need to be followed only before running the chain for the first time. + +1. Add the root key: + ``` + ./build/ethermintd keys add root + ``` + Keep a note of the keyring passphrase if you set it. +2. Init the chain: + ``` + ./build/ethermintd init test-moniker --chain-id ethermint_9000-1 + ``` +3. Add genesis account: + ``` + ./build/ethermintd add-genesis-account $(./build/ethermintd keys show root -a) 1000000000000000000aphoton,1000000000000000000stake + ``` +4. Make a genesis tx: + ``` + ./build/ethermintd gentx root 1000000000000000000stake --chain-id ethermint_9000-1 + ``` +5. Collect gentxs: + ``` + ./build/ethermintd collect-gentxs + ``` + +The chain can now be started using: +``` +./build/ethermintd start +``` + +## Querying the Params + +The following command will dislay the default params for the `auction` module: +``` +# ./build/ethermintd q auction params -o json | jq + +{ + "params": { + "commits_duration": "0s", + "reveals_duration": "0s", + "commit_fee": { + "denom": "", + "amount": "0" + }, + "reveal_fee": { + "denom": "", + "amount": "0" + }, + "minimum_bid": { + "denom": "", + "amount": "0" + } + } +} +``` + +## Auction TX CLI Commands + +### Create Auction + +``` +# ./build/ethermintd tx auction create 100s 100s 10aphoton 10aphoton 1000aphoton --from root --chain-id $(./build/ethermintd status | jq .NodeInfo.network -r) + +Enter keyring passphrase: + +{"body":{"messages":[{"@type":"/vulcanize.auction.v1beta1.MsgCreateAuction","commits_duration":"100s","reveals_duration":"100s","commit_fee":{"denom":"aphoton","amount":"10"},"reveal_fee":{"denom":"aphoton","amount":"10"},"minimum_bid":{"denom":"aphoton","amount":"1000"},"signer":"ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]} + +confirm transaction before signing and broadcasting [y/N]: y + +code: 0 +codespace: "" +data: "" +gas_used: "0" +gas_wanted: "0" +height: "0" +info: "" +logs: [] +raw_log: '[]' +timestamp: "" +tx: null +txhash: ECAD6DF1ECA763FBD26EB7C2C0B77425FFE2FBEA2BEC57CE0FBC173AE0F45298 +``` + +### Commit Bid + +``` +# ./build/ethermintd tx auction commit-bid e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d 2000aphoton --from root --chain-id $(./build/ethermintd status | jq .NodeInfo.network -r) + +Enter keyring passphrase: + +{"body":{"messages":[{"@type":"/vulcanize.auction.v1beta1.MsgCommitBid","auction_id":"e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d","commit_hash":"bafyreibt4twofrc3xi2es27cfrroy346iy6lr3gkw33i5dltkqqarlyltm","signer":"ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]} + +confirm transaction before signing and broadcasting [y/N]: y + +code: 0 +codespace: "" +data: "" +gas_used: "0" +gas_wanted: "0" +height: "0" +info: "" +logs: [] +raw_log: '[]' +timestamp: "" +tx: null +txhash: 71D8CF34026E32A3A34C2C2D4ADF25ABC8D7943A4619761BE27F196603D91B9D +``` + +### Reveal Bid + +``` +# ./build/ethermintd tx auction reveal-bid e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d root-bafyreibt4twofrc3xi2es27cfrroy346iy6lr3gkw33i5dltkqqarlyltm.json --from root --chain-id $(./build/ethermintd status | jq .NodeInfo.network -r) + +Enter keyring passphrase: + +{"body":{"messages":[{"@type":"/vulcanize.auction.v1beta1.MsgRevealBid","auction_id":"e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d","reveal":"7b2261756374696f6e4964223a2265376431346337653761366437353337636264623866626536326632326231353533633265663463653337303561646137633238663830666166326662653064222c22626964416d6f756e74223a22323030306170686f746f6e222c2262696464657241646472657373223a226574686d316c37637374777466326c76657632376b613637633233796b376d6d6a38616437746574707163222c22636861696e4964223a2265746865726d696e745f393030302d31222c226e6f697365223a22636c69666620737566666572206472616d6120676f7370656c2077656173656c207061706572206c696272617279206469736f726465722063757276652073706f74206375727461696e207a6562726120696e76657374206465766f74652072656e64657220636c6970207377616c6c6f77206d6f6e6b6579206f62736572766520726573706f6e7365206c696e6b206372616e6520766961626c6520736576656e227d","signer":"ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]} + +confirm transaction before signing and broadcasting [y/N]: y + +code: 0 +codespace: "" +data: "" +gas_used: "0" +gas_wanted: "0" +height: "0" +info: "" +logs: [] +raw_log: '[]' +timestamp: "" +tx: null +txhash: 4D1C0B3DDA4050F9BB32240FBD5234229E5C32543C1A0A78033B9531EB0CF8BA +``` + +## Auction Query CLI Commands + +### List Auctions + +``` +# ./build/ethermintd q auction list + +auctions: + auctions: + - commit_fee: + amount: "10" + denom: aphoton + commits_end_time: "2021-09-30T07:57:07.933412800Z" + create_time: "2021-09-30T07:55:27.933412800Z" + id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d + minimum_bid: + amount: "1000" + denom: aphoton + owner_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc + reveal_fee: + amount: "10" + denom: aphoton + reveals_end_time: "2021-09-30T07:58:47.933412800Z" + status: commit + winner_address: "" + winning_bid: + amount: "0" + denom: "" + winning_price: + amount: "0" + denom: "" +pagination: null +``` + +### Get Bid + +``` +# ./build/ethermintd q auction get-bid e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0e ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc + +bid: + auction_id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d + bid_amount: + amount: "0" + denom: "" + bidder_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc + commit_fee: + amount: "10" + denom: aphoton + commit_hash: bafyreibt4twofrc3xi2es27cfrroy346iy6lr3gkw33i5dltkqqarlyltm + commit_time: "2021-09-30T08:49:48.358878200Z" + reveal_fee: + amount: "10" + denom: aphoton + reveal_time: "0001-01-01T00:00:00Z" + status: commit +``` + +### Get All Bids for an Auction + +``` +./build/ethermintd q auction get-bids e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d + +bids: +- auction_id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d + bid_amount: + amount: "0" + denom: "" + bidder_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc + commit_fee: + amount: "10" + denom: aphoton + commit_hash: bafyreibt4twofrc3xi2es27cfrroy346iy6lr3gkw33i5dltkqqarlyltm + commit_time: "2021-09-30T08:49:48.358878200Z" + reveal_fee: + amount: "10" + denom: aphoton + reveal_time: "0001-01-01T00:00:00Z" + status: commit +``` + +### Get Auction by AuctionID + +``` +# ./build/ethermintd q auction get e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d + +auction: + commit_fee: + amount: "10" + denom: aphoton + commits_end_time: "2021-09-30T07:57:07.933412800Z" + create_time: "2021-09-30T07:55:27.933412800Z" + id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d + minimum_bid: + amount: "1000" + denom: aphoton + owner_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc + reveal_fee: + amount: "10" + denom: aphoton + reveals_end_time: "2021-09-30T07:58:47.933412800Z" + status: commit + winner_address: "" + winning_bid: + amount: "0" + denom: "" + winning_price: + amount: "0" + denom: "" + +``` + +### Get Auction by Bidder + +``` +# ./build/ethermintd q auction query-by-owner ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc + +auctions: + auctions: + - commit_fee: + amount: "10" + denom: aphoton + commits_end_time: "2021-09-30T07:57:07.933412800Z" + create_time: "2021-09-30T07:55:27.933412800Z" + id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d + minimum_bid: + amount: "1000" + denom: aphoton + owner_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc + reveal_fee: + amount: "10" + denom: aphoton + reveals_end_time: "2021-09-30T07:58:47.933412800Z" + status: commit + winner_address: "" + winning_bid: + amount: "0" + denom: "" + winning_price: + amount: "0" + denom: "" +``` + +### Query Account Balance + +``` +# ./build/ethermintd q auction balance + +balance: +- amount: "20" + denom: aphoton +``` diff --git a/x/auction/abci.go b/x/auction/abci.go new file mode 100644 index 00000000..636803d5 --- /dev/null +++ b/x/auction/abci.go @@ -0,0 +1,13 @@ +package auction + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tharsis/ethermint/x/auction/keeper" +) + +// EndBlocker is called every block, returns updated validator set. +func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate { + k.EndBlockerProcessAuctions(ctx) + return []abci.ValidatorUpdate{} +} diff --git a/x/auction/client/cli/query.go b/x/auction/client/cli/query.go new file mode 100644 index 00000000..8419b03c --- /dev/null +++ b/x/auction/client/cli/query.go @@ -0,0 +1,234 @@ +package cli + +import ( + "fmt" + "strings" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/version" + + "github.com/spf13/cobra" + + "github.com/tharsis/ethermint/x/auction/types" +) + +func GetQueryCmd() *cobra.Command { + auctionQueryCmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + auctionQueryCmd.AddCommand( + GetCmdList(), + GetCmdGetAuction(), + GetCmdGetBid(), + GetCmdGetBids(), + GetCmdAuctionsByBidder(), + GetCmdQueryParams(), + GetCmdBalance(), + ) + + return auctionQueryCmd +} + +// GetCmdList queries all auctions. +func GetCmdList() *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "List auctions.", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.Auctions(cmd.Context(), &types.AuctionsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdGetBid queries an auction bid. +func GetCmdGetBid() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-bid [auction-id] [bidder]", + Short: "Get auction bid.", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + id := args[0] + bidder := args[1] + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.GetBid(cmd.Context(), &types.BidRequest{AuctionId: id, Bidder: bidder}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdGetBids queries all auction bids. +func GetCmdGetBids() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-bids [auction-id]", + Short: "Get all auction bids.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + id := args[0] + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.GetBids(cmd.Context(), &types.BidsRequest{AuctionId: id}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdGetAuction queries an auction. +func GetCmdGetAuction() *cobra.Command { + cmd := &cobra.Command{ + Use: "get [ID]", + Short: "Get auction.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + id := args[0] + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.GetAuction(cmd.Context(), &types.AuctionRequest{Id: id}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdAuctionsByBidder queries auctions by bidder. +func GetCmdAuctionsByBidder() *cobra.Command { + cmd := &cobra.Command{ + Use: "query-by-owner [address]", + Short: "Query auctions by owner/creator.", + 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 +} + +// GetCmdQueryParams implements the params query command. +func GetCmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Args: cobra.NoArgs, + Short: "Query the current auction parameters information.", + Long: strings.TrimSpace( + fmt.Sprintf(`Query values set as auction parameters. + Example: + $ %s query auction params + `, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.QueryParams(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdBalance queries the auction module account balance. +func GetCmdBalance() *cobra.Command { + cmd := &cobra.Command{ + Use: "balance", + Short: "Get auction module account balance.", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.Balance(cmd.Context(), &types.BalanceRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/auction/client/cli/tx.go b/x/auction/client/cli/tx.go new file mode 100644 index 00000000..e363970b --- /dev/null +++ b/x/auction/client/cli/tx.go @@ -0,0 +1,190 @@ +package cli + +import ( + "encoding/hex" + "fmt" + "io/ioutil" + "time" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/spf13/cobra" + "github.com/spf13/viper" + + "github.com/tharsis/ethermint/x/auction/types" + + wnsUtils "github.com/tharsis/ethermint/utils" +) + +// GetTxCmd returns transaction commands for this module. +func GetTxCmd() *cobra.Command { + auctionTxCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Auction transactions subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + // TODO(ashwin): Add Tx commands. + auctionTxCmd.AddCommand( + GetCmdCreateAuction(), + GetCmdCommitBid(), + GetCmdRevealBid(), + ) + + return auctionTxCmd +} + +func GetCmdCreateAuction() *cobra.Command { + cmd := &cobra.Command{ + Use: "create [commits-duration] [reveals-duration] [commit-fee] [reveal-fee] [minimum-bid]", + Short: "Create auction.", + Args: cobra.ExactArgs(5), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + commitsDuration, err := time.ParseDuration(args[0]) + if err != nil { + return err + } + + revealsDuration, err := time.ParseDuration(args[1]) + if err != nil { + return err + } + + commitFee, err := sdk.ParseCoinNormalized(args[2]) + if err != nil { + return err + } + + revealFee, err := sdk.ParseCoinNormalized(args[3]) + if err != nil { + return err + } + + minimumBid, err := sdk.ParseCoinNormalized(args[4]) + if err != nil { + return err + } + + params := types.Params{ + CommitsDuration: commitsDuration, + RevealsDuration: revealsDuration, + CommitFee: commitFee, + RevealFee: revealFee, + MinimumBid: minimumBid, + } + msg := types.NewMsgCreateAuction(params, clientCtx.GetFromAddress()) + err = msg.ValidateBasic() + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdCommitBid is the CLI command for committing a bid. +func GetCmdCommitBid() *cobra.Command { + cmd := &cobra.Command{ + Use: "commit-bid [auction-id] [bid-amount]", + Short: "Commit sealed bid.", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + bidAmount, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + + mnemonic, err := wnsUtils.GenerateMnemonic() + if err != nil { + return err + } + + chainID := viper.GetString("chain-id") + auctionID := args[0] + + reveal := map[string]interface{}{ + "chainId": chainID, + "auctionId": auctionID, + "bidderAddress": clientCtx.GetFromAddress().String(), + "bidAmount": bidAmount.String(), + "noise": mnemonic, + } + + commitHash, content, err := wnsUtils.GenerateHash(reveal) + if err != nil { + return err + } + + // Save reveal file. + ioutil.WriteFile(fmt.Sprintf("%s-%s.json", clientCtx.GetFromName(), commitHash), content, 0600) + + msg := types.NewMsgCommitBid(auctionID, commitHash, clientCtx.GetFromAddress()) + err = msg.ValidateBasic() + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +// GetCmdRevealBid is the CLI command for revealing a bid. +func GetCmdRevealBid() *cobra.Command { + cmd := &cobra.Command{ + Use: "reveal-bid [auction-id] [reveal-file-path]", + Short: "Reveal bid.", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + auctionID := args[0] + revealFilePath := args[1] + + revealBytes, err := ioutil.ReadFile(revealFilePath) + if err != nil { + 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 { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/auction/genesis.go b/x/auction/genesis.go new file mode 100644 index 00000000..a413a1c7 --- /dev/null +++ b/x/auction/genesis.go @@ -0,0 +1,44 @@ +package auction + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + abci "github.com/tendermint/tendermint/abci/types" + + "github.com/tharsis/ethermint/x/auction/keeper" + "github.com/tharsis/ethermint/x/auction/types" +) + +// func NewGenesisState(params types.Params, auctions []types.Auction) types.GenesisState { +// return types.GenesisState{Params: params, Auctions: &types.Auctions{Auctions: auctions}} +// } + +func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data types.GenesisState) []abci.ValidatorUpdate { + keeper.SetParams(ctx, data.Params) + + for _, auction := range data.Auctions { + keeper.SaveAuction(ctx, auction) + } + + return []abci.ValidatorUpdate{} +} + +func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { + params := keeper.GetParams(ctx) + auctions := keeper.ListAuctions(ctx) + + var genesisAuctions []*types.Auction + for _, auction := range auctions { + genesisAuctions = append(genesisAuctions, &auction) + } + return types.GenesisState{Params: params, Auctions: genesisAuctions} +} + +func ValidateGenesis(data types.GenesisState) error { + err := data.Params.Validate() + if err != nil { + return err + } + + return nil +} diff --git a/x/auction/keeper/grpc_query.go b/x/auction/keeper/grpc_query.go new file mode 100644 index 00000000..b3585fc7 --- /dev/null +++ b/x/auction/keeper/grpc_query.go @@ -0,0 +1,64 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/tharsis/ethermint/x/auction/types" +) + +type Querier struct { + Keeper +} + +var _ types.QueryServer = Querier{} + +// Auctions queries all auctions +func (q Querier) Auctions(c context.Context, req *types.AuctionsRequest) (*types.AuctionsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + resp := q.Keeper.ListAuctions(ctx) + return &types.AuctionsResponse{Auctions: &types.Auctions{Auctions: resp}}, nil +} + +// GetAuction queries an auction +func (q Querier) GetAuction(c context.Context, req *types.AuctionRequest) (*types.AuctionResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + resp := q.Keeper.GetAuction(ctx, req.Id) + return &types.AuctionResponse{Auction: resp}, nil +} + +// GetBid queries and auction bid +func (q Querier) GetBid(c context.Context, req *types.BidRequest) (*types.BidResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + resp := q.Keeper.GetBid(ctx, req.AuctionId, req.Bidder) + return &types.BidResponse{Bid: &resp}, nil +} + +// GetBids queries all auction bids +func (q Querier) GetBids(c context.Context, req *types.BidsRequest) (*types.BidsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + resp := q.Keeper.GetBids(ctx, req.AuctionId) + return &types.BidsResponse{Bids: resp}, nil +} + +// 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) + return &types.AuctionsByBidderResponse{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) + resp := q.Keeper.GetParams(ctx) + return &types.QueryParamsResponse{Params: &resp}, nil +} + +// Balance queries the auction module account balance +func (q Querier) Balance(c context.Context, req *types.BalanceRequest) (*types.BalanceResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + resp := q.Keeper.GetAuctionModuleBalances(ctx) + return &types.BalanceResponse{Balance: resp}, nil +} diff --git a/x/auction/keeper/invariants.go b/x/auction/keeper/invariants.go new file mode 100644 index 00000000..5fc83d1b --- /dev/null +++ b/x/auction/keeper/invariants.go @@ -0,0 +1,37 @@ +package keeper + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/tharsis/ethermint/x/auction/types" +) + +// RegisterInvariants registers all auction module invariants. +func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) { + ir.RegisterRoute(types.ModuleName, "module-account", ModuleAccountInvariant(k)) +} + +// ModuleAccountInvariant checks that the 'auction' module account balance is non-negative. +func ModuleAccountInvariant(k Keeper) sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + moduleAddress := k.accountKeeper.GetModuleAddress(types.ModuleName) + if k.bankKeeper.GetAllBalances(ctx, moduleAddress).IsAnyNegative() { + return sdk.FormatInvariant( + types.ModuleName, + "module-account", + fmt.Sprintf("Module account '%s' has negative balance.", types.ModuleName)), + true + } + + return "", false + } +} + +// AllInvariants runs all invariants of the auctions module. +func AllInvariants(k Keeper) sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + return ModuleAccountInvariant(k)(ctx) + } +} diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go new file mode 100644 index 00000000..96df3016 --- /dev/null +++ b/x/auction/keeper/keeper.go @@ -0,0 +1,627 @@ +package keeper + +import ( + "encoding/hex" + "encoding/json" + "fmt" + "time" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + auth "github.com/cosmos/cosmos-sdk/x/auth/keeper" + bank "github.com/cosmos/cosmos-sdk/x/bank/keeper" + params "github.com/cosmos/cosmos-sdk/x/params/types" + + "github.com/tharsis/ethermint/x/auction/types" + + wnsUtils "github.com/tharsis/ethermint/utils" +) + +// CompletedAuctionDeleteTimeout => Completed auctions are deleted after this timeout (after reveals end time). +const CompletedAuctionDeleteTimeout time.Duration = time.Hour * 24 + +// PrefixIDToAuctionIndex is the prefix for Id -> Auction index in the KVStore. +// Note: This is the primary index in the system. +// Note: Golang doesn't support const arrays. +var PrefixIDToAuctionIndex = []byte{0x00} + +// prefixOwnerToAuctionsIndex is the prefix for the Owner -> [Auction] index in the KVStore. +var prefixOwnerToAuctionsIndex = []byte{0x01} + +// PrefixAuctionBidsIndex is the prefix for the (auction, bidder) -> Bid index in the KVStore. +var PrefixAuctionBidsIndex = []byte{0x02} + +// 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 + bankKeeper bank.Keeper + + // Track auction usage in other cosmos-sdk modules (more like a usage tracker). + usageKeepers []types.AuctionUsageKeeper + + storeKey sdk.StoreKey // Unexposed key to access store from sdk.Context + + cdc codec.BinaryCodec // The wire codec for binary encoding/decoding. + + paramSubspace params.Subspace +} + +// AuctionClientKeeper is the subset of functionality exposed to other modules. +type AuctionClientKeeper interface { + HasAuction(ctx sdk.Context, id string) bool + GetAuction(ctx sdk.Context, id string) types.Auction + MatchAuctions(ctx sdk.Context, matchFn func(*types.Auction) bool) []*types.Auction +} + +// NewKeeper creates new instances of the auction Keeper +func NewKeeper(accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, storeKey sdk.StoreKey, cdc codec.BinaryCodec, paramstore params.Subspace) Keeper { + if !paramstore.HasKeyTable() { + paramstore = paramstore.WithKeyTable(types.ParamKeyTable()) + } + return Keeper{ + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + storeKey: storeKey, + cdc: cdc, + paramSubspace: paramstore, + } +} + +func (k *Keeper) SetUsageKeepers(usageKeepers []types.AuctionUsageKeeper) { + k.usageKeepers = usageKeepers +} + +func (k Keeper) GetUsageKeepers() []types.AuctionUsageKeeper { + return k.usageKeepers +} + +// Generates Auction Id -> Auction index key. +func GetAuctionIndexKey(id string) []byte { + return append(PrefixIDToAuctionIndex, []byte(id)...) +} + +// Generates Owner -> Auctions index key. +func GetOwnerToAuctionsIndexKey(owner string, auctionID string) []byte { + return append(append(prefixOwnerToAuctionsIndex, []byte(owner)...), []byte(auctionID)...) +} + +func GetBidIndexKey(auctionID string, bidder string) []byte { + return append(GetAuctionBidsIndexPrefix(auctionID), []byte(bidder)...) +} + +func GetAuctionBidsIndexPrefix(auctionID string) []byte { + return append(append(PrefixAuctionBidsIndex, []byte(auctionID)...)) +} + +// SaveAuction - saves a auction to the store. +func (k Keeper) SaveAuction(ctx sdk.Context, auction *types.Auction) { + store := ctx.KVStore(k.storeKey) + + // Auction Id -> Auction index. + store.Set(GetAuctionIndexKey(auction.Id), k.cdc.MustMarshal(auction)) + + // Owner -> [Auction] index. + store.Set(GetOwnerToAuctionsIndexKey(auction.OwnerAddress, auction.Id), []byte{}) + + // Notify interested parties. + for _, keeper := range k.usageKeepers { + keeper.OnAuction(ctx, auction.Id) + } +} + +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)) + + // Notify interested parties. + for _, keeper := range k.usageKeepers { + keeper.OnAuctionBid(ctx, bid.AuctionId, bid.BidderAddress) + } +} + +func (k Keeper) DeleteBid(ctx sdk.Context, bid types.Bid) { + store := ctx.KVStore(k.storeKey) + store.Delete(GetBidIndexKey(bid.AuctionId, bid.BidderAddress)) +} + +// HasAuction - checks if a auction by the given Id exists. +func (k Keeper) HasAuction(ctx sdk.Context, id string) bool { + store := ctx.KVStore(k.storeKey) + return store.Has(GetAuctionIndexKey(id)) +} + +func (k Keeper) HasBid(ctx sdk.Context, id string, bidder string) bool { + store := ctx.KVStore(k.storeKey) + return store.Has(GetBidIndexKey(id, bidder)) +} + +// DeleteAuction - deletes the auction. +func (k Keeper) DeleteAuction(ctx sdk.Context, auction types.Auction) { + // Delete all bids first. + bids := k.GetBids(ctx, auction.Id) + for _, bid := range bids { + k.DeleteBid(ctx, *bid) + } + + // Delete the auction itself. + store := ctx.KVStore(k.storeKey) + store.Delete(GetAuctionIndexKey(auction.Id)) + store.Delete(GetOwnerToAuctionsIndexKey(auction.OwnerAddress, auction.Id)) +} + +// GetAuction - gets a record from the store. +func (k Keeper) GetAuction(ctx sdk.Context, id string) *types.Auction { + store := ctx.KVStore(k.storeKey) + auctionKey := GetAuctionIndexKey(id) + if !store.Has(auctionKey) { + return nil + } + + bz := store.Get(auctionKey) + var obj types.Auction + k.cdc.MustUnmarshal(bz, &obj) + + return &obj +} + +// 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 + itr := sdk.KVStorePrefixIterator(store, GetAuctionBidsIndexPrefix(id)) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + bz := store.Get(itr.Key()) + if bz != nil { + var obj types.Bid + k.cdc.MustUnmarshal(bz, &obj) + bids = append(bids, &obj) + } + } + + return bids +} + +func (k Keeper) GetBid(ctx sdk.Context, id string, bidder string) types.Bid { + store := ctx.KVStore(k.storeKey) + + bz := store.Get(GetBidIndexKey(id, bidder)) + var obj types.Bid + k.cdc.MustUnmarshal(bz, &obj) + + return obj +} + +// ListAuctions - get all auctions. +func (k Keeper) ListAuctions(ctx sdk.Context) []types.Auction { + var auctions []types.Auction + + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, PrefixIDToAuctionIndex) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + bz := store.Get(itr.Key()) + if bz != nil { + var obj types.Auction + k.cdc.MustUnmarshal(bz, &obj) + auctions = append(auctions, obj) + } + } + + return auctions +} + +// QueryAuctionsByOwner - query auctions by owner. +func (k Keeper) QueryAuctionsByOwner(ctx sdk.Context, ownerAddress string) []types.Auction { + var auctions []types.Auction + + ownerPrefix := append(prefixOwnerToAuctionsIndex, []byte(ownerAddress)...) + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, ownerPrefix) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + auctionID := itr.Key()[len(ownerPrefix):] + 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 + + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, PrefixIDToAuctionIndex) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + bz := store.Get(itr.Key()) + if bz != nil { + var obj types.Auction + k.cdc.MustUnmarshal(bz, &obj) + if matchFn(&obj) { + auctions = append(auctions, &obj) + } + } + } + + return auctions +} + +// CreateAuction creates a new auction. +func (k Keeper) CreateAuction(ctx sdk.Context, msg types.MsgCreateAuction) (*types.Auction, error) { + // Might be called from another module directly, always validate. + err := msg.ValidateBasic() + if err != nil { + return nil, err + } + + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + // Generate auction Id. + account := k.accountKeeper.GetAccount(ctx, signerAddress) + if account == nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "Account not found.") + } + + auctionID := types.AuctionID{ + Address: signerAddress, + AccNum: account.GetAccountNumber(), + Sequence: account.GetSequence(), + }.Generate() + + // Compute timestamps. + now := ctx.BlockTime() + commitsEndTime := now.Add(time.Duration(msg.CommitsDuration)) + revealsEndTime := now.Add(time.Duration(msg.CommitsDuration + msg.RevealsDuration)) + + auction := types.Auction{ + Id: auctionID, + Status: types.AuctionStatusCommitPhase, + OwnerAddress: signerAddress.String(), + CreateTime: now, + CommitsEndTime: commitsEndTime, + RevealsEndTime: revealsEndTime, + CommitFee: msg.CommitFee, + RevealFee: msg.RevealFee, + MinimumBid: msg.MinimumBid, + } + + // Save auction in store. + k.SaveAuction(ctx, &auction) + + return &auction, nil +} + +func (k Keeper) CommitBid(ctx sdk.Context, msg types.MsgCommitBid) (*types.Auction, error) { + if !k.HasAuction(ctx, msg.AuctionId) { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Auction not found.") + } + + auction := k.GetAuction(ctx, msg.AuctionId) + if auction.Status != types.AuctionStatusCommitPhase { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Auction is not in commit phase.") + } + + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + // Take auction fees from account. + totalFee := auction.CommitFee.Add(auction.RevealFee) + sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, signerAddress, types.ModuleName, sdk.NewCoins(totalFee)) + if sdkErr != nil { + return nil, sdkErr + } + + // Check if an old bid already exists, if so, return old bids auction fee (update bid scenario). + bidder := signerAddress.String() + if k.HasBid(ctx, msg.AuctionId, bidder) { + oldBid := k.GetBid(ctx, msg.AuctionId, bidder) + oldTotalFee := oldBid.CommitFee.Add(oldBid.RevealFee) + sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, signerAddress, sdk.NewCoins(oldTotalFee)) + if sdkErr != nil { + return nil, sdkErr + } + } + + // Save new bid. + bid := types.Bid{ + AuctionId: msg.AuctionId, + BidderAddress: bidder, + Status: types.BidStatusCommitted, + CommitHash: msg.CommitHash, + CommitTime: ctx.BlockTime(), + CommitFee: auction.CommitFee, + RevealFee: auction.RevealFee, + } + + k.SaveBid(ctx, &bid) + + return auction, nil +} + +// RevealBid reeals a bid comitted earlier. +func (k Keeper) RevealBid(ctx sdk.Context, msg types.MsgRevealBid) (*types.Auction, error) { + if !k.HasAuction(ctx, msg.AuctionId) { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Auction not found.") + } + + auction := k.GetAuction(ctx, msg.AuctionId) + if auction.Status != types.AuctionStatusRevealPhase { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Auction is not in reveal phase.") + } + + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + if !k.HasBid(ctx, msg.AuctionId, signerAddress.String()) { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Bid not found.") + } + + bid := k.GetBid(ctx, auction.Id, signerAddress.String()) + if bid.Status != types.BidStatusCommitted { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Bid not in committed state.") + } + + revealBytes, err := hex.DecodeString(msg.Reveal) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal string.") + } + + cid, err := wnsUtils.CIDFromJSONBytes(revealBytes) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal JSON.") + } + + if bid.CommitHash != cid { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Commit hash mismatch.") + } + + var reveal map[string]interface{} + err = json.Unmarshal(revealBytes, &reveal) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Reveal JSON unmarshal error.") + } + + chainID, err := wnsUtils.GetAttributeAsString(reveal, "chainId") + if err != nil || chainID != ctx.ChainID() { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal chainID.") + } + + auctionID, err := wnsUtils.GetAttributeAsString(reveal, "auctionId") + if err != nil || auctionID != msg.AuctionId { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal auction Id.") + } + + bidderAddress, err := wnsUtils.GetAttributeAsString(reveal, "bidderAddress") + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal bid address.") + } + + if bidderAddress != signerAddress.String() { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Reveal bid address mismatch.") + } + + bidAmountStr, err := wnsUtils.GetAttributeAsString(reveal, "bidAmount") + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal bid amount.") + } + + bidAmount, err := sdk.ParseCoinNormalized(bidAmountStr) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal bid amount.") + } + + if bidAmount.IsLT(auction.MinimumBid) { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Bid is lower than minimum bid.") + } + + // Lock bid amount. + sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, signerAddress, types.ModuleName, sdk.NewCoins(bidAmount)) + if sdkErr != nil { + return nil, sdkErr + } + + // Update bid. + bid.BidAmount = bidAmount + bid.RevealTime = ctx.BlockTime() + bid.Status = types.BidStatusRevealed + k.SaveBid(ctx, &bid) + + return auction, nil +} + +// GetAuctionModuleBalances gets the auction module account(s) balances. +func (k Keeper) GetAuctionModuleBalances(ctx sdk.Context) sdk.Coins { + moduleAddress := k.accountKeeper.GetModuleAddress(types.ModuleName) + balances := k.bankKeeper.GetAllBalances(ctx, moduleAddress) + return balances +} + +func (k Keeper) EndBlockerProcessAuctions(ctx sdk.Context) { + // Transition auction state (commit, reveal, expired, completed). + k.processAuctionPhases(ctx) + + // Delete stale auctions. + k.deleteCompletedAuctions(ctx) +} + +func (k Keeper) processAuctionPhases(ctx sdk.Context) { + auctions := k.MatchAuctions(ctx, func(_ *types.Auction) bool { + return true + }) + + for _, auction := range auctions { + // Commit -> Reveal state. + if auction.Status == types.AuctionStatusCommitPhase && ctx.BlockTime().After(auction.CommitsEndTime) { + auction.Status = types.AuctionStatusRevealPhase + k.SaveAuction(ctx, auction) + ctx.Logger().Info(fmt.Sprintf("Moved auction %s to reveal phase.", auction.Id)) + } + + // Reveal -> Expired state. + if auction.Status == types.AuctionStatusRevealPhase && ctx.BlockTime().After(auction.RevealsEndTime) { + auction.Status = types.AuctionStatusExpired + k.SaveAuction(ctx, auction) + ctx.Logger().Info(fmt.Sprintf("Moved auction %s to expired state.", auction.Id)) + } + + // If auction has expired, pick a winner from revealed bids. + if auction.Status == types.AuctionStatusExpired { + k.pickAuctionWinner(ctx, auction) + } + } +} + +// Delete completed stale auctions. +func (k Keeper) deleteCompletedAuctions(ctx sdk.Context) { + auctions := k.MatchAuctions(ctx, func(auction *types.Auction) bool { + deleteTime := auction.RevealsEndTime.Add(CompletedAuctionDeleteTimeout) + return auction.Status == types.AuctionStatusCompleted && ctx.BlockTime().After(deleteTime) + }) + + for _, auction := range auctions { + ctx.Logger().Info(fmt.Sprintf("Deleting completed auction %s after timeout.", auction.Id)) + k.DeleteAuction(ctx, *auction) + } +} + +func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *types.Auction) { + ctx.Logger().Info(fmt.Sprintf("Picking auction %s winner.", auction.Id)) + + var highestBid *types.Bid + var secondHighestBid *types.Bid + + bids := k.GetBids(ctx, auction.Id) + for _, bid := range bids { + ctx.Logger().Info(fmt.Sprintf("Processing bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + + // Only consider revealed bids. + if bid.Status != types.BidStatusRevealed { + ctx.Logger().Info(fmt.Sprintf("Ignoring unrevealed bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + + continue + } + + // Init highest bid. + if highestBid == nil { + highestBid = bid + + ctx.Logger().Info(fmt.Sprintf("Initializing 1st bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + + continue + } + + if highestBid.BidAmount.IsLT(bid.BidAmount) { + ctx.Logger().Info(fmt.Sprintf("New highest bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + + secondHighestBid = highestBid + highestBid = bid + + ctx.Logger().Info(fmt.Sprintf("Updated 1st bid %s %s", highestBid.BidderAddress, highestBid.BidAmount.String())) + ctx.Logger().Info(fmt.Sprintf("Updated 2nd bid %s %s", secondHighestBid.BidderAddress, secondHighestBid.BidAmount.String())) + + } else if secondHighestBid == nil || secondHighestBid.BidAmount.IsLT(bid.BidAmount) { + ctx.Logger().Info(fmt.Sprintf("New 2nd highest bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + + secondHighestBid = bid + ctx.Logger().Info(fmt.Sprintf("Updated 2nd bid %s %s", secondHighestBid.BidderAddress, secondHighestBid.BidAmount.String())) + } else { + ctx.Logger().Info(fmt.Sprintf("Ignoring bid as it doesn't affect 1st/2nd price %s %s", bid.BidderAddress, bid.BidAmount.String())) + } + } + + // Highest bid is the winner, but pays second highest bid price. + auction.Status = types.AuctionStatusCompleted + + if highestBid != nil { + auction.WinnerAddress = highestBid.BidderAddress + auction.WinningBid = highestBid.BidAmount + + // Winner pays 2nd price, if a 2nd price exists. + auction.WinningPrice = highestBid.BidAmount + if secondHighestBid != nil { + auction.WinningPrice = secondHighestBid.BidAmount + } + + ctx.Logger().Info(fmt.Sprintf("Auction %s winner %s.", auction.Id, auction.WinnerAddress)) + ctx.Logger().Info(fmt.Sprintf("Auction %s winner bid %s.", auction.Id, auction.WinningBid.String())) + ctx.Logger().Info(fmt.Sprintf("Auction %s winner price %s.", auction.Id, auction.WinningPrice.String())) + + } else { + ctx.Logger().Info(fmt.Sprintf("Auction %s has no valid revealed bids (no winner).", auction.Id)) + } + + k.SaveAuction(ctx, auction) + + for _, bid := range bids { + bidderAddress, err := sdk.AccAddressFromBech32(bid.BidderAddress) + if err != nil { + panic("Invalid bidder address.") + } + + if bid.Status == types.BidStatusRevealed { + // Send reveal fee back to bidders that've revealed the bid. + sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidderAddress, sdk.NewCoins(bid.RevealFee)) + if sdkErr != nil { + ctx.Logger().Error(fmt.Sprintf("Auction error returning reveal fee: %v", sdkErr)) + panic(sdkErr) + } + } + + // Send back locked bid amount to all bidders. + sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidderAddress, sdk.NewCoins(bid.BidAmount)) + if sdkErr != nil { + ctx.Logger().Error(fmt.Sprintf("Auction error returning bid amount: %v", sdkErr)) + panic(sdkErr) + } + } + + // Process winner account (if nobody bids, there won't be a winner). + if auction.WinnerAddress != "" { + winnerAddress, err := sdk.AccAddressFromBech32(auction.WinnerAddress) + if err != nil { + panic("Invalid winner address.") + } + + // Take 2nd price from winner. + sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, winnerAddress, types.ModuleName, sdk.NewCoins(auction.WinningPrice)) + if sdkErr != nil { + ctx.Logger().Error(fmt.Sprintf("Auction error taking funds from winner: %v", sdkErr)) + panic(sdkErr) + } + + // Burn anything over the min. bid amount. + amountToBurn := auction.WinningPrice.Sub(auction.MinimumBid) + if amountToBurn.IsNegative() { + panic("Auction coins to burn cannot be negative.") + } + + // Use auction burn module account instead of actually burning coins to better keep track of supply. + sdkErr = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.AuctionBurnModuleAccountName, sdk.NewCoins(amountToBurn)) + if sdkErr != nil { + ctx.Logger().Error(fmt.Sprintf("Auction error burning coins: %v", sdkErr)) + panic(sdkErr) + } + } + + // Notify other modules (hook). + ctx.Logger().Info(fmt.Sprintf("Auction %s notifying %d modules.", auction.Id, len(k.usageKeepers))) + for _, keeper := range k.usageKeepers { + ctx.Logger().Info(fmt.Sprintf("Auction %s notifying module %s.", auction.Id, keeper.ModuleName())) + keeper.OnAuctionWinnerSelected(ctx, auction.Id) + } +} diff --git a/x/auction/keeper/msg_server.go b/x/auction/keeper/msg_server.go new file mode 100644 index 00000000..c32f7a46 --- /dev/null +++ b/x/auction/keeper/msg_server.go @@ -0,0 +1,110 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/tharsis/ethermint/x/auction/types" +) + +type msgServer struct { + Keeper +} + +func NewMsgServer(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +func (s msgServer) CreateAuction(c context.Context, msg *types.MsgCreateAuction) (*types.MsgCreateAuctionResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + resp, err := s.Keeper.CreateAuction(ctx, *msg) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeCreateAuction, + sdk.NewAttribute(types.AttributeKeyCommitsDuration, msg.CommitsDuration.String()), + sdk.NewAttribute(types.AttributeKeyCommitFee, msg.CommitFee.String()), + sdk.NewAttribute(types.AttributeKeyRevealFee, msg.RevealFee.String()), + sdk.NewAttribute(types.AttributeKeyMinimumBid, msg.MinimumBid.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, signerAddress.String()), + ), + }) + + return &types.MsgCreateAuctionResponse{Auction: resp}, nil +} + +// CommitBid is the command for committing a bid +func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types.MsgCommitBidResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + resp, err := s.Keeper.CommitBid(ctx, *msg) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeCommitBid, + sdk.NewAttribute(types.AttributeKeyAuctionID, msg.AuctionId), + sdk.NewAttribute(types.AttributeKeyCommitHash, msg.CommitHash), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, signerAddress.String()), + ), + }) + + return &types.MsgCommitBidResponse{Auction: resp}, nil +} + +//RevealBid is the command for revealing a bid +func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types.MsgRevealBidResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + resp, err := s.Keeper.RevealBid(ctx, *msg) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeRevealBid, + sdk.NewAttribute(types.AttributeKeyAuctionID, msg.AuctionId), + sdk.NewAttribute(types.AttributeKeyReveal, msg.Reveal), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, signerAddress.String()), + ), + }) + + return &types.MsgRevealBidResponse{Auction: resp}, nil +} diff --git a/x/auction/keeper/params.go b/x/auction/keeper/params.go new file mode 100644 index 00000000..2896f5a2 --- /dev/null +++ b/x/auction/keeper/params.go @@ -0,0 +1,18 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/tharsis/ethermint/x/auction/types" +) + +// GetParams - Get all parameteras as types.Params. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + k.paramSubspace.GetParamSet(ctx, ¶ms) + return +} + +// SetParams - set the params. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramSubspace.SetParamSet(ctx, ¶ms) +} diff --git a/x/auction/module.go b/x/auction/module.go new file mode 100644 index 00000000..b4d59ddb --- /dev/null +++ b/x/auction/module.go @@ -0,0 +1,142 @@ +package auction + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + + abci "github.com/tendermint/tendermint/abci/types" + + "github.com/tharsis/ethermint/x/auction/client/cli" + "github.com/tharsis/ethermint/x/auction/keeper" + "github.com/tharsis/ethermint/x/auction/types" +) + +// type check to ensure the interface is properly implemented +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// app module Basics object +type AppModuleBasic struct { + cdc codec.Codec +} + +func (b AppModuleBasic) Name() string { + return types.ModuleName +} + +func (b AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +func (b AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + +func (b AppModuleBasic) DefaultGenesis(jsonCodec codec.JSONCodec) json.RawMessage { + return jsonCodec.MustMarshalJSON(types.DefaultGenesisState()) +} + +// Validation check of the Genesis +func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var data types.GenesisState + err := cdc.UnmarshalJSON(bz, &data) + if err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + // Once json successfully marshalled, passes along to genesis.go + return ValidateGenesis(data) +} + +// Register rest routes +func (b AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router) { + // No-op. +} + +func (b AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, serveMux *runtime.ServeMux) { + err := types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(clientCtx)) + if err != nil { + panic(err) + } +} + +// Get the root query command of this module +func (b AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// Get the root tx command of this module +func (b AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +type AppModule struct { + AppModuleBasic + keeper keeper.Keeper +} + +// NewAppModule creates a new AppModule Object +func NewAppModule(cdc codec.Codec, k keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: AppModuleBasic{cdc: cdc}, + keeper: k, + } +} + +func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { + keeper.RegisterInvariants(ir, am.keeper) +} + +func (am AppModule) Route() sdk.Route { + return sdk.Route{} +} + +func (am AppModule) QuerierRoute() string { + return types.QuerierRoute +} + +func (am AppModule) LegacyQuerierHandler(cdc *codec.LegacyAmino) sdk.Querier { + return nil +} + +func (am AppModule) RegisterServices(cfg module.Configurator) { + querier := keeper.Querier{Keeper: am.keeper} + types.RegisterQueryServer(cfg.QueryServer(), querier) + + msgServer := keeper.NewMsgServer(am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), msgServer) +} + +func (am AppModule) ConsensusVersion() uint64 { + return 1 +} + +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} + +func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return EndBlocker(ctx, am.keeper) +} + +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + cdc.MustUnmarshalJSON(data, &genesisState) + InitGenesis(ctx, am.keeper, genesisState) + return []abci.ValidatorUpdate{} +} + +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(&gs) +} diff --git a/x/auction/types/codec.go b/x/auction/types/codec.go new file mode 100644 index 00000000..9d4e9767 --- /dev/null +++ b/x/auction/types/codec.go @@ -0,0 +1,37 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +// RegisterLegacyAminoCodec registers the necessary x/auction interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgCreateAuction{}, "auction/MsgCreateAuction", nil) + cdc.RegisterConcrete(&MsgCommitBid{}, "auction/MsgCommitBid", nil) + cdc.RegisterConcrete(&MsgRevealBid{}, "auction/MsgRevealBid", nil) +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCreateAuction{}, + &MsgCommitBid{}, + &MsgRevealBid{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} diff --git a/x/auction/types/events.go b/x/auction/types/events.go new file mode 100644 index 00000000..caa3fb2e --- /dev/null +++ b/x/auction/types/events.go @@ -0,0 +1,19 @@ +package types + +const ( + EventTypeCreateAuction = "create-auction" + EventTypeCommitBid = "commit-bid" + EventTypeRevealBid = "reveal-bid" + + AttributeKeyCommitsDuration = "commits-duration" + AttributeKeyRevealsDuration = "reveals-duration" + AttributeKeyCommitFee = "commit-fee" + AttributeKeyRevealFee = "reveal-fee" + AttributeKeyMinimumBid = "minimum-bid" + AttributeKeySigner = "signer" + AttributeKeyAuctionID = "auction-id" + AttributeKeyCommitHash = "commit-hash" + AttributeKeyReveal = "reveal" + + AttributeValueCategory = ModuleName +) diff --git a/x/auction/types/expected_keepers.go b/x/auction/types/expected_keepers.go new file mode 100644 index 00000000..3c29ec5e --- /dev/null +++ b/x/auction/types/expected_keepers.go @@ -0,0 +1,16 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AuctionUsageKeeper keep track of auction usage in other modules. +// Used to, for example, prevent deletion of a auction that's in use. +type AuctionUsageKeeper interface { + ModuleName() string + UsesAuction(ctx sdk.Context, auctionID string) bool + + OnAuction(ctx sdk.Context, auctionID string) + OnAuctionBid(ctx sdk.Context, auctionID string, bidderAddress string) + OnAuctionWinnerSelected(ctx sdk.Context, auctionID string) +} diff --git a/x/auction/types/genesis.go b/x/auction/types/genesis.go new file mode 100644 index 00000000..04a185f5 --- /dev/null +++ b/x/auction/types/genesis.go @@ -0,0 +1,9 @@ +package types + +// DefaultGenesisState sets default evm genesis state with empty accounts and default params and +// chain config values. +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + } +} diff --git a/x/auction/types/genesis.pb.go b/x/auction/types/genesis.pb.go new file mode 100644 index 00000000..2eb11d7a --- /dev/null +++ b/x/auction/types/genesis.pb.go @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/auction/v1beta1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the genesis state of the auction module +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + Auctions []*Auction `protobuf:"bytes,2,rep,name=auctions,proto3" json:"auctions,omitempty" json:"bonds" yaml:"bonds"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_23ebfbd3a1e67fe6, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetAuctions() []*Auction { + if m != nil { + return m.Auctions + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "vulcanize.auction.v1beta1.GenesisState") +} + +func init() { + proto.RegisterFile("vulcanize/auction/v1beta1/genesis.proto", fileDescriptor_23ebfbd3a1e67fe6) +} + +var fileDescriptor_23ebfbd3a1e67fe6 = []byte{ + // 264 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2f, 0x2b, 0xcd, 0x49, + 0x4e, 0xcc, 0xcb, 0xac, 0x4a, 0xd5, 0x4f, 0x2c, 0x4d, 0x2e, 0xc9, 0xcc, 0xcf, 0xd3, 0x2f, 0x33, + 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, + 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x84, 0x2b, 0xd4, 0x83, 0x2a, 0xd4, 0x83, 0x2a, 0x94, 0x12, 0x49, + 0xcf, 0x4f, 0xcf, 0x07, 0xab, 0xd2, 0x07, 0xb1, 0x20, 0x1a, 0xa4, 0x54, 0x71, 0x9b, 0x5c, 0x52, + 0x59, 0x90, 0x0a, 0x35, 0x57, 0x69, 0x1d, 0x23, 0x17, 0x8f, 0x3b, 0xc4, 0xa6, 0xe0, 0x92, 0xc4, + 0x92, 0x54, 0x21, 0x7b, 0x2e, 0xb6, 0x82, 0xc4, 0xa2, 0xc4, 0xdc, 0x62, 0x09, 0x46, 0x05, 0x46, + 0x0d, 0x6e, 0x23, 0x45, 0x3d, 0x9c, 0x36, 0xeb, 0x05, 0x80, 0x15, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, + 0xcf, 0x10, 0x04, 0xd5, 0x26, 0x14, 0xcb, 0xc5, 0x01, 0x55, 0x57, 0x2c, 0xc1, 0xa4, 0xc0, 0xac, + 0xc1, 0x6d, 0xa4, 0x84, 0xc7, 0x08, 0x47, 0x08, 0xdf, 0x49, 0xf6, 0xd3, 0x3d, 0x79, 0xc9, 0xac, + 0xe2, 0xfc, 0x3c, 0x2b, 0xa5, 0xa4, 0xfc, 0xbc, 0x94, 0x62, 0x25, 0x85, 0xca, 0xc4, 0xdc, 0x1c, + 0x18, 0x27, 0x08, 0x6e, 0xa4, 0x93, 0xdb, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, + 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, + 0x44, 0xe9, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x97, 0x64, 0x24, + 0x16, 0x15, 0x67, 0x16, 0xeb, 0xa7, 0x96, 0x64, 0xa4, 0x16, 0xe5, 0x66, 0xe6, 0x95, 0xe8, 0x57, + 0xc0, 0x83, 0x01, 0xec, 0xfd, 0x24, 0x36, 0xb0, 0xff, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x40, 0x0a, 0x31, 0x1a, 0x82, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Auctions) > 0 { + for iNdEx := len(m.Auctions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Auctions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.Auctions) > 0 { + for _, e := range m.Auctions { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + 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 ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Auctions = append(m.Auctions, &Auction{}) + if err := m.Auctions[len(m.Auctions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/auction/types/key.go b/x/auction/types/key.go new file mode 100644 index 00000000..f7937a5e --- /dev/null +++ b/x/auction/types/key.go @@ -0,0 +1,18 @@ +package types + +const ( + // ModuleName is the name of the module + ModuleName = "auction" + + // AuctionBurnModuleAccountName is the name of the auction burn module account. + AuctionBurnModuleAccountName = "auction_burn" + + // StoreKey to be used when creating the KVStore + StoreKey = ModuleName + + // QuerierRoute is the querier route for the staking module + QuerierRoute = ModuleName + + // RouterKey is the msg router key for the staking module + RouterKey = ModuleName +) diff --git a/x/auction/types/msgs.go b/x/auction/types/msgs.go new file mode 100644 index 00000000..7b2069d8 --- /dev/null +++ b/x/auction/types/msgs.go @@ -0,0 +1,150 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var ( + _ sdk.Msg = &MsgCreateAuction{} + _ sdk.Msg = &MsgCommitBid{} + _ sdk.Msg = &MsgRevealBid{} +) + +// NewMsgCreateAuction is the constructor function for MsgCreateAuction. +func NewMsgCreateAuction(params Params, signer sdk.AccAddress) MsgCreateAuction { + return MsgCreateAuction{ + CommitsDuration: params.CommitsDuration, + RevealsDuration: params.RevealsDuration, + CommitFee: params.CommitFee, + RevealFee: params.RevealFee, + MinimumBid: params.MinimumBid, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgCreateAuction) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgCreateAuction) Type() string { return "create" } + +// ValidateBasic Implements Msg. +func (msg MsgCreateAuction) ValidateBasic() error { + if msg.Signer == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Signer) + } + + if msg.CommitsDuration <= 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "commit phase duration invalid.") + } + + if msg.RevealsDuration <= 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "reveal phase duration invalid.") + } + + if !msg.MinimumBid.IsPositive() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "minimum bid should be greater than zero.") + } + + return nil +} + +// GetSignBytes Implements Msg. +func (msg MsgCreateAuction) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners Implements Msg. +func (msg MsgCreateAuction) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// NewMsgCommitBid is the constructor function for MsgCommitBid. +func NewMsgCommitBid(auctionID string, commitHash string, signer sdk.AccAddress) MsgCommitBid { + + return MsgCommitBid{ + AuctionId: auctionID, + CommitHash: commitHash, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgCommitBid) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgCommitBid) Type() string { return "commit" } + +// ValidateBasic Implements Msg. +func (msg MsgCommitBid) ValidateBasic() error { + if msg.Signer == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer address.") + } + + if msg.AuctionId == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid auction ID.") + } + + if msg.CommitHash == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid commit hash.") + } + + return nil +} + +// GetSignBytes Implements Msg. +func (msg MsgCommitBid) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners Implements Msg. +func (msg MsgCommitBid) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// 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(), + } +} + +// Route Implements Msg. +func (msg MsgRevealBid) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgRevealBid) Type() string { return "reveal" } + +// ValidateBasic Implements Msg. +func (msg MsgRevealBid) ValidateBasic() error { + if msg.Signer == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer address.") + } + + if msg.AuctionId == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid auction ID.") + } + + if msg.Reveal == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid reveal data.") + } + + return nil +} + +// GetSignBytes Implements Msg. +func (msg MsgRevealBid) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners Implements Msg. +func (msg MsgRevealBid) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} diff --git a/x/auction/types/params.go b/x/auction/types/params.go new file mode 100644 index 00000000..74bef07c --- /dev/null +++ b/x/auction/types/params.go @@ -0,0 +1,173 @@ +package types + +import ( + "bytes" + "errors" + "fmt" + "strings" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/params/types" +) + +// Default parameter namespace. +const ( + DefaultParamspace = ModuleName +) + +var ( + DefaultCommitsDuration = 5 * time.Minute + DefaultRevealsDuration = 5 * time.Minute + DefaultCommitFee = sdk.Coin{Amount: sdk.NewInt(10), Denom: sdk.DefaultBondDenom} + DefaultRevealFee = sdk.Coin{Amount: sdk.NewInt(10), Denom: sdk.DefaultBondDenom} + DefaultMinimumBid = sdk.Coin{Amount: sdk.NewInt(1000), Denom: sdk.DefaultBondDenom} + + ParamStoreKeyCommitsDuration = []byte("CommitsDuration") + ParamStoreKeyRevealsDuration = []byte("RevealsDuration") + ParamStoreKeyCommitFee = []byte("CommitFee") + ParamStoreKeyRevealFee = []byte("RevealFee") + ParamStoreKeyMinimumBid = []byte("MinimumBid") +) + +var _ types.ParamSet = Params{} + +func NewParams() Params { + return DefaultParams() +} + +// ParamKeyTable - ParamTable for bond module. +func ParamKeyTable() types.KeyTable { + return types.NewKeyTable().RegisterParamSet(&Params{}) +} + +// ParamSetPairs - implements params.ParamSet +func (p Params) ParamSetPairs() types.ParamSetPairs { + return types.ParamSetPairs{ + types.NewParamSetPair(ParamStoreKeyCommitsDuration, &p.CommitsDuration, validateCommitsDuration), + types.NewParamSetPair(ParamStoreKeyRevealsDuration, &p.RevealsDuration, validateRevealsDuration), + types.NewParamSetPair(ParamStoreKeyCommitFee, &p.CommitFee, validateCommitFee), + types.NewParamSetPair(ParamStoreKeyRevealFee, &p.RevealFee, validateRevealFee), + types.NewParamSetPair(ParamStoreKeyMinimumBid, &p.MinimumBid, validateMinimumBid), + } +} + +// Equal returns a boolean determining if two Params types are identical. +func (p Params) Equal(p2 Params) bool { + bz1 := ModuleCdc.MustMarshalLengthPrefixed(&p) + bz2 := ModuleCdc.MustMarshalLengthPrefixed(&p2) + return bytes.Equal(bz1, bz2) +} + +// DefaultParams returns a default set of parameters. +func DefaultParams() Params { + return Params{ + CommitsDuration: DefaultCommitsDuration, + RevealsDuration: DefaultRevealsDuration, + CommitFee: DefaultCommitFee, + RevealFee: DefaultRevealFee, + MinimumBid: 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() +} + +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("commits 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 +} + +// Validate a set of params. +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 +} diff --git a/x/auction/types/query.pb.go b/x/auction/types/query.pb.go new file mode 100644 index 00000000..91e7ae19 --- /dev/null +++ b/x/auction/types/query.pb.go @@ -0,0 +1,2995 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/auction/v1beta1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// AuctionsRequest is the format for querying all the auctions +type AuctionsRequest struct { + // pagination defines an optional pagination info for the next request + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *AuctionsRequest) Reset() { *m = AuctionsRequest{} } +func (m *AuctionsRequest) String() string { return proto.CompactTextString(m) } +func (*AuctionsRequest) ProtoMessage() {} +func (*AuctionsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{0} +} +func (m *AuctionsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionsRequest.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 *AuctionsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionsRequest.Merge(m, src) +} +func (m *AuctionsRequest) XXX_Size() int { + return m.Size() +} +func (m *AuctionsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionsRequest proto.InternalMessageInfo + +func (m *AuctionsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// AuctionsResponse returns the list of all auctions +type AuctionsResponse struct { + // List of auctions + Auctions *Auctions `protobuf:"bytes,1,opt,name=auctions,proto3" json:"auctions,omitempty"` + // pagination defines an optional pagination info for the next request + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *AuctionsResponse) Reset() { *m = AuctionsResponse{} } +func (m *AuctionsResponse) String() string { return proto.CompactTextString(m) } +func (*AuctionsResponse) ProtoMessage() {} +func (*AuctionsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{1} +} +func (m *AuctionsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionsResponse.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 *AuctionsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionsResponse.Merge(m, src) +} +func (m *AuctionsResponse) XXX_Size() int { + return m.Size() +} +func (m *AuctionsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionsResponse proto.InternalMessageInfo + +func (m *AuctionsResponse) GetAuctions() *Auctions { + if m != nil { + return m.Auctions + } + return nil +} + +func (m *AuctionsResponse) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// AuctionRequest is the format for querying a specific auction +type AuctionRequest struct { + // Auction ID + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *AuctionRequest) Reset() { *m = AuctionRequest{} } +func (m *AuctionRequest) String() string { return proto.CompactTextString(m) } +func (*AuctionRequest) ProtoMessage() {} +func (*AuctionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{2} +} +func (m *AuctionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionRequest.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 *AuctionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionRequest.Merge(m, src) +} +func (m *AuctionRequest) XXX_Size() int { + return m.Size() +} +func (m *AuctionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionRequest proto.InternalMessageInfo + +func (m *AuctionRequest) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +// AuctionResponse returns the details of the queried auction +type AuctionResponse struct { + // Auction details + Auction *Auction `protobuf:"bytes,1,opt,name=auction,proto3" json:"auction,omitempty"` +} + +func (m *AuctionResponse) Reset() { *m = AuctionResponse{} } +func (m *AuctionResponse) String() string { return proto.CompactTextString(m) } +func (*AuctionResponse) ProtoMessage() {} +func (*AuctionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{3} +} +func (m *AuctionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionResponse.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 *AuctionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionResponse.Merge(m, src) +} +func (m *AuctionResponse) XXX_Size() int { + return m.Size() +} +func (m *AuctionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionResponse proto.InternalMessageInfo + +func (m *AuctionResponse) GetAuction() *Auction { + if m != nil { + return m.Auction + } + return nil +} + +// BidRequest is the format for querying a specific bid in an auction +type BidRequest struct { + // Auction ID + AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` + // Bidder address + Bidder string `protobuf:"bytes,2,opt,name=bidder,proto3" json:"bidder,omitempty"` +} + +func (m *BidRequest) Reset() { *m = BidRequest{} } +func (m *BidRequest) String() string { return proto.CompactTextString(m) } +func (*BidRequest) ProtoMessage() {} +func (*BidRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{4} +} +func (m *BidRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BidRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BidRequest.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 *BidRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BidRequest.Merge(m, src) +} +func (m *BidRequest) XXX_Size() int { + return m.Size() +} +func (m *BidRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BidRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BidRequest proto.InternalMessageInfo + +func (m *BidRequest) GetAuctionId() string { + if m != nil { + return m.AuctionId + } + return "" +} + +func (m *BidRequest) GetBidder() string { + if m != nil { + return m.Bidder + } + return "" +} + +// BidResponse returns the details of the queried bid +type BidResponse struct { + // Bid details + Bid *Bid `protobuf:"bytes,1,opt,name=bid,proto3" json:"bid,omitempty"` +} + +func (m *BidResponse) Reset() { *m = BidResponse{} } +func (m *BidResponse) String() string { return proto.CompactTextString(m) } +func (*BidResponse) ProtoMessage() {} +func (*BidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{5} +} +func (m *BidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BidResponse.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 *BidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BidResponse.Merge(m, src) +} +func (m *BidResponse) XXX_Size() int { + return m.Size() +} +func (m *BidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BidResponse proto.InternalMessageInfo + +func (m *BidResponse) GetBid() *Bid { + if m != nil { + return m.Bid + } + return nil +} + +// BidsRequest is the format for querying all bids in an auction +type BidsRequest struct { + // Auction ID + AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` +} + +func (m *BidsRequest) Reset() { *m = BidsRequest{} } +func (m *BidsRequest) String() string { return proto.CompactTextString(m) } +func (*BidsRequest) ProtoMessage() {} +func (*BidsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{6} +} +func (m *BidsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BidsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BidsRequest.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 *BidsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BidsRequest.Merge(m, src) +} +func (m *BidsRequest) XXX_Size() int { + return m.Size() +} +func (m *BidsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BidsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BidsRequest proto.InternalMessageInfo + +func (m *BidsRequest) GetAuctionId() string { + if m != nil { + return m.AuctionId + } + return "" +} + +// BidsResponse returns details of all bids in an auction +type BidsResponse struct { + // List of bids in the auction + Bids []*Bid `protobuf:"bytes,1,rep,name=bids,proto3" json:"bids,omitempty"` +} + +func (m *BidsResponse) Reset() { *m = BidsResponse{} } +func (m *BidsResponse) String() string { return proto.CompactTextString(m) } +func (*BidsResponse) ProtoMessage() {} +func (*BidsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{7} +} +func (m *BidsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BidsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BidsResponse.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 *BidsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BidsResponse.Merge(m, src) +} +func (m *BidsResponse) XXX_Size() int { + return m.Size() +} +func (m *BidsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BidsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BidsResponse proto.InternalMessageInfo + +func (m *BidsResponse) GetBids() []*Bid { + if m != nil { + return m.Bids + } + return nil +} + +// AuctionsByBidderRequest is the format for querying all auctions containing a bidder address +type AuctionsByBidderRequest struct { + // Address of the bidder + BidderAddress string `protobuf:"bytes,1,opt,name=bidder_address,json=bidderAddress,proto3" json:"bidder_address,omitempty"` +} + +func (m *AuctionsByBidderRequest) Reset() { *m = AuctionsByBidderRequest{} } +func (m *AuctionsByBidderRequest) String() string { return proto.CompactTextString(m) } +func (*AuctionsByBidderRequest) ProtoMessage() {} +func (*AuctionsByBidderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{8} +} +func (m *AuctionsByBidderRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionsByBidderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionsByBidderRequest.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 *AuctionsByBidderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionsByBidderRequest.Merge(m, src) +} +func (m *AuctionsByBidderRequest) XXX_Size() int { + return m.Size() +} +func (m *AuctionsByBidderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionsByBidderRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionsByBidderRequest proto.InternalMessageInfo + +func (m *AuctionsByBidderRequest) GetBidderAddress() string { + if m != nil { + return m.BidderAddress + } + return "" +} + +// AuctionsByBidderResponse returns all auctions containing a bidder +type AuctionsByBidderResponse struct { + // List of auctions + Auctions *Auctions `protobuf:"bytes,1,opt,name=auctions,proto3" json:"auctions,omitempty"` +} + +func (m *AuctionsByBidderResponse) Reset() { *m = AuctionsByBidderResponse{} } +func (m *AuctionsByBidderResponse) String() string { return proto.CompactTextString(m) } +func (*AuctionsByBidderResponse) ProtoMessage() {} +func (*AuctionsByBidderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{9} +} +func (m *AuctionsByBidderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionsByBidderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionsByBidderResponse.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 *AuctionsByBidderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionsByBidderResponse.Merge(m, src) +} +func (m *AuctionsByBidderResponse) XXX_Size() int { + return m.Size() +} +func (m *AuctionsByBidderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionsByBidderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionsByBidderResponse proto.InternalMessageInfo + +func (m *AuctionsByBidderResponse) 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 { +} + +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} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse returns parameters of the auction module +type QueryParamsResponse struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +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} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() *Params { + if m != nil { + return m.Params + } + return nil +} + +// BalanceRequest is the format to fetch all balances +type BalanceRequest struct { +} + +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} +} +func (m *BalanceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BalanceRequest.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 *BalanceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BalanceRequest.Merge(m, src) +} +func (m *BalanceRequest) XXX_Size() int { + return m.Size() +} +func (m *BalanceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BalanceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BalanceRequest proto.InternalMessageInfo + +type BalanceResponse struct { + // Set of all balances within the auction + Balance []types.Coin `protobuf:"bytes,1,rep,name=balance,proto3" json:"balance"` +} + +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} +} +func (m *BalanceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BalanceResponse.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 *BalanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BalanceResponse.Merge(m, src) +} +func (m *BalanceResponse) XXX_Size() int { + return m.Size() +} +func (m *BalanceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BalanceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BalanceResponse proto.InternalMessageInfo + +func (m *BalanceResponse) GetBalance() []types.Coin { + if m != nil { + return m.Balance + } + return nil +} + +func init() { + proto.RegisterType((*AuctionsRequest)(nil), "vulcanize.auction.v1beta1.AuctionsRequest") + proto.RegisterType((*AuctionsResponse)(nil), "vulcanize.auction.v1beta1.AuctionsResponse") + proto.RegisterType((*AuctionRequest)(nil), "vulcanize.auction.v1beta1.AuctionRequest") + proto.RegisterType((*AuctionResponse)(nil), "vulcanize.auction.v1beta1.AuctionResponse") + proto.RegisterType((*BidRequest)(nil), "vulcanize.auction.v1beta1.BidRequest") + proto.RegisterType((*BidResponse)(nil), "vulcanize.auction.v1beta1.BidResponse") + proto.RegisterType((*BidsRequest)(nil), "vulcanize.auction.v1beta1.BidsRequest") + 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((*QueryParamsRequest)(nil), "vulcanize.auction.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "vulcanize.auction.v1beta1.QueryParamsResponse") + proto.RegisterType((*BalanceRequest)(nil), "vulcanize.auction.v1beta1.BalanceRequest") + proto.RegisterType((*BalanceResponse)(nil), "vulcanize.auction.v1beta1.BalanceResponse") +} + +func init() { + proto.RegisterFile("vulcanize/auction/v1beta1/query.proto", fileDescriptor_888c39bb00ad61a7) +} + +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, 0x10, 0xe4, 0xe1, 0x6e, 0xa9, 0xea, 0x7a, 0x75, 0xd7, 0xd3, 0x2d, 0xd3, + 0x63, 0xd2, 0x27, 0x72, 0x6d, 0x98, 0x35, 0xee, 0x08, 0x31, 0x6a, 0xd5, 0x4e, 0x6d, 0xa8, 0xaa, + 0xba, 0x3c, 0xdc, 0x8f, 0x39, 0x81, 0xbf, 0xdf, 0x60, 0x68, 0x49, 0x5f, 0xc0, 0xd0, 0xaa, 0xdc, + 0xf6, 0x2a, 0x6c, 0xb7, 0xc5, 0x3c, 0x9f, 0xac, 0x03, 0x9c, 0xb9, 0x8d, 0x2a, 0xe3, 0xca, 0x74, + 0xae, 0x3c, 0xa5, 0x49, 0x3b, 0x2d, 0xb0, 0xd3, 0xe4, 0x15, 0x60, 0x3a, 0x6d, 0xd3, 0xac, 0x31, + 0x8c, 0xad, 0x74, 0x44, 0xd2, 0xcf, 0x0a, 0x0c, 0x9f, 0xe5, 0xf6, 0x1a, 0xae, 0xe3, 0x31, 0xb2, + 0x02, 0x03, 0x88, 0xe3, 0x61, 0xea, 0x49, 0xed, 0xd2, 0x4b, 0xd4, 0xa2, 0xf0, 0x28, 0xe8, 0x1c, + 0x5d, 0xfa, 0x8f, 0xe9, 0xc6, 0x21, 0x8f, 0xd9, 0xc3, 0x73, 0xe7, 0x21, 0xcd, 0x6d, 0x01, 0x35, + 0x58, 0x49, 0x73, 0x9b, 0x3e, 0x8b, 0xae, 0x26, 0xa2, 0x5f, 0x86, 0x2c, 0x82, 0x20, 0x3c, 0xed, + 0x0d, 0x5f, 0x09, 0x43, 0xe8, 0x1a, 0x80, 0xc1, 0xed, 0xd0, 0xee, 0x26, 0x00, 0x6e, 0x6c, 0x45, + 0xb6, 0x83, 0xb8, 0xf2, 0xc4, 0x26, 0xd7, 0x20, 0x63, 0x71, 0xdb, 0x66, 0x4d, 0x71, 0xc6, 0xc1, + 0x0a, 0xfe, 0xa3, 0x2b, 0x90, 0x13, 0x49, 0x90, 0x68, 0x1e, 0xfa, 0x2c, 0x0c, 0xcf, 0x95, 0xd5, + 0x18, 0x9a, 0x20, 0x28, 0x90, 0xd2, 0x39, 0x91, 0xc0, 0x4b, 0x86, 0x41, 0x0d, 0xf8, 0x57, 0xaa, + 0xd1, 0xaf, 0x0c, 0xfd, 0x16, 0xb7, 0x83, 0xb7, 0xeb, 0x4b, 0x60, 0x28, 0xb4, 0xf4, 0x31, 0x5c, + 0x0f, 0x1f, 0xd2, 0xd8, 0x37, 0xc4, 0x31, 0x42, 0xf7, 0x22, 0xe4, 0xe5, 0xb9, 0xb6, 0x4c, 0xdb, + 0x6e, 0x32, 0xcf, 0x43, 0x82, 0xff, 0xe4, 0xea, 0xaa, 0x5c, 0xa4, 0xaf, 0x60, 0xf4, 0x62, 0x86, + 0xbf, 0x54, 0x51, 0x74, 0x04, 0xc8, 0xf3, 0xa0, 0x64, 0x36, 0xcd, 0xa6, 0x59, 0x0f, 0xef, 0x85, + 0x6e, 0xc2, 0xff, 0x5d, 0xab, 0xe8, 0xf6, 0x10, 0x32, 0x0d, 0xb1, 0x82, 0x5e, 0x13, 0x31, 0x5e, + 0x18, 0x8a, 0x01, 0x74, 0x18, 0xf2, 0x86, 0xb9, 0x63, 0x3a, 0xd5, 0xb0, 0x1e, 0xe9, 0x53, 0x18, + 0x8a, 0x56, 0xa2, 0xfc, 0x59, 0x4b, 0x2e, 0xe1, 0x15, 0x8f, 0x75, 0xd5, 0x76, 0x98, 0x7a, 0xcd, + 0xe5, 0x8e, 0xd1, 0x7f, 0xf4, 0xe3, 0x56, 0xaa, 0x12, 0xea, 0xcb, 0x5f, 0x07, 0xe0, 0x1f, 0x81, + 0x4c, 0x0e, 0x15, 0x18, 0x08, 0x0f, 0x4a, 0x4a, 0x49, 0x6e, 0x43, 0x02, 0x15, 0x66, 0x13, 0x69, + 0x25, 0x2a, 0x9d, 0x7d, 0xfb, 0xed, 0xd7, 0xfb, 0x74, 0x91, 0x4c, 0xea, 0x97, 0x8f, 0x9a, 0xa8, + 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, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Auctions queries all auctions + Auctions(ctx context.Context, in *AuctionsRequest, opts ...grpc.CallOption) (*AuctionsResponse, error) + // GetAuction queries an auction + GetAuction(ctx context.Context, in *AuctionRequest, opts ...grpc.CallOption) (*AuctionResponse, error) + // GetBid queries an auction bid + GetBid(ctx context.Context, in *BidRequest, opts ...grpc.CallOption) (*BidResponse, error) + // GetBids queries all auction bids + 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) + // QueryParams implements the params query command + QueryParams(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Balance queries the auction module account balance + Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Auctions(ctx context.Context, in *AuctionsRequest, opts ...grpc.CallOption) (*AuctionsResponse, error) { + out := new(AuctionsResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/Auctions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetAuction(ctx context.Context, in *AuctionRequest, opts ...grpc.CallOption) (*AuctionResponse, error) { + out := new(AuctionResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/GetAuction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetBid(ctx context.Context, in *BidRequest, opts ...grpc.CallOption) (*BidResponse, error) { + out := new(BidResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/GetBid", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetBids(ctx context.Context, in *BidsRequest, opts ...grpc.CallOption) (*BidsResponse, error) { + out := new(BidsResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/GetBids", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AuctionsByBidder(ctx context.Context, in *AuctionsByBidderRequest, opts ...grpc.CallOption) (*AuctionsByBidderResponse, error) { + out := new(AuctionsByBidderResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/AuctionsByBidder", 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...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) { + out := new(BalanceResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/Balance", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Auctions queries all auctions + Auctions(context.Context, *AuctionsRequest) (*AuctionsResponse, error) + // GetAuction queries an auction + GetAuction(context.Context, *AuctionRequest) (*AuctionResponse, error) + // GetBid queries an auction bid + GetBid(context.Context, *BidRequest) (*BidResponse, error) + // GetBids queries all auction bids + GetBids(context.Context, *BidsRequest) (*BidsResponse, error) + // AuctionsByBidder queries auctions by bidder + AuctionsByBidder(context.Context, *AuctionsByBidderRequest) (*AuctionsByBidderResponse, error) + // QueryParams implements the params query command + QueryParams(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Balance queries the auction module account balance + Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Auctions(ctx context.Context, req *AuctionsRequest) (*AuctionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Auctions not implemented") +} +func (*UnimplementedQueryServer) GetAuction(ctx context.Context, req *AuctionRequest) (*AuctionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAuction not implemented") +} +func (*UnimplementedQueryServer) GetBid(ctx context.Context, req *BidRequest) (*BidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBid not implemented") +} +func (*UnimplementedQueryServer) GetBids(ctx context.Context, req *BidsRequest) (*BidsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBids not implemented") +} +func (*UnimplementedQueryServer) AuctionsByBidder(ctx context.Context, req *AuctionsByBidderRequest) (*AuctionsByBidderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuctionsByBidder not implemented") +} +func (*UnimplementedQueryServer) QueryParams(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryParams not implemented") +} +func (*UnimplementedQueryServer) Balance(ctx context.Context, req *BalanceRequest) (*BalanceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Auctions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuctionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Auctions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/Auctions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Auctions(ctx, req.(*AuctionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetAuction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuctionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAuction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/GetAuction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAuction(ctx, req.(*AuctionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BidRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetBid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/GetBid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetBid(ctx, req.(*BidRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetBids_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BidsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetBids(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/GetBids", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetBids(ctx, req.(*BidsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AuctionsByBidder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuctionsByBidderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AuctionsByBidder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/AuctionsByBidder", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AuctionsByBidder(ctx, req.(*AuctionsByBidderRequest)) + } + 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 { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/QueryParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryParams(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BalanceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Balance(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/Balance", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Balance(ctx, req.(*BalanceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "vulcanize.auction.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Auctions", + Handler: _Query_Auctions_Handler, + }, + { + MethodName: "GetAuction", + Handler: _Query_GetAuction_Handler, + }, + { + MethodName: "GetBid", + Handler: _Query_GetBid_Handler, + }, + { + MethodName: "GetBids", + Handler: _Query_GetBids_Handler, + }, + { + MethodName: "AuctionsByBidder", + Handler: _Query_AuctionsByBidder_Handler, + }, + { + MethodName: "QueryParams", + Handler: _Query_QueryParams_Handler, + }, + { + MethodName: "Balance", + Handler: _Query_Balance_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "vulcanize/auction/v1beta1/query.proto", +} + +func (m *AuctionsRequest) 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 *AuctionsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.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 *AuctionsResponse) 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 *AuctionsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + 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 *AuctionRequest) 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 *AuctionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AuctionResponse) 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 *AuctionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionResponse) 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 = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BidRequest) 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 *BidRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BidRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Bidder) > 0 { + i -= len(m.Bidder) + copy(dAtA[i:], m.Bidder) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Bidder))) + i-- + dAtA[i] = 0x12 + } + if len(m.AuctionId) > 0 { + i -= len(m.AuctionId) + copy(dAtA[i:], m.AuctionId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AuctionId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BidResponse) 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 *BidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Bid != nil { + { + size, err := m.Bid.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 *BidsRequest) 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 *BidsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BidsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AuctionId) > 0 { + i -= len(m.AuctionId) + copy(dAtA[i:], m.AuctionId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AuctionId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BidsResponse) 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 *BidsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BidsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Bids) > 0 { + for iNdEx := len(m.Bids) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Bids[iNdEx].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 *AuctionsByBidderRequest) 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 *AuctionsByBidderRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionsByBidderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BidderAddress) > 0 { + i -= len(m.BidderAddress) + copy(dAtA[i:], m.BidderAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BidderAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AuctionsByBidderResponse) 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 *AuctionsByBidderResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionsByBidderResponse) 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) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Params != nil { + { + size, err := m.Params.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 *BalanceRequest) 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 *BalanceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *BalanceResponse) 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 *BalanceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Balance) > 0 { + for iNdEx := len(m.Balance) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Balance[iNdEx].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 encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *AuctionsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *AuctionsResponse) 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)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *AuctionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *AuctionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Auction != nil { + l = m.Auction.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *BidRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AuctionId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Bidder) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *BidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Bid != nil { + l = m.Bid.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *BidsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AuctionId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *BidsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Bids) > 0 { + for _, e := range m.Bids { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *AuctionsByBidderRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BidderAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *AuctionsByBidderResponse) 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 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *BalanceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *BalanceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Balance) > 0 { + for _, e := range m.Balance { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *AuctionsRequest) 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: AuctionsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.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 *AuctionsResponse) 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: AuctionsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionsResponse: 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 + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.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 *AuctionRequest) 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: AuctionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", 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.Id = 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 *AuctionResponse) 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: AuctionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionResponse: 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 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.Auction == nil { + m.Auction = &Auction{} + } + if err := m.Auction.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 *BidRequest) 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: BidRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BidRequest: 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 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.AuctionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bidder", 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.Bidder = 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 *BidResponse) 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: BidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bid", 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.Bid == nil { + m.Bid = &Bid{} + } + if err := m.Bid.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 *BidsRequest) 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: BidsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BidsRequest: 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 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.AuctionId = 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 *BidsResponse) 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: BidsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BidsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bids", 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 + } + m.Bids = append(m.Bids, &Bid{}) + if err := m.Bids[len(m.Bids)-1].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 *AuctionsByBidderRequest) 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: AuctionsByBidderRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionsByBidderRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidderAddress", 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.BidderAddress = 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 *AuctionsByBidderResponse) 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: AuctionsByBidderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionsByBidderResponse: 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 + 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *QueryParamsResponse) 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", 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.Params == nil { + m.Params = &Params{} + } + if err := m.Params.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 *BalanceRequest) 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: BalanceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BalanceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *BalanceResponse) 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: BalanceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", 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 + } + m.Balance = append(m.Balance, types.Coin{}) + if err := m.Balance[len(m.Balance)-1].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 skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/auction/types/query.pb.gw.go b/x/auction/types/query.pb.gw.go new file mode 100644 index 00000000..7f1ee808 --- /dev/null +++ b/x/auction/types/query.pb.gw.go @@ -0,0 +1,704 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: vulcanize/auction/v1beta1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage + +var ( + filter_Query_Auctions_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Auctions_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionsRequest + 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_Query_Auctions_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Auctions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Auctions_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionsRequest + 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_Query_Auctions_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Auctions(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetAuction_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.GetAuction(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetAuction_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := server.GetAuction(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetBid_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BidRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["auction_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "auction_id") + } + + protoReq.AuctionId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "auction_id", err) + } + + val, ok = pathParams["bidder"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bidder") + } + + protoReq.Bidder, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bidder", err) + } + + msg, err := client.GetBid(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetBid_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BidRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["auction_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "auction_id") + } + + protoReq.AuctionId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "auction_id", err) + } + + val, ok = pathParams["bidder"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bidder") + } + + protoReq.Bidder, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bidder", err) + } + + msg, err := server.GetBid(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetBids_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BidsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["auction_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "auction_id") + } + + protoReq.AuctionId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "auction_id", err) + } + + msg, err := client.GetBids(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetBids_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BidsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["auction_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "auction_id") + } + + protoReq.AuctionId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "auction_id", err) + } + + msg, err := server.GetBids(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_AuctionsByBidder_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionsByBidderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["bidder_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bidder_address") + } + + protoReq.BidderAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bidder_address", err) + } + + msg, err := client.AuctionsByBidder(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AuctionsByBidder_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionsByBidderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["bidder_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bidder_address") + } + + protoReq.BidderAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bidder_address", err) + } + + msg, err := server.AuctionsByBidder(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 + + msg, err := client.QueryParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryParams_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.QueryParams(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Balance_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BalanceRequest + var metadata runtime.ServerMetadata + + msg, err := client.Balance(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Balance_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BalanceRequest + var metadata runtime.ServerMetadata + + msg, err := server.Balance(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Auctions_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_Auctions_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_Auctions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAuction_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_GetAuction_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_GetAuction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBid_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_GetBid_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_GetBid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBids_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_GetBids_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_GetBids_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AuctionsByBidder_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_AuctionsByBidder_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_AuctionsByBidder_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() + 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_QueryParams_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_QueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Balance_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_Balance_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_Balance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Auctions_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_Auctions_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_Auctions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAuction_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_GetAuction_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_GetAuction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBid_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_GetBid_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_GetBid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBids_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_GetBids_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_GetBids_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AuctionsByBidder_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_AuctionsByBidder_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_AuctionsByBidder_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() + 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_QueryParams_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_QueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Balance_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_Balance_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_Balance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Auctions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "auction", "v1beta1", "auctions"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetAuction_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", "id"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetBid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"vulcanize", "auction", "v1beta1", "bids", "auction_id", "bidder"}, "", runtime.AssumeColonVerbOpt(true))) + + 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_QueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "auction", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Balance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "auction", "v1beta1", "balance"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_Auctions_0 = runtime.ForwardResponseMessage + + forward_Query_GetAuction_0 = runtime.ForwardResponseMessage + + forward_Query_GetBid_0 = runtime.ForwardResponseMessage + + forward_Query_GetBids_0 = runtime.ForwardResponseMessage + + forward_Query_AuctionsByBidder_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 new file mode 100644 index 00000000..e5de153e --- /dev/null +++ b/x/auction/types/tx.pb.go @@ -0,0 +1,1775 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/auction/v1beta1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + _ "google.golang.org/protobuf/types/known/durationpb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgCreateAuction defines a create auction message +type MsgCreateAuction 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"` + // Address of the signer + Signer string `protobuf:"bytes,6,opt,name=signer,proto3" json:"signer,omitempty" json:"signer" yaml:"signer"` +} + +func (m *MsgCreateAuction) Reset() { *m = MsgCreateAuction{} } +func (m *MsgCreateAuction) String() string { return proto.CompactTextString(m) } +func (*MsgCreateAuction) ProtoMessage() {} +func (*MsgCreateAuction) Descriptor() ([]byte, []int) { + return fileDescriptor_1684caa22ed7f7bf, []int{0} +} +func (m *MsgCreateAuction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateAuction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateAuction.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 *MsgCreateAuction) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateAuction.Merge(m, src) +} +func (m *MsgCreateAuction) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateAuction) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateAuction.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateAuction proto.InternalMessageInfo + +// MsgCreateAuctionResponse returns the details of the created auction +type MsgCreateAuctionResponse struct { + // Auction details + Auction *Auction `protobuf:"bytes,1,opt,name=auction,proto3" json:"auction,omitempty" json:"auction" yaml:"auction"` +} + +func (m *MsgCreateAuctionResponse) Reset() { *m = MsgCreateAuctionResponse{} } +func (m *MsgCreateAuctionResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateAuctionResponse) ProtoMessage() {} +func (*MsgCreateAuctionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1684caa22ed7f7bf, []int{1} +} +func (m *MsgCreateAuctionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateAuctionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateAuctionResponse.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 *MsgCreateAuctionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateAuctionResponse.Merge(m, src) +} +func (m *MsgCreateAuctionResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateAuctionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateAuctionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateAuctionResponse proto.InternalMessageInfo + +// CommitBid defines the message to commit a bid +type MsgCommitBid 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"` + // Commit Hash + CommitHash string `protobuf:"bytes,2,opt,name=commit_hash,json=commitHash,proto3" json:"commit_hash,omitempty" json:"commit_hash" yaml:"commit_hash"` + // Address of the signer + Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty" json:"signer" yaml:"signer"` +} + +func (m *MsgCommitBid) Reset() { *m = MsgCommitBid{} } +func (m *MsgCommitBid) String() string { return proto.CompactTextString(m) } +func (*MsgCommitBid) ProtoMessage() {} +func (*MsgCommitBid) Descriptor() ([]byte, []int) { + return fileDescriptor_1684caa22ed7f7bf, []int{2} +} +func (m *MsgCommitBid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCommitBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCommitBid.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 *MsgCommitBid) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCommitBid.Merge(m, src) +} +func (m *MsgCommitBid) XXX_Size() int { + return m.Size() +} +func (m *MsgCommitBid) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCommitBid.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCommitBid proto.InternalMessageInfo + +// RevealBid defines the message to reveal a bid +type MsgRevealBid 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"` + // Commit Hash + Reveal string `protobuf:"bytes,2,opt,name=reveal,proto3" json:"reveal,omitempty" json:"reveal" yaml:"reveal"` + // Address of the signer + Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty" json:"signer" yaml:"signer"` +} + +func (m *MsgRevealBid) Reset() { *m = MsgRevealBid{} } +func (m *MsgRevealBid) String() string { return proto.CompactTextString(m) } +func (*MsgRevealBid) ProtoMessage() {} +func (*MsgRevealBid) Descriptor() ([]byte, []int) { + return fileDescriptor_1684caa22ed7f7bf, []int{3} +} +func (m *MsgRevealBid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRevealBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRevealBid.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 *MsgRevealBid) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRevealBid.Merge(m, src) +} +func (m *MsgRevealBid) XXX_Size() int { + return m.Size() +} +func (m *MsgRevealBid) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRevealBid.DiscardUnknown(m) +} + +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"` +} + +func (m *MsgCommitBidResponse) Reset() { *m = MsgCommitBidResponse{} } +func (m *MsgCommitBidResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCommitBidResponse) ProtoMessage() {} +func (*MsgCommitBidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1684caa22ed7f7bf, []int{4} +} +func (m *MsgCommitBidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCommitBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCommitBidResponse.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 *MsgCommitBidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCommitBidResponse.Merge(m, src) +} +func (m *MsgCommitBidResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCommitBidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCommitBidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCommitBidResponse proto.InternalMessageInfo + +// MsgRevealBidResponse returns the state of the auction after the bid reveal +type MsgRevealBidResponse struct { + // Auction details + Auction *Auction `protobuf:"bytes,1,opt,name=auction,proto3" json:"auction,omitempty" json:"auction" yaml:"auction"` +} + +func (m *MsgRevealBidResponse) Reset() { *m = MsgRevealBidResponse{} } +func (m *MsgRevealBidResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRevealBidResponse) ProtoMessage() {} +func (*MsgRevealBidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1684caa22ed7f7bf, []int{5} +} +func (m *MsgRevealBidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRevealBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRevealBidResponse.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 *MsgRevealBidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRevealBidResponse.Merge(m, src) +} +func (m *MsgRevealBidResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRevealBidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRevealBidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRevealBidResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateAuction)(nil), "vulcanize.auction.v1beta1.MsgCreateAuction") + proto.RegisterType((*MsgCreateAuctionResponse)(nil), "vulcanize.auction.v1beta1.MsgCreateAuctionResponse") + proto.RegisterType((*MsgCommitBid)(nil), "vulcanize.auction.v1beta1.MsgCommitBid") + proto.RegisterType((*MsgRevealBid)(nil), "vulcanize.auction.v1beta1.MsgRevealBid") + proto.RegisterType((*MsgCommitBidResponse)(nil), "vulcanize.auction.v1beta1.MsgCommitBidResponse") + proto.RegisterType((*MsgRevealBidResponse)(nil), "vulcanize.auction.v1beta1.MsgRevealBidResponse") +} + +func init() { + proto.RegisterFile("vulcanize/auction/v1beta1/tx.proto", fileDescriptor_1684caa22ed7f7bf) +} + +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, 0x30, + 0x20, 0x58, 0x44, 0x5e, 0xb6, 0x8b, 0xfb, 0x59, 0xe2, 0x8a, 0x3a, 0x38, 0xf7, 0x19, 0x8f, 0x18, + 0xc7, 0x9e, 0xcb, 0x49, 0x41, 0xe7, 0x33, 0xaa, 0xce, 0x17, 0x2f, 0x11, 0x75, 0xb8, 0x47, 0xb8, + 0x84, 0x99, 0x1f, 0xa6, 0xd1, 0xec, 0x0e, 0x0f, 0xb6, 0x12, 0xe2, 0xa6, 0xe4, 0x89, 0x04, 0xb6, + 0x8f, 0x34, 0x34, 0xeb, 0xb3, 0x28, 0xa2, 0x29, 0xef, 0x29, 0xda, 0x8e, 0xb6, 0xa0, 0x2d, 0xcf, + 0xac, 0xcd, 0x5b, 0x52, 0x97, 0xa5, 0x74, 0x59, 0x4f, 0x01, 0x60, 0x3f, 0x3e, 0x1e, 0x1a, 0x8d, + 0xf3, 0xa1, 0x81, 0x5f, 0x71, 0x16, 0x6f, 0x9a, 0xf5, 0x06, 0xe6, 0xc2, 0xa1, 0x1b, 0x0d, 0x7e, + 0x91, 0xff, 0xf8, 0xcd, 0xd0, 0x9c, 0xdb, 0x90, 0x56, 0xdd, 0x84, 0x86, 0x84, 0xec, 0x13, 0x77, + 0x50, 0xd1, 0x30, 0x71, 0x45, 0x0d, 0xf5, 0x06, 0x4a, 0xc3, 0x85, 0xbc, 0xd4, 0x00, 0xe9, 0x42, + 0x03, 0x41, 0x48, 0xca, 0xea, 0xed, 0x12, 0xd2, 0x99, 0x04, 0x72, 0xb9, 0x78, 0x2b, 0x5f, 0xbc, + 0xba, 0x43, 0x6b, 0x8b, 0xd1, 0xd8, 0x5e, 0x01, 0xf2, 0xfb, 0xd5, 0x05, 0xe4, 0xa5, 0xa3, 0xa3, + 0x8b, 0x8c, 0xd3, 0x92, 0xc1, 0x36, 0x21, 0x39, 0x8d, 0x64, 0x16, 0x34, 0x53, 0x57, 0xa4, 0x29, + 0x4b, 0x47, 0xa7, 0x03, 0x1a, 0x19, 0xe4, 0x34, 0x14, 0xcd, 0x44, 0x34, 0xa6, 0x51, 0x16, 0xf5, + 0x3c, 0xda, 0xef, 0x4c, 0x8f, 0xe3, 0x79, 0x04, 0x3c, 0x8b, 0x92, 0xa7, 0x52, 0xab, 0x88, 0xaa, + 0x29, 0x07, 0x41, 0x64, 0xd3, 0x7e, 0x7b, 0x03, 0x35, 0x39, 0x0d, 0x62, 0x92, 0x74, 0x9a, 0x0b, + 0xda, 0x72, 0xcb, 0x36, 0xce, 0x87, 0xc6, 0x1d, 0xd9, 0x46, 0xe6, 0x55, 0x07, 0x88, 0x1c, 0x80, + 0x6f, 0x4e, 0xbd, 0xfb, 0x64, 0x34, 0xcc, 0x23, 0x0d, 0x75, 0xea, 0xa6, 0x74, 0x08, 0xdf, 0x63, + 0x31, 0x27, 0xed, 0x1e, 0xba, 0x01, 0x86, 0x06, 0x4b, 0x9a, 0xd6, 0x6f, 0xbf, 0x2d, 0x0b, 0x8a, + 0xed, 0x7b, 0xe7, 0x43, 0xe3, 0xae, 0x14, 0x00, 0x10, 0xa5, 0x40, 0x85, 0x8e, 0xea, 0x0a, 0x1a, + 0x7e, 0x68, 0xe8, 0x66, 0xae, 0x41, 0xdc, 0x52, 0x3e, 0xd3, 0x36, 0x42, 0x80, 0xe8, 0xd1, 0xbe, + 0xa0, 0x6e, 0xd9, 0x4b, 0xe5, 0x35, 0x94, 0x67, 0xb5, 0xce, 0x79, 0xc6, 0x69, 0x41, 0xf0, 0xbc, + 0xdf, 0x7e, 0x81, 0x66, 0xc0, 0x07, 0xa1, 0xcb, 0x43, 0x61, 0xe9, 0x96, 0xfd, 0xa0, 0xdc, 0x73, + 0xe5, 0xb0, 0xe6, 0x1b, 0x91, 0x72, 0xc0, 0x92, 0xcf, 0x5c, 0x1e, 0x56, 0xf6, 0x3c, 0xf9, 0x37, + 0x7b, 0xfe, 0x22, 0x67, 0x74, 0x84, 0x45, 0xfe, 0xe7, 0x8c, 0x1b, 0xa8, 0x29, 0x7d, 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, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // CreateAuction is the command for creating an auction + CreateAuction(ctx context.Context, in *MsgCreateAuction, opts ...grpc.CallOption) (*MsgCreateAuctionResponse, error) + // CommitBid is the command for committing a bid + CommitBid(ctx context.Context, in *MsgCommitBid, opts ...grpc.CallOption) (*MsgCommitBidResponse, error) + //RevealBid is the command for revealing a bid + RevealBid(ctx context.Context, in *MsgRevealBid, opts ...grpc.CallOption) (*MsgRevealBidResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateAuction(ctx context.Context, in *MsgCreateAuction, opts ...grpc.CallOption) (*MsgCreateAuctionResponse, error) { + out := new(MsgCreateAuctionResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Msg/CreateAuction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CommitBid(ctx context.Context, in *MsgCommitBid, opts ...grpc.CallOption) (*MsgCommitBidResponse, error) { + out := new(MsgCommitBidResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Msg/CommitBid", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RevealBid(ctx context.Context, in *MsgRevealBid, opts ...grpc.CallOption) (*MsgRevealBidResponse, error) { + out := new(MsgRevealBidResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Msg/RevealBid", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateAuction is the command for creating an auction + CreateAuction(context.Context, *MsgCreateAuction) (*MsgCreateAuctionResponse, error) + // CommitBid is the command for committing a bid + CommitBid(context.Context, *MsgCommitBid) (*MsgCommitBidResponse, error) + //RevealBid is the command for revealing a bid + RevealBid(context.Context, *MsgRevealBid) (*MsgRevealBidResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateAuction(ctx context.Context, req *MsgCreateAuction) (*MsgCreateAuctionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateAuction not implemented") +} +func (*UnimplementedMsgServer) CommitBid(ctx context.Context, req *MsgCommitBid) (*MsgCommitBidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CommitBid not implemented") +} +func (*UnimplementedMsgServer) RevealBid(ctx context.Context, req *MsgRevealBid) (*MsgRevealBidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RevealBid not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateAuction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateAuction) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateAuction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Msg/CreateAuction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateAuction(ctx, req.(*MsgCreateAuction)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CommitBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCommitBid) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CommitBid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Msg/CommitBid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CommitBid(ctx, req.(*MsgCommitBid)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RevealBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRevealBid) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RevealBid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Msg/RevealBid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RevealBid(ctx, req.(*MsgRevealBid)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "vulcanize.auction.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateAuction", + Handler: _Msg_CreateAuction_Handler, + }, + { + MethodName: "CommitBid", + Handler: _Msg_CommitBid_Handler, + }, + { + MethodName: "RevealBid", + Handler: _Msg_RevealBid_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "vulcanize/auction/v1beta1/tx.proto", +} + +func (m *MsgCreateAuction) 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 *MsgCreateAuction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateAuction) 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] = 0x32 + } + { + size, err := m.MinimumBid.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.RevealsDuration, dAtA[i-github_com_gogo_protobuf_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_gogo_protobuf_types.StdDurationMarshalTo(m.CommitsDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.CommitsDuration):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintTx(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgCreateAuctionResponse) 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 *MsgCreateAuctionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateAuctionResponse) 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 (m *MsgCommitBid) 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 *MsgCommitBid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCommitBid) 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] = 0x1a + } + if len(m.CommitHash) > 0 { + i -= len(m.CommitHash) + copy(dAtA[i:], m.CommitHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.CommitHash))) + 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 *MsgRevealBid) 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 *MsgRevealBid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRevealBid) 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] = 0x1a + } + if len(m.Reveal) > 0 { + i -= len(m.Reveal) + copy(dAtA[i:], m.Reveal) + i = encodeVarintTx(dAtA, i, uint64(len(m.Reveal))) + 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 *MsgCommitBidResponse) 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 *MsgCommitBidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCommitBidResponse) 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 (m *MsgRevealBidResponse) 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 *MsgRevealBidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRevealBidResponse) 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 { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCreateAuction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.CommitsDuration) + n += 1 + l + sovTx(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.RevealsDuration) + n += 1 + l + sovTx(uint64(l)) + l = m.CommitFee.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.RevealFee.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MinimumBid.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCreateAuctionResponse) 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 (m *MsgCommitBid) 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.CommitHash) + 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 *MsgRevealBid) 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.Reveal) + 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 *MsgCommitBidResponse) 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 (m *MsgRevealBidResponse) 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) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCreateAuction) 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: MsgCreateAuction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateAuction: illegal tag %d (wire type %d)", fieldNum, wire) + } + 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 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 err := github_com_gogo_protobuf_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 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 err := github_com_gogo_protobuf_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 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 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 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 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 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 err := m.MinimumBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + 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 *MsgCreateAuctionResponse) 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: MsgCreateAuctionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateAuctionResponse: 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 (m *MsgCommitBid) 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: MsgCommitBid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCommitBid: 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 CommitHash", 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.CommitHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 *MsgRevealBid) 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: MsgRevealBid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRevealBid: 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 Reveal", 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.Reveal = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 *MsgCommitBidResponse) 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: MsgCommitBidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCommitBidResponse: 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 (m *MsgRevealBidResponse) 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: MsgRevealBidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRevealBidResponse: 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) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/auction/types/types.go b/x/auction/types/types.go new file mode 100644 index 00000000..6cdd63c5 --- /dev/null +++ b/x/auction/types/types.go @@ -0,0 +1,71 @@ +package types + +import ( + "crypto/sha256" + "encoding/hex" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Auction status values. +const ( + // Auction is in commit phase. + AuctionStatusCommitPhase = "commit" + + // Auction is in reveal phase. + AuctionStatusRevealPhase = "reveal" + + // Auction has ended (no reveals allowed). + AuctionStatusExpired = "expired" + + // Auction has completed (winner selected). + AuctionStatusCompleted = "completed" +) + +// Bid status values. +const ( + BidStatusCommitted = "commit" + BidStatusRevealed = "reveal" +) + +// AuctionID simplifies generation of auction IDs. +type AuctionID struct { + Address sdk.Address + AccNum uint64 + Sequence uint64 +} + +// Generate creates the auction ID. +func (auctionID AuctionID) Generate() string { + hasher := sha256.New() + str := fmt.Sprintf("%s:%d:%d", auctionID.Address.String(), auctionID.AccNum, auctionID.Sequence) + hasher.Write([]byte(str)) + return hex.EncodeToString(hasher.Sum(nil)) +} + +func (auction Auction) GetCreateTime() string { + return string(sdk.FormatTimeBytes(auction.CreateTime)) +} + +func (auction Auction) GetCommitsEndTime() string { + return string(sdk.FormatTimeBytes(auction.CommitsEndTime)) +} + +func (auction Auction) GetRevealsEndTime() string { + return string(sdk.FormatTimeBytes(auction.RevealsEndTime)) +} + +func (bid Bid) GetCommitTime() string { + return string(sdk.FormatTimeBytes(bid.CommitTime)) +} + +func (bid Bid) GetRevealTime() string { + return string(sdk.FormatTimeBytes(bid.RevealTime)) +} + +// AuctionBidInfo is used in the block changeset. +type AuctionBidInfo struct { + AuctionID string + BidderAddress string +} diff --git a/x/auction/types/types.pb.go b/x/auction/types/types.pb.go new file mode 100644 index 00000000..8e9465a7 --- /dev/null +++ b/x/auction/types/types.pb.go @@ -0,0 +1,1943 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/auction/v1beta1/types.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the auction module parameters +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 (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_4ef8053ad65dd4d3, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +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 +type Auction struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` + // Address of the creator of the auction + OwnerAddress string `protobuf:"bytes,3,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` + // Timestamp at which the auction was created + 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 + 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 + 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 + // Reveal fee is returned only if the bid is revealed + 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,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 + MinimumBid types.Coin `protobuf:"bytes,9,opt,name=minimum_bid,json=minimumBid,proto3" json:"minimum_bid" json:"minimum_bid" yaml:"minimum_bid"` + // Address of the winner + WinnerAddress string `protobuf:"bytes,10,opt,name=winner_address,json=winnerAddress,proto3" json:"winner_address,omitempty"` + // Winning bid, i.e., the highest bid + WinningBid types.Coin `protobuf:"bytes,11,opt,name=winning_bid,json=winningBid,proto3" json:"winning_bid" json:"winning_bid" yaml:"winning_bid"` + // Amount the winner pays, i.e. the second highest auction + WinningPrice types.Coin `protobuf:"bytes,12,opt,name=winning_price,json=winningPrice,proto3" json:"winning_price" json:"winning_price" yaml:"winning_price"` +} + +func (m *Auction) Reset() { *m = Auction{} } +func (m *Auction) String() string { return proto.CompactTextString(m) } +func (*Auction) ProtoMessage() {} +func (*Auction) Descriptor() ([]byte, []int) { + return fileDescriptor_4ef8053ad65dd4d3, []int{1} +} +func (m *Auction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Auction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Auction.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 *Auction) XXX_Merge(src proto.Message) { + xxx_messageInfo_Auction.Merge(m, src) +} +func (m *Auction) XXX_Size() int { + return m.Size() +} +func (m *Auction) XXX_DiscardUnknown() { + xxx_messageInfo_Auction.DiscardUnknown(m) +} + +var xxx_messageInfo_Auction proto.InternalMessageInfo + +type Auctions struct { + Auctions []Auction `protobuf:"bytes,1,rep,name=auctions,proto3" json:"auctions"` +} + +func (m *Auctions) Reset() { *m = Auctions{} } +func (m *Auctions) String() string { return proto.CompactTextString(m) } +func (*Auctions) ProtoMessage() {} +func (*Auctions) Descriptor() ([]byte, []int) { + return fileDescriptor_4ef8053ad65dd4d3, []int{2} +} +func (m *Auctions) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Auctions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Auctions.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 *Auctions) XXX_Merge(src proto.Message) { + xxx_messageInfo_Auctions.Merge(m, src) +} +func (m *Auctions) XXX_Size() int { + return m.Size() +} +func (m *Auctions) XXX_DiscardUnknown() { + xxx_messageInfo_Auctions.DiscardUnknown(m) +} + +var xxx_messageInfo_Auctions proto.InternalMessageInfo + +// Bid represents a sealed bid (commit) made during the auction +type Bid struct { + AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` + BidderAddress string `protobuf:"bytes,2,opt,name=bidder_address,json=bidderAddress,proto3" json:"bidder_address,omitempty"` + Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` + CommitHash string `protobuf:"bytes,4,opt,name=commit_hash,json=commitHash,proto3" json:"commit_hash,omitempty"` + CommitTime time.Time `protobuf:"bytes,5,opt,name=commit_time,json=commitTime,proto3,stdtime" json:"commit_time" json:"commit_time" yaml:"commit_time"` + CommitFee types.Coin `protobuf:"bytes,6,opt,name=commit_fee,json=commitFee,proto3" json:"commit_fee" json:"commit_fee" yaml:"commit_fee"` + RevealTime time.Time `protobuf:"bytes,7,opt,name=reveal_time,json=revealTime,proto3,stdtime" json:"reveal_time" json:"reveal_time" yaml:"reveal_time"` + RevealFee types.Coin `protobuf:"bytes,8,opt,name=reveal_fee,json=revealFee,proto3" json:"reveal_fee" json:"reveal_fee" yaml:"reveal_fee"` + BidAmount types.Coin `protobuf:"bytes,9,opt,name=bid_amount,json=bidAmount,proto3" json:"bid_amount" json:"bid_amount" yaml:"bid_amount"` +} + +func (m *Bid) Reset() { *m = Bid{} } +func (m *Bid) String() string { return proto.CompactTextString(m) } +func (*Bid) ProtoMessage() {} +func (*Bid) Descriptor() ([]byte, []int) { + return fileDescriptor_4ef8053ad65dd4d3, []int{3} +} +func (m *Bid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Bid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Bid.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 *Bid) XXX_Merge(src proto.Message) { + xxx_messageInfo_Bid.Merge(m, src) +} +func (m *Bid) XXX_Size() int { + return m.Size() +} +func (m *Bid) XXX_DiscardUnknown() { + xxx_messageInfo_Bid.DiscardUnknown(m) +} + +var xxx_messageInfo_Bid proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Params)(nil), "vulcanize.auction.v1beta1.Params") + proto.RegisterType((*Auction)(nil), "vulcanize.auction.v1beta1.Auction") + proto.RegisterType((*Auctions)(nil), "vulcanize.auction.v1beta1.Auctions") + proto.RegisterType((*Bid)(nil), "vulcanize.auction.v1beta1.Bid") +} + +func init() { + proto.RegisterFile("vulcanize/auction/v1beta1/types.proto", fileDescriptor_4ef8053ad65dd4d3) +} + +var fileDescriptor_4ef8053ad65dd4d3 = []byte{ + // 809 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4d, 0x4f, 0xdb, 0x4a, + 0x14, 0x8d, 0x49, 0x08, 0xf1, 0x98, 0xf0, 0x9e, 0xac, 0xa7, 0xa7, 0x80, 0xd4, 0x04, 0x05, 0x21, + 0x51, 0xb5, 0xb5, 0x05, 0xdd, 0xd1, 0x15, 0x29, 0x45, 0xed, 0x0e, 0x59, 0x55, 0x17, 0xdd, 0x44, + 0x63, 0x7b, 0x48, 0xa6, 0x8a, 0x3d, 0xa9, 0x67, 0x0c, 0xa5, 0xbb, 0xee, 0xba, 0x44, 0x5d, 0xb1, + 0x6b, 0x7f, 0x0e, 0xbb, 0xb2, 0xec, 0x8a, 0x56, 0xf0, 0x0f, 0xfa, 0x0b, 0x2a, 0xcf, 0x87, 0x33, + 0x36, 0xa0, 0x34, 0x0b, 0xd8, 0x65, 0xce, 0xcc, 0xbd, 0xe7, 0xdc, 0x99, 0x7b, 0x6e, 0x0c, 0xd6, + 0x0f, 0xd3, 0x51, 0x00, 0x63, 0xfc, 0x11, 0xb9, 0x30, 0x0d, 0x18, 0x26, 0xb1, 0x7b, 0xb8, 0xe9, + 0x23, 0x06, 0x37, 0x5d, 0x76, 0x3c, 0x46, 0xd4, 0x19, 0x27, 0x84, 0x11, 0x7b, 0x39, 0x3f, 0xe6, + 0xc8, 0x63, 0x8e, 0x3c, 0xb6, 0xf2, 0xdf, 0x80, 0x0c, 0x08, 0x3f, 0xe5, 0x66, 0xbf, 0x44, 0xc0, + 0x4a, 0x7b, 0x40, 0xc8, 0x60, 0x84, 0x5c, 0xbe, 0xf2, 0xd3, 0x03, 0x37, 0x4c, 0x13, 0xc8, 0xe3, + 0xc4, 0x7e, 0xa7, 0xbc, 0xcf, 0x70, 0x84, 0x28, 0x83, 0xd1, 0x58, 0x25, 0x08, 0x08, 0x8d, 0x08, + 0x75, 0x7d, 0x48, 0x51, 0x2e, 0x29, 0x20, 0x58, 0x26, 0xe8, 0x7e, 0xaf, 0x81, 0xfa, 0x3e, 0x4c, + 0x60, 0x44, 0xed, 0x4f, 0x06, 0xf8, 0x37, 0x20, 0x51, 0x84, 0x19, 0xed, 0x2b, 0x9a, 0x96, 0xb1, + 0x6a, 0x6c, 0x58, 0x5b, 0xcb, 0x8e, 0xe0, 0x71, 0x14, 0x8f, 0xb3, 0x2b, 0x0f, 0xf4, 0x9e, 0x9d, + 0x5d, 0x74, 0x2a, 0xbf, 0x2f, 0x3a, 0xee, 0x3b, 0x4a, 0xe2, 0xed, 0x6e, 0x39, 0x41, 0x77, 0xf5, + 0x18, 0x46, 0xa3, 0x1b, 0xf0, 0xd3, 0x9f, 0x1d, 0xc3, 0xfb, 0x47, 0xc2, 0x2a, 0x1b, 0xd7, 0x90, + 0xa0, 0x43, 0x04, 0x47, 0x9a, 0x86, 0xb9, 0x19, 0x35, 0x94, 0x13, 0x28, 0x0d, 0xd7, 0x70, 0xa1, + 0x41, 0xc2, 0xb9, 0x06, 0x04, 0x80, 0x90, 0xd5, 0x3f, 0x40, 0xa8, 0x55, 0x95, 0xe4, 0xe2, 0x1e, + 0x9d, 0xec, 0x1e, 0xd5, 0x9b, 0x39, 0xcf, 0x09, 0x8e, 0x7b, 0x8f, 0x24, 0xf9, 0x9a, 0x7e, 0x01, + 0x59, 0x68, 0xb1, 0x74, 0x8e, 0x78, 0xa6, 0x58, 0xec, 0x21, 0x94, 0xd1, 0x08, 0x66, 0x4e, 0x53, + 0x9b, 0x91, 0x66, 0x12, 0x5a, 0xac, 0x4e, 0xd2, 0x88, 0x45, 0x46, 0x83, 0x81, 0x15, 0xe1, 0x18, + 0x47, 0x69, 0xd4, 0xf7, 0x71, 0xd8, 0x9a, 0x9f, 0xc6, 0xf3, 0x44, 0xf2, 0xac, 0x0b, 0x1e, 0x2d, + 0x56, 0x11, 0xe9, 0x90, 0x07, 0xe4, 0xaa, 0x87, 0xc3, 0xed, 0xda, 0xe9, 0xb7, 0x4e, 0xa5, 0xfb, + 0xa5, 0x01, 0x16, 0x76, 0x44, 0x73, 0xdb, 0x4b, 0x60, 0x0e, 0x87, 0xbc, 0x87, 0x4c, 0x6f, 0x0e, + 0x87, 0xf6, 0xff, 0xa0, 0x4e, 0x19, 0x64, 0x29, 0xe5, 0x6f, 0x6a, 0x7a, 0x72, 0x65, 0xaf, 0x81, + 0x26, 0x39, 0x8a, 0x51, 0xd2, 0x87, 0x61, 0x98, 0x20, 0x4a, 0xf9, 0xad, 0x9b, 0xde, 0x22, 0x07, + 0x77, 0x04, 0x66, 0xc7, 0xc0, 0x0a, 0x12, 0x04, 0x19, 0xea, 0x67, 0x4d, 0x2e, 0x6f, 0x6c, 0xe5, + 0x5a, 0x57, 0xbc, 0x56, 0x0e, 0xe8, 0x6d, 0x16, 0x4b, 0xd1, 0x82, 0xf3, 0xa7, 0xd1, 0xa0, 0x93, + 0xac, 0x19, 0x80, 0x40, 0xb2, 0x1c, 0x05, 0x3f, 0xa0, 0x38, 0x14, 0xac, 0xf3, 0x53, 0x59, 0x6f, + 0x31, 0x84, 0xca, 0x50, 0x36, 0x44, 0x8e, 0x73, 0xfe, 0x25, 0x09, 0xbf, 0x88, 0xc3, 0x5c, 0x83, + 0x6a, 0xdb, 0x5c, 0x43, 0x7d, 0x56, 0x0d, 0xe5, 0x0c, 0x65, 0x43, 0x94, 0x34, 0x48, 0x58, 0x69, + 0x28, 0xfa, 0x61, 0xe1, 0x7e, 0xfc, 0xd0, 0xb8, 0x27, 0x3f, 0x98, 0x77, 0xe7, 0x07, 0x7b, 0x1d, + 0x2c, 0x1d, 0xe1, 0x58, 0x6f, 0x6b, 0xc0, 0xdb, 0xba, 0x29, 0x50, 0xd5, 0xd7, 0x18, 0x58, 0x19, + 0x80, 0xe3, 0x01, 0x57, 0x64, 0xcd, 0xa8, 0x48, 0x8b, 0x55, 0x8a, 0x74, 0xc8, 0x03, 0x72, 0x95, + 0x29, 0x7a, 0x0f, 0x9a, 0x6a, 0x6f, 0x9c, 0xe0, 0x00, 0xb5, 0x16, 0xa7, 0x91, 0x29, 0x0f, 0x3d, + 0x2c, 0x92, 0xf1, 0xe8, 0x32, 0x9d, 0x00, 0xbd, 0x45, 0xb9, 0xde, 0xcf, 0x96, 0xdb, 0xb5, 0xcf, + 0xd9, 0x50, 0x78, 0x03, 0x1a, 0x72, 0x26, 0x50, 0x7b, 0x17, 0x34, 0xe4, 0x9f, 0x1f, 0x6d, 0x19, + 0xab, 0xd5, 0x0d, 0x6b, 0xab, 0xeb, 0xdc, 0xfa, 0xbf, 0xe8, 0xc8, 0xb0, 0x5e, 0x2d, 0x13, 0xe2, + 0xe5, 0x91, 0x32, 0xef, 0xd7, 0x79, 0x50, 0xcd, 0x0a, 0x7b, 0x00, 0x80, 0xdc, 0xe9, 0xe7, 0x03, + 0xc7, 0x94, 0xc8, 0x2b, 0xfe, 0x12, 0x3e, 0x0e, 0x43, 0xed, 0x25, 0xc4, 0xfc, 0x69, 0x0a, 0x54, + 0xbd, 0xc4, 0x64, 0x3c, 0x55, 0x0b, 0xe3, 0xa9, 0x03, 0x2c, 0xd9, 0xb4, 0x43, 0x48, 0x87, 0x7c, + 0xf2, 0x98, 0x9e, 0x34, 0xc5, 0x4b, 0x48, 0x87, 0x7c, 0x34, 0x89, 0x03, 0x7f, 0x39, 0x24, 0xca, + 0xa3, 0x69, 0x12, 0x5c, 0x72, 0x89, 0x3e, 0x9a, 0x38, 0x72, 0x83, 0x25, 0xeb, 0x77, 0x65, 0xc9, + 0x18, 0x58, 0xd2, 0x45, 0xbc, 0xac, 0x85, 0x59, 0xcb, 0xd2, 0x82, 0x4b, 0xae, 0xd4, 0xca, 0x12, + 0x88, 0x2a, 0xeb, 0x3e, 0x46, 0x00, 0x02, 0xc0, 0xc7, 0x61, 0x1f, 0x46, 0x24, 0x8d, 0xd9, 0xf4, + 0x09, 0x50, 0xa2, 0x99, 0x84, 0x2a, 0x1a, 0x0d, 0xf1, 0x4c, 0x1f, 0x87, 0x3b, 0xfc, 0xb7, 0xe8, + 0xd0, 0xde, 0xde, 0xd9, 0x65, 0xdb, 0x38, 0xbf, 0x6c, 0x1b, 0xbf, 0x2e, 0xdb, 0xc6, 0xc9, 0x55, + 0xbb, 0x72, 0x7e, 0xd5, 0xae, 0xfc, 0xb8, 0x6a, 0x57, 0xde, 0x3e, 0x1e, 0x60, 0x36, 0x4c, 0x7d, + 0x27, 0x20, 0x91, 0xcb, 0x86, 0x30, 0xa1, 0x98, 0xba, 0x88, 0x0d, 0x51, 0x12, 0xe1, 0x98, 0xb9, + 0x1f, 0xf2, 0x0f, 0x49, 0xfe, 0x01, 0xe9, 0xd7, 0xf9, 0x75, 0x3f, 0xfd, 0x13, 0x00, 0x00, 0xff, + 0xff, 0xb9, 0xce, 0x8c, 0x23, 0x6a, 0x0a, 0x00, 0x00, +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.MinimumBid.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.RevealsDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.RevealsDuration):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintTypes(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x12 + n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.CommitsDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.CommitsDuration):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintTypes(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Auction) 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 *Auction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.WinningPrice.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + { + size, err := m.WinningBid.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + if len(m.WinnerAddress) > 0 { + i -= len(m.WinnerAddress) + copy(dAtA[i:], m.WinnerAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.WinnerAddress))) + i-- + dAtA[i] = 0x52 + } + { + size, err := m.MinimumBid.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + { + size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + { + size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.RevealsEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.RevealsEndTime):]) + if err11 != nil { + return 0, err11 + } + i -= n11 + i = encodeVarintTypes(dAtA, i, uint64(n11)) + i-- + dAtA[i] = 0x32 + n12, err12 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CommitsEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CommitsEndTime):]) + if err12 != nil { + return 0, err12 + } + i -= n12 + i = encodeVarintTypes(dAtA, i, uint64(n12)) + i-- + dAtA[i] = 0x2a + n13, err13 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreateTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreateTime):]) + if err13 != nil { + return 0, err13 + } + i -= n13 + i = encodeVarintTypes(dAtA, i, uint64(n13)) + i-- + dAtA[i] = 0x22 + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Auctions) 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 *Auctions) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Auctions) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Auctions) > 0 { + for iNdEx := len(m.Auctions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Auctions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Bid) 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 *Bid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Bid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.BidAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + { + size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + n16, err16 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.RevealTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.RevealTime):]) + if err16 != nil { + return 0, err16 + } + i -= n16 + i = encodeVarintTypes(dAtA, i, uint64(n16)) + i-- + dAtA[i] = 0x3a + { + size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + n18, err18 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CommitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CommitTime):]) + if err18 != nil { + return 0, err18 + } + i -= n18 + i = encodeVarintTypes(dAtA, i, uint64(n18)) + i-- + dAtA[i] = 0x2a + if len(m.CommitHash) > 0 { + i -= len(m.CommitHash) + copy(dAtA[i:], m.CommitHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.CommitHash))) + i-- + dAtA[i] = 0x22 + } + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0x1a + } + if len(m.BidderAddress) > 0 { + i -= len(m.BidderAddress) + copy(dAtA[i:], m.BidderAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.BidderAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.AuctionId) > 0 { + i -= len(m.AuctionId) + copy(dAtA[i:], m.AuctionId) + i = encodeVarintTypes(dAtA, i, uint64(len(m.AuctionId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.CommitsDuration) + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.RevealsDuration) + n += 1 + l + sovTypes(uint64(l)) + l = m.CommitFee.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.RevealFee.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.MinimumBid.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *Auction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Status) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreateTime) + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CommitsEndTime) + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.RevealsEndTime) + n += 1 + l + sovTypes(uint64(l)) + l = m.CommitFee.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.RevealFee.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.MinimumBid.Size() + n += 1 + l + sovTypes(uint64(l)) + l = len(m.WinnerAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.WinningBid.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.WinningPrice.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *Auctions) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Auctions) > 0 { + for _, e := range m.Auctions { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *Bid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AuctionId) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.BidderAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Status) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.CommitHash) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CommitTime) + n += 1 + l + sovTypes(uint64(l)) + l = m.CommitFee.Size() + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.RevealTime) + n += 1 + l + sovTypes(uint64(l)) + l = m.RevealFee.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.BidAmount.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) 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 ErrIntOverflowTypes + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + 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 ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_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 ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_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 ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + 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 ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + 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 ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinimumBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Auction) 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 ErrIntOverflowTypes + } + 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: Auction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Auction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Status = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreateTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreateTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitsEndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CommitsEndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RevealsEndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.RevealsEndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + 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 ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommitFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + 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 ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RevealFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + 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 ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinimumBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WinnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WinnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WinningBid", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.WinningBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WinningPrice", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.WinningPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Auctions) 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 ErrIntOverflowTypes + } + 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: Auctions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Auctions: 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 ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Auctions = append(m.Auctions, Auction{}) + if err := m.Auctions[len(m.Auctions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Bid) 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 ErrIntOverflowTypes + } + 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: Bid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Bid: 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 ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + 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 BidderAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BidderAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Status = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CommitHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CommitTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + 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 ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommitFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RevealTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.RevealTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + 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 ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RevealFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BidAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/bond/client/cli/query.go b/x/bond/client/cli/query.go index dd4d2a93..546f08ae 100644 --- a/x/bond/client/cli/query.go +++ b/x/bond/client/cli/query.go @@ -2,12 +2,13 @@ package cli import ( "fmt" + "strings" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" "github.com/spf13/cobra" "github.com/tharsis/ethermint/x/bond/types" - "strings" ) // GetQueryCmd returns the cli query commands for this module diff --git a/x/bond/keeper/grpc_query.go b/x/bond/keeper/grpc_query.go index 9019d3ed..9a19d7bc 100644 --- a/x/bond/keeper/grpc_query.go +++ b/x/bond/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/tharsis/ethermint/x/bond/types"