Unverified Commit 1e80a2a2 authored by Hieu Vu's avatar Hieu Vu Committed by GitHub
Browse files

Remove streamswap (#3146)

* remove proto files

* remove x/streamswap
parent 2ce796c8
Showing with 0 additions and 8715 deletions
+0 -8715
syntax = "proto3";
package osmosis.streamswap.v1;
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/osmosis-labs/osmosis/v12/x/streamswap/types";
option (gogoproto.goproto_getters_all) = false;
message EventCreateSale {
uint64 id = 1;
string creator = 2;
string token_in = 3;
cosmos.base.v1beta1.Coin token_out = 4 [ (gogoproto.nullable) = false ];
}
message EventSubscribe {
string sender = 1;
uint64 sale_id = 2;
string amount = 3;
}
message EventWithdraw {
string sender = 1;
uint64 sale_id = 2;
// amount of staked token_in withdrawn by user.
string amount = 3;
}
message EventExit {
string sender = 1;
uint64 sale_id = 2;
// amount of purchased token_out sent to the user
string purchased = 3;
}
message EventFinalizeSale {
uint64 sale_id = 1;
// amount of earned tokens_in
string income = 3;
}
syntax = "proto3";
package osmosis.streamswap.v1;
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "osmosis/streamswap/v1/state.proto";
import "osmosis/streamswap/v1/params.proto";
option go_package = "github.com/osmosis-labs/osmosis/v12/x/streamswap/types";
// GenesisState defines the streamswap module's genesis state.
message GenesisState {
repeated Sale sales = 1 [ (gogoproto.nullable) = false ];
repeated UserPositionKV user_positions = 2 [ (gogoproto.nullable) = false ];
uint64 next_sale_id = 3;
Params params = 4 [ (gogoproto.nullable) = false ];
}
// UserPositionKV is a record in genesis representing acc_address user position
// of a sale_id sale.
message UserPositionKV {
// user account address
string acc_address = 1;
uint64 sale_id = 2;
UserPosition user_position = 3 [ (gogoproto.nullable) = false ];
}
syntax = "proto3";
package osmosis.streamswap.v1;
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "google/protobuf/duration.proto";
option go_package = "github.com/osmosis-labs/osmosis/v12/x/streamswap/types";
// Params holds parameters for the streamswap module
message Params {
// fee charged when creating a new sale. The fee will go to the
// sale_fee_recipient unless it is not defined (empty).
repeated cosmos.base.v1beta1.Coin sale_creation_fee = 1 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.moretags) = "yaml:\"sale_creation_fee\"",
(gogoproto.nullable) = false
];
// bech32 address of the fee recipient
string sale_creation_fee_recipient = 2;
// minimum amount duration of time between the sale creation and the sale
// start time.
google.protobuf.Duration min_duration_until_start_time = 3
[ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ];
// minimum duration for every new sale.
google.protobuf.Duration min_sale_duration = 4
[ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ];
}
syntax = "proto3";
package osmosis.streamswap.v1;
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "osmosis/streamswap/v1/state.proto";
option go_package = "github.com/osmosis-labs/osmosis/v12/x/streamswap/types";
option (gogoproto.goproto_getters_all) = false;
// Query defines the gRPC querier service.
service Query {
// Returns list of Sales ordered by the creation time
rpc Sales(QuerySales) returns (QuerySalesResponse) {
option (google.api.http).get = "/cosmos/streamswap/v1/sales";
}
// Returns the specific Sale object
rpc Sale(QuerySale) returns (QuerySaleResponse) {
option (google.api.http).get = "/cosmos/streamswap/v1/sales/{sale_id}";
}
rpc UserPosition(QueryUserPosition) returns (QueryUserPositionResponse) {
option (google.api.http).get =
"/cosmos/streamswap/v1/sales/{sale_id}/{user}";
}
}
message QuerySales {
// pagination defines an pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}
message QuerySalesResponse {
repeated osmosis.streamswap.v1.Sale sales = 1
[ (gogoproto.nullable) = false ];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// Request type for Query/Sale
message QuerySale {
// Sale ID
uint64 sale_id = 1;
}
message QuerySaleResponse {
osmosis.streamswap.v1.Sale sale = 1 [ (gogoproto.nullable) = false ];
}
// Request type for Query/Sale
message QueryUserPosition {
// ID of the Sale
uint64 sale_id = 1;
// user account address
string user = 2;
}
message QueryUserPositionResponse {
osmosis.streamswap.v1.UserPosition user_position = 1
[ (gogoproto.nullable) = false ];
}
syntax = "proto3";
package osmosis.streamswap.v1;
import "google/protobuf/timestamp.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/osmosis-labs/osmosis/v12/x/streamswap/types";
option (gogoproto.goproto_getters_all) = false;
message Sale {
// Destination for the earned token_in
string treasury = 1;
uint64 id = 2;
// token_out is a token denom to be bootstraped. May be referred as base
// currency, or a sale token.
string token_out = 3;
// token_in is a token denom used to buy sale tokens (`token_out`). May be
// referred as quote_currency or payment token.
string token_in = 4;
// total number of `tokens_out` to be sold during the continuous sale.
string token_out_supply = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// start time when the token emission starts.
google.protobuf.Timestamp start_time = 6
[ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ];
// end time when the token emission ends. Can't be bigger than start +
// 139years (to avoid round overflow)
google.protobuf.Timestamp end_time = 7
[ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ];
// Round number when the sale was last time updated.
int64 round = 8;
// Last round of the Sale;
int64 end_round = 9;
// amout of remaining token_out to sell
string out_remaining = 10 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// amount of token_out sold
string out_sold = 11 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// out token per share
string out_per_share = 12 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// total amount of currently staked coins (token_in) but not spent coins.
string staked = 13 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// total amount of earned coins (token_in)
string income = 14 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// total amount of shares
string shares = 15 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// Name for the sale.
string name = 20;
// URL with sale and project details.
string url = 21;
}
// UserPosition represents user account in a sale
message UserPosition {
string shares = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// total number of currently staked tokens
string staked = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// last token/share ratio
string out_per_share = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// amount of token_in spent
string spent = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// Amount of accumulated, not withdrawn, purchased tokens (token_out)
string purchased = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}
syntax = "proto3";
package osmosis.streamswap.v1;
import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/osmosis-labs/osmosis/v12/x/streamswap/types";
option (gogoproto.goproto_getters_all) = false;
service Msg {
// CreateSale creates new token sale. Anyone can create a new sale.
// params.SaleBond OSMO will be charged as a bond (returned in FinalizeSale)
// to avoid spams.
// The sale follows the streamswap functionality explained in the
// x/launchapd/spec
rpc CreateSale(MsgCreateSale) returns (MsgCreateSaleResponse);
// Subscribe to a token sale. Any use at any time before the sale end can join
// the sale by sending `token_in` to the Sale through the Subscribe msg.
// During the sale, user `token_in` will be automatically charged every
// epoch to purchase `token_out`.
rpc Subscribe(MsgSubscribe) returns (google.protobuf.Empty);
// Withdraw sends back `amount` of unspent tokens_in to the user.
// If `amount` is empty, it will default to all unspent tokens.
// User can do it any time unless his deposit is empty.
rpc Withdraw(MsgWithdraw) returns (google.protobuf.Empty);
// ExitSale withdraws (by a user who subscribed to the sale) purchased
// tokens_out from the pool and remained tokens_in. Must be called after
// the sale end.
rpc ExitSale(MsgExitSale) returns (MsgExitSaleResponse);
// FinalizeSale clean ups the sale and sends income (earned tokens_in) to the
// Sale recipient. Returns error if called before the Sale end or it was
// already finalized. Anyone can call this method.
rpc FinalizeSale(MsgFinalizeSale) returns (MsgFinalizeSaleResponse);
}
message MsgCreateSale {
// Sale creator and the account which provides token (token_out) to the sale.
// When processing this message, token_out
string creator = 1;
// token_in is a denom used to buy `token_out`. May be referred as a
// "quote currency".
string token_in = 2;
// token_out is a coin supply (denom + amount) to sell. May be referred as
// "base currency". The whole supply will be transferred from the creator
// to the module and will be sold during the sale.
cosmos.base.v1beta1.Coin token_out = 3 [ (gogoproto.nullable) = false ];
// Maximum fee the creator is going to pay for creating a sale. The creator
// will be charged params.SaleCreationFee. Transaction will fail if
// max_fee is smaller than params.SaleCreationFee. If empty, the creator
// doesn't accept any fee.
repeated cosmos.base.v1beta1.Coin max_fee = 4
[ (gogoproto.nullable) = false ];
// start time when the token sale starts.
google.protobuf.Timestamp start_time = 5
[ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ];
// duration time that the sale takes place over
google.protobuf.Duration duration = 6
[ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ];
// Recipient is the account which receives earned `token_in` from when the
// sale is finalized. If not defined (empty) the creator
// account will be used.
string recipient = 7;
// Name for the sale, max 40 characters, min 4. Required.
string name = 8;
// URL with sale and project details. Can be a link a link to IPFS,
// hackmd, project page, blog post... Max 120 characters. Must be
// valid agains Go url.ParseRequestURI. Required.
string url = 9;
}
message MsgCreateSaleResponse {
uint64 sale_id = 1 [ (gogoproto.moretags) = "yaml:\"sale_id\"" ];
}
message MsgSubscribe {
// sender is an account address adding a deposit
string sender = 1;
// ID of an existing sale.
uint64 sale_id = 2 [ (gogoproto.moretags) = "yaml:\"sale_id\"" ];
// number of sale.token_in staked by a user.
string amount = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}
message MsgWithdraw {
// sender is an account address subscribed to the sale_id
string sender = 1;
// ID of a sale.
uint64 sale_id = 2 [ (gogoproto.moretags) = "yaml:\"sale_id\"" ];
// amount of tokens_in to withdraw. Must be at most the amount of not spent
// tokens, unless set to null - then all remaining balance will be withdrawn.
string amount = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = true
];
}
message MsgExitSale {
// sender is an account address exiting a sale
string sender = 1;
// ID of an existing sale.
uint64 sale_id = 2 [ (gogoproto.moretags) = "yaml:\"sale_id\"" ];
}
message MsgExitSaleResponse {
// Purchased amount of "out" tokens withdrawn to the user.
string purchased = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}
message MsgFinalizeSale {
// sender is an account signing the message and triggering the finalization.
string sender = 1;
// ID of an existing sale.
uint64 sale_id = 2 [ (gogoproto.moretags) = "yaml:\"sale_id\"" ];
}
message MsgFinalizeSaleResponse {
// Income amount of token_in sent to the sale recipient.
string income = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}
# Streamswap
## Abstract
Streamswap is a new way and innovative way of selling token sale.
The mechanism allows anyone to create a new Sale event and sell any
amount of tokens in a more democratic way than the traditional solutions.
## Context
Since the first ICO boom, token sale mechanism was one of the driving
force for web3 onboarding.
Promise of a cheap tokens which can quickly accrue value is very attractive
for casual any sort of investors. Easy way of fundrising (the funding team)
opened doors for cohorts of new teams to focus on building on web3.
Traditional mechanisms of token sale included:
- Automated ICO, where team decides about the issuance price and the sale
happens through a swap controlled by a smart contract.
- Regulated, centralized ICO - token sale controlled by a dedicated company,
which will preform all operations using centralized services meeting
regulatory requirements (KYC...). Example: Coinlist sales.
- Balancer style ICO: a novel solution to utilize Dutch Auction mechanism to
find a fair strike price.
The first two mechanisms are not well suited for early stage startups, where
the token sale price is usually defined by a founding team and can't be
impacted by the ecosystem wisdom. False marketing actions are usually setup
to support their initial price.
The latter mechanism is not democratic - big entities can control the
price movements or place big orders leaving smaller investors with nothing.
## Design
### Sale Creation
[Sale](https://github.com/osmosis-labs/osmosis/blob/main/proto/osmosis/streamswap/v1/state.proto#L11) object represent a particular token sale event and describes the main
required parameters guarding the sale process:
- `treasury`: address where the sale earnings will go. When the sale is over,
anyone can trigger a [`MsgFinalizeSale`](https://github.com/osmosis-labs/osmosis/blob/main/proto/osmosis/streamswap/v1/tx.proto#L42)
to clean up the sale state and move the earning to the treasury.
- `id`: unique identifier of the sale.
- `token_out`: denom to sale (distributed to the investors).
Also known as a base currency.
- `token_in`: payment denom - used to buy `token_out`.
Also known as quote currency.
- `token_out_supply`: total initial supply of `token_in` to sale.
- `start_time`: Unix timestamp when the sale starts.
- `end_time`: Unix timestamp when the sale ends.
- `name`: Name of the sale.
- `url`: an external resource describing a sale. Can be IPFS link or a
commonwealth post.
The `Sale` object contains also other internal attributes to describe the current
status of the sale.
Anyone can create a `Sale` by sending [`MsgCreateSale`](https://github.com/osmosis-labs/osmosis/blob/robert%2Fstreamswap-spec/proto/osmosis/streamswap/v1/tx.proto#L21) transaction.
When doing so, `token_out` amount of `Sale.token_out` tokens will be debited from
his account and escrowed in the module account to distribute to Sale investors.
Moreover the creator will be charged `sale_creation_fee` (module param) and the
fee will be transferred to `sale_creation_fee_recipient` (module param) account.
This fee is not recoverable.
See other [module parameters](https://github.com/osmosis-labs/osmosis/main/proto/osmosis/streamswap/v1/params.proto) which control the sale creation.
### Investing and distribution mechanism
Anyone can join a sale by sending a [MsgSubscribe](https://github.com/osmosis-labs/osmosis/blob/main/proto/osmosis/streamswap/v1/tx.proto#L13) transaction.
When doing so, the transaction author has to specify the `amount` he wants to spend in the sale.
That `amount` will be credited from tx author and pledged to the sale.
`MsgSubscribe` can be submitted at any time after the sale is created and before it's end time.
From that moment, the investor will join the **token sale distribution stream**:
- The distribution happens discretely in rounds. Each round is 1 second long.
We define: `total_rounds := (sale.end_time - sale.start_time) / round_duration`.
- During each round we stream `round_supply := sale.token_out_supply / total_rounds`.
- During each round each investor receives `round_supply * current_investor_pledge / total_remaining_sale_pledge` share of the `token_out`.
At any time an investor can increase his participation for the sale by sending again `MsgSubscribe`
(his pledge will increase accordingly) or cancel it by sending
[`MsgWithdraw`](https://github.com/osmosis-labs/osmosis/blob/main/proto/osmosis/streamswap/v1/tx.proto#32).
When cancelling, the module will send back unspent pledged tokens to the investor
and keep the purchased tokens until the sale end_time.
### Withdrawing purchased tokens
When participating in a sale, investors receives a stream of sale tokens.
These tokens are locked until sale end to avoid second market creating during
the sale. Once sale is finished (block time is after `sale.end_time`), every
investor can send [`MsgExitSale`](https://github.com/osmosis-labs/osmosis/blob/main/proto/osmosis/streamswap/v1/tx.proto#L37)
to close his position and withdraw purchased tokens to his account.
### Withdrawing sale proceedings
To withdraw earned token to the `sale.treasury` account anyone can send a
transaction with [`MsgFinalizeSale`](https://github.com/osmosis-labs/osmosis/blob/main/proto/osmosis/streamswap/v1/tx.proto#L42) after the `sale.end_time`.
This transaction will send `sale.income` tokens from the module escrow account
to the `sale.treasury` and set `sale.finalized = true`.
### Events
The module uses typed events. Please see [`event.proto`](https://github.com/osmosis-labs/osmosis/blob/main/proto/osmosis/streamswap/v1/event.proto)
to inspect list events.
## Consequences
- The new sale mechanism provides a truly democratic way for token distribution and sale.
- It can be easily integrated with AMM pools: proceedings from the sale can
automatically be pledged to AMM.
- After the sale ends, there are few algorithms to provide token indicative market price:
- average price: `sale.income / sale.token_out_supply`
- last streamed price: `round_supply(last_round) / (sale.token_out_supply / total_rounds)`
## Future directions
- providing incentive for sales with `OSMO` or `ATOM` used as a base currency.
This diff is collapsed.
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: osmosis/streamswap/v1/genesis.proto
package types
import (
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
_ "github.com/cosmos/cosmos-sdk/types"
_ "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 streamswap module's genesis state.
type GenesisState struct {
Sales []Sale `protobuf:"bytes,1,rep,name=sales,proto3" json:"sales"`
UserPositions []UserPositionKV `protobuf:"bytes,2,rep,name=user_positions,json=userPositions,proto3" json:"user_positions"`
NextSaleId uint64 `protobuf:"varint,3,opt,name=next_sale_id,json=nextSaleId,proto3" json:"next_sale_id,omitempty"`
Params Params `protobuf:"bytes,4,opt,name=params,proto3" json:"params"`
}
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_8e54537622481acf, []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) GetSales() []Sale {
if m != nil {
return m.Sales
}
return nil
}
func (m *GenesisState) GetUserPositions() []UserPositionKV {
if m != nil {
return m.UserPositions
}
return nil
}
func (m *GenesisState) GetNextSaleId() uint64 {
if m != nil {
return m.NextSaleId
}
return 0
}
func (m *GenesisState) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
// UserPositionKV is a record in genesis representing acc_address user position
// of a sale_id sale.
type UserPositionKV struct {
// user account address
AccAddress string `protobuf:"bytes,1,opt,name=acc_address,json=accAddress,proto3" json:"acc_address,omitempty"`
SaleId uint64 `protobuf:"varint,2,opt,name=sale_id,json=saleId,proto3" json:"sale_id,omitempty"`
UserPosition UserPosition `protobuf:"bytes,3,opt,name=user_position,json=userPosition,proto3" json:"user_position"`
}
func (m *UserPositionKV) Reset() { *m = UserPositionKV{} }
func (m *UserPositionKV) String() string { return proto.CompactTextString(m) }
func (*UserPositionKV) ProtoMessage() {}
func (*UserPositionKV) Descriptor() ([]byte, []int) {
return fileDescriptor_8e54537622481acf, []int{1}
}
func (m *UserPositionKV) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *UserPositionKV) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_UserPositionKV.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 *UserPositionKV) XXX_Merge(src proto.Message) {
xxx_messageInfo_UserPositionKV.Merge(m, src)
}
func (m *UserPositionKV) XXX_Size() int {
return m.Size()
}
func (m *UserPositionKV) XXX_DiscardUnknown() {
xxx_messageInfo_UserPositionKV.DiscardUnknown(m)
}
var xxx_messageInfo_UserPositionKV proto.InternalMessageInfo
func (m *UserPositionKV) GetAccAddress() string {
if m != nil {
return m.AccAddress
}
return ""
}
func (m *UserPositionKV) GetSaleId() uint64 {
if m != nil {
return m.SaleId
}
return 0
}
func (m *UserPositionKV) GetUserPosition() UserPosition {
if m != nil {
return m.UserPosition
}
return UserPosition{}
}
func init() {
proto.RegisterType((*GenesisState)(nil), "osmosis.streamswap.v1.GenesisState")
proto.RegisterType((*UserPositionKV)(nil), "osmosis.streamswap.v1.UserPositionKV")
}
func init() {
proto.RegisterFile("osmosis/streamswap/v1/genesis.proto", fileDescriptor_8e54537622481acf)
}
var fileDescriptor_8e54537622481acf = []byte{
// 401 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xc1, 0xaa, 0xd3, 0x40,
0x14, 0x86, 0x33, 0x6d, 0xad, 0x38, 0x69, 0xbb, 0x08, 0x8a, 0xb1, 0x62, 0x1a, 0x5b, 0x84, 0x6c,
0xcc, 0x90, 0x08, 0xba, 0x70, 0x65, 0x37, 0x22, 0x82, 0x94, 0x14, 0x5d, 0xb8, 0x09, 0x93, 0x64,
0x88, 0x81, 0x26, 0x13, 0x72, 0xa6, 0xb1, 0xbe, 0x85, 0x6b, 0x9f, 0xa8, 0xcb, 0x2e, 0x5d, 0x89,
0xb4, 0x6f, 0x71, 0x57, 0x97, 0x64, 0xa6, 0xdc, 0x16, 0x5a, 0xb8, 0xbb, 0x9c, 0x73, 0xbe, 0x39,
0xff, 0xff, 0xe7, 0xe0, 0x19, 0x87, 0x9c, 0x43, 0x06, 0x04, 0x44, 0xc5, 0x68, 0x0e, 0x3f, 0x69,
0x49, 0x6a, 0x8f, 0xa4, 0xac, 0x60, 0x90, 0x81, 0x5b, 0x56, 0x5c, 0x70, 0xe3, 0x89, 0x82, 0xdc,
0x3b, 0xc8, 0xad, 0xbd, 0xf1, 0xe3, 0x94, 0xa7, 0xbc, 0x25, 0x48, 0xf3, 0x25, 0xe1, 0xf1, 0xb3,
0xb8, 0xa5, 0x43, 0x39, 0x90, 0x85, 0x1a, 0x59, 0xb2, 0x22, 0x11, 0x05, 0x46, 0x6a, 0x2f, 0x62,
0x82, 0x7a, 0x24, 0xe6, 0x59, 0xa1, 0xe6, 0x2f, 0x2f, 0x9b, 0x01, 0x41, 0x05, 0x53, 0xc8, 0xf4,
0x32, 0x52, 0xd2, 0x8a, 0xe6, 0x4a, 0x66, 0x7a, 0x83, 0xf0, 0xe0, 0xa3, 0x0c, 0xb0, 0x6c, 0x9e,
0x1a, 0xef, 0xf0, 0x03, 0xa0, 0x2b, 0x06, 0x26, 0xb2, 0xbb, 0x8e, 0xee, 0x3f, 0x77, 0x2f, 0xe6,
0x71, 0x97, 0x74, 0xc5, 0xe6, 0xbd, 0xed, 0xbf, 0x89, 0x16, 0x48, 0xde, 0x08, 0xf0, 0x68, 0x0d,
0xac, 0x0a, 0x4b, 0x0e, 0x99, 0xc8, 0x78, 0x01, 0x66, 0xa7, 0xdd, 0xf0, 0xea, 0xca, 0x86, 0xaf,
0xc0, 0xaa, 0x85, 0x62, 0x3f, 0x7f, 0x53, 0xbb, 0x86, 0xeb, 0x93, 0x2e, 0x18, 0x36, 0x1e, 0x14,
0x6c, 0x23, 0xc2, 0x46, 0x21, 0xcc, 0x12, 0xb3, 0x6b, 0x23, 0xa7, 0x17, 0xe0, 0xa6, 0xd7, 0x18,
0xf8, 0x94, 0x18, 0xef, 0x71, 0x5f, 0xe6, 0x31, 0x7b, 0x36, 0x72, 0x74, 0xff, 0xc5, 0x15, 0xb5,
0x45, 0x0b, 0x29, 0x15, 0xf5, 0x64, 0xfa, 0x07, 0xe1, 0xd1, 0xb9, 0x0d, 0x63, 0x82, 0x75, 0x1a,
0xc7, 0x21, 0x4d, 0x92, 0x8a, 0x41, 0xf3, 0x13, 0x90, 0xf3, 0x28, 0xc0, 0x34, 0x8e, 0x3f, 0xc8,
0x8e, 0xf1, 0x14, 0x3f, 0x3c, 0xba, 0xe9, 0xb4, 0x6e, 0xfa, 0x20, 0x9d, 0x7c, 0xc1, 0xc3, 0xb3,
0xfc, 0xad, 0x59, 0xdd, 0x9f, 0xdd, 0x23, 0xbe, 0xb2, 0x35, 0x38, 0x0d, 0x3f, 0x5f, 0x6c, 0xf7,
0x16, 0xda, 0xed, 0x2d, 0xf4, 0x7f, 0x6f, 0xa1, 0xdf, 0x07, 0x4b, 0xdb, 0x1d, 0x2c, 0xed, 0xef,
0xc1, 0xd2, 0xbe, 0xbf, 0x4d, 0x33, 0xf1, 0x63, 0x1d, 0xb9, 0x31, 0xcf, 0x89, 0x5a, 0xfe, 0x7a,
0x45, 0x23, 0x38, 0x16, 0xa4, 0xf6, 0x7c, 0xb2, 0x39, 0xbd, 0xba, 0xf8, 0x55, 0x32, 0x88, 0xfa,
0xed, 0xc9, 0xdf, 0xdc, 0x06, 0x00, 0x00, 0xff, 0xff, 0x4f, 0xcf, 0x66, 0x28, 0xc8, 0x02, 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
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
if m.NextSaleId != 0 {
i = encodeVarintGenesis(dAtA, i, uint64(m.NextSaleId))
i--
dAtA[i] = 0x18
}
if len(m.UserPositions) > 0 {
for iNdEx := len(m.UserPositions) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.UserPositions[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if len(m.Sales) > 0 {
for iNdEx := len(m.Sales) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Sales[iNdEx].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 (m *UserPositionKV) 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 *UserPositionKV) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *UserPositionKV) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.UserPosition.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
if m.SaleId != 0 {
i = encodeVarintGenesis(dAtA, i, uint64(m.SaleId))
i--
dAtA[i] = 0x10
}
if len(m.AccAddress) > 0 {
i -= len(m.AccAddress)
copy(dAtA[i:], m.AccAddress)
i = encodeVarintGenesis(dAtA, i, uint64(len(m.AccAddress)))
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
if len(m.Sales) > 0 {
for _, e := range m.Sales {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if len(m.UserPositions) > 0 {
for _, e := range m.UserPositions {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
if m.NextSaleId != 0 {
n += 1 + sovGenesis(uint64(m.NextSaleId))
}
l = m.Params.Size()
n += 1 + l + sovGenesis(uint64(l))
return n
}
func (m *UserPositionKV) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.AccAddress)
if l > 0 {
n += 1 + l + sovGenesis(uint64(l))
}
if m.SaleId != 0 {
n += 1 + sovGenesis(uint64(m.SaleId))
}
l = m.UserPosition.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 Sales", 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.Sales = append(m.Sales, Sale{})
if err := m.Sales[len(m.Sales)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field UserPositions", 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.UserPositions = append(m.UserPositions, UserPositionKV{})
if err := m.UserPositions[len(m.UserPositions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field NextSaleId", wireType)
}
m.NextSaleId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.NextSaleId |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
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
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 (m *UserPositionKV) 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: UserPositionKV: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: UserPositionKV: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field AccAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
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 ErrInvalidLengthGenesis
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.AccAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field SaleId", wireType)
}
m.SaleId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.SaleId |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field UserPosition", 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.UserPosition.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")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: osmosis/streamswap/v1/params.proto
package types
import (
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
_ "github.com/cosmos/cosmos-sdk/codec/types"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
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 "github.com/gogo/protobuf/types"
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 holds parameters for the streamswap module
type Params struct {
// fee charged when creating a new sale. The fee will go to the
// sale_fee_recipient unless it is not defined (empty).
SaleCreationFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=sale_creation_fee,json=saleCreationFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"sale_creation_fee" yaml:"sale_creation_fee"`
// bech32 address of the fee recipient
SaleCreationFeeRecipient string `protobuf:"bytes,2,opt,name=sale_creation_fee_recipient,json=saleCreationFeeRecipient,proto3" json:"sale_creation_fee_recipient,omitempty"`
// minimum amount duration of time between the sale creation and the sale
// start time.
MinDurationUntilStartTime time.Duration `protobuf:"bytes,3,opt,name=min_duration_until_start_time,json=minDurationUntilStartTime,proto3,stdduration" json:"min_duration_until_start_time"`
// minimum duration for every new sale.
MinSaleDuration time.Duration `protobuf:"bytes,4,opt,name=min_sale_duration,json=minSaleDuration,proto3,stdduration" json:"min_sale_duration"`
}
func (m *Params) Reset() { *m = Params{} }
func (m *Params) String() string { return proto.CompactTextString(m) }
func (*Params) ProtoMessage() {}
func (*Params) Descriptor() ([]byte, []int) {
return fileDescriptor_e87cd402886b5ef9, []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) GetSaleCreationFee() github_com_cosmos_cosmos_sdk_types.Coins {
if m != nil {
return m.SaleCreationFee
}
return nil
}
func (m *Params) GetSaleCreationFeeRecipient() string {
if m != nil {
return m.SaleCreationFeeRecipient
}
return ""
}
func (m *Params) GetMinDurationUntilStartTime() time.Duration {
if m != nil {
return m.MinDurationUntilStartTime
}
return 0
}
func (m *Params) GetMinSaleDuration() time.Duration {
if m != nil {
return m.MinSaleDuration
}
return 0
}
func init() {
proto.RegisterType((*Params)(nil), "osmosis.streamswap.v1.Params")
}
func init() {
proto.RegisterFile("osmosis/streamswap/v1/params.proto", fileDescriptor_e87cd402886b5ef9)
}
var fileDescriptor_e87cd402886b5ef9 = []byte{
// 418 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x4f, 0x6b, 0xd4, 0x40,
0x14, 0xcf, 0xb8, 0x52, 0x34, 0x1e, 0x4a, 0x83, 0x42, 0xb6, 0x62, 0xb2, 0xe4, 0xb4, 0x97, 0xce,
0x90, 0x0a, 0x1e, 0x04, 0x2f, 0xad, 0x78, 0x12, 0x2c, 0xa9, 0x5e, 0xbc, 0x0c, 0x93, 0xf4, 0x35,
0x0e, 0x66, 0x66, 0x42, 0x66, 0x12, 0xdd, 0x6f, 0x21, 0x88, 0xe0, 0x67, 0xf0, 0x93, 0xf4, 0xd8,
0xa3, 0xa7, 0x56, 0x76, 0xbf, 0x81, 0x9f, 0x40, 0x32, 0x99, 0xd1, 0xd2, 0xbd, 0x78, 0x4a, 0xde,
0xfc, 0xfe, 0xbd, 0xf7, 0x78, 0x61, 0xa6, 0xb4, 0x50, 0x9a, 0x6b, 0xa2, 0x4d, 0x07, 0x4c, 0xe8,
0x4f, 0xac, 0x25, 0x43, 0x4e, 0x5a, 0xd6, 0x31, 0xa1, 0x71, 0xdb, 0x29, 0xa3, 0xa2, 0x47, 0x8e,
0x83, 0xff, 0x71, 0xf0, 0x90, 0xef, 0x3f, 0xac, 0x55, 0xad, 0x2c, 0x83, 0x8c, 0x7f, 0x13, 0x79,
0x7f, 0x5e, 0x2b, 0x55, 0x37, 0x40, 0x6c, 0x55, 0xf6, 0xe7, 0x84, 0xc9, 0x95, 0x87, 0x2a, 0x6b,
0x44, 0x27, 0xcd, 0x54, 0x38, 0x28, 0x99, 0x2a, 0x52, 0x32, 0x0d, 0x64, 0xc8, 0x4b, 0x30, 0x2c,
0x27, 0x95, 0xe2, 0xd2, 0xe3, 0xb7, 0x5d, 0xcf, 0xfa, 0x8e, 0x19, 0xae, 0x1c, 0x9e, 0x7d, 0x9b,
0x85, 0x3b, 0x27, 0xb6, 0xe7, 0xe8, 0x2b, 0x0a, 0xf7, 0x34, 0x6b, 0x80, 0x56, 0x1d, 0x58, 0x0a,
0x3d, 0x07, 0x88, 0xd1, 0x62, 0xb6, 0x7c, 0x70, 0x38, 0xc7, 0x2e, 0x75, 0xcc, 0xc1, 0x2e, 0x07,
0x1f, 0x2b, 0x2e, 0x8f, 0x5e, 0x5f, 0x5c, 0xa5, 0xc1, 0xef, 0xab, 0x34, 0x5e, 0x31, 0xd1, 0x3c,
0xcf, 0xb6, 0x1c, 0xb2, 0x1f, 0xd7, 0xe9, 0xb2, 0xe6, 0xe6, 0x43, 0x5f, 0xe2, 0x4a, 0x09, 0xd7,
0xbe, 0xfb, 0x1c, 0xe8, 0xb3, 0x8f, 0xc4, 0xac, 0x5a, 0xd0, 0xd6, 0x4c, 0x17, 0xbb, 0xa3, 0xfe,
0xd8, 0xc9, 0x5f, 0x01, 0x44, 0x2f, 0xc2, 0xc7, 0x5b, 0x96, 0xb4, 0x83, 0x8a, 0xb7, 0x1c, 0xa4,
0x89, 0xef, 0x2c, 0xd0, 0xf2, 0x7e, 0x11, 0xdf, 0x52, 0x15, 0x1e, 0x8f, 0x20, 0x7c, 0x22, 0xb8,
0xa4, 0x7e, 0x6a, 0xda, 0x4b, 0xc3, 0x1b, 0xaa, 0x0d, 0xeb, 0x0c, 0x35, 0x5c, 0x40, 0x3c, 0x5b,
0x20, 0x3b, 0xdf, 0xb4, 0x27, 0xec, 0xf7, 0x84, 0x5f, 0x3a, 0xc5, 0xd1, 0xbd, 0x71, 0xbe, 0xef,
0xd7, 0x29, 0x2a, 0xe6, 0x82, 0x4b, 0xff, 0xfc, 0x6e, 0xf4, 0x39, 0x1d, 0x6d, 0xde, 0x72, 0x01,
0xd1, 0x9b, 0x70, 0x6f, 0x8c, 0xb1, 0x9d, 0xfa, 0xac, 0xf8, 0xee, 0xff, 0x5b, 0xef, 0x0a, 0x2e,
0x4f, 0x59, 0x03, 0x7f, 0xa1, 0x93, 0x8b, 0x75, 0x82, 0x2e, 0xd7, 0x09, 0xfa, 0xb5, 0x4e, 0xd0,
0x97, 0x4d, 0x12, 0x5c, 0x6e, 0x92, 0xe0, 0xe7, 0x26, 0x09, 0xde, 0x3f, 0xbb, 0xb1, 0x4b, 0x77,
0x5f, 0x07, 0x0d, 0x2b, 0xb5, 0x2f, 0xc8, 0x90, 0x1f, 0x92, 0xcf, 0x37, 0xcf, 0xd2, 0xee, 0xb7,
0xdc, 0xb1, 0xf9, 0x4f, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x87, 0x6c, 0xd4, 0x78, 0xb9, 0x02,
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
n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MinSaleDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MinSaleDuration):])
if err1 != nil {
return 0, err1
}
i -= n1
i = encodeVarintParams(dAtA, i, uint64(n1))
i--
dAtA[i] = 0x22
n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MinDurationUntilStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MinDurationUntilStartTime):])
if err2 != nil {
return 0, err2
}
i -= n2
i = encodeVarintParams(dAtA, i, uint64(n2))
i--
dAtA[i] = 0x1a
if len(m.SaleCreationFeeRecipient) > 0 {
i -= len(m.SaleCreationFeeRecipient)
copy(dAtA[i:], m.SaleCreationFeeRecipient)
i = encodeVarintParams(dAtA, i, uint64(len(m.SaleCreationFeeRecipient)))
i--
dAtA[i] = 0x12
}
if len(m.SaleCreationFee) > 0 {
for iNdEx := len(m.SaleCreationFee) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.SaleCreationFee[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintParams(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func encodeVarintParams(dAtA []byte, offset int, v uint64) int {
offset -= sovParams(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
if len(m.SaleCreationFee) > 0 {
for _, e := range m.SaleCreationFee {
l = e.Size()
n += 1 + l + sovParams(uint64(l))
}
}
l = len(m.SaleCreationFeeRecipient)
if l > 0 {
n += 1 + l + sovParams(uint64(l))
}
l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MinDurationUntilStartTime)
n += 1 + l + sovParams(uint64(l))
l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MinSaleDuration)
n += 1 + l + sovParams(uint64(l))
return n
}
func sovParams(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozParams(x uint64) (n int) {
return sovParams(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 ErrIntOverflowParams
}
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 SaleCreationFee", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.SaleCreationFee = append(m.SaleCreationFee, types.Coin{})
if err := m.SaleCreationFee[len(m.SaleCreationFee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SaleCreationFeeRecipient", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
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 ErrInvalidLengthParams
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.SaleCreationFeeRecipient = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MinDurationUntilStartTime", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.MinDurationUntilStartTime, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MinSaleDuration", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowParams
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthParams
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthParams
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.MinSaleDuration, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipParams(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthParams
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipParams(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, ErrIntOverflowParams
}
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, ErrIntOverflowParams
}
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, ErrIntOverflowParams
}
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, ErrInvalidLengthParams
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupParams
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthParams
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowParams = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
)
This diff is collapsed.
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: osmosis/streamswap/v1/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/metadata"
"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 _ = metadata.Join
var (
filter_Query_Sales_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_Sales_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QuerySales
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_Sales_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.Sales(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Sales_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QuerySales
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_Sales_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Sales(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_Sale_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QuerySale
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["sale_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sale_id")
}
protoReq.SaleId, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sale_id", err)
}
msg, err := client.Sale(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Sale_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QuerySale
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["sale_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sale_id")
}
protoReq.SaleId, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sale_id", err)
}
msg, err := server.Sale(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_UserPosition_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryUserPosition
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["sale_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sale_id")
}
protoReq.SaleId, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sale_id", err)
}
val, ok = pathParams["user"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user")
}
protoReq.User, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user", err)
}
msg, err := client.UserPosition(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_UserPosition_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryUserPosition
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["sale_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sale_id")
}
protoReq.SaleId, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sale_id", err)
}
val, ok = pathParams["user"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user")
}
protoReq.User, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user", err)
}
msg, err := server.UserPosition(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 to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
mux.Handle("GET", pattern_Query_Sales_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_Sales_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Sales_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_Sale_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_Sale_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Sale_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_UserPosition_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_UserPosition_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_UserPosition_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_Sales_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_Sales_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_Sales_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_Sale_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_Sale_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_Sale_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_UserPosition_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_UserPosition_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_UserPosition_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Query_Sales_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "streamswap", "v1", "sales"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Sale_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "streamswap", "v1", "sales", "sale_id"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_UserPosition_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{"cosmos", "streamswap", "v1", "sales", "sale_id", "user"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
forward_Query_Sales_0 = runtime.ForwardResponseMessage
forward_Query_Sale_0 = runtime.ForwardResponseMessage
forward_Query_UserPosition_0 = runtime.ForwardResponseMessage
)
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment