From 9baf8c3dad1ef5abd9c4732ae54a2b7098d1b4b9 Mon Sep 17 00:00:00 2001 From: Muku <44918265+muku314115@users.noreply.github.com> Date: Fri, 21 Jul 2023 18:32:41 +0530 Subject: [PATCH] submodule: crescent (#491) * initial approach * shortened * validation * callback tests * adding validation * params test * claim tests * minor fixes * gofumpt * lint * removing unused interface * resolving comments * resolving comments * resolving comments * additional test cases * prooftypeposition and denom validation * validation * validation * gofumpt * resolving comments * lint * validation tests * separate directory for claims logic * updating comment * lint * lint * lint * lint * fixing imports * fixing imports * lint * fix conflict with externalised multierror mod --------- Co-authored-by: Alex Johnson Co-authored-by: Ajaz Ahmed Ansari Co-authored-by: Joe Bowman --- .../v1/participationrewards.proto | 3 + .../crescent-types/liquidity/types/keys.go | 20 + .../liquidity/types/liquidity.pb.go | 3722 ++++++++++++++ .../crescent-types/liquidity/types/pool.go | 32 + .../crescent-types/lpfarm/keys.go | 20 + .../crescent-types/lpfarm/lpfarm.pb.go | 2100 ++++++++ .../crescent-types/lpfarm/params.go | 117 + .../crescent-types/lpfarm/query.pb.go | 4297 +++++++++++++++++ .../crescent-types/lpfarm/query.pb.gw.go | 994 ++++ .../crescent-types/validation.go | 96 + .../osmosis-types}/gamm/codec.go | 0 .../osmosis-types}/gamm/constants.go | 0 .../osmosis-types}/gamm/errors.go | 0 .../osmosis-types}/gamm/events.go | 0 .../osmosis-types}/gamm/expected_keepers.go | 0 .../osmosis-types}/gamm/genesis.pb.go | 0 .../osmosis-types}/gamm/hooks.go | 0 .../osmosis-types}/gamm/key.go | 0 .../osmosis-types}/gamm/key_test.go | 0 .../osmosis-types}/gamm/msg_create_pool.go | 0 .../osmosis-types}/gamm/msg_lp.go | 0 .../osmosis-types}/gamm/msg_swap.go | 0 .../osmosis-types}/gamm/msgs.go | 0 .../gamm/pool-models/balancer/amm.go | 6 +- .../pool-models/balancer/balancerPool.pb.go | 0 .../gamm/pool-models/balancer/codec.go | 3 +- .../gamm/pool-models/balancer/constants.go | 0 .../gamm/pool-models/balancer/doc.go | 0 .../gamm/pool-models/balancer/marshal.go | 0 .../gamm/pool-models/balancer/msgs.go | 3 +- .../gamm/pool-models/balancer/pool.go | 5 +- .../gamm/pool-models/balancer/pool_asset.go | 4 +- .../gamm/pool-models/balancer/pool_params.go | 4 +- .../gamm/pool-models/balancer/tx.pb.go | 0 .../pool-models/internal/cfmm_common/lp.go | 6 +- .../internal/cfmm_common/lp_test.go | 18 +- .../gamm/pool-models/stableswap/README.md | 0 .../gamm/pool-models/stableswap/amm.go | 6 +- .../gamm/pool-models/stableswap/cfmm.py | 0 .../gamm/pool-models/stableswap/codec.go | 3 +- .../gamm/pool-models/stableswap/msgs.go | 2 +- .../gamm/pool-models/stableswap/pool.go | 9 +- .../pool-models/stableswap/pool_params.go | 3 +- .../stableswap/stableswap_pool.pb.go | 0 .../gamm/pool-models/stableswap/tx.pb.go | 0 .../osmosis-types}/gamm/pool.go | 0 .../osmosis-types}/gamm/query.pb.go | 0 .../osmosis-types}/gamm/query.pb.gw.go | 0 .../osmosis-types}/gamm/route.go | 0 .../osmosis-types}/gamm/tx.pb.go | 0 .../osmosis-types}/lockup/codec.go | 0 .../osmosis-types}/lockup/errors.go | 0 .../osmosis-types}/lockup/events.go | 0 .../osmosis-types}/lockup/expected_keepers.go | 0 .../osmosis-types}/lockup/genesis.go | 0 .../osmosis-types}/lockup/genesis.pb.go | 0 .../osmosis-types}/lockup/hooks.go | 0 .../osmosis-types}/lockup/keys.go | 0 .../osmosis-types}/lockup/lock.go | 0 .../osmosis-types}/lockup/lock.pb.go | 0 .../osmosis-types}/lockup/lockI.go | 0 .../osmosis-types}/lockup/msgs.go | 0 .../osmosis-types}/lockup/querier.go | 0 .../osmosis-types}/lockup/query.pb.go | 0 .../osmosis-types}/lockup/query.pb.gw.go | 0 .../osmosis-types}/lockup/tx.pb.go | 0 .../osmosis-types}/osmomath/decimal.go | 0 .../osmosis-types}/osmomath/int.go | 0 .../osmosis-types}/osmomath/int_test.go | 0 .../osmosis-types}/osmomath/math.go | 0 .../osmosis-types}/osmomath/sigfig_round.go | 0 .../osmosis-types}/osmoutils/binary_search.go | 0 .../osmosis-types}/osmoutils/cache_ctx.go | 0 .../osmosis-types}/osmoutils/cli_helpers.go | 0 .../osmosis-types}/osmoutils/coin_helper.go | 0 .../osmoutils/encoding_helper.go | 0 .../osmoutils/module_account.go | 0 .../osmosis-types}/osmoutils/parse.go | 0 .../osmoutils/partialord/internal/dag/dag.go | 0 .../partialord/internal/dag/module.go | 0 .../osmoutils/partialord/module.go | 0 .../osmoutils/partialord/partialord.go | 2 +- .../osmosis-types}/osmoutils/slice_helper.go | 0 .../osmosis-types}/osmoutils/store_helper.go | 0 .../osmosis-types}/validation.go | 3 +- .../umee-types}/leverage/genesis.pb.go | 0 .../umee-types}/leverage/leverage.pb.go | 0 .../umee-types}/leverage/params.go | 0 .../umee-types}/leverage/query.pb.go | 0 .../umee-types}/leverage/query.pb.gw.go | 0 .../umee-types}/leverage/types/keys.go | 0 .../umee-types}/leverage/types/token.go | 0 .../umee-types}/validation.go | 3 +- utils/strings.go | 8 + x/airdrop/keeper/claim_handler.go | 5 +- x/claimsmanager/types/codec.go | 7 +- x/epochs/types/hooks.go | 4 +- x/participationrewards/keeper/callbacks.go | 146 +- .../keeper/callbacks_test.go | 158 +- x/participationrewards/keeper/keeper.go | 23 +- x/participationrewards/keeper/keeper_test.go | 69 +- .../keeper/msg_server_test.go | 150 +- .../keeper/submodule_crescent.go | 149 + .../keeper/submodule_osmosis.go | 5 +- .../keeper/submodule_umee.go | 20 +- x/participationrewards/types/codec.go | 7 +- x/participationrewards/types/errors.go | 1 + x/participationrewards/types/keys.go | 2 + .../types/participationrewards.go | 61 +- .../types/participationrewards.pb.go | 155 +- .../types/participationrewards_test.go | 237 + x/participationrewards/types/protocol_data.go | 142 +- .../types/protocol_data_test.go | 229 +- .../types/submodule_crescent.go | 155 + .../types/submodule_crescent_test.go | 45 + .../types/submodule_osmosis.go | 8 +- x/tokenfactory/simulation/operations.go | 3 +- 117 files changed, 12921 insertions(+), 349 deletions(-) create mode 100644 third-party-chains/crescent-types/liquidity/types/keys.go create mode 100644 third-party-chains/crescent-types/liquidity/types/liquidity.pb.go create mode 100644 third-party-chains/crescent-types/liquidity/types/pool.go create mode 100644 third-party-chains/crescent-types/lpfarm/keys.go create mode 100644 third-party-chains/crescent-types/lpfarm/lpfarm.pb.go create mode 100644 third-party-chains/crescent-types/lpfarm/params.go create mode 100644 third-party-chains/crescent-types/lpfarm/query.pb.go create mode 100644 third-party-chains/crescent-types/lpfarm/query.pb.gw.go create mode 100644 third-party-chains/crescent-types/validation.go rename {osmosis-types => third-party-chains/osmosis-types}/gamm/codec.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/constants.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/errors.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/events.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/expected_keepers.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/genesis.pb.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/hooks.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/key.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/key_test.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/msg_create_pool.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/msg_lp.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/msg_swap.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/msgs.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/balancer/amm.go (98%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/balancer/balancerPool.pb.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/balancer/codec.go (95%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/balancer/constants.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/balancer/doc.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/balancer/marshal.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/balancer/msgs.go (96%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/balancer/pool.go (99%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/balancer/pool_asset.go (97%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/balancer/pool_params.go (96%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/balancer/tx.pb.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/internal/cfmm_common/lp.go (97%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/internal/cfmm_common/lp_test.go (91%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/stableswap/README.md (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/stableswap/amm.go (98%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/stableswap/cfmm.py (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/stableswap/codec.go (95%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/stableswap/msgs.go (98%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/stableswap/pool.go (98%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/stableswap/pool_params.go (84%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/stableswap/stableswap_pool.pb.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool-models/stableswap/tx.pb.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/pool.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/query.pb.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/query.pb.gw.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/route.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/gamm/tx.pb.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/codec.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/errors.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/events.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/expected_keepers.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/genesis.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/genesis.pb.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/hooks.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/keys.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/lock.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/lock.pb.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/lockI.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/msgs.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/querier.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/query.pb.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/query.pb.gw.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/lockup/tx.pb.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmomath/decimal.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmomath/int.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmomath/int_test.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmomath/math.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmomath/sigfig_round.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmoutils/binary_search.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmoutils/cache_ctx.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmoutils/cli_helpers.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmoutils/coin_helper.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmoutils/encoding_helper.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmoutils/module_account.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmoutils/parse.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmoutils/partialord/internal/dag/dag.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmoutils/partialord/internal/dag/module.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmoutils/partialord/module.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmoutils/partialord/partialord.go (96%) rename {osmosis-types => third-party-chains/osmosis-types}/osmoutils/slice_helper.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/osmoutils/store_helper.go (100%) rename {osmosis-types => third-party-chains/osmosis-types}/validation.go (95%) rename {umee-types => third-party-chains/umee-types}/leverage/genesis.pb.go (100%) rename {umee-types => third-party-chains/umee-types}/leverage/leverage.pb.go (100%) rename {umee-types => third-party-chains/umee-types}/leverage/params.go (100%) rename {umee-types => third-party-chains/umee-types}/leverage/query.pb.go (100%) rename {umee-types => third-party-chains/umee-types}/leverage/query.pb.gw.go (100%) rename {umee-types => third-party-chains/umee-types}/leverage/types/keys.go (100%) rename {umee-types => third-party-chains/umee-types}/leverage/types/token.go (100%) rename {umee-types => third-party-chains/umee-types}/validation.go (98%) create mode 100644 utils/strings.go create mode 100644 x/participationrewards/keeper/submodule_crescent.go create mode 100644 x/participationrewards/types/submodule_crescent.go create mode 100644 x/participationrewards/types/submodule_crescent_test.go diff --git a/proto/quicksilver/participationrewards/v1/participationrewards.proto b/proto/quicksilver/participationrewards/v1/participationrewards.proto index bcef0ddd8..0a93f76ba 100644 --- a/proto/quicksilver/participationrewards/v1/participationrewards.proto +++ b/proto/quicksilver/participationrewards/v1/participationrewards.proto @@ -68,4 +68,7 @@ enum ProtocolDataType { ProtocolDataTypeUmeeTotalBorrows = 10; ProtocolDataTypeUmeeUTokenSupply = 11; ProtocolDataTypeUmeeLeverageModuleBalance = 12; + ProtocolDataTypeCrescentParams = 13; + ProtocolDataTypeCrescentReserveAddressBalance = 14; + ProtocolDataTypeCrescentPoolCoinSupply = 15; } \ No newline at end of file diff --git a/third-party-chains/crescent-types/liquidity/types/keys.go b/third-party-chains/crescent-types/liquidity/types/keys.go new file mode 100644 index 000000000..b05171fc3 --- /dev/null +++ b/third-party-chains/crescent-types/liquidity/types/keys.go @@ -0,0 +1,20 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + // ModuleName defines the module name. + ModuleName = "liquidity" + + // StoreKey defines the primary module store key. + StoreKey = ModuleName +) + +var PoolKeyPrefix = []byte{0xab} + +// GetPoolKey returns the store key to retrieve pool object from the pool id. +func GetPoolKey(poolID uint64) []byte { + return append(PoolKeyPrefix, sdk.Uint64ToBigEndian(poolID)...) +} diff --git a/third-party-chains/crescent-types/liquidity/types/liquidity.pb.go b/third-party-chains/crescent-types/liquidity/types/liquidity.pb.go new file mode 100644 index 000000000..ef30efb9d --- /dev/null +++ b/third-party-chains/crescent-types/liquidity/types/liquidity.pb.go @@ -0,0 +1,3722 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: crescent/liquidity/v1beta1/liquidity.proto + +package types + +import ( + fmt "fmt" + 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" + _ "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 + +// PoolType enumerates pool types. +type PoolType int32 + +const ( + // POOL_TYPE_UNSPECIFIED specifies unknown pool type + PoolTypeUnspecified PoolType = 0 + // POOL_TYPE_BASIC specifies the basic pool type + PoolTypeBasic PoolType = 1 + // POOL_TYPE_RANGED specifies the ranged pool type + PoolTypeRanged PoolType = 2 +) + +var PoolType_name = map[int32]string{ + 0: "POOL_TYPE_UNSPECIFIED", + 1: "POOL_TYPE_BASIC", + 2: "POOL_TYPE_RANGED", +} + +var PoolType_value = map[string]int32{ + "POOL_TYPE_UNSPECIFIED": 0, + "POOL_TYPE_BASIC": 1, + "POOL_TYPE_RANGED": 2, +} + +func (x PoolType) String() string { + return proto.EnumName(PoolType_name, int32(x)) +} + +func (PoolType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_c9be4f53a63dce2f, []int{0} +} + +// OrderType enumerates order types. +type OrderType int32 + +const ( + // ORDER_TYPE_UNSPECIFIED specifies unknown order type. + OrderTypeUnspecified OrderType = 0 + // ORDER_TYPE_LIMIT specifies limit order type. + OrderTypeLimit OrderType = 1 + // ORDER_TYPE_MARKET specifies market order type. + OrderTypeMarket OrderType = 2 + // ORDER_TYPE_MM specifies MM(market making) order type. + OrderTypeMM OrderType = 3 +) + +var OrderType_name = map[int32]string{ + 0: "ORDER_TYPE_UNSPECIFIED", + 1: "ORDER_TYPE_LIMIT", + 2: "ORDER_TYPE_MARKET", + 3: "ORDER_TYPE_MM", +} + +var OrderType_value = map[string]int32{ + "ORDER_TYPE_UNSPECIFIED": 0, + "ORDER_TYPE_LIMIT": 1, + "ORDER_TYPE_MARKET": 2, + "ORDER_TYPE_MM": 3, +} + +func (x OrderType) String() string { + return proto.EnumName(OrderType_name, int32(x)) +} + +func (OrderType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_c9be4f53a63dce2f, []int{1} +} + +// OrderDirection enumerates order directions. +type OrderDirection int32 + +const ( + // ORDER_DIRECTION_UNSPECIFIED specifies unknown order direction + OrderDirectionUnspecified OrderDirection = 0 + // ORDER_DIRECTION_BUY specifies buy(swap quote coin to base coin) order direction + OrderDirectionBuy OrderDirection = 1 + // ORDER_DIRECTION_SELL specifies sell(swap base coin to quote coin) order direction + OrderDirectionSell OrderDirection = 2 +) + +var OrderDirection_name = map[int32]string{ + 0: "ORDER_DIRECTION_UNSPECIFIED", + 1: "ORDER_DIRECTION_BUY", + 2: "ORDER_DIRECTION_SELL", +} + +var OrderDirection_value = map[string]int32{ + "ORDER_DIRECTION_UNSPECIFIED": 0, + "ORDER_DIRECTION_BUY": 1, + "ORDER_DIRECTION_SELL": 2, +} + +func (x OrderDirection) String() string { + return proto.EnumName(OrderDirection_name, int32(x)) +} + +func (OrderDirection) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_c9be4f53a63dce2f, []int{2} +} + +// RequestStatus enumerates request statuses. +type RequestStatus int32 + +const ( + // REQUEST_STATUS_UNSPECIFIED specifies unknown request status + RequestStatusUnspecified RequestStatus = 0 + // REQUEST_STATUS_NOT_EXECUTED indicates the request is not executed yet + RequestStatusNotExecuted RequestStatus = 1 + // REQUEST_STATUS_SUCCEEDED indicates the request has been succeeded + RequestStatusSucceeded RequestStatus = 2 + // REQUEST_STATUS_FAILED indicates the request is failed + RequestStatusFailed RequestStatus = 3 +) + +var RequestStatus_name = map[int32]string{ + 0: "REQUEST_STATUS_UNSPECIFIED", + 1: "REQUEST_STATUS_NOT_EXECUTED", + 2: "REQUEST_STATUS_SUCCEEDED", + 3: "REQUEST_STATUS_FAILED", +} + +var RequestStatus_value = map[string]int32{ + "REQUEST_STATUS_UNSPECIFIED": 0, + "REQUEST_STATUS_NOT_EXECUTED": 1, + "REQUEST_STATUS_SUCCEEDED": 2, + "REQUEST_STATUS_FAILED": 3, +} + +func (x RequestStatus) String() string { + return proto.EnumName(RequestStatus_name, int32(x)) +} + +func (RequestStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_c9be4f53a63dce2f, []int{3} +} + +// OrderStatus enumerates order statuses. +type OrderStatus int32 + +const ( + // ORDER_STATUS_UNSPECIFIED specifies unknown order status + OrderStatusUnspecified OrderStatus = 0 + // ORDER_STATUS_NOT_EXECUTED indicates the order has not been executed yet + OrderStatusNotExecuted OrderStatus = 1 + // ORDER_STATUS_NOT_MATCHED indicates the order has been executed but has no match + OrderStatusNotMatched OrderStatus = 2 + // ORDER_STATUS_PARTIALLY_MATCHED indicates the order has been partially matched + OrderStatusPartiallyMatched OrderStatus = 3 + // ORDER_STATUS_COMPLETED indicates the order has been fully matched and completed + OrderStatusCompleted OrderStatus = 4 + // ORDER_STATUS_CANCELED indicates the order has been canceled + OrderStatusCanceled OrderStatus = 5 + // ORDER_STATUS_EXPIRED indicates the order has been expired + OrderStatusExpired OrderStatus = 6 +) + +var OrderStatus_name = map[int32]string{ + 0: "ORDER_STATUS_UNSPECIFIED", + 1: "ORDER_STATUS_NOT_EXECUTED", + 2: "ORDER_STATUS_NOT_MATCHED", + 3: "ORDER_STATUS_PARTIALLY_MATCHED", + 4: "ORDER_STATUS_COMPLETED", + 5: "ORDER_STATUS_CANCELED", + 6: "ORDER_STATUS_EXPIRED", +} + +var OrderStatus_value = map[string]int32{ + "ORDER_STATUS_UNSPECIFIED": 0, + "ORDER_STATUS_NOT_EXECUTED": 1, + "ORDER_STATUS_NOT_MATCHED": 2, + "ORDER_STATUS_PARTIALLY_MATCHED": 3, + "ORDER_STATUS_COMPLETED": 4, + "ORDER_STATUS_CANCELED": 5, + "ORDER_STATUS_EXPIRED": 6, +} + +func (x OrderStatus) String() string { + return proto.EnumName(OrderStatus_name, int32(x)) +} + +func (OrderStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_c9be4f53a63dce2f, []int{4} +} + +// Params defines the parameters for the liquidity module. +type Params struct { + BatchSize uint32 `protobuf:"varint,1,opt,name=batch_size,json=batchSize,proto3" json:"batch_size,omitempty"` + TickPrecision uint32 `protobuf:"varint,2,opt,name=tick_precision,json=tickPrecision,proto3" json:"tick_precision,omitempty"` + FeeCollectorAddress string `protobuf:"bytes,3,opt,name=fee_collector_address,json=feeCollectorAddress,proto3" json:"fee_collector_address,omitempty"` + DustCollectorAddress string `protobuf:"bytes,4,opt,name=dust_collector_address,json=dustCollectorAddress,proto3" json:"dust_collector_address,omitempty"` + MinInitialPoolCoinSupply github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=min_initial_pool_coin_supply,json=minInitialPoolCoinSupply,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_initial_pool_coin_supply"` + PairCreationFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=pair_creation_fee,json=pairCreationFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"pair_creation_fee"` + PoolCreationFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,7,rep,name=pool_creation_fee,json=poolCreationFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"pool_creation_fee"` + MinInitialDepositAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,8,opt,name=min_initial_deposit_amount,json=minInitialDepositAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_initial_deposit_amount"` + MaxPriceLimitRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,9,opt,name=max_price_limit_ratio,json=maxPriceLimitRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_price_limit_ratio"` + MaxNumMarketMakingOrderTicks uint32 `protobuf:"varint,10,opt,name=max_num_market_making_order_ticks,json=maxNumMarketMakingOrderTicks,proto3" json:"max_num_market_making_order_ticks,omitempty"` + MaxNumMarketMakingOrdersPerPair uint32 `protobuf:"varint,11,opt,name=max_num_market_making_orders_per_pair,json=maxNumMarketMakingOrdersPerPair,proto3" json:"max_num_market_making_orders_per_pair,omitempty"` + MaxOrderLifespan time.Duration `protobuf:"bytes,12,opt,name=max_order_lifespan,json=maxOrderLifespan,proto3,stdduration" json:"max_order_lifespan"` + SwapFeeRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,13,opt,name=swap_fee_rate,json=swapFeeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"swap_fee_rate"` + WithdrawFeeRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,14,opt,name=withdraw_fee_rate,json=withdrawFeeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"withdraw_fee_rate"` + DepositExtraGas github_com_cosmos_cosmos_sdk_types.Gas `protobuf:"varint,15,opt,name=deposit_extra_gas,json=depositExtraGas,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Gas" json:"deposit_extra_gas"` + WithdrawExtraGas github_com_cosmos_cosmos_sdk_types.Gas `protobuf:"varint,16,opt,name=withdraw_extra_gas,json=withdrawExtraGas,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Gas" json:"withdraw_extra_gas"` + OrderExtraGas github_com_cosmos_cosmos_sdk_types.Gas `protobuf:"varint,17,opt,name=order_extra_gas,json=orderExtraGas,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Gas" json:"order_extra_gas"` + MaxNumActivePoolsPerPair uint32 `protobuf:"varint,18,opt,name=max_num_active_pools_per_pair,json=maxNumActivePoolsPerPair,proto3" json:"max_num_active_pools_per_pair,omitempty"` +} + +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_c9be4f53a63dce2f, []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 + +// Pair defines a coin pair. +type Pair struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + BaseCoinDenom string `protobuf:"bytes,2,opt,name=base_coin_denom,json=baseCoinDenom,proto3" json:"base_coin_denom,omitempty"` + QuoteCoinDenom string `protobuf:"bytes,3,opt,name=quote_coin_denom,json=quoteCoinDenom,proto3" json:"quote_coin_denom,omitempty"` + EscrowAddress string `protobuf:"bytes,4,opt,name=escrow_address,json=escrowAddress,proto3" json:"escrow_address,omitempty"` + LastOrderId uint64 `protobuf:"varint,5,opt,name=last_order_id,json=lastOrderId,proto3" json:"last_order_id,omitempty"` + LastPrice *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=last_price,json=lastPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"last_price,omitempty"` + CurrentBatchId uint64 `protobuf:"varint,7,opt,name=current_batch_id,json=currentBatchId,proto3" json:"current_batch_id,omitempty"` +} + +func (m *Pair) Reset() { *m = Pair{} } +func (m *Pair) String() string { return proto.CompactTextString(m) } +func (*Pair) ProtoMessage() {} +func (*Pair) Descriptor() ([]byte, []int) { + return fileDescriptor_c9be4f53a63dce2f, []int{1} +} +func (m *Pair) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Pair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Pair.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 *Pair) XXX_Merge(src proto.Message) { + xxx_messageInfo_Pair.Merge(m, src) +} +func (m *Pair) XXX_Size() int { + return m.Size() +} +func (m *Pair) XXX_DiscardUnknown() { + xxx_messageInfo_Pair.DiscardUnknown(m) +} + +var xxx_messageInfo_Pair proto.InternalMessageInfo + +// Pool defines generic liquidity pool object which can be either a basic pool or a +// ranged pool. +type Pool struct { + Type PoolType `protobuf:"varint,1,opt,name=type,proto3,enum=crescent.liquidity.v1beta1.PoolType" json:"type,omitempty"` + Id uint64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` + PairId uint64 `protobuf:"varint,3,opt,name=pair_id,json=pairId,proto3" json:"pair_id,omitempty"` + Creator string `protobuf:"bytes,4,opt,name=creator,proto3" json:"creator,omitempty"` + ReserveAddress string `protobuf:"bytes,5,opt,name=reserve_address,json=reserveAddress,proto3" json:"reserve_address,omitempty"` + PoolCoinDenom string `protobuf:"bytes,6,opt,name=pool_coin_denom,json=poolCoinDenom,proto3" json:"pool_coin_denom,omitempty"` + MinPrice *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=min_price,json=minPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_price,omitempty"` + MaxPrice *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,8,opt,name=max_price,json=maxPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_price,omitempty"` + LastDepositRequestId uint64 `protobuf:"varint,9,opt,name=last_deposit_request_id,json=lastDepositRequestId,proto3" json:"last_deposit_request_id,omitempty"` + LastWithdrawRequestId uint64 `protobuf:"varint,10,opt,name=last_withdraw_request_id,json=lastWithdrawRequestId,proto3" json:"last_withdraw_request_id,omitempty"` + Disabled bool `protobuf:"varint,11,opt,name=disabled,proto3" json:"disabled,omitempty"` +} + +func (m *Pool) Reset() { *m = Pool{} } +func (m *Pool) String() string { return proto.CompactTextString(m) } +func (*Pool) ProtoMessage() {} +func (*Pool) Descriptor() ([]byte, []int) { + return fileDescriptor_c9be4f53a63dce2f, []int{2} +} +func (m *Pool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Pool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Pool.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 *Pool) XXX_Merge(src proto.Message) { + xxx_messageInfo_Pool.Merge(m, src) +} +func (m *Pool) XXX_Size() int { + return m.Size() +} +func (m *Pool) XXX_DiscardUnknown() { + xxx_messageInfo_Pool.DiscardUnknown(m) +} + +var xxx_messageInfo_Pool proto.InternalMessageInfo + +// DepositRequest defines a deposit request. +type DepositRequest struct { + // id specifies the id for the request + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // pool_id specifies the pool id + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // msg_height specifies the block height when the request is stored for the batch execution + MsgHeight int64 `protobuf:"varint,3,opt,name=msg_height,json=msgHeight,proto3" json:"msg_height,omitempty"` + // depositor specifies the bech32-encoded address that makes a deposit to the pool + Depositor string `protobuf:"bytes,4,opt,name=depositor,proto3" json:"depositor,omitempty"` + // deposit_coins specifies the amount of coins to deposit. + DepositCoins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,5,rep,name=deposit_coins,json=depositCoins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"deposit_coins"` + // accepted_coins specifies the amount of coins that are accepted. + AcceptedCoins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=accepted_coins,json=acceptedCoins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"accepted_coins"` + MintedPoolCoin types.Coin `protobuf:"bytes,7,opt,name=minted_pool_coin,json=mintedPoolCoin,proto3" json:"minted_pool_coin"` + Status RequestStatus `protobuf:"varint,8,opt,name=status,proto3,enum=crescent.liquidity.v1beta1.RequestStatus" json:"status,omitempty"` +} + +func (m *DepositRequest) Reset() { *m = DepositRequest{} } +func (m *DepositRequest) String() string { return proto.CompactTextString(m) } +func (*DepositRequest) ProtoMessage() {} +func (*DepositRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c9be4f53a63dce2f, []int{3} +} +func (m *DepositRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DepositRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DepositRequest.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 *DepositRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DepositRequest.Merge(m, src) +} +func (m *DepositRequest) XXX_Size() int { + return m.Size() +} +func (m *DepositRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DepositRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DepositRequest proto.InternalMessageInfo + +// WithdrawRequest defines a withdraw request. +type WithdrawRequest struct { + // id specifies the id for the request + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // pool_id specifies the pool id + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // msg_height specifies the block height when the request is stored for the batch execution + MsgHeight int64 `protobuf:"varint,3,opt,name=msg_height,json=msgHeight,proto3" json:"msg_height,omitempty"` + // withdrawer specifies the bech32-encoded address that withdraws pool coin from the pool + Withdrawer string `protobuf:"bytes,4,opt,name=withdrawer,proto3" json:"withdrawer,omitempty"` + // pool_coin specifies the pool coin that is a proof of liquidity provider for the pool + PoolCoin types.Coin `protobuf:"bytes,5,opt,name=pool_coin,json=poolCoin,proto3" json:"pool_coin"` + // withdrawn_coins specifies the amount of coins that are withdrawn. + WithdrawnCoins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=withdrawn_coins,json=withdrawnCoins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"withdrawn_coins"` + Status RequestStatus `protobuf:"varint,7,opt,name=status,proto3,enum=crescent.liquidity.v1beta1.RequestStatus" json:"status,omitempty"` +} + +func (m *WithdrawRequest) Reset() { *m = WithdrawRequest{} } +func (m *WithdrawRequest) String() string { return proto.CompactTextString(m) } +func (*WithdrawRequest) ProtoMessage() {} +func (*WithdrawRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c9be4f53a63dce2f, []int{4} +} +func (m *WithdrawRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WithdrawRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WithdrawRequest.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 *WithdrawRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_WithdrawRequest.Merge(m, src) +} +func (m *WithdrawRequest) XXX_Size() int { + return m.Size() +} +func (m *WithdrawRequest) XXX_DiscardUnknown() { + xxx_messageInfo_WithdrawRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_WithdrawRequest proto.InternalMessageInfo + +// Order defines an order. +type Order struct { + // type specifies the typo of the order + Type OrderType `protobuf:"varint,1,opt,name=type,proto3,enum=crescent.liquidity.v1beta1.OrderType" json:"type,omitempty"` + // id specifies the id of the order + Id uint64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` + // pair_id specifies the pair id + PairId uint64 `protobuf:"varint,3,opt,name=pair_id,json=pairId,proto3" json:"pair_id,omitempty"` + // msg_height specifies the block height when the order is stored for the batch execution + MsgHeight int64 `protobuf:"varint,4,opt,name=msg_height,json=msgHeight,proto3" json:"msg_height,omitempty"` + // orderer specifies the bech32-encoded address that makes an order + Orderer string `protobuf:"bytes,5,opt,name=orderer,proto3" json:"orderer,omitempty"` + // direction specifies the order direction; either buy or sell + Direction OrderDirection `protobuf:"varint,6,opt,name=direction,proto3,enum=crescent.liquidity.v1beta1.OrderDirection" json:"direction,omitempty"` + OfferCoin types.Coin `protobuf:"bytes,7,opt,name=offer_coin,json=offerCoin,proto3" json:"offer_coin"` + // remaining_offer_coin specifies the remaining offer coin + RemainingOfferCoin types.Coin `protobuf:"bytes,8,opt,name=remaining_offer_coin,json=remainingOfferCoin,proto3" json:"remaining_offer_coin"` + // received_coin specifies the received coin after the swap + ReceivedCoin types.Coin `protobuf:"bytes,9,opt,name=received_coin,json=receivedCoin,proto3" json:"received_coin"` + // price specifies the price that an orderer is willing to swap + Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + OpenAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,12,opt,name=open_amount,json=openAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"open_amount"` + // batch_id specifies the pair's batch id when the request is stored + BatchId uint64 `protobuf:"varint,13,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` + ExpireAt time.Time `protobuf:"bytes,14,opt,name=expire_at,json=expireAt,proto3,stdtime" json:"expire_at"` + Status OrderStatus `protobuf:"varint,15,opt,name=status,proto3,enum=crescent.liquidity.v1beta1.OrderStatus" json:"status,omitempty"` +} + +func (m *Order) Reset() { *m = Order{} } +func (m *Order) String() string { return proto.CompactTextString(m) } +func (*Order) ProtoMessage() {} +func (*Order) Descriptor() ([]byte, []int) { + return fileDescriptor_c9be4f53a63dce2f, []int{5} +} +func (m *Order) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Order) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Order.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 *Order) XXX_Merge(src proto.Message) { + xxx_messageInfo_Order.Merge(m, src) +} +func (m *Order) XXX_Size() int { + return m.Size() +} +func (m *Order) XXX_DiscardUnknown() { + xxx_messageInfo_Order.DiscardUnknown(m) +} + +var xxx_messageInfo_Order proto.InternalMessageInfo + +func init() { + proto.RegisterEnum("crescent.liquidity.v1beta1.PoolType", PoolType_name, PoolType_value) + proto.RegisterEnum("crescent.liquidity.v1beta1.OrderType", OrderType_name, OrderType_value) + proto.RegisterEnum("crescent.liquidity.v1beta1.OrderDirection", OrderDirection_name, OrderDirection_value) + proto.RegisterEnum("crescent.liquidity.v1beta1.RequestStatus", RequestStatus_name, RequestStatus_value) + proto.RegisterEnum("crescent.liquidity.v1beta1.OrderStatus", OrderStatus_name, OrderStatus_value) + proto.RegisterType((*Params)(nil), "crescent.liquidity.v1beta1.Params") + proto.RegisterType((*Pair)(nil), "crescent.liquidity.v1beta1.Pair") + proto.RegisterType((*Pool)(nil), "crescent.liquidity.v1beta1.Pool") + proto.RegisterType((*DepositRequest)(nil), "crescent.liquidity.v1beta1.DepositRequest") + proto.RegisterType((*WithdrawRequest)(nil), "crescent.liquidity.v1beta1.WithdrawRequest") + proto.RegisterType((*Order)(nil), "crescent.liquidity.v1beta1.Order") +} + +func init() { + proto.RegisterFile("crescent/liquidity/v1beta1/liquidity.proto", fileDescriptor_c9be4f53a63dce2f) +} + +var fileDescriptor_c9be4f53a63dce2f = []byte{ + // 2016 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0x1b, 0xc7, + 0x15, 0x17, 0x29, 0x8a, 0x22, 0x1f, 0xcd, 0x0f, 0x8d, 0x65, 0x7b, 0x4d, 0xdb, 0x14, 0x2b, 0xd4, + 0x8e, 0x2a, 0x20, 0x64, 0xa2, 0x36, 0x48, 0x0c, 0xa4, 0x09, 0x28, 0x72, 0x25, 0x13, 0xa5, 0x24, + 0x7a, 0x49, 0x35, 0x71, 0x50, 0x60, 0x31, 0xda, 0x1d, 0x51, 0x03, 0xed, 0x97, 0x77, 0x87, 0xfa, + 0xc8, 0xa9, 0xc7, 0x82, 0xa7, 0x9c, 0x8a, 0x5e, 0x78, 0x69, 0x2f, 0x45, 0xff, 0x82, 0x5e, 0x7b, + 0x28, 0xe0, 0x63, 0x8e, 0x6d, 0x0f, 0x49, 0x6b, 0xdf, 0x7a, 0x2a, 0xfa, 0x17, 0x04, 0x33, 0xfb, + 0xc1, 0x25, 0xed, 0x38, 0x16, 0x11, 0x9f, 0xa4, 0x9d, 0x79, 0xbf, 0xdf, 0x9b, 0xf9, 0xbd, 0x37, + 0x6f, 0xde, 0x10, 0x36, 0x35, 0x97, 0x78, 0x1a, 0xb1, 0x58, 0xdd, 0xa0, 0x4f, 0x87, 0x54, 0xa7, + 0xec, 0xb2, 0x7e, 0xf6, 0xfe, 0x11, 0x61, 0xf8, 0xfd, 0xc9, 0x48, 0xcd, 0x71, 0x6d, 0x66, 0xa3, + 0x72, 0x68, 0x5b, 0x9b, 0xcc, 0x04, 0xb6, 0xe5, 0xd5, 0x81, 0x3d, 0xb0, 0x85, 0x59, 0x9d, 0xff, + 0xe7, 0x23, 0xca, 0x15, 0xcd, 0xf6, 0x4c, 0xdb, 0xab, 0x1f, 0x61, 0x8f, 0x44, 0xb4, 0x9a, 0x4d, + 0xad, 0x60, 0x7e, 0x6d, 0x60, 0xdb, 0x03, 0x83, 0xd4, 0xc5, 0xd7, 0xd1, 0xf0, 0xb8, 0xce, 0xa8, + 0x49, 0x3c, 0x86, 0x4d, 0x27, 0x24, 0x98, 0x35, 0xd0, 0x87, 0x2e, 0x66, 0xd4, 0x0e, 0x08, 0xd6, + 0xff, 0x99, 0x83, 0x74, 0x17, 0xbb, 0xd8, 0xf4, 0xd0, 0x3d, 0x80, 0x23, 0xcc, 0xb4, 0x13, 0xd5, + 0xa3, 0x5f, 0x12, 0x29, 0x51, 0x4d, 0x6c, 0xe4, 0x95, 0xac, 0x18, 0xe9, 0xd1, 0x2f, 0x09, 0xba, + 0x0f, 0x05, 0x46, 0xb5, 0x53, 0xd5, 0x71, 0x89, 0x46, 0x3d, 0x6a, 0x5b, 0x52, 0x52, 0x98, 0xe4, + 0xf9, 0x68, 0x37, 0x1c, 0x44, 0x5b, 0x70, 0xe3, 0x98, 0x10, 0x55, 0xb3, 0x0d, 0x83, 0x68, 0xcc, + 0x76, 0x55, 0xac, 0xeb, 0x2e, 0xf1, 0x3c, 0x69, 0xb1, 0x9a, 0xd8, 0xc8, 0x2a, 0xd7, 0x8f, 0x09, + 0x69, 0x86, 0x73, 0x0d, 0x7f, 0x0a, 0xfd, 0x02, 0x6e, 0xea, 0x43, 0x8f, 0xbd, 0x02, 0x94, 0x12, + 0xa0, 0x55, 0x3e, 0xfb, 0x12, 0xca, 0x82, 0xbb, 0x26, 0xb5, 0x54, 0x6a, 0x51, 0x46, 0xb1, 0xa1, + 0x3a, 0xb6, 0x6d, 0xa8, 0x5c, 0x1a, 0xd5, 0x1b, 0x3a, 0x8e, 0x71, 0x29, 0x2d, 0x71, 0xec, 0x76, + 0xed, 0xd9, 0x37, 0x6b, 0x0b, 0xff, 0xfa, 0x66, 0xed, 0xc1, 0x80, 0xb2, 0x93, 0xe1, 0x51, 0x4d, + 0xb3, 0xcd, 0x7a, 0x20, 0xaa, 0xff, 0xe7, 0x5d, 0x4f, 0x3f, 0xad, 0xb3, 0x4b, 0x87, 0x78, 0xb5, + 0xb6, 0xc5, 0x14, 0xc9, 0xa4, 0x56, 0xdb, 0xa7, 0xec, 0xda, 0xb6, 0xd1, 0xb4, 0xa9, 0xd5, 0x13, + 0x7c, 0xe8, 0x1c, 0x56, 0x1c, 0x4c, 0x5d, 0x55, 0x73, 0x89, 0x50, 0x50, 0x3d, 0x26, 0x44, 0x4a, + 0x57, 0x17, 0x37, 0x72, 0x5b, 0xb7, 0x6b, 0x3e, 0x57, 0x8d, 0xc7, 0x29, 0x0c, 0x69, 0x8d, 0x63, + 0xb7, 0xdf, 0xe3, 0xfe, 0xff, 0xf2, 0xed, 0xda, 0xc6, 0x1b, 0xf8, 0xe7, 0x00, 0x4f, 0x29, 0x72, + 0x2f, 0xcd, 0xc0, 0xc9, 0x0e, 0x21, 0xc2, 0xb1, 0xd8, 0x5c, 0xdc, 0xf1, 0xf2, 0xdb, 0x70, 0xcc, + 0x37, 0x1c, 0x73, 0x7c, 0x0a, 0xe5, 0xb8, 0xc2, 0x3a, 0x71, 0x6c, 0x8f, 0x32, 0x15, 0x9b, 0xf6, + 0xd0, 0x62, 0x52, 0x66, 0x2e, 0x7d, 0x6f, 0x4d, 0xf4, 0x6d, 0xf9, 0x7c, 0x0d, 0x41, 0x87, 0x30, + 0xdc, 0x30, 0xf1, 0x85, 0xea, 0xb8, 0x54, 0x23, 0xaa, 0x41, 0x4d, 0xca, 0x54, 0x91, 0xa9, 0x52, + 0xf6, 0xca, 0x7e, 0x5a, 0x44, 0x53, 0x90, 0x89, 0x2f, 0xba, 0x9c, 0xab, 0xc3, 0xa9, 0x14, 0xce, + 0x84, 0x76, 0xe1, 0x27, 0xdc, 0x85, 0x35, 0x34, 0x55, 0x13, 0xbb, 0xa7, 0x84, 0xa9, 0x26, 0x3e, + 0xa5, 0xd6, 0x40, 0xb5, 0x5d, 0x9d, 0xb8, 0x2a, 0x4f, 0x64, 0x4f, 0x02, 0x91, 0xd5, 0x77, 0x4d, + 0x7c, 0xb1, 0x3f, 0x34, 0xf7, 0x84, 0xd9, 0x9e, 0xb0, 0x3a, 0xe0, 0x46, 0x7d, 0x6e, 0x83, 0xf6, + 0xe1, 0xfe, 0x6b, 0x88, 0x3c, 0xd5, 0x21, 0xae, 0xca, 0xa3, 0x28, 0xe5, 0x04, 0xd9, 0xda, 0xf7, + 0x90, 0x79, 0x5d, 0xe2, 0x76, 0x31, 0x75, 0xd1, 0x63, 0xe0, 0xcb, 0x0d, 0x96, 0x61, 0xd0, 0x63, + 0xe2, 0x39, 0xd8, 0x92, 0xae, 0x55, 0x13, 0x22, 0xc4, 0xfe, 0x11, 0xae, 0x85, 0x47, 0xb8, 0xd6, + 0x0a, 0x8e, 0xf0, 0x76, 0x86, 0x6b, 0xf2, 0x87, 0x6f, 0xd7, 0x12, 0x4a, 0xc9, 0xc4, 0x17, 0x82, + 0xb2, 0x13, 0x80, 0x91, 0x02, 0x79, 0xef, 0x1c, 0x3b, 0x3c, 0x57, 0xb8, 0x8e, 0x44, 0xca, 0xcf, + 0x25, 0x63, 0x8e, 0x93, 0xec, 0x10, 0xa2, 0x60, 0x46, 0xd0, 0x17, 0xb0, 0x72, 0x4e, 0xd9, 0x89, + 0xee, 0xe2, 0xf3, 0x09, 0x6f, 0x61, 0x2e, 0xde, 0x62, 0x48, 0x14, 0xe3, 0x0e, 0xf3, 0x8b, 0x5c, + 0x30, 0x17, 0xab, 0x03, 0xec, 0x49, 0xc5, 0x6a, 0x62, 0x23, 0x75, 0x25, 0xee, 0x5d, 0xec, 0x29, + 0xc5, 0x80, 0x48, 0xe6, 0x3c, 0xbb, 0xd8, 0x43, 0xbf, 0x01, 0x14, 0xad, 0x7b, 0x42, 0x5e, 0x9a, + 0x8b, 0xbc, 0x14, 0x32, 0x45, 0xec, 0xbf, 0x86, 0xa2, 0x1f, 0xb8, 0x09, 0xf5, 0xca, 0x5c, 0xd4, + 0x79, 0x41, 0x13, 0xf1, 0x7e, 0x0a, 0xf7, 0xc2, 0x24, 0xc3, 0x1a, 0xa3, 0x67, 0x44, 0x94, 0xb8, + 0x58, 0x72, 0x21, 0x91, 0x5c, 0x92, 0x9f, 0x5c, 0x0d, 0x61, 0xc2, 0x4b, 0x56, 0x98, 0x55, 0xeb, + 0x7f, 0x4e, 0x42, 0x4a, 0xa4, 0x57, 0x01, 0x92, 0x54, 0x17, 0x15, 0x3d, 0xa5, 0x24, 0xa9, 0x8e, + 0x1e, 0x40, 0x91, 0xd7, 0x0b, 0xbf, 0x5a, 0xea, 0xc4, 0xb2, 0x4d, 0x51, 0xcb, 0xb3, 0x4a, 0x9e, + 0x0f, 0xf3, 0x62, 0xd0, 0xe2, 0x83, 0x68, 0x03, 0x4a, 0x4f, 0x87, 0x36, 0x9b, 0x32, 0xf4, 0xcb, + 0x78, 0x41, 0x8c, 0x4f, 0x2c, 0xef, 0x43, 0x81, 0x78, 0x9a, 0x6b, 0x9f, 0xcf, 0x54, 0xee, 0xbc, + 0x3f, 0x1a, 0x96, 0xec, 0x75, 0xc8, 0x1b, 0xd8, 0x63, 0x41, 0xa2, 0x53, 0x5d, 0xd4, 0xe8, 0x94, + 0x92, 0xe3, 0x83, 0x22, 0x7d, 0xdb, 0x3a, 0x6a, 0x03, 0x08, 0x1b, 0x51, 0x08, 0xa4, 0xb4, 0xc8, + 0xae, 0xcd, 0x2b, 0x64, 0x56, 0x96, 0xa3, 0xc5, 0xc9, 0xe7, 0xeb, 0xd7, 0x86, 0xae, 0x4b, 0x2c, + 0xa6, 0xfa, 0x37, 0x1b, 0xd5, 0xa5, 0x65, 0xe1, 0xb1, 0x10, 0x8c, 0x6f, 0xf3, 0xe1, 0xb6, 0xbe, + 0xfe, 0xff, 0x45, 0x48, 0x71, 0xed, 0xd0, 0x47, 0x90, 0xe2, 0x54, 0x42, 0xac, 0xc2, 0xd6, 0x4f, + 0x6b, 0xdf, 0x7f, 0x63, 0xd7, 0xb8, 0x7d, 0xff, 0xd2, 0x21, 0x8a, 0x40, 0x04, 0x22, 0x27, 0x23, + 0x91, 0x6f, 0xc1, 0xb2, 0xb8, 0x2e, 0xa8, 0x2e, 0x34, 0x4b, 0x29, 0x69, 0xfe, 0xd9, 0xd6, 0x91, + 0x04, 0xcb, 0xa2, 0x92, 0xdb, 0x6e, 0x20, 0x52, 0xf8, 0x89, 0xde, 0x81, 0xa2, 0x4b, 0x3c, 0xe2, + 0x9e, 0x91, 0x48, 0xc6, 0x25, 0x5f, 0xee, 0x60, 0x38, 0xd4, 0xf1, 0x01, 0x14, 0x27, 0xd7, 0x9d, + 0x1f, 0x97, 0xb4, 0xaf, 0xb7, 0x13, 0xdc, 0x59, 0x7e, 0x58, 0x76, 0x21, 0xcb, 0x0b, 0xb8, 0x2f, + 0xe5, 0xf2, 0x95, 0xa5, 0xcc, 0x98, 0xd4, 0xf2, 0x95, 0xe4, 0x44, 0x61, 0x71, 0x0e, 0x0a, 0xff, + 0xd5, 0x88, 0x82, 0x62, 0x8c, 0x3e, 0x80, 0x5b, 0x22, 0xba, 0xe1, 0x59, 0x77, 0xc9, 0xd3, 0x21, + 0xf1, 0x18, 0x57, 0x29, 0x2b, 0x54, 0x5a, 0xe5, 0xd3, 0xc1, 0xcd, 0xa0, 0xf8, 0x93, 0x6d, 0x1d, + 0x7d, 0x08, 0x92, 0x80, 0x45, 0xc7, 0x38, 0x86, 0x03, 0x81, 0xbb, 0xc1, 0xe7, 0x3f, 0x0b, 0xa6, + 0x27, 0xc0, 0x32, 0x64, 0x74, 0xea, 0xe1, 0x23, 0x83, 0xe8, 0xa2, 0x18, 0x67, 0x94, 0xe8, 0x7b, + 0xfd, 0xbf, 0x8b, 0x50, 0x98, 0xf6, 0xf4, 0xd2, 0x49, 0xe1, 0x41, 0xe4, 0x42, 0x47, 0x91, 0x4d, + 0xf3, 0xcf, 0xb6, 0xce, 0x9b, 0x25, 0xd3, 0x1b, 0xa8, 0x27, 0x84, 0x0e, 0x4e, 0x98, 0x08, 0xf0, + 0xa2, 0x92, 0x35, 0xbd, 0xc1, 0x23, 0x31, 0x80, 0xee, 0x42, 0x36, 0xd8, 0x61, 0x14, 0xe5, 0xc9, + 0x00, 0x72, 0x20, 0x1f, 0xee, 0x9f, 0x47, 0x90, 0x47, 0xf9, 0x47, 0xbf, 0xcc, 0xaf, 0x05, 0x1e, + 0xc4, 0x17, 0x72, 0xa1, 0x80, 0x35, 0x8d, 0x38, 0x8c, 0xe8, 0x81, 0xcb, 0xb7, 0xd0, 0xb8, 0xe4, + 0x43, 0x17, 0xbe, 0xcf, 0x36, 0x94, 0x4c, 0x6a, 0x71, 0x8f, 0x51, 0xae, 0x8a, 0x1c, 0x7c, 0xad, + 0xd7, 0x14, 0xf7, 0xaa, 0x14, 0x7c, 0x60, 0xd8, 0x80, 0xa1, 0x06, 0xa4, 0x3d, 0x86, 0xd9, 0xd0, + 0x13, 0xb9, 0x57, 0xd8, 0xfa, 0xd9, 0xeb, 0xce, 0x65, 0x10, 0xcb, 0x9e, 0x00, 0x28, 0x01, 0x70, + 0xfd, 0x7f, 0x49, 0x28, 0xce, 0xa4, 0xc7, 0x8f, 0x16, 0xed, 0x0a, 0x40, 0x98, 0x98, 0x24, 0x0c, + 0x77, 0x6c, 0x04, 0x7d, 0x0c, 0xd9, 0x89, 0x04, 0x4b, 0x6f, 0x26, 0x41, 0x26, 0x3c, 0xc9, 0x88, + 0x41, 0x74, 0x59, 0x5a, 0x6f, 0x2f, 0x78, 0x85, 0xc8, 0x87, 0x1f, 0xbd, 0x89, 0xe4, 0xcb, 0xf3, + 0x4a, 0xfe, 0xf7, 0x34, 0x2c, 0x89, 0xaa, 0x8e, 0x1e, 0x4e, 0x55, 0xd5, 0xfb, 0xaf, 0xa3, 0xf2, + 0xbb, 0xac, 0x39, 0xca, 0xea, 0x74, 0x8c, 0x52, 0xb3, 0x31, 0x92, 0x60, 0x59, 0xdc, 0x3a, 0xc4, + 0x0d, 0x6a, 0x6a, 0xf8, 0x89, 0x1e, 0x41, 0x56, 0xa7, 0x2e, 0xd1, 0x78, 0x4b, 0x25, 0xca, 0x68, + 0x61, 0x6b, 0xf3, 0x07, 0x57, 0xd8, 0x0a, 0x11, 0xca, 0x04, 0x8c, 0x3e, 0x01, 0xb0, 0x8f, 0x8f, + 0x89, 0x7b, 0xa5, 0x5c, 0xcf, 0x0a, 0x88, 0x88, 0xf4, 0x63, 0x58, 0x75, 0x89, 0x89, 0xa9, 0x25, + 0x5a, 0xc9, 0x09, 0x53, 0xe6, 0xcd, 0x98, 0x50, 0x04, 0x3e, 0x88, 0x28, 0x5b, 0x90, 0x77, 0x89, + 0x46, 0xe8, 0x59, 0x70, 0xf0, 0x45, 0x95, 0x7d, 0x03, 0xae, 0x6b, 0x21, 0x2a, 0x60, 0x59, 0xf2, + 0x4b, 0x3f, 0xcc, 0xd5, 0xec, 0xf9, 0x60, 0xb4, 0x03, 0xe9, 0xe0, 0xe9, 0x90, 0x9b, 0xeb, 0xe9, + 0x10, 0xa0, 0xd1, 0x01, 0xe4, 0x6c, 0x87, 0x58, 0xe1, 0x3b, 0xe4, 0xda, 0x5c, 0x64, 0xc0, 0x29, + 0x82, 0xa7, 0xc7, 0x6d, 0xc8, 0x44, 0xfd, 0x41, 0x5e, 0x24, 0xd5, 0xf2, 0x91, 0xdf, 0x18, 0xa0, + 0x06, 0x64, 0xc9, 0x85, 0x43, 0x5d, 0xa2, 0x62, 0x26, 0x5a, 0xdd, 0xdc, 0x56, 0xf9, 0xa5, 0x86, + 0xbc, 0x1f, 0x3e, 0xba, 0xfd, 0x8e, 0xfc, 0x2b, 0xde, 0x91, 0x67, 0x7c, 0x58, 0x83, 0xa1, 0x4f, + 0xa3, 0x93, 0x54, 0x14, 0xc9, 0xf5, 0xce, 0x0f, 0x26, 0xd7, 0xf4, 0x39, 0xda, 0xfc, 0x7d, 0x02, + 0x32, 0x61, 0xb3, 0xc1, 0xdf, 0xd7, 0xdd, 0x83, 0x83, 0x8e, 0xda, 0x7f, 0xd2, 0x95, 0xd5, 0xc3, + 0xfd, 0x5e, 0x57, 0x6e, 0xb6, 0x77, 0xda, 0x72, 0xab, 0xb4, 0x50, 0xbe, 0x35, 0x1a, 0x57, 0xaf, + 0x87, 0x86, 0x87, 0x96, 0xe7, 0x10, 0x8d, 0x1e, 0x53, 0x22, 0xfa, 0xbd, 0x09, 0x66, 0xbb, 0xd1, + 0x6b, 0x37, 0x4b, 0x89, 0xf2, 0xca, 0x68, 0x5c, 0xcd, 0x87, 0xd6, 0xdb, 0xd8, 0xa3, 0x1a, 0xef, + 0x97, 0x26, 0x76, 0x4a, 0x63, 0x7f, 0x57, 0x6e, 0x95, 0x92, 0x65, 0x34, 0x1a, 0x57, 0x0b, 0x51, + 0xb3, 0x83, 0xad, 0x01, 0xd1, 0xcb, 0xa9, 0xdf, 0xfd, 0xa9, 0xb2, 0xb0, 0xf9, 0xb7, 0x04, 0x64, + 0xa3, 0xf3, 0xca, 0x5f, 0xf1, 0x07, 0x4a, 0x4b, 0x56, 0x5e, 0xb5, 0x34, 0x69, 0x34, 0xae, 0xae, + 0x46, 0xa6, 0xf1, 0xb5, 0x6d, 0x40, 0x29, 0x86, 0xea, 0xb4, 0xf7, 0xda, 0xfd, 0x52, 0xc2, 0xf7, + 0x19, 0xd9, 0x8b, 0x27, 0x1c, 0xda, 0x84, 0x95, 0x98, 0xe5, 0x5e, 0x43, 0xf9, 0x95, 0xdc, 0x2f, + 0x25, 0xcb, 0xd7, 0x47, 0xe3, 0x6a, 0x31, 0x32, 0xf5, 0xdf, 0x58, 0xbc, 0xd1, 0x8c, 0xdb, 0xee, + 0x95, 0x16, 0xcb, 0xc5, 0xd1, 0xb8, 0x9a, 0x9b, 0xd8, 0xed, 0x05, 0x7b, 0xf8, 0x6b, 0x02, 0x0a, + 0xd3, 0x27, 0x1a, 0x7d, 0x02, 0x77, 0x7c, 0x70, 0xab, 0xad, 0xc8, 0xcd, 0x7e, 0xfb, 0x60, 0x7f, + 0x66, 0x37, 0xf7, 0x46, 0xe3, 0xea, 0xed, 0x69, 0x50, 0x7c, 0x4b, 0x35, 0xb8, 0x3e, 0x8b, 0xdf, + 0x3e, 0x7c, 0x52, 0x4a, 0x94, 0x6f, 0x8c, 0xc6, 0xd5, 0x95, 0x69, 0xdc, 0xf6, 0xf0, 0x12, 0xbd, + 0x07, 0xab, 0xb3, 0xf6, 0x3d, 0xb9, 0xd3, 0x29, 0x25, 0xcb, 0x37, 0x47, 0xe3, 0x2a, 0x9a, 0x06, + 0xf4, 0x88, 0x61, 0x04, 0x4b, 0xff, 0x6d, 0x12, 0xf2, 0x53, 0x95, 0x17, 0x7d, 0x0c, 0x65, 0x45, + 0x7e, 0x7c, 0x28, 0xf7, 0xfa, 0x6a, 0xaf, 0xdf, 0xe8, 0x1f, 0xf6, 0x66, 0x16, 0x7e, 0x77, 0x34, + 0xae, 0x4a, 0x53, 0x90, 0xf8, 0xba, 0x7f, 0x09, 0x77, 0x66, 0xd0, 0xfb, 0x07, 0x7d, 0x55, 0xfe, + 0x5c, 0x6e, 0x1e, 0xf6, 0xe5, 0x56, 0x29, 0xf1, 0x0a, 0xf8, 0xbe, 0xcd, 0xe4, 0x0b, 0xa2, 0x0d, + 0x19, 0xd1, 0xd1, 0x47, 0x20, 0xcd, 0xc0, 0x7b, 0x87, 0xcd, 0xa6, 0x2c, 0xb7, 0x44, 0x16, 0x95, + 0x47, 0xe3, 0xea, 0xcd, 0x29, 0x6c, 0x6f, 0xa8, 0x69, 0x84, 0xe8, 0x44, 0xe7, 0x39, 0x3d, 0x83, + 0xdc, 0x69, 0xb4, 0x3b, 0x72, 0xab, 0xb4, 0xe8, 0xe7, 0xf4, 0x14, 0x6c, 0x07, 0x53, 0x23, 0xca, + 0xc0, 0x3f, 0x2e, 0x42, 0x2e, 0x76, 0x64, 0xf8, 0x1a, 0x7c, 0x29, 0x5f, 0xb9, 0x7d, 0xb1, 0x86, + 0x98, 0x79, 0x7c, 0xf3, 0x0f, 0xe1, 0xf6, 0x14, 0x72, 0x66, 0xeb, 0xb3, 0xd0, 0xf8, 0xc6, 0x3f, + 0x9c, 0x71, 0xca, 0xa1, 0x7b, 0x8d, 0x7e, 0xf3, 0x91, 0xd8, 0xf8, 0xed, 0xd1, 0xb8, 0x7a, 0x63, + 0x1a, 0xb9, 0xc7, 0x8b, 0x0b, 0xd1, 0x51, 0x13, 0x2a, 0x53, 0xc0, 0x6e, 0x43, 0xe9, 0xb7, 0x1b, + 0x9d, 0xce, 0x93, 0x08, 0xbe, 0x58, 0x5e, 0x1b, 0x8d, 0xab, 0x77, 0x62, 0xf0, 0x2e, 0x76, 0x19, + 0xc5, 0x86, 0x71, 0x19, 0x92, 0x44, 0xc7, 0x2e, 0x20, 0x69, 0x1e, 0xec, 0x75, 0x3b, 0x32, 0x5f, + 0x75, 0x2a, 0x76, 0xec, 0x7c, 0x70, 0xd3, 0x36, 0x1d, 0x83, 0x30, 0x5f, 0xf2, 0x69, 0x54, 0x63, + 0xbf, 0x29, 0x73, 0xc9, 0x97, 0x7c, 0xc9, 0xe3, 0x20, 0x6c, 0x69, 0xc4, 0x20, 0xfa, 0x24, 0x4f, + 0x03, 0x8c, 0xfc, 0x79, 0xb7, 0xad, 0xc8, 0xad, 0x52, 0x3a, 0x96, 0xa7, 0x3e, 0x44, 0x16, 0xb5, + 0x2f, 0x08, 0xd2, 0xf6, 0x67, 0xcf, 0xfe, 0x53, 0x59, 0x78, 0xf6, 0xbc, 0x92, 0xf8, 0xfa, 0x79, + 0x25, 0xf1, 0xef, 0xe7, 0x95, 0xc4, 0x57, 0x2f, 0x2a, 0x0b, 0x5f, 0xbf, 0xa8, 0x2c, 0xfc, 0xe3, + 0x45, 0x65, 0xe1, 0x8b, 0x87, 0xf1, 0x82, 0x1d, 0x14, 0xc6, 0x77, 0x2d, 0xc2, 0xce, 0x6d, 0xf7, + 0x34, 0x1a, 0xa8, 0x9f, 0x7d, 0x50, 0xbf, 0x88, 0xfd, 0xc2, 0x2a, 0xea, 0xf8, 0x51, 0x5a, 0x54, + 0xe0, 0x9f, 0x7f, 0x17, 0x00, 0x00, 0xff, 0xff, 0x95, 0xe9, 0x2b, 0x59, 0x84, 0x15, 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 + if m.MaxNumActivePoolsPerPair != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.MaxNumActivePoolsPerPair)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x90 + } + if m.OrderExtraGas != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.OrderExtraGas)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 + } + if m.WithdrawExtraGas != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.WithdrawExtraGas)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + } + if m.DepositExtraGas != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.DepositExtraGas)) + i-- + dAtA[i] = 0x78 + } + { + size := m.WithdrawFeeRate.Size() + i -= size + if _, err := m.WithdrawFeeRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x72 + { + size := m.SwapFeeRate.Size() + i -= size + if _, err := m.SwapFeeRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6a + n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxOrderLifespan, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxOrderLifespan):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintLiquidity(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x62 + if m.MaxNumMarketMakingOrdersPerPair != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.MaxNumMarketMakingOrdersPerPair)) + i-- + dAtA[i] = 0x58 + } + if m.MaxNumMarketMakingOrderTicks != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.MaxNumMarketMakingOrderTicks)) + i-- + dAtA[i] = 0x50 + } + { + size := m.MaxPriceLimitRatio.Size() + i -= size + if _, err := m.MaxPriceLimitRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + { + size := m.MinInitialDepositAmount.Size() + i -= size + if _, err := m.MinInitialDepositAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + if len(m.PoolCreationFee) > 0 { + for iNdEx := len(m.PoolCreationFee) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PoolCreationFee[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if len(m.PairCreationFee) > 0 { + for iNdEx := len(m.PairCreationFee) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PairCreationFee[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + { + size := m.MinInitialPoolCoinSupply.Size() + i -= size + if _, err := m.MinInitialPoolCoinSupply.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.DustCollectorAddress) > 0 { + i -= len(m.DustCollectorAddress) + copy(dAtA[i:], m.DustCollectorAddress) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.DustCollectorAddress))) + i-- + dAtA[i] = 0x22 + } + if len(m.FeeCollectorAddress) > 0 { + i -= len(m.FeeCollectorAddress) + copy(dAtA[i:], m.FeeCollectorAddress) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.FeeCollectorAddress))) + i-- + dAtA[i] = 0x1a + } + if m.TickPrecision != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.TickPrecision)) + i-- + dAtA[i] = 0x10 + } + if m.BatchSize != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.BatchSize)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Pair) 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 *Pair) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Pair) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CurrentBatchId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.CurrentBatchId)) + i-- + dAtA[i] = 0x38 + } + if m.LastPrice != nil { + { + size := m.LastPrice.Size() + i -= size + if _, err := m.LastPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.LastOrderId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.LastOrderId)) + i-- + dAtA[i] = 0x28 + } + if len(m.EscrowAddress) > 0 { + i -= len(m.EscrowAddress) + copy(dAtA[i:], m.EscrowAddress) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.EscrowAddress))) + i-- + dAtA[i] = 0x22 + } + if len(m.QuoteCoinDenom) > 0 { + i -= len(m.QuoteCoinDenom) + copy(dAtA[i:], m.QuoteCoinDenom) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.QuoteCoinDenom))) + i-- + dAtA[i] = 0x1a + } + if len(m.BaseCoinDenom) > 0 { + i -= len(m.BaseCoinDenom) + copy(dAtA[i:], m.BaseCoinDenom) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.BaseCoinDenom))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Pool) 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 *Pool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Disabled { + i-- + if m.Disabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } + if m.LastWithdrawRequestId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.LastWithdrawRequestId)) + i-- + dAtA[i] = 0x50 + } + if m.LastDepositRequestId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.LastDepositRequestId)) + i-- + dAtA[i] = 0x48 + } + if m.MaxPrice != nil { + { + size := m.MaxPrice.Size() + i -= size + if _, err := m.MaxPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + if m.MinPrice != nil { + { + size := m.MinPrice.Size() + i -= size + if _, err := m.MinPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if len(m.PoolCoinDenom) > 0 { + i -= len(m.PoolCoinDenom) + copy(dAtA[i:], m.PoolCoinDenom) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.PoolCoinDenom))) + i-- + dAtA[i] = 0x32 + } + if len(m.ReserveAddress) > 0 { + i -= len(m.ReserveAddress) + copy(dAtA[i:], m.ReserveAddress) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.ReserveAddress))) + i-- + dAtA[i] = 0x2a + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0x22 + } + if m.PairId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.PairId)) + i-- + dAtA[i] = 0x18 + } + if m.Id != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x10 + } + if m.Type != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *DepositRequest) 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 *DepositRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Status != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x40 + } + { + size, err := m.MintedPoolCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if len(m.AcceptedCoins) > 0 { + for iNdEx := len(m.AcceptedCoins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AcceptedCoins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.DepositCoins) > 0 { + for iNdEx := len(m.DepositCoins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DepositCoins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x22 + } + if m.MsgHeight != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.MsgHeight)) + i-- + dAtA[i] = 0x18 + } + if m.PoolId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if m.Id != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *WithdrawRequest) 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 *WithdrawRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WithdrawRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Status != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x38 + } + if len(m.WithdrawnCoins) > 0 { + for iNdEx := len(m.WithdrawnCoins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.WithdrawnCoins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + { + size, err := m.PoolCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.Withdrawer) > 0 { + i -= len(m.Withdrawer) + copy(dAtA[i:], m.Withdrawer) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.Withdrawer))) + i-- + dAtA[i] = 0x22 + } + if m.MsgHeight != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.MsgHeight)) + i-- + dAtA[i] = 0x18 + } + if m.PoolId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if m.Id != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Order) 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 *Order) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Order) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Status != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x78 + } + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpireAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpireAt):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintLiquidity(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x72 + if m.BatchId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.BatchId)) + i-- + dAtA[i] = 0x68 + } + { + size := m.OpenAmount.Size() + i -= size + if _, err := m.OpenAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + { + size := m.Price.Size() + i -= size + if _, err := m.Price.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + { + size, err := m.ReceivedCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + { + size, err := m.RemainingOfferCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + { + size, err := m.OfferCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLiquidity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if m.Direction != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Direction)) + i-- + dAtA[i] = 0x30 + } + if len(m.Orderer) > 0 { + i -= len(m.Orderer) + copy(dAtA[i:], m.Orderer) + i = encodeVarintLiquidity(dAtA, i, uint64(len(m.Orderer))) + i-- + dAtA[i] = 0x2a + } + if m.MsgHeight != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.MsgHeight)) + i-- + dAtA[i] = 0x20 + } + if m.PairId != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.PairId)) + i-- + dAtA[i] = 0x18 + } + if m.Id != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x10 + } + if m.Type != 0 { + i = encodeVarintLiquidity(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintLiquidity(dAtA []byte, offset int, v uint64) int { + offset -= sovLiquidity(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 m.BatchSize != 0 { + n += 1 + sovLiquidity(uint64(m.BatchSize)) + } + if m.TickPrecision != 0 { + n += 1 + sovLiquidity(uint64(m.TickPrecision)) + } + l = len(m.FeeCollectorAddress) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + l = len(m.DustCollectorAddress) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + l = m.MinInitialPoolCoinSupply.Size() + n += 1 + l + sovLiquidity(uint64(l)) + if len(m.PairCreationFee) > 0 { + for _, e := range m.PairCreationFee { + l = e.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + } + if len(m.PoolCreationFee) > 0 { + for _, e := range m.PoolCreationFee { + l = e.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + } + l = m.MinInitialDepositAmount.Size() + n += 1 + l + sovLiquidity(uint64(l)) + l = m.MaxPriceLimitRatio.Size() + n += 1 + l + sovLiquidity(uint64(l)) + if m.MaxNumMarketMakingOrderTicks != 0 { + n += 1 + sovLiquidity(uint64(m.MaxNumMarketMakingOrderTicks)) + } + if m.MaxNumMarketMakingOrdersPerPair != 0 { + n += 1 + sovLiquidity(uint64(m.MaxNumMarketMakingOrdersPerPair)) + } + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxOrderLifespan) + n += 1 + l + sovLiquidity(uint64(l)) + l = m.SwapFeeRate.Size() + n += 1 + l + sovLiquidity(uint64(l)) + l = m.WithdrawFeeRate.Size() + n += 1 + l + sovLiquidity(uint64(l)) + if m.DepositExtraGas != 0 { + n += 1 + sovLiquidity(uint64(m.DepositExtraGas)) + } + if m.WithdrawExtraGas != 0 { + n += 2 + sovLiquidity(uint64(m.WithdrawExtraGas)) + } + if m.OrderExtraGas != 0 { + n += 2 + sovLiquidity(uint64(m.OrderExtraGas)) + } + if m.MaxNumActivePoolsPerPair != 0 { + n += 2 + sovLiquidity(uint64(m.MaxNumActivePoolsPerPair)) + } + return n +} + +func (m *Pair) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovLiquidity(uint64(m.Id)) + } + l = len(m.BaseCoinDenom) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + l = len(m.QuoteCoinDenom) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + l = len(m.EscrowAddress) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.LastOrderId != 0 { + n += 1 + sovLiquidity(uint64(m.LastOrderId)) + } + if m.LastPrice != nil { + l = m.LastPrice.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.CurrentBatchId != 0 { + n += 1 + sovLiquidity(uint64(m.CurrentBatchId)) + } + return n +} + +func (m *Pool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovLiquidity(uint64(m.Type)) + } + if m.Id != 0 { + n += 1 + sovLiquidity(uint64(m.Id)) + } + if m.PairId != 0 { + n += 1 + sovLiquidity(uint64(m.PairId)) + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + l = len(m.ReserveAddress) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + l = len(m.PoolCoinDenom) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.MinPrice != nil { + l = m.MinPrice.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.MaxPrice != nil { + l = m.MaxPrice.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.LastDepositRequestId != 0 { + n += 1 + sovLiquidity(uint64(m.LastDepositRequestId)) + } + if m.LastWithdrawRequestId != 0 { + n += 1 + sovLiquidity(uint64(m.LastWithdrawRequestId)) + } + if m.Disabled { + n += 2 + } + return n +} + +func (m *DepositRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovLiquidity(uint64(m.Id)) + } + if m.PoolId != 0 { + n += 1 + sovLiquidity(uint64(m.PoolId)) + } + if m.MsgHeight != 0 { + n += 1 + sovLiquidity(uint64(m.MsgHeight)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + if len(m.DepositCoins) > 0 { + for _, e := range m.DepositCoins { + l = e.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + } + if len(m.AcceptedCoins) > 0 { + for _, e := range m.AcceptedCoins { + l = e.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + } + l = m.MintedPoolCoin.Size() + n += 1 + l + sovLiquidity(uint64(l)) + if m.Status != 0 { + n += 1 + sovLiquidity(uint64(m.Status)) + } + return n +} + +func (m *WithdrawRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovLiquidity(uint64(m.Id)) + } + if m.PoolId != 0 { + n += 1 + sovLiquidity(uint64(m.PoolId)) + } + if m.MsgHeight != 0 { + n += 1 + sovLiquidity(uint64(m.MsgHeight)) + } + l = len(m.Withdrawer) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + l = m.PoolCoin.Size() + n += 1 + l + sovLiquidity(uint64(l)) + if len(m.WithdrawnCoins) > 0 { + for _, e := range m.WithdrawnCoins { + l = e.Size() + n += 1 + l + sovLiquidity(uint64(l)) + } + } + if m.Status != 0 { + n += 1 + sovLiquidity(uint64(m.Status)) + } + return n +} + +func (m *Order) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovLiquidity(uint64(m.Type)) + } + if m.Id != 0 { + n += 1 + sovLiquidity(uint64(m.Id)) + } + if m.PairId != 0 { + n += 1 + sovLiquidity(uint64(m.PairId)) + } + if m.MsgHeight != 0 { + n += 1 + sovLiquidity(uint64(m.MsgHeight)) + } + l = len(m.Orderer) + if l > 0 { + n += 1 + l + sovLiquidity(uint64(l)) + } + if m.Direction != 0 { + n += 1 + sovLiquidity(uint64(m.Direction)) + } + l = m.OfferCoin.Size() + n += 1 + l + sovLiquidity(uint64(l)) + l = m.RemainingOfferCoin.Size() + n += 1 + l + sovLiquidity(uint64(l)) + l = m.ReceivedCoin.Size() + n += 1 + l + sovLiquidity(uint64(l)) + l = m.Price.Size() + n += 1 + l + sovLiquidity(uint64(l)) + l = m.Amount.Size() + n += 1 + l + sovLiquidity(uint64(l)) + l = m.OpenAmount.Size() + n += 1 + l + sovLiquidity(uint64(l)) + if m.BatchId != 0 { + n += 1 + sovLiquidity(uint64(m.BatchId)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpireAt) + n += 1 + l + sovLiquidity(uint64(l)) + if m.Status != 0 { + n += 1 + sovLiquidity(uint64(m.Status)) + } + return n +} + +func sovLiquidity(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozLiquidity(x uint64) (n int) { + return sovLiquidity(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 ErrIntOverflowLiquidity + } + 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 != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchSize", wireType) + } + m.BatchSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BatchSize |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TickPrecision", wireType) + } + m.TickPrecision = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TickPrecision |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeCollectorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeeCollectorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DustCollectorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DustCollectorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinInitialPoolCoinSupply", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinInitialPoolCoinSupply.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PairCreationFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PairCreationFee = append(m.PairCreationFee, types.Coin{}) + if err := m.PairCreationFee[len(m.PairCreationFee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolCreationFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PoolCreationFee = append(m.PoolCreationFee, types.Coin{}) + if err := m.PoolCreationFee[len(m.PoolCreationFee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDepositAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinInitialDepositAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxPriceLimitRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxPriceLimitRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxNumMarketMakingOrderTicks", wireType) + } + m.MaxNumMarketMakingOrderTicks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxNumMarketMakingOrderTicks |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxNumMarketMakingOrdersPerPair", wireType) + } + m.MaxNumMarketMakingOrdersPerPair = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxNumMarketMakingOrdersPerPair |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxOrderLifespan", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.MaxOrderLifespan, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapFeeRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SwapFeeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawFeeRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.WithdrawFeeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositExtraGas", wireType) + } + m.DepositExtraGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DepositExtraGas |= github_com_cosmos_cosmos_sdk_types.Gas(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 16: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawExtraGas", wireType) + } + m.WithdrawExtraGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.WithdrawExtraGas |= github_com_cosmos_cosmos_sdk_types.Gas(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 17: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderExtraGas", wireType) + } + m.OrderExtraGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OrderExtraGas |= github_com_cosmos_cosmos_sdk_types.Gas(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 18: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxNumActivePoolsPerPair", wireType) + } + m.MaxNumActivePoolsPerPair = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxNumActivePoolsPerPair |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Pair) 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 ErrIntOverflowLiquidity + } + 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: Pair: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Pair: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseCoinDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BaseCoinDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QuoteCoinDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QuoteCoinDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EscrowAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EscrowAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastOrderId", wireType) + } + m.LastOrderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastOrderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Dec + m.LastPrice = &v + if err := m.LastPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentBatchId", wireType) + } + m.CurrentBatchId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentBatchId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Pool) 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 ErrIntOverflowLiquidity + } + 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: Pool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Pool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= PoolType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PairId", wireType) + } + m.PairId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PairId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReserveAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ReserveAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolCoinDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PoolCoinDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Dec + m.MinPrice = &v + if err := m.MinPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Dec + m.MaxPrice = &v + if err := m.MaxPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastDepositRequestId", wireType) + } + m.LastDepositRequestId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastDepositRequestId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastWithdrawRequestId", wireType) + } + m.LastWithdrawRequestId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastWithdrawRequestId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Disabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Disabled = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DepositRequest) 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 ErrIntOverflowLiquidity + } + 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: DepositRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgHeight", wireType) + } + m.MsgHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MsgHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositCoins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DepositCoins = append(m.DepositCoins, types.Coin{}) + if err := m.DepositCoins[len(m.DepositCoins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AcceptedCoins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AcceptedCoins = append(m.AcceptedCoins, types.Coin{}) + if err := m.AcceptedCoins[len(m.AcceptedCoins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintedPoolCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MintedPoolCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= RequestStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WithdrawRequest) 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 ErrIntOverflowLiquidity + } + 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: WithdrawRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WithdrawRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgHeight", wireType) + } + m.MsgHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MsgHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Withdrawer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Withdrawer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PoolCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawnCoins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WithdrawnCoins = append(m.WithdrawnCoins, types.Coin{}) + if err := m.WithdrawnCoins[len(m.WithdrawnCoins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= RequestStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Order) 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 ErrIntOverflowLiquidity + } + 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: Order: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Order: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= OrderType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PairId", wireType) + } + m.PairId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PairId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgHeight", wireType) + } + m.MsgHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MsgHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Orderer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Orderer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Direction", wireType) + } + m.Direction = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Direction |= OrderDirection(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OfferCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OfferCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RemainingOfferCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RemainingOfferCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReceivedCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ReceivedCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Price.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OpenAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + 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 ErrInvalidLengthLiquidity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OpenAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchId", wireType) + } + m.BatchId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BatchId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpireAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLiquidity + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLiquidity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExpireAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= OrderStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLiquidity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLiquidity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipLiquidity(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, ErrIntOverflowLiquidity + } + 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, ErrIntOverflowLiquidity + } + 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, ErrIntOverflowLiquidity + } + 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, ErrInvalidLengthLiquidity + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupLiquidity + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthLiquidity + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthLiquidity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLiquidity = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupLiquidity = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third-party-chains/crescent-types/liquidity/types/pool.go b/third-party-chains/crescent-types/liquidity/types/pool.go new file mode 100644 index 000000000..7b3874da1 --- /dev/null +++ b/third-party-chains/crescent-types/liquidity/types/pool.go @@ -0,0 +1,32 @@ +package types + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (pool Pool) GetReserveAddress() sdk.AccAddress { + addr, err := sdk.AccAddressFromBech32(pool.ReserveAddress) + if err != nil { + panic(err) + } + return addr +} + +// Validate validates Pool for genesis. +func (pool Pool) Validate() error { + if pool.Id == 0 { + return fmt.Errorf("pool id must not be 0") + } + if pool.PairId == 0 { + return fmt.Errorf("pair id must not be 0") + } + if _, err := sdk.AccAddressFromBech32(pool.ReserveAddress); err != nil { + return fmt.Errorf("invalid reserve address %s: %w", pool.ReserveAddress, err) + } + if err := sdk.ValidateDenom(pool.PoolCoinDenom); err != nil { + return fmt.Errorf("invalid pool coin denom: %w", err) + } + return nil +} diff --git a/third-party-chains/crescent-types/lpfarm/keys.go b/third-party-chains/crescent-types/lpfarm/keys.go new file mode 100644 index 000000000..f327abf08 --- /dev/null +++ b/third-party-chains/crescent-types/lpfarm/keys.go @@ -0,0 +1,20 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" +) + +const ( + // ModuleName defines the module name. + ModuleName = "lpfarm" + + // StoreKey defines the primary module store key. + StoreKey = ModuleName +) + +var PositionKeyPrefix = []byte{0xd5} + +func GetPositionKey(farmerAddr sdk.AccAddress, denom string) []byte { + return append(append(PositionKeyPrefix, address.MustLengthPrefix(farmerAddr)...), denom...) +} diff --git a/third-party-chains/crescent-types/lpfarm/lpfarm.pb.go b/third-party-chains/crescent-types/lpfarm/lpfarm.pb.go new file mode 100644 index 000000000..f34ab0781 --- /dev/null +++ b/third-party-chains/crescent-types/lpfarm/lpfarm.pb.go @@ -0,0 +1,2100 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: crescent/lpfarm/v1beta1/lpfarm.proto + +package types + +import ( + fmt "fmt" + 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" + _ "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 + +type Params struct { + PrivatePlanCreationFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=private_plan_creation_fee,json=privatePlanCreationFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"private_plan_creation_fee"` + FeeCollector string `protobuf:"bytes,2,opt,name=fee_collector,json=feeCollector,proto3" json:"fee_collector,omitempty"` + MaxNumPrivatePlans uint32 `protobuf:"varint,3,opt,name=max_num_private_plans,json=maxNumPrivatePlans,proto3" json:"max_num_private_plans,omitempty"` + MaxBlockDuration time.Duration `protobuf:"bytes,4,opt,name=max_block_duration,json=maxBlockDuration,proto3,stdduration" json:"max_block_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_a35ee56b16793e84, []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 + +type Plan struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + FarmingPoolAddress string `protobuf:"bytes,3,opt,name=farming_pool_address,json=farmingPoolAddress,proto3" json:"farming_pool_address,omitempty"` + TerminationAddress string `protobuf:"bytes,4,opt,name=termination_address,json=terminationAddress,proto3" json:"termination_address,omitempty"` + RewardAllocations []RewardAllocation `protobuf:"bytes,5,rep,name=reward_allocations,json=rewardAllocations,proto3" json:"reward_allocations"` + StartTime time.Time `protobuf:"bytes,6,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time"` + EndTime time.Time `protobuf:"bytes,7,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time"` + IsPrivate bool `protobuf:"varint,8,opt,name=is_private,json=isPrivate,proto3" json:"is_private,omitempty"` + IsTerminated bool `protobuf:"varint,9,opt,name=is_terminated,json=isTerminated,proto3" json:"is_terminated,omitempty"` +} + +func (m *Plan) Reset() { *m = Plan{} } +func (m *Plan) String() string { return proto.CompactTextString(m) } +func (*Plan) ProtoMessage() {} +func (*Plan) Descriptor() ([]byte, []int) { + return fileDescriptor_a35ee56b16793e84, []int{1} +} +func (m *Plan) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Plan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Plan.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 *Plan) XXX_Merge(src proto.Message) { + xxx_messageInfo_Plan.Merge(m, src) +} +func (m *Plan) XXX_Size() int { + return m.Size() +} +func (m *Plan) XXX_DiscardUnknown() { + xxx_messageInfo_Plan.DiscardUnknown(m) +} + +var xxx_messageInfo_Plan proto.InternalMessageInfo + +type RewardAllocation struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + PairId uint64 `protobuf:"varint,2,opt,name=pair_id,json=pairId,proto3" json:"pair_id,omitempty"` + RewardsPerDay github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=rewards_per_day,json=rewardsPerDay,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"rewards_per_day"` +} + +func (m *RewardAllocation) Reset() { *m = RewardAllocation{} } +func (m *RewardAllocation) String() string { return proto.CompactTextString(m) } +func (*RewardAllocation) ProtoMessage() {} +func (*RewardAllocation) Descriptor() ([]byte, []int) { + return fileDescriptor_a35ee56b16793e84, []int{2} +} +func (m *RewardAllocation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RewardAllocation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RewardAllocation.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 *RewardAllocation) XXX_Merge(src proto.Message) { + xxx_messageInfo_RewardAllocation.Merge(m, src) +} +func (m *RewardAllocation) XXX_Size() int { + return m.Size() +} +func (m *RewardAllocation) XXX_DiscardUnknown() { + xxx_messageInfo_RewardAllocation.DiscardUnknown(m) +} + +var xxx_messageInfo_RewardAllocation proto.InternalMessageInfo + +type Farm struct { + TotalFarmingAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=total_farming_amount,json=totalFarmingAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_farming_amount"` + CurrentRewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,2,rep,name=current_rewards,json=currentRewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"current_rewards"` + OutstandingRewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,3,rep,name=outstanding_rewards,json=outstandingRewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"outstanding_rewards"` + Period uint64 `protobuf:"varint,4,opt,name=period,proto3" json:"period,omitempty"` + PreviousShare *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=previous_share,json=previousShare,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"previous_share,omitempty"` +} + +func (m *Farm) Reset() { *m = Farm{} } +func (m *Farm) String() string { return proto.CompactTextString(m) } +func (*Farm) ProtoMessage() {} +func (*Farm) Descriptor() ([]byte, []int) { + return fileDescriptor_a35ee56b16793e84, []int{3} +} +func (m *Farm) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Farm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Farm.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 *Farm) XXX_Merge(src proto.Message) { + xxx_messageInfo_Farm.Merge(m, src) +} +func (m *Farm) XXX_Size() int { + return m.Size() +} +func (m *Farm) XXX_DiscardUnknown() { + xxx_messageInfo_Farm.DiscardUnknown(m) +} + +var xxx_messageInfo_Farm proto.InternalMessageInfo + +type Position struct { + Farmer string `protobuf:"bytes,1,opt,name=farmer,proto3" json:"farmer,omitempty"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` + FarmingAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=farming_amount,json=farmingAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"farming_amount"` + PreviousPeriod uint64 `protobuf:"varint,4,opt,name=previous_period,json=previousPeriod,proto3" json:"previous_period,omitempty"` + StartingBlockHeight int64 `protobuf:"varint,5,opt,name=starting_block_height,json=startingBlockHeight,proto3" json:"starting_block_height,omitempty"` +} + +func (m *Position) Reset() { *m = Position{} } +func (m *Position) String() string { return proto.CompactTextString(m) } +func (*Position) ProtoMessage() {} +func (*Position) Descriptor() ([]byte, []int) { + return fileDescriptor_a35ee56b16793e84, []int{4} +} +func (m *Position) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Position) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Position.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 *Position) XXX_Merge(src proto.Message) { + xxx_messageInfo_Position.Merge(m, src) +} +func (m *Position) XXX_Size() int { + return m.Size() +} +func (m *Position) XXX_DiscardUnknown() { + xxx_messageInfo_Position.DiscardUnknown(m) +} + +var xxx_messageInfo_Position proto.InternalMessageInfo + +type HistoricalRewards struct { + CumulativeUnitRewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=cumulative_unit_rewards,json=cumulativeUnitRewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"cumulative_unit_rewards"` + ReferenceCount uint32 `protobuf:"varint,2,opt,name=reference_count,json=referenceCount,proto3" json:"reference_count,omitempty"` +} + +func (m *HistoricalRewards) Reset() { *m = HistoricalRewards{} } +func (m *HistoricalRewards) String() string { return proto.CompactTextString(m) } +func (*HistoricalRewards) ProtoMessage() {} +func (*HistoricalRewards) Descriptor() ([]byte, []int) { + return fileDescriptor_a35ee56b16793e84, []int{5} +} +func (m *HistoricalRewards) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HistoricalRewards) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HistoricalRewards.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 *HistoricalRewards) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistoricalRewards.Merge(m, src) +} +func (m *HistoricalRewards) XXX_Size() int { + return m.Size() +} +func (m *HistoricalRewards) XXX_DiscardUnknown() { + xxx_messageInfo_HistoricalRewards.DiscardUnknown(m) +} + +var xxx_messageInfo_HistoricalRewards proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Params)(nil), "crescent.lpfarm.v1beta1.Params") + proto.RegisterType((*Plan)(nil), "crescent.lpfarm.v1beta1.Plan") + proto.RegisterType((*RewardAllocation)(nil), "crescent.lpfarm.v1beta1.RewardAllocation") + proto.RegisterType((*Farm)(nil), "crescent.lpfarm.v1beta1.Farm") + proto.RegisterType((*Position)(nil), "crescent.lpfarm.v1beta1.Position") + proto.RegisterType((*HistoricalRewards)(nil), "crescent.lpfarm.v1beta1.HistoricalRewards") +} + +func init() { + proto.RegisterFile("crescent/lpfarm/v1beta1/lpfarm.proto", fileDescriptor_a35ee56b16793e84) +} + +var fileDescriptor_a35ee56b16793e84 = []byte{ + // 962 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4d, 0x6f, 0x1b, 0x45, + 0x18, 0xce, 0xda, 0x8e, 0x13, 0x4f, 0x6b, 0xa7, 0x9d, 0x7c, 0x6d, 0x23, 0xb0, 0x2d, 0x83, 0xa8, + 0x01, 0x75, 0xb7, 0x69, 0x11, 0x57, 0x14, 0x3b, 0x8a, 0xda, 0x0b, 0x72, 0x97, 0xf4, 0xc2, 0x81, + 0x61, 0xbc, 0xfb, 0xda, 0x19, 0x65, 0x77, 0x67, 0x35, 0x33, 0xeb, 0x26, 0x1c, 0x39, 0x20, 0x71, + 0xeb, 0x91, 0xdf, 0xc0, 0x0f, 0xe0, 0xc4, 0x15, 0x29, 0xc7, 0x1e, 0x38, 0x20, 0x0e, 0x2d, 0x24, + 0x57, 0x7e, 0x04, 0x9a, 0xd9, 0x1d, 0xc7, 0x0d, 0x20, 0x05, 0x44, 0x4f, 0xc9, 0xbc, 0x9f, 0xcf, + 0xfb, 0xbc, 0xcf, 0xcc, 0x1a, 0xbd, 0x1b, 0x0a, 0x90, 0x21, 0xa4, 0xca, 0x8f, 0xb3, 0x09, 0x15, + 0x89, 0x3f, 0xdb, 0x1d, 0x83, 0xa2, 0xbb, 0xe5, 0xd1, 0xcb, 0x04, 0x57, 0x1c, 0x6f, 0xdb, 0x28, + 0xaf, 0x34, 0x97, 0x51, 0x3b, 0x1b, 0x53, 0x3e, 0xe5, 0x26, 0xc6, 0xd7, 0xff, 0x15, 0xe1, 0x3b, + 0xed, 0x90, 0xcb, 0x84, 0x4b, 0x7f, 0x4c, 0x25, 0xcc, 0x0b, 0x86, 0x9c, 0xa5, 0xa5, 0xbf, 0x33, + 0xe5, 0x7c, 0x1a, 0x83, 0x6f, 0x4e, 0xe3, 0x7c, 0xe2, 0x2b, 0x96, 0x80, 0x54, 0x34, 0xc9, 0x6c, + 0x81, 0xab, 0x01, 0x51, 0x2e, 0xa8, 0x62, 0xbc, 0x2c, 0xd0, 0xfb, 0xb1, 0x82, 0xea, 0x23, 0x2a, + 0x68, 0x22, 0xf1, 0x37, 0x0e, 0xba, 0x93, 0x09, 0x36, 0xa3, 0x0a, 0x48, 0x16, 0xd3, 0x94, 0x84, + 0x02, 0x4c, 0x28, 0x99, 0x00, 0xb8, 0x4e, 0xb7, 0xda, 0xbf, 0xf1, 0xe0, 0x8e, 0x57, 0x00, 0xf2, + 0x34, 0x20, 0x8b, 0xdd, 0x1b, 0x72, 0x96, 0x0e, 0xee, 0x9f, 0xbd, 0xec, 0x2c, 0x7d, 0xff, 0xaa, + 0xd3, 0x9f, 0x32, 0x75, 0x94, 0x8f, 0xbd, 0x90, 0x27, 0x7e, 0x89, 0xbe, 0xf8, 0x73, 0x4f, 0x46, + 0xc7, 0xbe, 0x3a, 0xcd, 0x40, 0x9a, 0x04, 0x19, 0x6c, 0x95, 0xdd, 0x46, 0x31, 0x4d, 0x87, 0x65, + 0xaf, 0x03, 0x00, 0xfc, 0x0e, 0x6a, 0x4e, 0x00, 0x48, 0xc8, 0xe3, 0x18, 0x42, 0xc5, 0x85, 0x5b, + 0xe9, 0x3a, 0xfd, 0x46, 0x70, 0x73, 0x02, 0x30, 0xb4, 0x36, 0xbc, 0x8b, 0x36, 0x13, 0x7a, 0x42, + 0xd2, 0x3c, 0x21, 0x8b, 0xa0, 0xa5, 0x5b, 0xed, 0x3a, 0xfd, 0x66, 0x80, 0x13, 0x7a, 0xf2, 0x69, + 0x9e, 0x8c, 0x2e, 0x3b, 0x48, 0xfc, 0x04, 0x69, 0x2b, 0x19, 0xc7, 0x3c, 0x3c, 0x26, 0x96, 0x07, + 0xb7, 0xd6, 0x75, 0xcc, 0x60, 0x05, 0x51, 0x9e, 0x25, 0xca, 0xdb, 0x2f, 0x03, 0x06, 0xab, 0x7a, + 0xb0, 0xef, 0x5e, 0x75, 0x9c, 0xe0, 0x56, 0x42, 0x4f, 0x06, 0x3a, 0xdb, 0xfa, 0x7a, 0x3f, 0x55, + 0x51, 0x4d, 0x17, 0xc7, 0x2d, 0x54, 0x61, 0x91, 0xeb, 0x74, 0x9d, 0x7e, 0x2d, 0xa8, 0xb0, 0x08, + 0x77, 0xd1, 0x8d, 0x08, 0x64, 0x28, 0x58, 0x66, 0x9a, 0x14, 0x13, 0x2c, 0x9a, 0xf0, 0x7d, 0xb4, + 0xa1, 0x05, 0xc0, 0xd2, 0x29, 0xc9, 0x38, 0x8f, 0x09, 0x8d, 0x22, 0x01, 0xb2, 0xc0, 0xdf, 0x08, + 0x70, 0xe9, 0x1b, 0x71, 0x1e, 0xef, 0x15, 0x1e, 0xec, 0xa3, 0x75, 0x05, 0xda, 0x5a, 0x6c, 0xc5, + 0x26, 0xd4, 0x8a, 0x84, 0x05, 0x97, 0x4d, 0xf8, 0x02, 0x61, 0x01, 0xcf, 0xa8, 0x88, 0x08, 0x8d, + 0x63, 0x1e, 0x1a, 0x9f, 0x74, 0x97, 0xcd, 0x26, 0xdf, 0xf7, 0xfe, 0x41, 0x89, 0x5e, 0x60, 0x52, + 0xf6, 0xe6, 0x19, 0x83, 0x9a, 0x26, 0x20, 0xb8, 0x2d, 0xae, 0xd8, 0x25, 0x1e, 0x22, 0x24, 0x15, + 0x15, 0x8a, 0x68, 0xd5, 0xb9, 0x75, 0x43, 0xe4, 0xce, 0x5f, 0x88, 0x3c, 0xb4, 0x92, 0x2c, 0x98, + 0x7c, 0xae, 0x99, 0x6c, 0x98, 0x3c, 0xed, 0xc1, 0x9f, 0xa0, 0x55, 0x48, 0xa3, 0xa2, 0xc4, 0xca, + 0xbf, 0x28, 0xb1, 0x02, 0x69, 0x64, 0x0a, 0xbc, 0x8d, 0x10, 0x93, 0x56, 0x04, 0xee, 0x6a, 0xd7, + 0xe9, 0xaf, 0x06, 0x0d, 0x26, 0xcb, 0xd5, 0x6b, 0x35, 0x31, 0x49, 0x2c, 0x3b, 0x10, 0xb9, 0x0d, + 0x13, 0x71, 0x93, 0xc9, 0xc3, 0xb9, 0xad, 0xf7, 0x83, 0x83, 0x6e, 0x5d, 0x9d, 0x1b, 0x6f, 0xa0, + 0xe5, 0x08, 0x52, 0x9e, 0x98, 0xb5, 0x36, 0x82, 0xe2, 0x80, 0xb7, 0xd1, 0x4a, 0x46, 0x99, 0x20, + 0x2c, 0x32, 0x5b, 0xad, 0x05, 0x75, 0x7d, 0x7c, 0x1c, 0x61, 0x89, 0xd6, 0x0a, 0x8a, 0x24, 0xc9, + 0x40, 0x90, 0x88, 0x9e, 0xba, 0xd5, 0xff, 0xff, 0xd2, 0x34, 0xcb, 0x1e, 0x23, 0x10, 0xfb, 0xf4, + 0xb4, 0xf7, 0x73, 0x15, 0xd5, 0x0e, 0xa8, 0x48, 0xf0, 0x97, 0x68, 0x43, 0x71, 0x45, 0x63, 0x62, + 0x45, 0x45, 0x13, 0x9e, 0xa7, 0xaa, 0xc0, 0x3e, 0xf0, 0x74, 0x9f, 0x5f, 0x5f, 0x76, 0xde, 0xbb, + 0x46, 0x9f, 0xc7, 0xa9, 0x0a, 0xb0, 0xa9, 0x75, 0x50, 0x94, 0xda, 0x33, 0x95, 0xf0, 0x57, 0x68, + 0x2d, 0xcc, 0x85, 0x80, 0x54, 0x91, 0x12, 0x83, 0x5b, 0x31, 0xf3, 0xbd, 0xf5, 0xb7, 0xf3, 0xed, + 0x43, 0x68, 0x46, 0x7c, 0x58, 0x8e, 0xf8, 0xe1, 0x35, 0x5a, 0x97, 0x39, 0x32, 0x68, 0x95, 0x9d, + 0x8a, 0x9d, 0x48, 0xfc, 0xb5, 0x83, 0xd6, 0x79, 0xae, 0xa4, 0xa2, 0x69, 0xa4, 0x87, 0xb3, 0x00, + 0xaa, 0x6f, 0x0a, 0x00, 0x5e, 0xe8, 0x66, 0x41, 0x6c, 0xa1, 0x7a, 0x06, 0x82, 0xf1, 0xc8, 0x5c, + 0x39, 0xbd, 0x78, 0x73, 0xc2, 0x4f, 0x50, 0x2b, 0x13, 0x30, 0x63, 0x3c, 0x97, 0x44, 0x1e, 0x51, + 0x01, 0xee, 0xb2, 0x21, 0xfd, 0x83, 0x6b, 0x12, 0xbe, 0x0f, 0x61, 0xd0, 0xb4, 0x15, 0x3e, 0xd3, + 0x05, 0x7a, 0x7f, 0x38, 0x68, 0x75, 0xc4, 0x25, 0x33, 0x3a, 0xdc, 0x42, 0x75, 0xbd, 0x54, 0x10, + 0xa5, 0x10, 0xcb, 0xd3, 0xa5, 0x3e, 0x2b, 0x8b, 0xfa, 0x7c, 0x8a, 0x5a, 0x57, 0x24, 0x50, 0xfd, + 0x4f, 0x12, 0x68, 0x4e, 0x5e, 0xdb, 0xfe, 0x5d, 0xb4, 0x36, 0x1f, 0xf2, 0x35, 0x16, 0xe6, 0xb3, + 0x8f, 0x0a, 0x36, 0x1e, 0xa0, 0x4d, 0x73, 0xb9, 0x35, 0x80, 0xe2, 0xa9, 0x3d, 0x02, 0x36, 0x3d, + 0x52, 0x86, 0x94, 0x6a, 0xb0, 0x6e, 0x9d, 0xe6, 0x21, 0x7d, 0x64, 0x5c, 0xbd, 0x33, 0x07, 0xdd, + 0x7e, 0xc4, 0xa4, 0xe2, 0x82, 0x85, 0x34, 0xb6, 0x7c, 0x7f, 0xeb, 0xa0, 0xed, 0x30, 0x4f, 0xf2, + 0x98, 0x2a, 0x36, 0x03, 0x92, 0xa7, 0xec, 0x52, 0x79, 0xce, 0x9b, 0x5a, 0xfc, 0xe6, 0x65, 0xc7, + 0xa7, 0x29, 0x9b, 0x0b, 0xf0, 0xae, 0xbe, 0xdc, 0x13, 0x10, 0x90, 0x86, 0xfa, 0xcb, 0xa4, 0x69, + 0xad, 0x98, 0x0f, 0x4d, 0x6b, 0x6e, 0x1e, 0x6a, 0xeb, 0xe0, 0xf0, 0xec, 0xf7, 0xf6, 0xd2, 0xd9, + 0x79, 0xdb, 0x79, 0x71, 0xde, 0x76, 0x7e, 0x3b, 0x6f, 0x3b, 0xcf, 0x2f, 0xda, 0x4b, 0x2f, 0x2e, + 0xda, 0x4b, 0xbf, 0x5c, 0xb4, 0x97, 0x3e, 0xff, 0x78, 0x11, 0x4a, 0xf9, 0xfe, 0xde, 0x4b, 0x41, + 0x3d, 0xe3, 0xe2, 0x78, 0x6e, 0xf0, 0x67, 0x1f, 0xf9, 0x27, 0xf6, 0x57, 0x84, 0x81, 0x37, 0xae, + 0x9b, 0xa7, 0xf0, 0xe1, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x49, 0x26, 0x39, 0xd2, 0x65, 0x08, + 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.MaxBlockDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxBlockDuration):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintLpfarm(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x22 + if m.MaxNumPrivatePlans != 0 { + i = encodeVarintLpfarm(dAtA, i, uint64(m.MaxNumPrivatePlans)) + i-- + dAtA[i] = 0x18 + } + if len(m.FeeCollector) > 0 { + i -= len(m.FeeCollector) + copy(dAtA[i:], m.FeeCollector) + i = encodeVarintLpfarm(dAtA, i, uint64(len(m.FeeCollector))) + i-- + dAtA[i] = 0x12 + } + if len(m.PrivatePlanCreationFee) > 0 { + for iNdEx := len(m.PrivatePlanCreationFee) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PrivatePlanCreationFee[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLpfarm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Plan) 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 *Plan) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Plan) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsTerminated { + i-- + if m.IsTerminated { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x48 + } + if m.IsPrivate { + i-- + if m.IsPrivate { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.EndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.EndTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintLpfarm(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x3a + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTime):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintLpfarm(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x32 + if len(m.RewardAllocations) > 0 { + for iNdEx := len(m.RewardAllocations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardAllocations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLpfarm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.TerminationAddress) > 0 { + i -= len(m.TerminationAddress) + copy(dAtA[i:], m.TerminationAddress) + i = encodeVarintLpfarm(dAtA, i, uint64(len(m.TerminationAddress))) + i-- + dAtA[i] = 0x22 + } + if len(m.FarmingPoolAddress) > 0 { + i -= len(m.FarmingPoolAddress) + copy(dAtA[i:], m.FarmingPoolAddress) + i = encodeVarintLpfarm(dAtA, i, uint64(len(m.FarmingPoolAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintLpfarm(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintLpfarm(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *RewardAllocation) 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 *RewardAllocation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RewardAllocation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RewardsPerDay) > 0 { + for iNdEx := len(m.RewardsPerDay) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardsPerDay[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLpfarm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.PairId != 0 { + i = encodeVarintLpfarm(dAtA, i, uint64(m.PairId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintLpfarm(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Farm) 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 *Farm) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Farm) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PreviousShare != nil { + { + size := m.PreviousShare.Size() + i -= size + if _, err := m.PreviousShare.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLpfarm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if m.Period != 0 { + i = encodeVarintLpfarm(dAtA, i, uint64(m.Period)) + i-- + dAtA[i] = 0x20 + } + if len(m.OutstandingRewards) > 0 { + for iNdEx := len(m.OutstandingRewards) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OutstandingRewards[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLpfarm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.CurrentRewards) > 0 { + for iNdEx := len(m.CurrentRewards) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CurrentRewards[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLpfarm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size := m.TotalFarmingAmount.Size() + i -= size + if _, err := m.TotalFarmingAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLpfarm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Position) 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 *Position) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Position) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.StartingBlockHeight != 0 { + i = encodeVarintLpfarm(dAtA, i, uint64(m.StartingBlockHeight)) + i-- + dAtA[i] = 0x28 + } + if m.PreviousPeriod != 0 { + i = encodeVarintLpfarm(dAtA, i, uint64(m.PreviousPeriod)) + i-- + dAtA[i] = 0x20 + } + { + size := m.FarmingAmount.Size() + i -= size + if _, err := m.FarmingAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLpfarm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintLpfarm(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Farmer) > 0 { + i -= len(m.Farmer) + copy(dAtA[i:], m.Farmer) + i = encodeVarintLpfarm(dAtA, i, uint64(len(m.Farmer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *HistoricalRewards) 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 *HistoricalRewards) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HistoricalRewards) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ReferenceCount != 0 { + i = encodeVarintLpfarm(dAtA, i, uint64(m.ReferenceCount)) + i-- + dAtA[i] = 0x10 + } + if len(m.CumulativeUnitRewards) > 0 { + for iNdEx := len(m.CumulativeUnitRewards) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CumulativeUnitRewards[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLpfarm(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintLpfarm(dAtA []byte, offset int, v uint64) int { + offset -= sovLpfarm(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.PrivatePlanCreationFee) > 0 { + for _, e := range m.PrivatePlanCreationFee { + l = e.Size() + n += 1 + l + sovLpfarm(uint64(l)) + } + } + l = len(m.FeeCollector) + if l > 0 { + n += 1 + l + sovLpfarm(uint64(l)) + } + if m.MaxNumPrivatePlans != 0 { + n += 1 + sovLpfarm(uint64(m.MaxNumPrivatePlans)) + } + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxBlockDuration) + n += 1 + l + sovLpfarm(uint64(l)) + return n +} + +func (m *Plan) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovLpfarm(uint64(m.Id)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovLpfarm(uint64(l)) + } + l = len(m.FarmingPoolAddress) + if l > 0 { + n += 1 + l + sovLpfarm(uint64(l)) + } + l = len(m.TerminationAddress) + if l > 0 { + n += 1 + l + sovLpfarm(uint64(l)) + } + if len(m.RewardAllocations) > 0 { + for _, e := range m.RewardAllocations { + l = e.Size() + n += 1 + l + sovLpfarm(uint64(l)) + } + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTime) + n += 1 + l + sovLpfarm(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.EndTime) + n += 1 + l + sovLpfarm(uint64(l)) + if m.IsPrivate { + n += 2 + } + if m.IsTerminated { + n += 2 + } + return n +} + +func (m *RewardAllocation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovLpfarm(uint64(l)) + } + if m.PairId != 0 { + n += 1 + sovLpfarm(uint64(m.PairId)) + } + if len(m.RewardsPerDay) > 0 { + for _, e := range m.RewardsPerDay { + l = e.Size() + n += 1 + l + sovLpfarm(uint64(l)) + } + } + return n +} + +func (m *Farm) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TotalFarmingAmount.Size() + n += 1 + l + sovLpfarm(uint64(l)) + if len(m.CurrentRewards) > 0 { + for _, e := range m.CurrentRewards { + l = e.Size() + n += 1 + l + sovLpfarm(uint64(l)) + } + } + if len(m.OutstandingRewards) > 0 { + for _, e := range m.OutstandingRewards { + l = e.Size() + n += 1 + l + sovLpfarm(uint64(l)) + } + } + if m.Period != 0 { + n += 1 + sovLpfarm(uint64(m.Period)) + } + if m.PreviousShare != nil { + l = m.PreviousShare.Size() + n += 1 + l + sovLpfarm(uint64(l)) + } + return n +} + +func (m *Position) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Farmer) + if l > 0 { + n += 1 + l + sovLpfarm(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovLpfarm(uint64(l)) + } + l = m.FarmingAmount.Size() + n += 1 + l + sovLpfarm(uint64(l)) + if m.PreviousPeriod != 0 { + n += 1 + sovLpfarm(uint64(m.PreviousPeriod)) + } + if m.StartingBlockHeight != 0 { + n += 1 + sovLpfarm(uint64(m.StartingBlockHeight)) + } + return n +} + +func (m *HistoricalRewards) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.CumulativeUnitRewards) > 0 { + for _, e := range m.CumulativeUnitRewards { + l = e.Size() + n += 1 + l + sovLpfarm(uint64(l)) + } + } + if m.ReferenceCount != 0 { + n += 1 + sovLpfarm(uint64(m.ReferenceCount)) + } + return n +} + +func sovLpfarm(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozLpfarm(x uint64) (n int) { + return sovLpfarm(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 ErrIntOverflowLpfarm + } + 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 PrivatePlanCreationFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLpfarm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PrivatePlanCreationFee = append(m.PrivatePlanCreationFee, types.Coin{}) + if err := m.PrivatePlanCreationFee[len(m.PrivatePlanCreationFee)-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 FeeCollector", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + 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 ErrInvalidLengthLpfarm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeeCollector = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxNumPrivatePlans", wireType) + } + m.MaxNumPrivatePlans = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxNumPrivatePlans |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxBlockDuration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLpfarm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.MaxBlockDuration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLpfarm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLpfarm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Plan) 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 ErrIntOverflowLpfarm + } + 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: Plan: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Plan: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + 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 ErrInvalidLengthLpfarm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FarmingPoolAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + 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 ErrInvalidLengthLpfarm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FarmingPoolAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TerminationAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + 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 ErrInvalidLengthLpfarm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TerminationAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardAllocations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLpfarm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardAllocations = append(m.RewardAllocations, RewardAllocation{}) + if err := m.RewardAllocations[len(m.RewardAllocations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLpfarm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.StartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLpfarm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.EndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsPrivate", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsPrivate = bool(v != 0) + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsTerminated", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsTerminated = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipLpfarm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLpfarm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RewardAllocation) 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 ErrIntOverflowLpfarm + } + 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: RewardAllocation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RewardAllocation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + 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 ErrInvalidLengthLpfarm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PairId", wireType) + } + m.PairId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PairId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardsPerDay", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLpfarm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardsPerDay = append(m.RewardsPerDay, types.Coin{}) + if err := m.RewardsPerDay[len(m.RewardsPerDay)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLpfarm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLpfarm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Farm) 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 ErrIntOverflowLpfarm + } + 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: Farm: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Farm: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalFarmingAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + 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 ErrInvalidLengthLpfarm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TotalFarmingAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentRewards", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLpfarm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurrentRewards = append(m.CurrentRewards, types.DecCoin{}) + if err := m.CurrentRewards[len(m.CurrentRewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OutstandingRewards", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLpfarm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OutstandingRewards = append(m.OutstandingRewards, types.DecCoin{}) + if err := m.OutstandingRewards[len(m.OutstandingRewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Period", wireType) + } + m.Period = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Period |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreviousShare", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + 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 ErrInvalidLengthLpfarm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Dec + m.PreviousShare = &v + if err := m.PreviousShare.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLpfarm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLpfarm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Position) 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 ErrIntOverflowLpfarm + } + 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: Position: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Position: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Farmer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + 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 ErrInvalidLengthLpfarm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Farmer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + 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 ErrInvalidLengthLpfarm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FarmingAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + 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 ErrInvalidLengthLpfarm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FarmingAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PreviousPeriod", wireType) + } + m.PreviousPeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PreviousPeriod |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartingBlockHeight", wireType) + } + m.StartingBlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartingBlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLpfarm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLpfarm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HistoricalRewards) 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 ErrIntOverflowLpfarm + } + 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: HistoricalRewards: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HistoricalRewards: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CumulativeUnitRewards", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLpfarm + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLpfarm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CumulativeUnitRewards = append(m.CumulativeUnitRewards, types.DecCoin{}) + if err := m.CumulativeUnitRewards[len(m.CumulativeUnitRewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ReferenceCount", wireType) + } + m.ReferenceCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLpfarm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ReferenceCount |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLpfarm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLpfarm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipLpfarm(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, ErrIntOverflowLpfarm + } + 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, ErrIntOverflowLpfarm + } + 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, ErrIntOverflowLpfarm + } + 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, ErrInvalidLengthLpfarm + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupLpfarm + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthLpfarm + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthLpfarm = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLpfarm = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupLpfarm = fmt.Errorf("proto: unexpected end of group") +) diff --git a/third-party-chains/crescent-types/lpfarm/params.go b/third-party-chains/crescent-types/lpfarm/params.go new file mode 100644 index 000000000..bf6e14ac9 --- /dev/null +++ b/third-party-chains/crescent-types/lpfarm/params.go @@ -0,0 +1,117 @@ +package types + +import ( + "fmt" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramstypes.ParamSet = (*Params)(nil) + +var ( + KeyPrivatePlanCreationFee = []byte("PrivatePlanCreationFee") + KeyFeeCollector = []byte("FeeCollector") + KeyMaxNumPrivatePlans = []byte("MaxNumPrivatePlans") + KeyMaxBlockDuration = []byte("MaxBlockDuration") +) + +const ( + DefaultMaxNumPrivatePlans = 50 + DefaultMaxBlockDuration = 10 * time.Second + + MaxPlanDescriptionLen = 200 // Maximum length of a plan's description +) + +var ( + DefaultPrivatePlanCreationFee = sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 100_000000)) + DefaultFeeCollector = sdk.AccAddress(address.Module(ModuleName, []byte("FeeCollector"))) + + RewardsPoolAddress = address.Module(ModuleName, []byte("RewardsPool")) +) + +func ParamKeyTable() paramstypes.KeyTable { + return paramstypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// DefaultParams returns a default params for the module. +func DefaultParams() Params { + return Params{ + PrivatePlanCreationFee: DefaultPrivatePlanCreationFee, + FeeCollector: DefaultFeeCollector.String(), + MaxNumPrivatePlans: DefaultMaxNumPrivatePlans, + MaxBlockDuration: DefaultMaxBlockDuration, + } +} + +// ParamSetPairs implements ParamSet. +func (params *Params) ParamSetPairs() paramstypes.ParamSetPairs { + return paramstypes.ParamSetPairs{ + paramstypes.NewParamSetPair(KeyPrivatePlanCreationFee, ¶ms.PrivatePlanCreationFee, validatePrivatePlanCreationFee), + paramstypes.NewParamSetPair(KeyFeeCollector, ¶ms.FeeCollector, validateFeeCollector), + paramstypes.NewParamSetPair(KeyMaxNumPrivatePlans, ¶ms.MaxNumPrivatePlans, validateMaxNumPrivatePlans), + paramstypes.NewParamSetPair(KeyMaxBlockDuration, ¶ms.MaxBlockDuration, validateMaxBlockDuration), + } +} + +// Validate validates Params. +func (params Params) Validate() error { + for _, field := range []struct { + val interface{} + validateFunc func(i interface{}) error + }{ + {params.PrivatePlanCreationFee, validatePrivatePlanCreationFee}, + {params.FeeCollector, validateFeeCollector}, + {params.MaxNumPrivatePlans, validateMaxNumPrivatePlans}, + {params.MaxBlockDuration, validateMaxBlockDuration}, + } { + if err := field.validateFunc(field.val); err != nil { + return err + } + } + return nil +} + +func validatePrivatePlanCreationFee(i interface{}) error { + v, ok := i.(sdk.Coins) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + if err := v.Validate(); err != nil { + return fmt.Errorf("invalid private plan creation fee: %w", err) + } + return nil +} + +func validateFeeCollector(i interface{}) error { + v, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + _, err := sdk.AccAddressFromBech32(v) + if err != nil { + return fmt.Errorf("invalid fee collector address: %v", v) + } + return nil +} + +func validateMaxNumPrivatePlans(i interface{}) error { + _, ok := i.(uint32) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + return nil +} + +func validateMaxBlockDuration(i interface{}) error { + v, ok := i.(time.Duration) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + if v <= 0 { + return fmt.Errorf("max block duration must be positive") + } + return nil +} diff --git a/third-party-chains/crescent-types/lpfarm/query.pb.go b/third-party-chains/crescent-types/lpfarm/query.pb.go new file mode 100644 index 000000000..77706dbfc --- /dev/null +++ b/third-party-chains/crescent-types/lpfarm/query.pb.go @@ -0,0 +1,4297 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: crescent/lpfarm/v1beta1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + 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 + +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_d8516c7b94395f5e, []int{0} +} +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 + +type QueryParamsResponse struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +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_d8516c7b94395f5e, []int{1} +} +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 Params{} +} + +type QueryPlansRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryPlansRequest) Reset() { *m = QueryPlansRequest{} } +func (m *QueryPlansRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPlansRequest) ProtoMessage() {} +func (*QueryPlansRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{2} +} +func (m *QueryPlansRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPlansRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPlansRequest.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 *QueryPlansRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPlansRequest.Merge(m, src) +} +func (m *QueryPlansRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPlansRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPlansRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPlansRequest proto.InternalMessageInfo + +func (m *QueryPlansRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryPlansResponse struct { + Plans []Plan `protobuf:"bytes,1,rep,name=plans,proto3" json:"plans"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryPlansResponse) Reset() { *m = QueryPlansResponse{} } +func (m *QueryPlansResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPlansResponse) ProtoMessage() {} +func (*QueryPlansResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{3} +} +func (m *QueryPlansResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPlansResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPlansResponse.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 *QueryPlansResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPlansResponse.Merge(m, src) +} +func (m *QueryPlansResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPlansResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPlansResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPlansResponse proto.InternalMessageInfo + +func (m *QueryPlansResponse) GetPlans() []Plan { + if m != nil { + return m.Plans + } + return nil +} + +func (m *QueryPlansResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryPlanRequest struct { + PlanId uint64 `protobuf:"varint,1,opt,name=plan_id,json=planId,proto3" json:"plan_id,omitempty"` +} + +func (m *QueryPlanRequest) Reset() { *m = QueryPlanRequest{} } +func (m *QueryPlanRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPlanRequest) ProtoMessage() {} +func (*QueryPlanRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{4} +} +func (m *QueryPlanRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPlanRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPlanRequest.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 *QueryPlanRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPlanRequest.Merge(m, src) +} +func (m *QueryPlanRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPlanRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPlanRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPlanRequest proto.InternalMessageInfo + +func (m *QueryPlanRequest) GetPlanId() uint64 { + if m != nil { + return m.PlanId + } + return 0 +} + +type QueryPlanResponse struct { + Plan Plan `protobuf:"bytes,1,opt,name=plan,proto3" json:"plan"` +} + +func (m *QueryPlanResponse) Reset() { *m = QueryPlanResponse{} } +func (m *QueryPlanResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPlanResponse) ProtoMessage() {} +func (*QueryPlanResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{5} +} +func (m *QueryPlanResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPlanResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPlanResponse.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 *QueryPlanResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPlanResponse.Merge(m, src) +} +func (m *QueryPlanResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPlanResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPlanResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPlanResponse proto.InternalMessageInfo + +func (m *QueryPlanResponse) GetPlan() Plan { + if m != nil { + return m.Plan + } + return Plan{} +} + +type QueryFarmRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryFarmRequest) Reset() { *m = QueryFarmRequest{} } +func (m *QueryFarmRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFarmRequest) ProtoMessage() {} +func (*QueryFarmRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{6} +} +func (m *QueryFarmRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFarmRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFarmRequest.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 *QueryFarmRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFarmRequest.Merge(m, src) +} +func (m *QueryFarmRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryFarmRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFarmRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFarmRequest proto.InternalMessageInfo + +func (m *QueryFarmRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +type QueryFarmResponse struct { + Farm Farm `protobuf:"bytes,1,opt,name=farm,proto3" json:"farm"` +} + +func (m *QueryFarmResponse) Reset() { *m = QueryFarmResponse{} } +func (m *QueryFarmResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFarmResponse) ProtoMessage() {} +func (*QueryFarmResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{7} +} +func (m *QueryFarmResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFarmResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFarmResponse.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 *QueryFarmResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFarmResponse.Merge(m, src) +} +func (m *QueryFarmResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryFarmResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFarmResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFarmResponse proto.InternalMessageInfo + +func (m *QueryFarmResponse) GetFarm() Farm { + if m != nil { + return m.Farm + } + return Farm{} +} + +type QueryPositionsRequest struct { + Farmer string `protobuf:"bytes,1,opt,name=farmer,proto3" json:"farmer,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryPositionsRequest) Reset() { *m = QueryPositionsRequest{} } +func (m *QueryPositionsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPositionsRequest) ProtoMessage() {} +func (*QueryPositionsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{8} +} +func (m *QueryPositionsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPositionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPositionsRequest.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 *QueryPositionsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPositionsRequest.Merge(m, src) +} +func (m *QueryPositionsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPositionsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPositionsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPositionsRequest proto.InternalMessageInfo + +func (m *QueryPositionsRequest) GetFarmer() string { + if m != nil { + return m.Farmer + } + return "" +} + +func (m *QueryPositionsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryPositionsResponse struct { + Positions []Position `protobuf:"bytes,1,rep,name=positions,proto3" json:"positions"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryPositionsResponse) Reset() { *m = QueryPositionsResponse{} } +func (m *QueryPositionsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPositionsResponse) ProtoMessage() {} +func (*QueryPositionsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{9} +} +func (m *QueryPositionsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPositionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPositionsResponse.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 *QueryPositionsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPositionsResponse.Merge(m, src) +} +func (m *QueryPositionsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPositionsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPositionsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPositionsResponse proto.InternalMessageInfo + +func (m *QueryPositionsResponse) GetPositions() []Position { + if m != nil { + return m.Positions + } + return nil +} + +func (m *QueryPositionsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryPositionRequest struct { + Farmer string `protobuf:"bytes,1,opt,name=farmer,proto3" json:"farmer,omitempty"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryPositionRequest) Reset() { *m = QueryPositionRequest{} } +func (m *QueryPositionRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPositionRequest) ProtoMessage() {} +func (*QueryPositionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{10} +} +func (m *QueryPositionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPositionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPositionRequest.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 *QueryPositionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPositionRequest.Merge(m, src) +} +func (m *QueryPositionRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPositionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPositionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPositionRequest proto.InternalMessageInfo + +func (m *QueryPositionRequest) GetFarmer() string { + if m != nil { + return m.Farmer + } + return "" +} + +func (m *QueryPositionRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +type QueryPositionResponse struct { + Position Position `protobuf:"bytes,1,opt,name=position,proto3" json:"position"` +} + +func (m *QueryPositionResponse) Reset() { *m = QueryPositionResponse{} } +func (m *QueryPositionResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPositionResponse) ProtoMessage() {} +func (*QueryPositionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{11} +} +func (m *QueryPositionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPositionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPositionResponse.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 *QueryPositionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPositionResponse.Merge(m, src) +} +func (m *QueryPositionResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPositionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPositionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPositionResponse proto.InternalMessageInfo + +func (m *QueryPositionResponse) GetPosition() Position { + if m != nil { + return m.Position + } + return Position{} +} + +type QueryHistoricalRewardsRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryHistoricalRewardsRequest) Reset() { *m = QueryHistoricalRewardsRequest{} } +func (m *QueryHistoricalRewardsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryHistoricalRewardsRequest) ProtoMessage() {} +func (*QueryHistoricalRewardsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{12} +} +func (m *QueryHistoricalRewardsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryHistoricalRewardsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryHistoricalRewardsRequest.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 *QueryHistoricalRewardsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHistoricalRewardsRequest.Merge(m, src) +} +func (m *QueryHistoricalRewardsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryHistoricalRewardsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHistoricalRewardsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryHistoricalRewardsRequest proto.InternalMessageInfo + +func (m *QueryHistoricalRewardsRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *QueryHistoricalRewardsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryHistoricalRewardsResponse struct { + HistoricalRewards []HistoricalRewardsResponse `protobuf:"bytes,1,rep,name=historical_rewards,json=historicalRewards,proto3" json:"historical_rewards"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryHistoricalRewardsResponse) Reset() { *m = QueryHistoricalRewardsResponse{} } +func (m *QueryHistoricalRewardsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryHistoricalRewardsResponse) ProtoMessage() {} +func (*QueryHistoricalRewardsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{13} +} +func (m *QueryHistoricalRewardsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryHistoricalRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryHistoricalRewardsResponse.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 *QueryHistoricalRewardsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHistoricalRewardsResponse.Merge(m, src) +} +func (m *QueryHistoricalRewardsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryHistoricalRewardsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHistoricalRewardsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryHistoricalRewardsResponse proto.InternalMessageInfo + +func (m *QueryHistoricalRewardsResponse) GetHistoricalRewards() []HistoricalRewardsResponse { + if m != nil { + return m.HistoricalRewards + } + return nil +} + +func (m *QueryHistoricalRewardsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryTotalRewardsRequest struct { + Farmer string `protobuf:"bytes,1,opt,name=farmer,proto3" json:"farmer,omitempty"` +} + +func (m *QueryTotalRewardsRequest) Reset() { *m = QueryTotalRewardsRequest{} } +func (m *QueryTotalRewardsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalRewardsRequest) ProtoMessage() {} +func (*QueryTotalRewardsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{14} +} +func (m *QueryTotalRewardsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalRewardsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalRewardsRequest.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 *QueryTotalRewardsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalRewardsRequest.Merge(m, src) +} +func (m *QueryTotalRewardsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalRewardsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalRewardsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalRewardsRequest proto.InternalMessageInfo + +func (m *QueryTotalRewardsRequest) GetFarmer() string { + if m != nil { + return m.Farmer + } + return "" +} + +type QueryTotalRewardsResponse struct { + Rewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"rewards"` +} + +func (m *QueryTotalRewardsResponse) Reset() { *m = QueryTotalRewardsResponse{} } +func (m *QueryTotalRewardsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalRewardsResponse) ProtoMessage() {} +func (*QueryTotalRewardsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{15} +} +func (m *QueryTotalRewardsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalRewardsResponse.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 *QueryTotalRewardsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalRewardsResponse.Merge(m, src) +} +func (m *QueryTotalRewardsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalRewardsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalRewardsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalRewardsResponse proto.InternalMessageInfo + +func (m *QueryTotalRewardsResponse) GetRewards() github_com_cosmos_cosmos_sdk_types.DecCoins { + if m != nil { + return m.Rewards + } + return nil +} + +type QueryRewardsRequest struct { + Farmer string `protobuf:"bytes,1,opt,name=farmer,proto3" json:"farmer,omitempty"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryRewardsRequest) Reset() { *m = QueryRewardsRequest{} } +func (m *QueryRewardsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRewardsRequest) ProtoMessage() {} +func (*QueryRewardsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{16} +} +func (m *QueryRewardsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRewardsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRewardsRequest.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 *QueryRewardsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRewardsRequest.Merge(m, src) +} +func (m *QueryRewardsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRewardsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRewardsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRewardsRequest proto.InternalMessageInfo + +func (m *QueryRewardsRequest) GetFarmer() string { + if m != nil { + return m.Farmer + } + return "" +} + +func (m *QueryRewardsRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +type QueryRewardsResponse struct { + Rewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"rewards"` +} + +func (m *QueryRewardsResponse) Reset() { *m = QueryRewardsResponse{} } +func (m *QueryRewardsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRewardsResponse) ProtoMessage() {} +func (*QueryRewardsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{17} +} +func (m *QueryRewardsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRewardsResponse.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 *QueryRewardsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRewardsResponse.Merge(m, src) +} +func (m *QueryRewardsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRewardsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRewardsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRewardsResponse proto.InternalMessageInfo + +func (m *QueryRewardsResponse) GetRewards() github_com_cosmos_cosmos_sdk_types.DecCoins { + if m != nil { + return m.Rewards + } + return nil +} + +type HistoricalRewardsResponse struct { + Period uint64 `protobuf:"varint,1,opt,name=period,proto3" json:"period,omitempty"` + CumulativeUnitRewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,2,rep,name=cumulative_unit_rewards,json=cumulativeUnitRewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"cumulative_unit_rewards"` + ReferenceCount uint32 `protobuf:"varint,3,opt,name=reference_count,json=referenceCount,proto3" json:"reference_count,omitempty"` +} + +func (m *HistoricalRewardsResponse) Reset() { *m = HistoricalRewardsResponse{} } +func (m *HistoricalRewardsResponse) String() string { return proto.CompactTextString(m) } +func (*HistoricalRewardsResponse) ProtoMessage() {} +func (*HistoricalRewardsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d8516c7b94395f5e, []int{18} +} +func (m *HistoricalRewardsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HistoricalRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HistoricalRewardsResponse.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 *HistoricalRewardsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistoricalRewardsResponse.Merge(m, src) +} +func (m *HistoricalRewardsResponse) XXX_Size() int { + return m.Size() +} +func (m *HistoricalRewardsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_HistoricalRewardsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_HistoricalRewardsResponse proto.InternalMessageInfo + +func (m *HistoricalRewardsResponse) GetPeriod() uint64 { + if m != nil { + return m.Period + } + return 0 +} + +func (m *HistoricalRewardsResponse) GetCumulativeUnitRewards() github_com_cosmos_cosmos_sdk_types.DecCoins { + if m != nil { + return m.CumulativeUnitRewards + } + return nil +} + +func (m *HistoricalRewardsResponse) GetReferenceCount() uint32 { + if m != nil { + return m.ReferenceCount + } + return 0 +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "crescent.lpfarm.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "crescent.lpfarm.v1beta1.QueryParamsResponse") + proto.RegisterType((*QueryPlansRequest)(nil), "crescent.lpfarm.v1beta1.QueryPlansRequest") + proto.RegisterType((*QueryPlansResponse)(nil), "crescent.lpfarm.v1beta1.QueryPlansResponse") + proto.RegisterType((*QueryPlanRequest)(nil), "crescent.lpfarm.v1beta1.QueryPlanRequest") + proto.RegisterType((*QueryPlanResponse)(nil), "crescent.lpfarm.v1beta1.QueryPlanResponse") + proto.RegisterType((*QueryFarmRequest)(nil), "crescent.lpfarm.v1beta1.QueryFarmRequest") + proto.RegisterType((*QueryFarmResponse)(nil), "crescent.lpfarm.v1beta1.QueryFarmResponse") + proto.RegisterType((*QueryPositionsRequest)(nil), "crescent.lpfarm.v1beta1.QueryPositionsRequest") + proto.RegisterType((*QueryPositionsResponse)(nil), "crescent.lpfarm.v1beta1.QueryPositionsResponse") + proto.RegisterType((*QueryPositionRequest)(nil), "crescent.lpfarm.v1beta1.QueryPositionRequest") + proto.RegisterType((*QueryPositionResponse)(nil), "crescent.lpfarm.v1beta1.QueryPositionResponse") + proto.RegisterType((*QueryHistoricalRewardsRequest)(nil), "crescent.lpfarm.v1beta1.QueryHistoricalRewardsRequest") + proto.RegisterType((*QueryHistoricalRewardsResponse)(nil), "crescent.lpfarm.v1beta1.QueryHistoricalRewardsResponse") + proto.RegisterType((*QueryTotalRewardsRequest)(nil), "crescent.lpfarm.v1beta1.QueryTotalRewardsRequest") + proto.RegisterType((*QueryTotalRewardsResponse)(nil), "crescent.lpfarm.v1beta1.QueryTotalRewardsResponse") + proto.RegisterType((*QueryRewardsRequest)(nil), "crescent.lpfarm.v1beta1.QueryRewardsRequest") + proto.RegisterType((*QueryRewardsResponse)(nil), "crescent.lpfarm.v1beta1.QueryRewardsResponse") + proto.RegisterType((*HistoricalRewardsResponse)(nil), "crescent.lpfarm.v1beta1.HistoricalRewardsResponse") +} + +func init() { + proto.RegisterFile("crescent/lpfarm/v1beta1/query.proto", fileDescriptor_d8516c7b94395f5e) +} + +var fileDescriptor_d8516c7b94395f5e = []byte{ + // 1032 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x97, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xc7, 0x33, 0xae, 0xe3, 0x34, 0x2f, 0xfc, 0xca, 0x90, 0x26, 0xa9, 0xd5, 0x3a, 0xe9, 0x82, + 0x12, 0x37, 0xc6, 0xbb, 0xd8, 0x86, 0x56, 0x15, 0xe2, 0x92, 0x94, 0x02, 0x12, 0x87, 0x62, 0x95, + 0x0b, 0x20, 0x45, 0x9b, 0xf5, 0xd4, 0x59, 0xc5, 0xde, 0xd9, 0xee, 0xae, 0x13, 0xaa, 0x28, 0x17, + 0xb8, 0x14, 0x09, 0x04, 0x12, 0x17, 0xae, 0x15, 0x12, 0xaa, 0xf8, 0x2f, 0xb8, 0xf5, 0x58, 0xc1, + 0x85, 0x13, 0xa0, 0x84, 0x03, 0x7f, 0x06, 0xda, 0x99, 0x37, 0xeb, 0xb5, 0x93, 0xc9, 0x6e, 0x50, + 0x10, 0xa7, 0x76, 0x66, 0xde, 0x8f, 0xcf, 0xf7, 0xcd, 0xf3, 0xbe, 0x09, 0xbc, 0xe2, 0x04, 0x2c, + 0x74, 0x98, 0x17, 0x59, 0x3d, 0xff, 0xbe, 0x1d, 0xf4, 0xad, 0xdd, 0xc6, 0x16, 0x8b, 0xec, 0x86, + 0xf5, 0x60, 0xc0, 0x82, 0x87, 0xa6, 0x1f, 0xf0, 0x88, 0xd3, 0x05, 0x65, 0x64, 0x4a, 0x23, 0x13, + 0x8d, 0xca, 0x73, 0x5d, 0xde, 0xe5, 0xc2, 0xc6, 0x8a, 0xff, 0x27, 0xcd, 0xcb, 0x57, 0xba, 0x9c, + 0x77, 0x7b, 0xcc, 0xb2, 0x7d, 0xd7, 0xb2, 0x3d, 0x8f, 0x47, 0x76, 0xe4, 0x72, 0x2f, 0xc4, 0xd3, + 0x8a, 0xc3, 0xc3, 0x3e, 0x0f, 0xad, 0x2d, 0x3b, 0x64, 0x49, 0x36, 0x87, 0xbb, 0x1e, 0x9e, 0xaf, + 0xa5, 0xcf, 0x05, 0x45, 0x62, 0xe5, 0xdb, 0x5d, 0xd7, 0x13, 0xc1, 0xd0, 0xf6, 0x55, 0x1d, 0x3d, + 0x72, 0x0a, 0x2b, 0x63, 0x0e, 0xe8, 0x87, 0x71, 0x9c, 0xbb, 0x76, 0x60, 0xf7, 0xc3, 0x36, 0x7b, + 0x30, 0x60, 0x61, 0x64, 0xdc, 0x83, 0x97, 0x47, 0x76, 0x43, 0x9f, 0x7b, 0x21, 0xa3, 0x6f, 0x43, + 0xc9, 0x17, 0x3b, 0x8b, 0x64, 0x99, 0x54, 0x67, 0x9a, 0x4b, 0xa6, 0x46, 0xbc, 0x29, 0x1d, 0xd7, + 0x8b, 0x4f, 0x7f, 0x5f, 0x9a, 0x68, 0xa3, 0x93, 0xf1, 0x09, 0xcc, 0xca, 0xa8, 0x3d, 0xdb, 0x53, + 0xa9, 0xe8, 0x1d, 0x80, 0x21, 0x3a, 0xc6, 0x5d, 0x31, 0xa5, 0x4e, 0x33, 0xd6, 0x69, 0xca, 0x6a, + 0x0f, 0x23, 0x77, 0x19, 0xfa, 0xb6, 0x53, 0x9e, 0xc6, 0xf7, 0x44, 0x29, 0x91, 0xd1, 0x11, 0xf9, + 0x16, 0x4c, 0xfa, 0xf1, 0xc6, 0x22, 0x59, 0xbe, 0x50, 0x9d, 0x69, 0x5e, 0xd5, 0x13, 0xf7, 0x6c, + 0x0f, 0x79, 0xa5, 0x07, 0x7d, 0x77, 0x84, 0xac, 0x20, 0xc8, 0x56, 0x33, 0xc9, 0x64, 0xde, 0x11, + 0xb4, 0x1a, 0xbc, 0x94, 0x90, 0x29, 0xd9, 0x0b, 0x30, 0x15, 0x67, 0xd9, 0x74, 0x3b, 0x42, 0x73, + 0xb1, 0x5d, 0x8a, 0x97, 0xef, 0x77, 0x8c, 0x0f, 0x52, 0x45, 0x4a, 0x54, 0xdc, 0x84, 0x62, 0x7c, + 0x8c, 0xe5, 0xc9, 0x25, 0x42, 0x38, 0x18, 0x55, 0x4c, 0x7d, 0xc7, 0x0e, 0xfa, 0x2a, 0xf5, 0x1c, + 0x4c, 0x76, 0x98, 0xc7, 0xfb, 0x22, 0xda, 0x74, 0x5b, 0x2e, 0x92, 0xbc, 0xd2, 0x72, 0x98, 0x37, + 0x8e, 0x9f, 0x99, 0x37, 0x76, 0x52, 0x79, 0xe3, 0x03, 0x63, 0x0f, 0x2e, 0x49, 0x15, 0x3c, 0x74, + 0x45, 0x83, 0xab, 0xe4, 0xf3, 0x50, 0x8a, 0x0d, 0x58, 0x80, 0xd9, 0x71, 0x35, 0xd6, 0x06, 0x85, + 0x7f, 0xdd, 0x06, 0x4f, 0x08, 0xcc, 0x8f, 0x67, 0x46, 0x31, 0xef, 0xc0, 0xb4, 0xaf, 0x36, 0xb1, + 0x1d, 0xae, 0xe9, 0x2b, 0x89, 0x96, 0xa8, 0x6a, 0xe8, 0x79, 0x7e, 0x6d, 0x71, 0x1b, 0xe6, 0x46, + 0x48, 0xb3, 0x4a, 0x94, 0xdc, 0x5b, 0x21, 0x7d, 0x6f, 0x9f, 0x8e, 0x55, 0x3a, 0x91, 0xbb, 0x01, + 0x17, 0x15, 0x34, 0xde, 0x5f, 0x6e, 0xb5, 0x89, 0xa3, 0x71, 0x00, 0x57, 0x45, 0xf4, 0xf7, 0xdc, + 0x30, 0xe2, 0x81, 0xeb, 0xd8, 0xbd, 0x36, 0xdb, 0xb3, 0x83, 0x4e, 0x78, 0x6a, 0x33, 0x9d, 0xdb, + 0x6d, 0xfe, 0x42, 0xa0, 0xa2, 0xcb, 0x8f, 0x32, 0xbb, 0x40, 0xb7, 0x93, 0xc3, 0xcd, 0x40, 0x9e, + 0xe2, 0xf5, 0x36, 0xb5, 0x82, 0xb5, 0xf1, 0xb0, 0x02, 0xb3, 0xdb, 0xe3, 0x06, 0xe7, 0x77, 0xef, + 0x4d, 0x58, 0x14, 0x9a, 0xee, 0xf1, 0xe8, 0x58, 0x39, 0x35, 0x77, 0x6f, 0x3c, 0x22, 0x70, 0xf9, + 0x04, 0x27, 0xac, 0xc1, 0x0e, 0x4c, 0x8d, 0x0a, 0xbf, 0x32, 0xc2, 0xa5, 0x88, 0x6e, 0x33, 0x67, + 0x83, 0xbb, 0xde, 0x7a, 0x2b, 0x96, 0xf8, 0xd3, 0x1f, 0x4b, 0xb5, 0xae, 0x1b, 0x6d, 0x0f, 0xb6, + 0x4c, 0x87, 0xf7, 0x2d, 0x1c, 0x2c, 0xf2, 0x9f, 0x7a, 0xd8, 0xd9, 0xb1, 0xa2, 0x87, 0x3e, 0x0b, + 0x95, 0x4f, 0xd8, 0x56, 0x19, 0x8c, 0x0d, 0x9c, 0x0d, 0xf9, 0xc8, 0x35, 0x5d, 0xfb, 0x05, 0xc1, + 0xe6, 0xff, 0x5f, 0xa5, 0xfc, 0x4d, 0xe0, 0xb2, 0xbe, 0xb3, 0xe6, 0xa1, 0xe4, 0xb3, 0xc0, 0xe5, + 0xc3, 0x2f, 0xb4, 0x58, 0xd1, 0x2f, 0x09, 0x2c, 0x38, 0x83, 0xfe, 0xa0, 0x67, 0x47, 0xee, 0x2e, + 0xdb, 0x1c, 0x78, 0x6e, 0x94, 0xf4, 0x5d, 0xe1, 0xbf, 0x62, 0xbe, 0x34, 0xcc, 0xf8, 0x91, 0xe7, + 0x46, 0xaa, 0x29, 0x57, 0xe1, 0xc5, 0x80, 0xdd, 0x67, 0x01, 0xf3, 0x1c, 0xb6, 0xe9, 0xf0, 0x81, + 0x17, 0x2d, 0x5e, 0x58, 0x26, 0xd5, 0xe7, 0xdb, 0x2f, 0x24, 0xdb, 0x1b, 0xf1, 0x6e, 0xf3, 0x87, + 0x19, 0x98, 0x14, 0x05, 0xa7, 0x5f, 0x11, 0x28, 0xc9, 0xf1, 0x4c, 0x6b, 0xda, 0xdf, 0xc7, 0xf1, + 0x37, 0x41, 0xf9, 0xb5, 0x7c, 0xc6, 0xb2, 0x78, 0xc6, 0xea, 0xe7, 0xbf, 0xfe, 0xf5, 0x5d, 0xe1, + 0x1a, 0x5d, 0xb2, 0x74, 0xcf, 0x10, 0xf9, 0x28, 0xa0, 0x8f, 0x08, 0x4c, 0x8a, 0x91, 0x4d, 0xd7, + 0x32, 0x12, 0xa4, 0x5e, 0x0d, 0xe5, 0x5a, 0x2e, 0x5b, 0x64, 0x59, 0x11, 0x2c, 0xcb, 0xb4, 0xa2, + 0x67, 0x11, 0x00, 0xdf, 0x10, 0x28, 0xc6, 0x9e, 0xf4, 0x7a, 0x76, 0x74, 0x05, 0xb2, 0x96, 0xc7, + 0x14, 0x39, 0x5e, 0x17, 0x1c, 0x6b, 0xb4, 0x7a, 0x3a, 0x87, 0xb5, 0x8f, 0x2f, 0x83, 0x03, 0xfa, + 0x35, 0x81, 0x62, 0x3c, 0x5b, 0xb3, 0x88, 0x52, 0xe3, 0x3d, 0x8b, 0x28, 0x3d, 0xdf, 0x0d, 0x53, + 0x10, 0x55, 0xe9, 0x8a, 0x96, 0x28, 0x5e, 0x84, 0xd6, 0xbe, 0xf8, 0xd5, 0x1e, 0xd0, 0xc7, 0x04, + 0xa6, 0x93, 0xc1, 0x4a, 0xcd, 0x0c, 0xed, 0x63, 0xb3, 0xbf, 0x6c, 0xe5, 0xb6, 0x47, 0xbc, 0x96, + 0xc0, 0xab, 0xd3, 0x9a, 0xbe, 0x60, 0xca, 0xc7, 0xda, 0x97, 0xdf, 0x9b, 0x03, 0xfa, 0x23, 0x81, + 0x8b, 0x2a, 0x14, 0xad, 0xe7, 0x4b, 0xa9, 0x08, 0xcd, 0xbc, 0xe6, 0x08, 0xf8, 0x96, 0x00, 0x7c, + 0x93, 0xb6, 0xce, 0x00, 0x98, 0x14, 0xf3, 0x67, 0x02, 0xb3, 0xc7, 0xbe, 0x3e, 0xf4, 0xc6, 0xe9, + 0x08, 0xba, 0x41, 0x5c, 0xbe, 0x79, 0x66, 0xbf, 0xdc, 0x1a, 0x8e, 0xcf, 0xd7, 0x44, 0xc3, 0x13, + 0x02, 0xcf, 0xa5, 0x47, 0x12, 0x6d, 0x9c, 0x8e, 0x71, 0xc2, 0xcc, 0x2b, 0x37, 0xcf, 0xe2, 0x82, + 0xd0, 0x0d, 0x01, 0x5d, 0xa3, 0xd7, 0xb5, 0xd0, 0x09, 0xa9, 0xea, 0x8b, 0xc7, 0x04, 0xa6, 0x14, + 0x65, 0xc6, 0xb7, 0x6c, 0x0c, 0xb0, 0x9e, 0xd3, 0x1a, 0xd9, 0x6e, 0x09, 0xb6, 0x16, 0x6d, 0xe4, + 0x66, 0x53, 0xe5, 0x5c, 0xbf, 0xfb, 0xf4, 0xb0, 0x42, 0x9e, 0x1d, 0x56, 0xc8, 0x9f, 0x87, 0x15, + 0xf2, 0xed, 0x51, 0x65, 0xe2, 0xd9, 0x51, 0x65, 0xe2, 0xb7, 0xa3, 0xca, 0xc4, 0xc7, 0x37, 0xd2, + 0xc3, 0x02, 0xc3, 0xd6, 0x3d, 0x16, 0xed, 0xf1, 0x60, 0x67, 0x98, 0x67, 0xf7, 0x0d, 0xeb, 0x33, + 0x95, 0x4c, 0x0c, 0x90, 0xad, 0x92, 0xf8, 0x33, 0xaf, 0xf5, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x8a, 0xb5, 0xed, 0xc1, 0xcc, 0x0e, 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 { + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + Plans(ctx context.Context, in *QueryPlansRequest, opts ...grpc.CallOption) (*QueryPlansResponse, error) + Plan(ctx context.Context, in *QueryPlanRequest, opts ...grpc.CallOption) (*QueryPlanResponse, error) + Farm(ctx context.Context, in *QueryFarmRequest, opts ...grpc.CallOption) (*QueryFarmResponse, error) + Positions(ctx context.Context, in *QueryPositionsRequest, opts ...grpc.CallOption) (*QueryPositionsResponse, error) + Position(ctx context.Context, in *QueryPositionRequest, opts ...grpc.CallOption) (*QueryPositionResponse, error) + HistoricalRewards(ctx context.Context, in *QueryHistoricalRewardsRequest, opts ...grpc.CallOption) (*QueryHistoricalRewardsResponse, error) + TotalRewards(ctx context.Context, in *QueryTotalRewardsRequest, opts ...grpc.CallOption) (*QueryTotalRewardsResponse, error) + Rewards(ctx context.Context, in *QueryRewardsRequest, opts ...grpc.CallOption) (*QueryRewardsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/crescent.lpfarm.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Plans(ctx context.Context, in *QueryPlansRequest, opts ...grpc.CallOption) (*QueryPlansResponse, error) { + out := new(QueryPlansResponse) + err := c.cc.Invoke(ctx, "/crescent.lpfarm.v1beta1.Query/Plans", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Plan(ctx context.Context, in *QueryPlanRequest, opts ...grpc.CallOption) (*QueryPlanResponse, error) { + out := new(QueryPlanResponse) + err := c.cc.Invoke(ctx, "/crescent.lpfarm.v1beta1.Query/Plan", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Farm(ctx context.Context, in *QueryFarmRequest, opts ...grpc.CallOption) (*QueryFarmResponse, error) { + out := new(QueryFarmResponse) + err := c.cc.Invoke(ctx, "/crescent.lpfarm.v1beta1.Query/Farm", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Positions(ctx context.Context, in *QueryPositionsRequest, opts ...grpc.CallOption) (*QueryPositionsResponse, error) { + out := new(QueryPositionsResponse) + err := c.cc.Invoke(ctx, "/crescent.lpfarm.v1beta1.Query/Positions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Position(ctx context.Context, in *QueryPositionRequest, opts ...grpc.CallOption) (*QueryPositionResponse, error) { + out := new(QueryPositionResponse) + err := c.cc.Invoke(ctx, "/crescent.lpfarm.v1beta1.Query/Position", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) HistoricalRewards(ctx context.Context, in *QueryHistoricalRewardsRequest, opts ...grpc.CallOption) (*QueryHistoricalRewardsResponse, error) { + out := new(QueryHistoricalRewardsResponse) + err := c.cc.Invoke(ctx, "/crescent.lpfarm.v1beta1.Query/HistoricalRewards", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TotalRewards(ctx context.Context, in *QueryTotalRewardsRequest, opts ...grpc.CallOption) (*QueryTotalRewardsResponse, error) { + out := new(QueryTotalRewardsResponse) + err := c.cc.Invoke(ctx, "/crescent.lpfarm.v1beta1.Query/TotalRewards", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Rewards(ctx context.Context, in *QueryRewardsRequest, opts ...grpc.CallOption) (*QueryRewardsResponse, error) { + out := new(QueryRewardsResponse) + err := c.cc.Invoke(ctx, "/crescent.lpfarm.v1beta1.Query/Rewards", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + Plans(context.Context, *QueryPlansRequest) (*QueryPlansResponse, error) + Plan(context.Context, *QueryPlanRequest) (*QueryPlanResponse, error) + Farm(context.Context, *QueryFarmRequest) (*QueryFarmResponse, error) + Positions(context.Context, *QueryPositionsRequest) (*QueryPositionsResponse, error) + Position(context.Context, *QueryPositionRequest) (*QueryPositionResponse, error) + HistoricalRewards(context.Context, *QueryHistoricalRewardsRequest) (*QueryHistoricalRewardsResponse, error) + TotalRewards(context.Context, *QueryTotalRewardsRequest) (*QueryTotalRewardsResponse, error) + Rewards(context.Context, *QueryRewardsRequest) (*QueryRewardsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Plans(ctx context.Context, req *QueryPlansRequest) (*QueryPlansResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Plans not implemented") +} +func (*UnimplementedQueryServer) Plan(ctx context.Context, req *QueryPlanRequest) (*QueryPlanResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Plan not implemented") +} +func (*UnimplementedQueryServer) Farm(ctx context.Context, req *QueryFarmRequest) (*QueryFarmResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Farm not implemented") +} +func (*UnimplementedQueryServer) Positions(ctx context.Context, req *QueryPositionsRequest) (*QueryPositionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Positions not implemented") +} +func (*UnimplementedQueryServer) Position(ctx context.Context, req *QueryPositionRequest) (*QueryPositionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Position not implemented") +} +func (*UnimplementedQueryServer) HistoricalRewards(ctx context.Context, req *QueryHistoricalRewardsRequest) (*QueryHistoricalRewardsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HistoricalRewards not implemented") +} +func (*UnimplementedQueryServer) TotalRewards(ctx context.Context, req *QueryTotalRewardsRequest) (*QueryTotalRewardsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalRewards not implemented") +} +func (*UnimplementedQueryServer) Rewards(ctx context.Context, req *QueryRewardsRequest) (*QueryRewardsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Rewards not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_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).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/crescent.lpfarm.v1beta1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Plans_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPlansRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Plans(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/crescent.lpfarm.v1beta1.Query/Plans", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Plans(ctx, req.(*QueryPlansRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Plan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPlanRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Plan(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/crescent.lpfarm.v1beta1.Query/Plan", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Plan(ctx, req.(*QueryPlanRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Farm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFarmRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Farm(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/crescent.lpfarm.v1beta1.Query/Farm", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Farm(ctx, req.(*QueryFarmRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Positions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPositionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Positions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/crescent.lpfarm.v1beta1.Query/Positions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Positions(ctx, req.(*QueryPositionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Position_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPositionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Position(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/crescent.lpfarm.v1beta1.Query/Position", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Position(ctx, req.(*QueryPositionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_HistoricalRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryHistoricalRewardsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).HistoricalRewards(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/crescent.lpfarm.v1beta1.Query/HistoricalRewards", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).HistoricalRewards(ctx, req.(*QueryHistoricalRewardsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TotalRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalRewardsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TotalRewards(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/crescent.lpfarm.v1beta1.Query/TotalRewards", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TotalRewards(ctx, req.(*QueryTotalRewardsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Rewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRewardsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Rewards(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/crescent.lpfarm.v1beta1.Query/Rewards", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Rewards(ctx, req.(*QueryRewardsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "crescent.lpfarm.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Plans", + Handler: _Query_Plans_Handler, + }, + { + MethodName: "Plan", + Handler: _Query_Plan_Handler, + }, + { + MethodName: "Farm", + Handler: _Query_Farm_Handler, + }, + { + MethodName: "Positions", + Handler: _Query_Positions_Handler, + }, + { + MethodName: "Position", + Handler: _Query_Position_Handler, + }, + { + MethodName: "HistoricalRewards", + Handler: _Query_HistoricalRewards_Handler, + }, + { + MethodName: "TotalRewards", + Handler: _Query_TotalRewards_Handler, + }, + { + MethodName: "Rewards", + Handler: _Query_Rewards_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "crescent/lpfarm/v1beta1/query.proto", +} + +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 + { + 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 *QueryPlansRequest) 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 *QueryPlansRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPlansRequest) 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 *QueryPlansResponse) 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 *QueryPlansResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPlansResponse) 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 len(m.Plans) > 0 { + for iNdEx := len(m.Plans) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Plans[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 *QueryPlanRequest) 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 *QueryPlanRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPlanRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PlanId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.PlanId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryPlanResponse) 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 *QueryPlanResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPlanResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Plan.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 *QueryFarmRequest) 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 *QueryFarmRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFarmRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryFarmResponse) 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 *QueryFarmResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFarmResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Farm.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 *QueryPositionsRequest) 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 *QueryPositionsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPositionsRequest) 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 len(m.Farmer) > 0 { + i -= len(m.Farmer) + copy(dAtA[i:], m.Farmer) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Farmer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryPositionsResponse) 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 *QueryPositionsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPositionsResponse) 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 len(m.Positions) > 0 { + for iNdEx := len(m.Positions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Positions[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 *QueryPositionRequest) 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 *QueryPositionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPositionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Farmer) > 0 { + i -= len(m.Farmer) + copy(dAtA[i:], m.Farmer) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Farmer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryPositionResponse) 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 *QueryPositionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPositionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Position.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 *QueryHistoricalRewardsRequest) 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 *QueryHistoricalRewardsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHistoricalRewardsRequest) 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 len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryHistoricalRewardsResponse) 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 *QueryHistoricalRewardsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHistoricalRewardsResponse) 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 len(m.HistoricalRewards) > 0 { + for iNdEx := len(m.HistoricalRewards) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.HistoricalRewards[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 *QueryTotalRewardsRequest) 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 *QueryTotalRewardsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalRewardsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Farmer) > 0 { + i -= len(m.Farmer) + copy(dAtA[i:], m.Farmer) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Farmer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTotalRewardsResponse) 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 *QueryTotalRewardsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Rewards) > 0 { + for iNdEx := len(m.Rewards) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rewards[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 *QueryRewardsRequest) 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 *QueryRewardsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRewardsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Farmer) > 0 { + i -= len(m.Farmer) + copy(dAtA[i:], m.Farmer) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Farmer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryRewardsResponse) 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 *QueryRewardsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Rewards) > 0 { + for iNdEx := len(m.Rewards) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rewards[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 *HistoricalRewardsResponse) 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 *HistoricalRewardsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HistoricalRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ReferenceCount != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ReferenceCount)) + i-- + dAtA[i] = 0x18 + } + if len(m.CumulativeUnitRewards) > 0 { + for iNdEx := len(m.CumulativeUnitRewards) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CumulativeUnitRewards[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Period != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Period)) + i-- + dAtA[i] = 0x8 + } + 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 *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 + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryPlansRequest) 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 *QueryPlansResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Plans) > 0 { + for _, e := range m.Plans { + l = e.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 *QueryPlanRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PlanId != 0 { + n += 1 + sovQuery(uint64(m.PlanId)) + } + return n +} + +func (m *QueryPlanResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Plan.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryFarmRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryFarmResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Farm.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryPositionsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Farmer) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPositionsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Positions) > 0 { + for _, e := range m.Positions { + l = e.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 *QueryPositionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Farmer) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPositionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Position.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryHistoricalRewardsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryHistoricalRewardsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.HistoricalRewards) > 0 { + for _, e := range m.HistoricalRewards { + l = e.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 *QueryTotalRewardsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Farmer) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTotalRewardsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Rewards) > 0 { + for _, e := range m.Rewards { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryRewardsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Farmer) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRewardsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Rewards) > 0 { + for _, e := range m.Rewards { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *HistoricalRewardsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Period != 0 { + n += 1 + sovQuery(uint64(m.Period)) + } + if len(m.CumulativeUnitRewards) > 0 { + for _, e := range m.CumulativeUnitRewards { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.ReferenceCount != 0 { + n += 1 + sovQuery(uint64(m.ReferenceCount)) + } + 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 *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 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 *QueryPlansRequest) 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: QueryPlansRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPlansRequest: 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 *QueryPlansResponse) 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: QueryPlansResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPlansResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Plans", 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.Plans = append(m.Plans, Plan{}) + if err := m.Plans[len(m.Plans)-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 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.PageResponse{} + } + 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 *QueryPlanRequest) 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: QueryPlanRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPlanRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PlanId", wireType) + } + m.PlanId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PlanId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *QueryPlanResponse) 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: QueryPlanResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPlanResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Plan", 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 err := m.Plan.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 *QueryFarmRequest) 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: QueryFarmRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFarmRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 *QueryFarmResponse) 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: QueryFarmResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFarmResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Farm", 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 err := m.Farm.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 *QueryPositionsRequest) 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: QueryPositionsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPositionsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Farmer", 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.Farmer = string(dAtA[iNdEx:postIndex]) + 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 *QueryPositionsResponse) 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: QueryPositionsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPositionsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Positions", 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.Positions = append(m.Positions, Position{}) + if err := m.Positions[len(m.Positions)-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 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.PageResponse{} + } + 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 *QueryPositionRequest) 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: QueryPositionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPositionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Farmer", 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.Farmer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 *QueryPositionResponse) 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: QueryPositionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPositionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Position", 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 err := m.Position.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 *QueryHistoricalRewardsRequest) 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: QueryHistoricalRewardsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHistoricalRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = string(dAtA[iNdEx:postIndex]) + 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 *QueryHistoricalRewardsResponse) 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: QueryHistoricalRewardsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHistoricalRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HistoricalRewards", 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.HistoricalRewards = append(m.HistoricalRewards, HistoricalRewardsResponse{}) + if err := m.HistoricalRewards[len(m.HistoricalRewards)-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 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.PageResponse{} + } + 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 *QueryTotalRewardsRequest) 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: QueryTotalRewardsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Farmer", 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.Farmer = 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 *QueryTotalRewardsResponse) 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: QueryTotalRewardsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rewards", 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.Rewards = append(m.Rewards, types.DecCoin{}) + if err := m.Rewards[len(m.Rewards)-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 *QueryRewardsRequest) 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: QueryRewardsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Farmer", 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.Farmer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 *QueryRewardsResponse) 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: QueryRewardsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rewards", 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.Rewards = append(m.Rewards, types.DecCoin{}) + if err := m.Rewards[len(m.Rewards)-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 *HistoricalRewardsResponse) 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: HistoricalRewardsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HistoricalRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Period", wireType) + } + m.Period = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Period |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CumulativeUnitRewards", 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.CumulativeUnitRewards = append(m.CumulativeUnitRewards, types.DecCoin{}) + if err := m.CumulativeUnitRewards[len(m.CumulativeUnitRewards)-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 ReferenceCount", wireType) + } + m.ReferenceCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ReferenceCount |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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/third-party-chains/crescent-types/lpfarm/query.pb.gw.go b/third-party-chains/crescent-types/lpfarm/query.pb.gw.go new file mode 100644 index 000000000..7f919bd1c --- /dev/null +++ b/third-party-chains/crescent-types/lpfarm/query.pb.gw.go @@ -0,0 +1,994 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: crescent/lpfarm/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 + +func request_Query_Params_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.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_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.Params(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Plans_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Plans_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPlansRequest + 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_Plans_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Plans(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Plans_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPlansRequest + 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_Plans_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Plans(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Plan_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPlanRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["plan_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "plan_id") + } + + protoReq.PlanId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "plan_id", err) + } + + msg, err := client.Plan(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Plan_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPlanRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["plan_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "plan_id") + } + + protoReq.PlanId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "plan_id", err) + } + + msg, err := server.Plan(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Farm_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFarmRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := client.Farm(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Farm_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFarmRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := server.Farm(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Positions_0 = &utilities.DoubleArray{Encoding: map[string]int{"farmer": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_Positions_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPositionsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["farmer"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "farmer") + } + + protoReq.Farmer, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "farmer", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Positions_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Positions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Positions_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPositionsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["farmer"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "farmer") + } + + protoReq.Farmer, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "farmer", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Positions_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Positions(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Position_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPositionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["farmer"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "farmer") + } + + protoReq.Farmer, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "farmer", err) + } + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := client.Position(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Position_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPositionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["farmer"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "farmer") + } + + protoReq.Farmer, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "farmer", err) + } + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := server.Position(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_HistoricalRewards_0 = &utilities.DoubleArray{Encoding: map[string]int{"denom": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_HistoricalRewards_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryHistoricalRewardsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_HistoricalRewards_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.HistoricalRewards(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_HistoricalRewards_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryHistoricalRewardsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_HistoricalRewards_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.HistoricalRewards(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_TotalRewards_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalRewardsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["farmer"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "farmer") + } + + protoReq.Farmer, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "farmer", err) + } + + msg, err := client.TotalRewards(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TotalRewards_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalRewardsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["farmer"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "farmer") + } + + protoReq.Farmer, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "farmer", err) + } + + msg, err := server.TotalRewards(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Rewards_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRewardsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["farmer"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "farmer") + } + + protoReq.Farmer, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "farmer", err) + } + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := client.Rewards(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Rewards_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRewardsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["farmer"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "farmer") + } + + protoReq.Farmer, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "farmer", err) + } + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := server.Rewards(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_Params_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_Params_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_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Plans_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_Plans_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_Plans_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Plan_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_Plan_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_Plan_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Farm_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_Farm_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_Farm_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Positions_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_Positions_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_Positions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Position_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_Position_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_Position_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_HistoricalRewards_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_HistoricalRewards_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_HistoricalRewards_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TotalRewards_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_TotalRewards_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_TotalRewards_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Rewards_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_Rewards_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_Rewards_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_Params_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_Params_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_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Plans_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_Plans_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_Plans_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Plan_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_Plan_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_Plan_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Farm_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_Farm_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_Farm_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Positions_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_Positions_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_Positions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Position_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_Position_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_Position_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_HistoricalRewards_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_HistoricalRewards_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_HistoricalRewards_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TotalRewards_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_TotalRewards_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_TotalRewards_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Rewards_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_Rewards_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_Rewards_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"crescent", "lpfarm", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Plans_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"crescent", "lpfarm", "v1beta1", "plans"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Plan_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"crescent", "lpfarm", "v1beta1", "plans", "plan_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Farm_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"crescent", "lpfarm", "v1beta1", "farms", "denom"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Positions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"crescent", "lpfarm", "v1beta1", "positions", "farmer"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Position_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{"crescent", "lpfarm", "v1beta1", "positions", "farmer", "denom"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_HistoricalRewards_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"crescent", "lpfarm", "v1beta1", "historical_rewards", "denom"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TotalRewards_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"crescent", "lpfarm", "v1beta1", "rewards", "farmer"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Rewards_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{"crescent", "lpfarm", "v1beta1", "rewards", "farmer", "denom"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_Plans_0 = runtime.ForwardResponseMessage + + forward_Query_Plan_0 = runtime.ForwardResponseMessage + + forward_Query_Farm_0 = runtime.ForwardResponseMessage + + forward_Query_Positions_0 = runtime.ForwardResponseMessage + + forward_Query_Position_0 = runtime.ForwardResponseMessage + + forward_Query_HistoricalRewards_0 = runtime.ForwardResponseMessage + + forward_Query_TotalRewards_0 = runtime.ForwardResponseMessage + + forward_Query_Rewards_0 = runtime.ForwardResponseMessage +) diff --git a/third-party-chains/crescent-types/validation.go b/third-party-chains/crescent-types/validation.go new file mode 100644 index 000000000..e8f16ceb1 --- /dev/null +++ b/third-party-chains/crescent-types/validation.go @@ -0,0 +1,96 @@ +package crescenttypes + +import ( + "fmt" + + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + + lpfarm "github.com/ingenuity-build/quicksilver/third-party-chains/crescent-types/lpfarm" + "github.com/ingenuity-build/quicksilver/utils" + participationrewardstypes "github.com/ingenuity-build/quicksilver/x/participationrewards/types" +) + +type ParticipationRewardsKeeper interface { + GetProtocolData(ctx sdk.Context, pdType participationrewardstypes.ProtocolDataType, key string) (participationrewardstypes.ProtocolData, bool) +} + +func DetermineApplicableTokensInPool(ctx sdk.Context, prKeeper ParticipationRewardsKeeper, position lpfarm.Position, chainID string) (math.Int, error) { + farmingAmount := position.FarmingAmount + + poolID := position.Denom[4:] + pd, ok := prKeeper.GetProtocolData(ctx, participationrewardstypes.ProtocolDataTypeCrescentPool, poolID) + if !ok { + return sdk.ZeroInt(), fmt.Errorf("unable to obtain crescent protocol data for poolID=%s", poolID) + } + + ipool, err := participationrewardstypes.UnmarshalProtocolData(participationrewardstypes.ProtocolDataTypeCrescentPool, pd.Data) + if err != nil { + return sdk.ZeroInt(), err + } + pool, _ := ipool.(*participationrewardstypes.CrescentPoolProtocolData) + + poolDenom := "" + for _, zk := range utils.Keys(pool.Denoms) { + if pool.Denoms[zk].ChainID == chainID { + poolDenom = zk + break + } + } + + if poolDenom == "" { + return sdk.ZeroInt(), fmt.Errorf("invalid zone, pool zone must match %s", chainID) + } + + poolData, err := pool.GetPool() + if err != nil { + return sdk.ZeroInt(), err + } + + if poolData.Disabled { + return sdk.ZeroInt(), fmt.Errorf("pool%d is disabled", pool.PoolID) + } + + reserveAddress := poolData.GetReserveAddress() + + pd, ok = prKeeper.GetProtocolData(ctx, participationrewardstypes.ProtocolDataTypeCrescentReserveAddressBalance, reserveAddress.String()+poolDenom) + if !ok { + return sdk.ZeroInt(), fmt.Errorf("unable to obtain reserveaddressbalance protocoldata for address=%s, denom=%s", reserveAddress.String(), poolDenom) + } + ibalance, err := participationrewardstypes.UnmarshalProtocolData(participationrewardstypes.ProtocolDataTypeCrescentReserveAddressBalance, pd.Data) + if err != nil { + return sdk.ZeroInt(), err + } + balance, _ := ibalance.(*participationrewardstypes.CrescentReserveAddressBalanceProtocolData) + + poolDenomBalance, err := balance.GetBalance() + if err != nil { + return sdk.ZeroInt(), err + } + + pd, ok = prKeeper.GetProtocolData(ctx, participationrewardstypes.ProtocolDataTypeCrescentPoolCoinSupply, poolData.PoolCoinDenom) + if !ok { + return sdk.ZeroInt(), fmt.Errorf("unable to obtain poolcoinsupply protocoldata for denom=%s", poolData.PoolCoinDenom) + } + isupply, err := participationrewardstypes.UnmarshalProtocolData(participationrewardstypes.ProtocolDataTypeCrescentPoolCoinSupply, pd.Data) + if err != nil { + return sdk.ZeroInt(), err + } + supply, _ := isupply.(*participationrewardstypes.CrescentPoolCoinSupplyProtocolData) + + // calculate user PoolCoin ratio and LP asset amount + poolSupply, err := supply.GetSupply() // total poolcoin supply + if err != nil { + return sdk.ZeroInt(), err + } + + if poolSupply.IsZero() { + return sdk.ZeroInt(), fmt.Errorf("empty pool, %s", poolID) + } + uratio := sdk.NewDecFromInt(farmingAmount).QuoInt(poolSupply) + + uAmount := uratio.MulInt(poolDenomBalance).TruncateInt() + + return uAmount, nil +} diff --git a/osmosis-types/gamm/codec.go b/third-party-chains/osmosis-types/gamm/codec.go similarity index 100% rename from osmosis-types/gamm/codec.go rename to third-party-chains/osmosis-types/gamm/codec.go diff --git a/osmosis-types/gamm/constants.go b/third-party-chains/osmosis-types/gamm/constants.go similarity index 100% rename from osmosis-types/gamm/constants.go rename to third-party-chains/osmosis-types/gamm/constants.go diff --git a/osmosis-types/gamm/errors.go b/third-party-chains/osmosis-types/gamm/errors.go similarity index 100% rename from osmosis-types/gamm/errors.go rename to third-party-chains/osmosis-types/gamm/errors.go diff --git a/osmosis-types/gamm/events.go b/third-party-chains/osmosis-types/gamm/events.go similarity index 100% rename from osmosis-types/gamm/events.go rename to third-party-chains/osmosis-types/gamm/events.go diff --git a/osmosis-types/gamm/expected_keepers.go b/third-party-chains/osmosis-types/gamm/expected_keepers.go similarity index 100% rename from osmosis-types/gamm/expected_keepers.go rename to third-party-chains/osmosis-types/gamm/expected_keepers.go diff --git a/osmosis-types/gamm/genesis.pb.go b/third-party-chains/osmosis-types/gamm/genesis.pb.go similarity index 100% rename from osmosis-types/gamm/genesis.pb.go rename to third-party-chains/osmosis-types/gamm/genesis.pb.go diff --git a/osmosis-types/gamm/hooks.go b/third-party-chains/osmosis-types/gamm/hooks.go similarity index 100% rename from osmosis-types/gamm/hooks.go rename to third-party-chains/osmosis-types/gamm/hooks.go diff --git a/osmosis-types/gamm/key.go b/third-party-chains/osmosis-types/gamm/key.go similarity index 100% rename from osmosis-types/gamm/key.go rename to third-party-chains/osmosis-types/gamm/key.go diff --git a/osmosis-types/gamm/key_test.go b/third-party-chains/osmosis-types/gamm/key_test.go similarity index 100% rename from osmosis-types/gamm/key_test.go rename to third-party-chains/osmosis-types/gamm/key_test.go diff --git a/osmosis-types/gamm/msg_create_pool.go b/third-party-chains/osmosis-types/gamm/msg_create_pool.go similarity index 100% rename from osmosis-types/gamm/msg_create_pool.go rename to third-party-chains/osmosis-types/gamm/msg_create_pool.go diff --git a/osmosis-types/gamm/msg_lp.go b/third-party-chains/osmosis-types/gamm/msg_lp.go similarity index 100% rename from osmosis-types/gamm/msg_lp.go rename to third-party-chains/osmosis-types/gamm/msg_lp.go diff --git a/osmosis-types/gamm/msg_swap.go b/third-party-chains/osmosis-types/gamm/msg_swap.go similarity index 100% rename from osmosis-types/gamm/msg_swap.go rename to third-party-chains/osmosis-types/gamm/msg_swap.go diff --git a/osmosis-types/gamm/msgs.go b/third-party-chains/osmosis-types/gamm/msgs.go similarity index 100% rename from osmosis-types/gamm/msgs.go rename to third-party-chains/osmosis-types/gamm/msgs.go diff --git a/osmosis-types/gamm/pool-models/balancer/amm.go b/third-party-chains/osmosis-types/gamm/pool-models/balancer/amm.go similarity index 98% rename from osmosis-types/gamm/pool-models/balancer/amm.go rename to third-party-chains/osmosis-types/gamm/pool-models/balancer/amm.go index 096aaa6a1..d71f7caec 100644 --- a/osmosis-types/gamm/pool-models/balancer/amm.go +++ b/third-party-chains/osmosis-types/gamm/pool-models/balancer/amm.go @@ -3,11 +3,11 @@ package balancer import ( "fmt" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/osmomath" + sdkioerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" - "github.com/ingenuity-build/quicksilver/osmosis-types/osmomath" ) // subPoolAssetWeights subtracts the weights of two different pool asset slices. diff --git a/osmosis-types/gamm/pool-models/balancer/balancerPool.pb.go b/third-party-chains/osmosis-types/gamm/pool-models/balancer/balancerPool.pb.go similarity index 100% rename from osmosis-types/gamm/pool-models/balancer/balancerPool.pb.go rename to third-party-chains/osmosis-types/gamm/pool-models/balancer/balancerPool.pb.go diff --git a/osmosis-types/gamm/pool-models/balancer/codec.go b/third-party-chains/osmosis-types/gamm/pool-models/balancer/codec.go similarity index 95% rename from osmosis-types/gamm/pool-models/balancer/codec.go rename to third-party-chains/osmosis-types/gamm/pool-models/balancer/codec.go index 1fc0003c6..9e93f233e 100644 --- a/osmosis-types/gamm/pool-models/balancer/codec.go +++ b/third-party-chains/osmosis-types/gamm/pool-models/balancer/codec.go @@ -6,8 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" proto "github.com/gogo/protobuf/proto" - - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" ) // RegisterLegacyAminoCodec registers the necessary x/gamm interfaces and concrete types diff --git a/osmosis-types/gamm/pool-models/balancer/constants.go b/third-party-chains/osmosis-types/gamm/pool-models/balancer/constants.go similarity index 100% rename from osmosis-types/gamm/pool-models/balancer/constants.go rename to third-party-chains/osmosis-types/gamm/pool-models/balancer/constants.go diff --git a/osmosis-types/gamm/pool-models/balancer/doc.go b/third-party-chains/osmosis-types/gamm/pool-models/balancer/doc.go similarity index 100% rename from osmosis-types/gamm/pool-models/balancer/doc.go rename to third-party-chains/osmosis-types/gamm/pool-models/balancer/doc.go diff --git a/osmosis-types/gamm/pool-models/balancer/marshal.go b/third-party-chains/osmosis-types/gamm/pool-models/balancer/marshal.go similarity index 100% rename from osmosis-types/gamm/pool-models/balancer/marshal.go rename to third-party-chains/osmosis-types/gamm/pool-models/balancer/marshal.go diff --git a/osmosis-types/gamm/pool-models/balancer/msgs.go b/third-party-chains/osmosis-types/gamm/pool-models/balancer/msgs.go similarity index 96% rename from osmosis-types/gamm/pool-models/balancer/msgs.go rename to third-party-chains/osmosis-types/gamm/pool-models/balancer/msgs.go index 363d63764..38bd1af07 100644 --- a/osmosis-types/gamm/pool-models/balancer/msgs.go +++ b/third-party-chains/osmosis-types/gamm/pool-models/balancer/msgs.go @@ -4,8 +4,7 @@ import ( sdkioerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" ) const ( diff --git a/osmosis-types/gamm/pool-models/balancer/pool.go b/third-party-chains/osmosis-types/gamm/pool-models/balancer/pool.go similarity index 99% rename from osmosis-types/gamm/pool-models/balancer/pool.go rename to third-party-chains/osmosis-types/gamm/pool-models/balancer/pool.go index 55c3dd058..2ab1eb58b 100644 --- a/osmosis-types/gamm/pool-models/balancer/pool.go +++ b/third-party-chains/osmosis-types/gamm/pool-models/balancer/pool.go @@ -7,11 +7,12 @@ import ( "strings" "time" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm/pool-models/internal/cfmm_common" + sdkioerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm/pool-models/internal/cfmm_common" "github.com/ingenuity-build/quicksilver/utils/addressutils" ) diff --git a/osmosis-types/gamm/pool-models/balancer/pool_asset.go b/third-party-chains/osmosis-types/gamm/pool-models/balancer/pool_asset.go similarity index 97% rename from osmosis-types/gamm/pool-models/balancer/pool_asset.go rename to third-party-chains/osmosis-types/gamm/pool-models/balancer/pool_asset.go index b50487c16..c1fba10c6 100644 --- a/osmosis-types/gamm/pool-models/balancer/pool_asset.go +++ b/third-party-chains/osmosis-types/gamm/pool-models/balancer/pool_asset.go @@ -5,13 +5,13 @@ import ( "sort" "strings" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" + "gopkg.in/yaml.v2" sdkioerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" ) type poolAssetPretty struct { diff --git a/osmosis-types/gamm/pool-models/balancer/pool_params.go b/third-party-chains/osmosis-types/gamm/pool-models/balancer/pool_params.go similarity index 96% rename from osmosis-types/gamm/pool-models/balancer/pool_params.go rename to third-party-chains/osmosis-types/gamm/pool-models/balancer/pool_params.go index d48559bfd..5725c7107 100644 --- a/osmosis-types/gamm/pool-models/balancer/pool_params.go +++ b/third-party-chains/osmosis-types/gamm/pool-models/balancer/pool_params.go @@ -3,9 +3,9 @@ package balancer import ( "errors" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" + sdk "github.com/cosmos/cosmos-sdk/types" ) func NewPoolParams(swapFee, exitFee sdk.Dec, params *SmoothWeightChangeParams) PoolParams { diff --git a/osmosis-types/gamm/pool-models/balancer/tx.pb.go b/third-party-chains/osmosis-types/gamm/pool-models/balancer/tx.pb.go similarity index 100% rename from osmosis-types/gamm/pool-models/balancer/tx.pb.go rename to third-party-chains/osmosis-types/gamm/pool-models/balancer/tx.pb.go diff --git a/osmosis-types/gamm/pool-models/internal/cfmm_common/lp.go b/third-party-chains/osmosis-types/gamm/pool-models/internal/cfmm_common/lp.go similarity index 97% rename from osmosis-types/gamm/pool-models/internal/cfmm_common/lp.go rename to third-party-chains/osmosis-types/gamm/pool-models/internal/cfmm_common/lp.go index ccf8aa2f6..aa11d8062 100644 --- a/osmosis-types/gamm/pool-models/internal/cfmm_common/lp.go +++ b/third-party-chains/osmosis-types/gamm/pool-models/internal/cfmm_common/lp.go @@ -3,11 +3,11 @@ package cfmm_common import ( "errors" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/osmoutils" + sdkioerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" - "github.com/ingenuity-build/quicksilver/osmosis-types/osmoutils" ) const errMsgFormatSharesLargerThanMax = "%s resulted shares is larger than the max amount of %s" diff --git a/osmosis-types/gamm/pool-models/internal/cfmm_common/lp_test.go b/third-party-chains/osmosis-types/gamm/pool-models/internal/cfmm_common/lp_test.go similarity index 91% rename from osmosis-types/gamm/pool-models/internal/cfmm_common/lp_test.go rename to third-party-chains/osmosis-types/gamm/pool-models/internal/cfmm_common/lp_test.go index 54f3a071e..0a1e4ac9a 100644 --- a/osmosis-types/gamm/pool-models/internal/cfmm_common/lp_test.go +++ b/third-party-chains/osmosis-types/gamm/pool-models/internal/cfmm_common/lp_test.go @@ -4,14 +4,14 @@ import ( "testing" "time" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm/pool-models/balancer" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm/pool-models/internal/cfmm_common" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm/pool-models/stableswap" + "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" - - gammtypes "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm/pool-models/balancer" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm/pool-models/internal/cfmm_common" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm/pool-models/stableswap" ) // a helper function used to multiply coins @@ -79,7 +79,7 @@ func TestCalcExitPool(t *testing.T) { tests := []struct { name string - pool gammtypes.PoolI + pool gamm.PoolI exitingShares sdk.Int expError bool }{ @@ -147,14 +147,14 @@ func TestMaximalExactRatioJoin(t *testing.T) { tests := []struct { name string - pool func() gammtypes.PoolI + pool func() gamm.PoolI tokensIn sdk.Coins expNumShare sdk.Int expRemCoin sdk.Coins }{ { name: "two asset pool, same tokenIn ratio", - pool: func() gammtypes.PoolI { + pool: func() gamm.PoolI { balancerPool, err := balancer.NewBalancerPool( 1, balancer.PoolParams{SwapFee: sdk.ZeroDec(), ExitFee: sdk.ZeroDec()}, @@ -171,7 +171,7 @@ func TestMaximalExactRatioJoin(t *testing.T) { }, { name: "two asset pool, different tokenIn ratio with pool", - pool: func() gammtypes.PoolI { + pool: func() gamm.PoolI { balancerPool, err := balancer.NewBalancerPool( 1, balancer.PoolParams{SwapFee: sdk.ZeroDec(), ExitFee: sdk.ZeroDec()}, diff --git a/osmosis-types/gamm/pool-models/stableswap/README.md b/third-party-chains/osmosis-types/gamm/pool-models/stableswap/README.md similarity index 100% rename from osmosis-types/gamm/pool-models/stableswap/README.md rename to third-party-chains/osmosis-types/gamm/pool-models/stableswap/README.md diff --git a/osmosis-types/gamm/pool-models/stableswap/amm.go b/third-party-chains/osmosis-types/gamm/pool-models/stableswap/amm.go similarity index 98% rename from osmosis-types/gamm/pool-models/stableswap/amm.go rename to third-party-chains/osmosis-types/gamm/pool-models/stableswap/amm.go index 6c3cc86ae..f49bf944b 100644 --- a/osmosis-types/gamm/pool-models/stableswap/amm.go +++ b/third-party-chains/osmosis-types/gamm/pool-models/stableswap/amm.go @@ -3,10 +3,10 @@ package stableswap import ( "errors" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm/pool-models/internal/cfmm_common" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm/pool-models/internal/cfmm_common" + sdk "github.com/cosmos/cosmos-sdk/types" ) var ( diff --git a/osmosis-types/gamm/pool-models/stableswap/cfmm.py b/third-party-chains/osmosis-types/gamm/pool-models/stableswap/cfmm.py similarity index 100% rename from osmosis-types/gamm/pool-models/stableswap/cfmm.py rename to third-party-chains/osmosis-types/gamm/pool-models/stableswap/cfmm.py diff --git a/osmosis-types/gamm/pool-models/stableswap/codec.go b/third-party-chains/osmosis-types/gamm/pool-models/stableswap/codec.go similarity index 95% rename from osmosis-types/gamm/pool-models/stableswap/codec.go rename to third-party-chains/osmosis-types/gamm/pool-models/stableswap/codec.go index 224969266..6028635f0 100644 --- a/osmosis-types/gamm/pool-models/stableswap/codec.go +++ b/third-party-chains/osmosis-types/gamm/pool-models/stableswap/codec.go @@ -5,8 +5,7 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" ) // RegisterLegacyAminoCodec registers the necessary x/gamm interfaces and concrete types diff --git a/osmosis-types/gamm/pool-models/stableswap/msgs.go b/third-party-chains/osmosis-types/gamm/pool-models/stableswap/msgs.go similarity index 98% rename from osmosis-types/gamm/pool-models/stableswap/msgs.go rename to third-party-chains/osmosis-types/gamm/pool-models/stableswap/msgs.go index fee47698f..e99617db7 100644 --- a/osmosis-types/gamm/pool-models/stableswap/msgs.go +++ b/third-party-chains/osmosis-types/gamm/pool-models/stableswap/msgs.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" ) const ( diff --git a/osmosis-types/gamm/pool-models/stableswap/pool.go b/third-party-chains/osmosis-types/gamm/pool-models/stableswap/pool.go similarity index 98% rename from osmosis-types/gamm/pool-models/stableswap/pool.go rename to third-party-chains/osmosis-types/gamm/pool-models/stableswap/pool.go index 2e6dacb13..a3b0ae2e5 100644 --- a/osmosis-types/gamm/pool-models/stableswap/pool.go +++ b/third-party-chains/osmosis-types/gamm/pool-models/stableswap/pool.go @@ -6,12 +6,13 @@ import ( "fmt" "time" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm/pool-models/internal/cfmm_common" + "github.com/ingenuity-build/quicksilver/utils/addressutils" + sdkioerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm/pool-models/internal/cfmm_common" - "github.com/ingenuity-build/quicksilver/utils/addressutils" + sdk "github.com/cosmos/cosmos-sdk/types" ) var _ gamm.PoolI = &Pool{} diff --git a/osmosis-types/gamm/pool-models/stableswap/pool_params.go b/third-party-chains/osmosis-types/gamm/pool-models/stableswap/pool_params.go similarity index 84% rename from osmosis-types/gamm/pool-models/stableswap/pool_params.go rename to third-party-chains/osmosis-types/gamm/pool-models/stableswap/pool_params.go index 8972550af..fcd465f6a 100644 --- a/osmosis-types/gamm/pool-models/stableswap/pool_params.go +++ b/third-party-chains/osmosis-types/gamm/pool-models/stableswap/pool_params.go @@ -2,8 +2,7 @@ package stableswap import ( sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" ) func (params PoolParams) Validate() error { diff --git a/osmosis-types/gamm/pool-models/stableswap/stableswap_pool.pb.go b/third-party-chains/osmosis-types/gamm/pool-models/stableswap/stableswap_pool.pb.go similarity index 100% rename from osmosis-types/gamm/pool-models/stableswap/stableswap_pool.pb.go rename to third-party-chains/osmosis-types/gamm/pool-models/stableswap/stableswap_pool.pb.go diff --git a/osmosis-types/gamm/pool-models/stableswap/tx.pb.go b/third-party-chains/osmosis-types/gamm/pool-models/stableswap/tx.pb.go similarity index 100% rename from osmosis-types/gamm/pool-models/stableswap/tx.pb.go rename to third-party-chains/osmosis-types/gamm/pool-models/stableswap/tx.pb.go diff --git a/osmosis-types/gamm/pool.go b/third-party-chains/osmosis-types/gamm/pool.go similarity index 100% rename from osmosis-types/gamm/pool.go rename to third-party-chains/osmosis-types/gamm/pool.go diff --git a/osmosis-types/gamm/query.pb.go b/third-party-chains/osmosis-types/gamm/query.pb.go similarity index 100% rename from osmosis-types/gamm/query.pb.go rename to third-party-chains/osmosis-types/gamm/query.pb.go diff --git a/osmosis-types/gamm/query.pb.gw.go b/third-party-chains/osmosis-types/gamm/query.pb.gw.go similarity index 100% rename from osmosis-types/gamm/query.pb.gw.go rename to third-party-chains/osmosis-types/gamm/query.pb.gw.go diff --git a/osmosis-types/gamm/route.go b/third-party-chains/osmosis-types/gamm/route.go similarity index 100% rename from osmosis-types/gamm/route.go rename to third-party-chains/osmosis-types/gamm/route.go diff --git a/osmosis-types/gamm/tx.pb.go b/third-party-chains/osmosis-types/gamm/tx.pb.go similarity index 100% rename from osmosis-types/gamm/tx.pb.go rename to third-party-chains/osmosis-types/gamm/tx.pb.go diff --git a/osmosis-types/lockup/codec.go b/third-party-chains/osmosis-types/lockup/codec.go similarity index 100% rename from osmosis-types/lockup/codec.go rename to third-party-chains/osmosis-types/lockup/codec.go diff --git a/osmosis-types/lockup/errors.go b/third-party-chains/osmosis-types/lockup/errors.go similarity index 100% rename from osmosis-types/lockup/errors.go rename to third-party-chains/osmosis-types/lockup/errors.go diff --git a/osmosis-types/lockup/events.go b/third-party-chains/osmosis-types/lockup/events.go similarity index 100% rename from osmosis-types/lockup/events.go rename to third-party-chains/osmosis-types/lockup/events.go diff --git a/osmosis-types/lockup/expected_keepers.go b/third-party-chains/osmosis-types/lockup/expected_keepers.go similarity index 100% rename from osmosis-types/lockup/expected_keepers.go rename to third-party-chains/osmosis-types/lockup/expected_keepers.go diff --git a/osmosis-types/lockup/genesis.go b/third-party-chains/osmosis-types/lockup/genesis.go similarity index 100% rename from osmosis-types/lockup/genesis.go rename to third-party-chains/osmosis-types/lockup/genesis.go diff --git a/osmosis-types/lockup/genesis.pb.go b/third-party-chains/osmosis-types/lockup/genesis.pb.go similarity index 100% rename from osmosis-types/lockup/genesis.pb.go rename to third-party-chains/osmosis-types/lockup/genesis.pb.go diff --git a/osmosis-types/lockup/hooks.go b/third-party-chains/osmosis-types/lockup/hooks.go similarity index 100% rename from osmosis-types/lockup/hooks.go rename to third-party-chains/osmosis-types/lockup/hooks.go diff --git a/osmosis-types/lockup/keys.go b/third-party-chains/osmosis-types/lockup/keys.go similarity index 100% rename from osmosis-types/lockup/keys.go rename to third-party-chains/osmosis-types/lockup/keys.go diff --git a/osmosis-types/lockup/lock.go b/third-party-chains/osmosis-types/lockup/lock.go similarity index 100% rename from osmosis-types/lockup/lock.go rename to third-party-chains/osmosis-types/lockup/lock.go diff --git a/osmosis-types/lockup/lock.pb.go b/third-party-chains/osmosis-types/lockup/lock.pb.go similarity index 100% rename from osmosis-types/lockup/lock.pb.go rename to third-party-chains/osmosis-types/lockup/lock.pb.go diff --git a/osmosis-types/lockup/lockI.go b/third-party-chains/osmosis-types/lockup/lockI.go similarity index 100% rename from osmosis-types/lockup/lockI.go rename to third-party-chains/osmosis-types/lockup/lockI.go diff --git a/osmosis-types/lockup/msgs.go b/third-party-chains/osmosis-types/lockup/msgs.go similarity index 100% rename from osmosis-types/lockup/msgs.go rename to third-party-chains/osmosis-types/lockup/msgs.go diff --git a/osmosis-types/lockup/querier.go b/third-party-chains/osmosis-types/lockup/querier.go similarity index 100% rename from osmosis-types/lockup/querier.go rename to third-party-chains/osmosis-types/lockup/querier.go diff --git a/osmosis-types/lockup/query.pb.go b/third-party-chains/osmosis-types/lockup/query.pb.go similarity index 100% rename from osmosis-types/lockup/query.pb.go rename to third-party-chains/osmosis-types/lockup/query.pb.go diff --git a/osmosis-types/lockup/query.pb.gw.go b/third-party-chains/osmosis-types/lockup/query.pb.gw.go similarity index 100% rename from osmosis-types/lockup/query.pb.gw.go rename to third-party-chains/osmosis-types/lockup/query.pb.gw.go diff --git a/osmosis-types/lockup/tx.pb.go b/third-party-chains/osmosis-types/lockup/tx.pb.go similarity index 100% rename from osmosis-types/lockup/tx.pb.go rename to third-party-chains/osmosis-types/lockup/tx.pb.go diff --git a/osmosis-types/osmomath/decimal.go b/third-party-chains/osmosis-types/osmomath/decimal.go similarity index 100% rename from osmosis-types/osmomath/decimal.go rename to third-party-chains/osmosis-types/osmomath/decimal.go diff --git a/osmosis-types/osmomath/int.go b/third-party-chains/osmosis-types/osmomath/int.go similarity index 100% rename from osmosis-types/osmomath/int.go rename to third-party-chains/osmosis-types/osmomath/int.go diff --git a/osmosis-types/osmomath/int_test.go b/third-party-chains/osmosis-types/osmomath/int_test.go similarity index 100% rename from osmosis-types/osmomath/int_test.go rename to third-party-chains/osmosis-types/osmomath/int_test.go diff --git a/osmosis-types/osmomath/math.go b/third-party-chains/osmosis-types/osmomath/math.go similarity index 100% rename from osmosis-types/osmomath/math.go rename to third-party-chains/osmosis-types/osmomath/math.go diff --git a/osmosis-types/osmomath/sigfig_round.go b/third-party-chains/osmosis-types/osmomath/sigfig_round.go similarity index 100% rename from osmosis-types/osmomath/sigfig_round.go rename to third-party-chains/osmosis-types/osmomath/sigfig_round.go diff --git a/osmosis-types/osmoutils/binary_search.go b/third-party-chains/osmosis-types/osmoutils/binary_search.go similarity index 100% rename from osmosis-types/osmoutils/binary_search.go rename to third-party-chains/osmosis-types/osmoutils/binary_search.go diff --git a/osmosis-types/osmoutils/cache_ctx.go b/third-party-chains/osmosis-types/osmoutils/cache_ctx.go similarity index 100% rename from osmosis-types/osmoutils/cache_ctx.go rename to third-party-chains/osmosis-types/osmoutils/cache_ctx.go diff --git a/osmosis-types/osmoutils/cli_helpers.go b/third-party-chains/osmosis-types/osmoutils/cli_helpers.go similarity index 100% rename from osmosis-types/osmoutils/cli_helpers.go rename to third-party-chains/osmosis-types/osmoutils/cli_helpers.go diff --git a/osmosis-types/osmoutils/coin_helper.go b/third-party-chains/osmosis-types/osmoutils/coin_helper.go similarity index 100% rename from osmosis-types/osmoutils/coin_helper.go rename to third-party-chains/osmosis-types/osmoutils/coin_helper.go diff --git a/osmosis-types/osmoutils/encoding_helper.go b/third-party-chains/osmosis-types/osmoutils/encoding_helper.go similarity index 100% rename from osmosis-types/osmoutils/encoding_helper.go rename to third-party-chains/osmosis-types/osmoutils/encoding_helper.go diff --git a/osmosis-types/osmoutils/module_account.go b/third-party-chains/osmosis-types/osmoutils/module_account.go similarity index 100% rename from osmosis-types/osmoutils/module_account.go rename to third-party-chains/osmosis-types/osmoutils/module_account.go diff --git a/osmosis-types/osmoutils/parse.go b/third-party-chains/osmosis-types/osmoutils/parse.go similarity index 100% rename from osmosis-types/osmoutils/parse.go rename to third-party-chains/osmosis-types/osmoutils/parse.go diff --git a/osmosis-types/osmoutils/partialord/internal/dag/dag.go b/third-party-chains/osmosis-types/osmoutils/partialord/internal/dag/dag.go similarity index 100% rename from osmosis-types/osmoutils/partialord/internal/dag/dag.go rename to third-party-chains/osmosis-types/osmoutils/partialord/internal/dag/dag.go diff --git a/osmosis-types/osmoutils/partialord/internal/dag/module.go b/third-party-chains/osmosis-types/osmoutils/partialord/internal/dag/module.go similarity index 100% rename from osmosis-types/osmoutils/partialord/internal/dag/module.go rename to third-party-chains/osmosis-types/osmoutils/partialord/internal/dag/module.go diff --git a/osmosis-types/osmoutils/partialord/module.go b/third-party-chains/osmosis-types/osmoutils/partialord/module.go similarity index 100% rename from osmosis-types/osmoutils/partialord/module.go rename to third-party-chains/osmosis-types/osmoutils/partialord/module.go diff --git a/osmosis-types/osmoutils/partialord/partialord.go b/third-party-chains/osmosis-types/osmoutils/partialord/partialord.go similarity index 96% rename from osmosis-types/osmoutils/partialord/partialord.go rename to third-party-chains/osmosis-types/osmoutils/partialord/partialord.go index d9ecc49a5..9ec765cca 100644 --- a/osmosis-types/osmoutils/partialord/partialord.go +++ b/third-party-chains/osmosis-types/osmoutils/partialord/partialord.go @@ -3,7 +3,7 @@ package partialord import ( "sort" - "github.com/ingenuity-build/quicksilver/osmosis-types/osmoutils/partialord/internal/dag" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/osmoutils/partialord/internal/dag" ) type PartialOrdering struct { diff --git a/osmosis-types/osmoutils/slice_helper.go b/third-party-chains/osmosis-types/osmoutils/slice_helper.go similarity index 100% rename from osmosis-types/osmoutils/slice_helper.go rename to third-party-chains/osmosis-types/osmoutils/slice_helper.go diff --git a/osmosis-types/osmoutils/store_helper.go b/third-party-chains/osmosis-types/osmoutils/store_helper.go similarity index 100% rename from osmosis-types/osmoutils/store_helper.go rename to third-party-chains/osmosis-types/osmoutils/store_helper.go diff --git a/osmosis-types/validation.go b/third-party-chains/osmosis-types/validation.go similarity index 95% rename from osmosis-types/validation.go rename to third-party-chains/osmosis-types/validation.go index 333c276bb..ae58d2321 100644 --- a/osmosis-types/validation.go +++ b/third-party-chains/osmosis-types/validation.go @@ -4,10 +4,11 @@ import ( "fmt" "strings" + osmosislockuptypes "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/lockup" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - osmosislockuptypes "github.com/ingenuity-build/quicksilver/osmosis-types/lockup" "github.com/ingenuity-build/quicksilver/utils" participationrewardstypes "github.com/ingenuity-build/quicksilver/x/participationrewards/types" ) diff --git a/umee-types/leverage/genesis.pb.go b/third-party-chains/umee-types/leverage/genesis.pb.go similarity index 100% rename from umee-types/leverage/genesis.pb.go rename to third-party-chains/umee-types/leverage/genesis.pb.go diff --git a/umee-types/leverage/leverage.pb.go b/third-party-chains/umee-types/leverage/leverage.pb.go similarity index 100% rename from umee-types/leverage/leverage.pb.go rename to third-party-chains/umee-types/leverage/leverage.pb.go diff --git a/umee-types/leverage/params.go b/third-party-chains/umee-types/leverage/params.go similarity index 100% rename from umee-types/leverage/params.go rename to third-party-chains/umee-types/leverage/params.go diff --git a/umee-types/leverage/query.pb.go b/third-party-chains/umee-types/leverage/query.pb.go similarity index 100% rename from umee-types/leverage/query.pb.go rename to third-party-chains/umee-types/leverage/query.pb.go diff --git a/umee-types/leverage/query.pb.gw.go b/third-party-chains/umee-types/leverage/query.pb.gw.go similarity index 100% rename from umee-types/leverage/query.pb.gw.go rename to third-party-chains/umee-types/leverage/query.pb.gw.go diff --git a/umee-types/leverage/types/keys.go b/third-party-chains/umee-types/leverage/types/keys.go similarity index 100% rename from umee-types/leverage/types/keys.go rename to third-party-chains/umee-types/leverage/types/keys.go diff --git a/umee-types/leverage/types/token.go b/third-party-chains/umee-types/leverage/types/token.go similarity index 100% rename from umee-types/leverage/types/token.go rename to third-party-chains/umee-types/leverage/types/token.go diff --git a/umee-types/validation.go b/third-party-chains/umee-types/validation.go similarity index 98% rename from umee-types/validation.go rename to third-party-chains/umee-types/validation.go index ff46899e0..d9a42e6d6 100644 --- a/umee-types/validation.go +++ b/third-party-chains/umee-types/validation.go @@ -3,9 +3,10 @@ package umeetypes import ( "fmt" + "github.com/ingenuity-build/quicksilver/third-party-chains/umee-types/leverage/types" + sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ingenuity-build/quicksilver/umee-types/leverage/types" participationrewardstypes "github.com/ingenuity-build/quicksilver/x/participationrewards/types" ) diff --git a/utils/strings.go b/utils/strings.go new file mode 100644 index 000000000..0304c622d --- /dev/null +++ b/utils/strings.go @@ -0,0 +1,8 @@ +package utils + +// LengthPrefixString returns length-prefixed bytes representation of a string. +func LengthPrefixString(s string) []byte { + bz := []byte(s) + bzLen := len(bz) + return append([]byte{byte(bzLen)}, bz...) +} diff --git a/x/airdrop/keeper/claim_handler.go b/x/airdrop/keeper/claim_handler.go index c74763e5f..9843798b2 100644 --- a/x/airdrop/keeper/claim_handler.go +++ b/x/airdrop/keeper/claim_handler.go @@ -4,12 +4,13 @@ import ( "errors" "fmt" + osmosistypes "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types" + osmosislockuptypes "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/lockup" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - osmosistypes "github.com/ingenuity-build/quicksilver/osmosis-types" - osmosislockuptypes "github.com/ingenuity-build/quicksilver/osmosis-types/lockup" "github.com/ingenuity-build/quicksilver/x/airdrop/types" cmtypes "github.com/ingenuity-build/quicksilver/x/claimsmanager/types" icstypes "github.com/ingenuity-build/quicksilver/x/interchainstaking/types" diff --git a/x/claimsmanager/types/codec.go b/x/claimsmanager/types/codec.go index a0a97fc44..27637ae4b 100644 --- a/x/claimsmanager/types/codec.go +++ b/x/claimsmanager/types/codec.go @@ -6,10 +6,9 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm/pool-models/balancer" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm/pool-models/stableswap" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm/pool-models/balancer" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm/pool-models/stableswap" ) var ( diff --git a/x/epochs/types/hooks.go b/x/epochs/types/hooks.go index 283c67b4a..06261a0d6 100644 --- a/x/epochs/types/hooks.go +++ b/x/epochs/types/hooks.go @@ -3,9 +3,9 @@ package types import ( "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/osmoutils" - "github.com/ingenuity-build/quicksilver/osmosis-types/osmoutils" + sdk "github.com/cosmos/cosmos-sdk/types" ) type EpochHooks interface { diff --git a/x/participationrewards/keeper/callbacks.go b/x/participationrewards/keeper/callbacks.go index 74709e9bf..b08794d5a 100644 --- a/x/participationrewards/keeper/callbacks.go +++ b/x/participationrewards/keeper/callbacks.go @@ -5,14 +5,15 @@ import ( "errors" "fmt" + liquiditytypes "github.com/ingenuity-build/quicksilver/third-party-chains/crescent-types/liquidity/types" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" + umeetypes "github.com/ingenuity-build/quicksilver/third-party-chains/umee-types/leverage/types" + "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" sdk "github.com/cosmos/cosmos-sdk/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" - umeetypes "github.com/ingenuity-build/quicksilver/umee-types/leverage/types" icqtypes "github.com/ingenuity-build/quicksilver/x/interchainquery/types" "github.com/ingenuity-build/quicksilver/x/participationrewards/types" ) @@ -26,6 +27,9 @@ const ( UmeeInterestScalarUpdateCallbackID = "umeeinterestscalarupdatecallback" UmeeUTokenSupplyUpdateCallbackID = "umeeutokensupplyupdatecallback" UmeeLeverageModuleBalanceUpdateCallbackID = "umeeleveragemodulebalanceupdatecallback" + CrescentPoolUpdateCallbackID = "crescentpoolupdate" + CrescentReserveBalanceUpdateCallbackID = "reservebalanceupdate" + CrescentPoolCoinSupplyUpdateCallbackID = "poolcoinsupplyupdate" ) // Callback wrapper struct for interchainstaking keeper. @@ -66,7 +70,10 @@ func (c Callbacks) RegisterCallbacks() icqtypes.QueryCallbacks { AddCallback(UmeeTotalBorrowsUpdateCallbackID, Callback(UmeeTotalBorrowsUpdateCallback)). AddCallback(UmeeInterestScalarUpdateCallbackID, Callback(UmeeInterestScalarUpdateCallback)). AddCallback(UmeeUTokenSupplyUpdateCallbackID, Callback(UmeeUTokenSupplyUpdateCallback)). - AddCallback(UmeeLeverageModuleBalanceUpdateCallbackID, Callback(UmeeLeverageModuleBalanceUpdateCallback)) + AddCallback(UmeeLeverageModuleBalanceUpdateCallbackID, Callback(UmeeLeverageModuleBalanceUpdateCallback)). + AddCallback(CrescentPoolUpdateCallbackID, Callback(CrescentPoolUpdateCallback)). + AddCallback(CrescentReserveBalanceUpdateCallbackID, Callback(CrescentReserveBalanceUpdateCallback)). + AddCallback(CrescentPoolCoinSupplyUpdateCallbackID, Callback(CrescentPoolCoinSupplyUpdateCallback)) return a.(Callbacks) } @@ -407,3 +414,134 @@ func SetEpochBlockCallback(ctx sdk.Context, k *Keeper, args []byte, query icqtyp k.SetProtocolData(ctx, connectionData.GenerateKey(), &data) return nil } + +func CrescentPoolUpdateCallback(ctx sdk.Context, k *Keeper, response []byte, query icqtypes.Query) error { + var pd liquiditytypes.Pool + if err := k.cdc.Unmarshal(response, &pd); err != nil { + return err + } + + if query.Request[0] != liquiditytypes.PoolKeyPrefix[0] { + return errors.New("crescent pool query request has unexpected prefix") + } + + poolID := sdk.BigEndianToUint64(query.Request[1:]) + + data, ok := k.GetProtocolData(ctx, types.ProtocolDataTypeCrescentPool, fmt.Sprintf("%d", poolID)) + if !ok { + return fmt.Errorf("unable to find protocol data for crescent-types pool/%d", poolID) + } + ipool, err := types.UnmarshalProtocolData(types.ProtocolDataTypeCrescentPool, data.Data) + if err != nil { + return err + } + pool, ok := ipool.(*types.CrescentPoolProtocolData) + if !ok { + return fmt.Errorf("unable to unmarshal protocol data for crescent-types pool/%d", poolID) + } + pool.PoolData, err = json.Marshal(pd) + if err != nil { + return err + } + pool.LastUpdated = ctx.BlockTime() + data.Data, err = json.Marshal(pool) + if err != nil { + return err + } + k.SetProtocolData(ctx, pool.GenerateKey(), &data) + + return nil +} + +func CrescentPoolCoinSupplyUpdateCallback(ctx sdk.Context, k *Keeper, response []byte, query icqtypes.Query) error { + supplyAmount := sdk.ZeroInt() + if err := supplyAmount.Unmarshal(response); err != nil { + return err + } else if !supplyAmount.IsPositive() { + return errors.New("PoolCoinSupply must be positive") + } + + if len(query.Request) < 2 { + k.Logger(ctx).Error("unable to unmarshal crescent poolcoinsupply request, request length is too short") + return errors.New("coinsupply request must always have a length of at least 2 bytes") + } + + if query.Request[0] != banktypes.SupplyKey[0] { + return errors.New("query request has unexpected prefix") + } + + denom := string(query.Request[1:]) + data, ok := k.GetProtocolData(ctx, types.ProtocolDataTypeCrescentPoolCoinSupply, denom) + if !ok { + return fmt.Errorf("unable to find protocol data for crescent-types poolcoin supply/%s", denom) + } + isupply, err := types.UnmarshalProtocolData(types.ProtocolDataTypeCrescentPoolCoinSupply, data.Data) + if err != nil { + return err + } + supply, ok := isupply.(*types.CrescentPoolCoinSupplyProtocolData) + if !ok { + return fmt.Errorf("unable to unmarshal protocol data for crescent-types poolcoin supply/%s", denom) + } + supply.Supply, err = json.Marshal(supplyAmount) + if err != nil { + return err + } + supply.LastUpdated = ctx.BlockTime() + data.Data, err = json.Marshal(supply) + if err != nil { + return err + } + k.SetProtocolData(ctx, supply.GenerateKey(), &data) + + return nil +} + +func CrescentReserveBalanceUpdateCallback(ctx sdk.Context, k *Keeper, response []byte, query icqtypes.Query) error { + if len(query.Request) < 2 { + k.Logger(ctx).Error("unable to unmarshal balance request, request length is too short") + return errors.New("account balance icq request must always have a length of at least 2 bytes") + } + balancesStore := query.Request[1:] + addr, denom, err := banktypes.AddressAndDenomFromBalancesStore(balancesStore) + if err != nil { + return err + } + + address := addr.String() + balanceCoin, err := bankkeeper.UnmarshalBalanceCompat(k.cdc, response, denom) + if err != nil { + return err + } + + balanceAmount := balanceCoin.Amount + + if balanceAmount.IsNegative() { + return errors.New("CrescentReserveAddress account balance cannot be negative") + } + + data, ok := k.GetProtocolData(ctx, types.ProtocolDataTypeCrescentReserveAddressBalance, address+denom) + if !ok { + return fmt.Errorf("unable to find protocol data for crescent-types reserve address coins/%s, %s", address, denom) + } + ibalance, err := types.UnmarshalProtocolData(types.ProtocolDataTypeCrescentReserveAddressBalance, data.Data) + if err != nil { + return err + } + balance, ok := ibalance.(*types.CrescentReserveAddressBalanceProtocolData) + if !ok { + return fmt.Errorf("unable to unmarshal protocol data for reserve address coins/%s, %s", address, denom) + } + balance.Balance, err = json.Marshal(balanceAmount) + if err != nil { + return err + } + balance.LastUpdated = ctx.BlockTime() + data.Data, err = json.Marshal(balance) + if err != nil { + return err + } + k.SetProtocolData(ctx, balance.GenerateKey(), &data) + + return nil +} diff --git a/x/participationrewards/keeper/callbacks_test.go b/x/participationrewards/keeper/callbacks_test.go index d15c39a76..e4629a7b3 100644 --- a/x/participationrewards/keeper/callbacks_test.go +++ b/x/participationrewards/keeper/callbacks_test.go @@ -5,19 +5,24 @@ import ( "fmt" "strings" + liquiditytypes "github.com/ingenuity-build/quicksilver/third-party-chains/crescent-types/liquidity/types" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" + leveragetypes "github.com/ingenuity-build/quicksilver/third-party-chains/umee-types/leverage/types" + "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/bech32" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" - umeetypes "github.com/ingenuity-build/quicksilver/umee-types/leverage/types" icqkeeper "github.com/ingenuity-build/quicksilver/x/interchainquery/keeper" "github.com/ingenuity-build/quicksilver/x/participationrewards/keeper" "github.com/ingenuity-build/quicksilver/x/participationrewards/types" ) +var PoolCoinDenom = "pool1" + func (suite *KeeperTestSuite) executeOsmosisPoolUpdateCallback() { prk := suite.GetQuicksilverApp(suite.chainA).ParticipationRewardsKeeper ctx := suite.chainA.GetContext() @@ -56,8 +61,8 @@ func (suite *KeeperTestSuite) executeOsmosisPoolUpdateCallback() { PoolData: expectedData, PoolType: "balancer", Denoms: map[string]types.DenomWithZone{ - "ibc/3020922B7576FC75BBE057A0290A9AEEFF489BB1113E6E365CE472D4BFB7FFA3": {ChainID: "cosmoshub-4", Denom: "uatom"}, - "ibc/15E9C5CF5969080539DB395FA7D9C0868265217EFC528433671AAF9B1912D159": {ChainID: "osmosis-1", Denom: "uosmo"}, + cosmosIBCDenom: {ChainID: "cosmoshub-4", Denom: "uatom"}, + osmosisIBCDenom: {ChainID: "osmosis-1", Denom: "uosmo"}, }, } @@ -153,7 +158,7 @@ func (suite *KeeperTestSuite) executeUmeeReservesUpdateCallback() { prk := suite.GetQuicksilverApp(suite.chainA).ParticipationRewardsKeeper ctx := suite.chainA.GetContext() - qid := icqkeeper.GenerateQueryHash(umeeTestConnection, umeeTestChain, "store/leverage/key", umeetypes.KeyReserveAmount(umeeBaseDenom), types.ModuleName) + qid := icqkeeper.GenerateQueryHash(umeeTestConnection, umeeTestChain, "store/leverage/key", leveragetypes.KeyReserveAmount(umeeBaseDenom), types.ModuleName) query, found := prk.IcqKeeper.GetQuery(ctx, qid) suite.Require().True(found, "qid: %s", qid) @@ -195,7 +200,7 @@ func (suite *KeeperTestSuite) executeUmeeLeverageModuleBalanceUpdateCallback() { prk := suite.GetQuicksilverApp(suite.chainA).ParticipationRewardsKeeper ctx := suite.chainA.GetContext() - accountPrefix := banktypes.CreateAccountBalancesPrefix(authtypes.NewModuleAddress(umeetypes.LeverageModuleName)) + accountPrefix := banktypes.CreateAccountBalancesPrefix(authtypes.NewModuleAddress(leveragetypes.LeverageModuleName)) qid := icqkeeper.GenerateQueryHash(umeeTestConnection, umeeTestChain, "store/bank/key", append(accountPrefix, []byte(umeeBaseDenom)...), types.ModuleName) @@ -239,7 +244,7 @@ func (suite *KeeperTestSuite) executeUmeeUTokenSupplyUpdateCallback() { prk := suite.GetQuicksilverApp(suite.chainA).ParticipationRewardsKeeper ctx := suite.chainA.GetContext() - qid := icqkeeper.GenerateQueryHash(umeeTestConnection, umeeTestChain, "store/leverage/key", umeetypes.KeyUTokenSupply(umeetypes.UTokenPrefix+umeeBaseDenom), types.ModuleName) + qid := icqkeeper.GenerateQueryHash(umeeTestConnection, umeeTestChain, "store/leverage/key", leveragetypes.KeyUTokenSupply(leveragetypes.UTokenPrefix+umeeBaseDenom), types.ModuleName) query, found := prk.IcqKeeper.GetQuery(ctx, qid) suite.Require().True(found, "qid: %s", qid) @@ -262,13 +267,13 @@ func (suite *KeeperTestSuite) executeUmeeUTokenSupplyUpdateCallback() { want := &types.UmeeUTokenSupplyProtocolData{ UmeeProtocolData: types.UmeeProtocolData{ - Denom: umeetypes.UTokenPrefix + umeeBaseDenom, + Denom: leveragetypes.UTokenPrefix + umeeBaseDenom, LastUpdated: ctx.BlockTime(), Data: expectedData, }, } - pd, found := prk.GetProtocolData(ctx, types.ProtocolDataTypeUmeeUTokenSupply, umeetypes.UTokenPrefix+umeeBaseDenom) + pd, found := prk.GetProtocolData(ctx, types.ProtocolDataTypeUmeeUTokenSupply, leveragetypes.UTokenPrefix+umeeBaseDenom) suite.Require().True(found) value, err := types.UnmarshalProtocolData(types.ProtocolDataTypeUmeeUTokenSupply, pd.Data) @@ -281,7 +286,7 @@ func (suite *KeeperTestSuite) executeUmeeTotalBorrowsUpdateCallback() { prk := suite.GetQuicksilverApp(suite.chainA).ParticipationRewardsKeeper ctx := suite.chainA.GetContext() - qid := icqkeeper.GenerateQueryHash(umeeTestConnection, umeeTestChain, "store/leverage/key", umeetypes.KeyAdjustedTotalBorrow(umeeBaseDenom), types.ModuleName) + qid := icqkeeper.GenerateQueryHash(umeeTestConnection, umeeTestChain, "store/leverage/key", leveragetypes.KeyAdjustedTotalBorrow(umeeBaseDenom), types.ModuleName) query, found := prk.IcqKeeper.GetQuery(ctx, qid) suite.Require().True(found, "qid: %s", qid) @@ -323,7 +328,7 @@ func (suite *KeeperTestSuite) executeUmeeInterestScalarUpdateCallback() { prk := suite.GetQuicksilverApp(suite.chainA).ParticipationRewardsKeeper ctx := suite.chainA.GetContext() - qid := icqkeeper.GenerateQueryHash(umeeTestConnection, umeeTestChain, "store/leverage/key", umeetypes.KeyInterestScalar(umeeBaseDenom), types.ModuleName) + qid := icqkeeper.GenerateQueryHash(umeeTestConnection, umeeTestChain, "store/leverage/key", leveragetypes.KeyInterestScalar(umeeBaseDenom), types.ModuleName) query, found := prk.IcqKeeper.GetQuery(ctx, qid) suite.Require().True(found, "qid: %s", qid) @@ -360,3 +365,134 @@ func (suite *KeeperTestSuite) executeUmeeInterestScalarUpdateCallback() { result := value.(*types.UmeeInterestScalarProtocolData) suite.Require().Equal(want, result) } + +func (suite *KeeperTestSuite) executeCrescentPoolUpdateCallback() { + prk := suite.GetQuicksilverApp(suite.chainA).ParticipationRewardsKeeper + ctx := suite.chainA.GetContext() + + qid := icqkeeper.GenerateQueryHash(crescentTestConnection, crescentTestChain, "store/liquidity/key", liquiditytypes.GetPoolKey(1), types.ModuleName) + + query, found := prk.IcqKeeper.GetQuery(ctx, qid) + suite.Require().True(found, "qid: %s", qid) + + var err error + poolResponse := liquiditytypes.Pool{Type: 0, Id: 1, PairId: 7, Creator: testCrescentAddress, ReserveAddress: testAddress, PoolCoinDenom: PoolCoinDenom, Disabled: false} + resp, _ := prk.GetCodec().Marshal(&poolResponse) + + // setup for expected + var pdi liquiditytypes.Pool + err = prk.GetCodec().Unmarshal(resp, &pdi) + suite.Require().NoError(err) + expectedData, err := json.Marshal(pdi) + suite.Require().NoError(err) + + err = keeper.CrescentPoolUpdateCallback( + ctx, + prk, + resp, + query, + ) + suite.Require().NoError(err) + + want := &types.CrescentPoolProtocolData{ + PoolID: 1, + LastUpdated: ctx.BlockTime(), + PoolData: expectedData, + Denoms: map[string]types.DenomWithZone{ + cosmosIBCDenom: {ChainID: "cosmoshub-4", Denom: "uatom"}, + osmosisIBCDenom: {ChainID: "osmosis-1", Denom: "uosmo"}, + }, + } + + pd, found := prk.GetProtocolData(ctx, types.ProtocolDataTypeCrescentPool, "1") + suite.Require().True(found) + + icpd, err := types.UnmarshalProtocolData(types.ProtocolDataTypeCrescentPool, pd.Data) + suite.Require().NoError(err) + cpd := icpd.(*types.CrescentPoolProtocolData) + suite.Require().Equal(want, cpd) +} + +func (suite *KeeperTestSuite) executeCrescentPoolCoinSupplyUpdateCallback() { + prk := suite.GetQuicksilverApp(suite.chainA).ParticipationRewardsKeeper + ctx := suite.chainA.GetContext() + + qid := icqkeeper.GenerateQueryHash(crescentTestConnection, crescentTestChain, "store/bank/key", append(banktypes.SupplyKey, []byte(PoolCoinDenom)...), types.ModuleName) + + query, found := prk.IcqKeeper.GetQuery(ctx, qid) + suite.Require().True(found, "qid: %s", qid) + + data := sdk.NewInt(100000) + resp, err := data.Marshal() + suite.Require().NoError(err) + expectedData, err := json.Marshal(data) + suite.Require().NoError(err) + + // setup for expected + + err = keeper.CrescentPoolCoinSupplyUpdateCallback( + ctx, + prk, + resp, + query, + ) + suite.Require().NoError(err) + + want := &types.CrescentPoolCoinSupplyProtocolData{ + PoolCoinDenom: PoolCoinDenom, + LastUpdated: ctx.BlockTime(), + Supply: expectedData, + } + + pd, found := prk.GetProtocolData(ctx, types.ProtocolDataTypeCrescentPoolCoinSupply, PoolCoinDenom) + suite.Require().True(found) + + value, err := types.UnmarshalProtocolData(types.ProtocolDataTypeCrescentPoolCoinSupply, pd.Data) + suite.Require().NoError(err) + result := value.(*types.CrescentPoolCoinSupplyProtocolData) + suite.Require().Equal(want, result) +} + +func (suite *KeeperTestSuite) executeCrescentReserveBalanceUpdateCallback() { + prk := suite.GetQuicksilverApp(suite.chainA).ParticipationRewardsKeeper + ctx := suite.chainA.GetContext() + + _, addr, _ := bech32.DecodeAndConvert(testAddress) + accountPrefix := banktypes.CreateAccountBalancesPrefix(addr) + + qid := icqkeeper.GenerateQueryHash(crescentTestConnection, crescentTestChain, "store/bank/key", append(accountPrefix, []byte(cosmosIBCDenom)...), types.ModuleName) + + query, found := prk.IcqKeeper.GetQuery(ctx, qid) + suite.Require().True(found, "qid: %s", qid) + + data := sdk.NewInt(1000000) + resp, err := data.Marshal() + suite.Require().NoError(err) + expectedData, err := json.Marshal(data) + suite.Require().NoError(err) + + // setup for expected + + err = keeper.CrescentReserveBalanceUpdateCallback( + ctx, + prk, + resp, + query, + ) + suite.Require().NoError(err) + + want := &types.CrescentReserveAddressBalanceProtocolData{ + ReserveAddress: testAddress, + Denom: cosmosIBCDenom, + LastUpdated: ctx.BlockTime(), + Balance: expectedData, + } + + pd, found := prk.GetProtocolData(ctx, types.ProtocolDataTypeCrescentReserveAddressBalance, testAddress+cosmosIBCDenom) + suite.Require().True(found) + + value, err := types.UnmarshalProtocolData(types.ProtocolDataTypeCrescentReserveAddressBalance, pd.Data) + suite.Require().NoError(err) + result := value.(*types.CrescentReserveAddressBalanceProtocolData) + suite.Require().Equal(want, result) +} diff --git a/x/participationrewards/keeper/keeper.go b/x/participationrewards/keeper/keeper.go index 9913b8ad1..ec490087d 100644 --- a/x/participationrewards/keeper/keeper.go +++ b/x/participationrewards/keeper/keeper.go @@ -5,21 +5,25 @@ import ( "fmt" sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/tendermint/tendermint/libs/log" config "github.com/ingenuity-build/quicksilver/cmd/config" - osmosistypes "github.com/ingenuity-build/quicksilver/osmosis-types" + crescenttypes "github.com/ingenuity-build/quicksilver/third-party-chains/crescent-types" + osmosistypes "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types" + umeetypes "github.com/ingenuity-build/quicksilver/third-party-chains/umee-types" "github.com/ingenuity-build/quicksilver/utils" cmtypes "github.com/ingenuity-build/quicksilver/x/claimsmanager/types" epochskeeper "github.com/ingenuity-build/quicksilver/x/epochs/keeper" icqkeeper "github.com/ingenuity-build/quicksilver/x/interchainquery/keeper" icskeeper "github.com/ingenuity-build/quicksilver/x/interchainstaking/keeper" "github.com/ingenuity-build/quicksilver/x/participationrewards/types" + + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) // UserAllocation is an internal keeper struct to track transient state for @@ -30,7 +34,11 @@ type UserAllocation struct { Amount sdkmath.Int } -var _ osmosistypes.ParticipationRewardsKeeper = &Keeper{} +var ( + _ osmosistypes.ParticipationRewardsKeeper = &Keeper{} + _ umeetypes.ParticipationRewardsKeeper = &Keeper{} + _ crescenttypes.ParticipationRewardsKeeper = &Keeper{} +) type Keeper struct { cdc codec.BinaryCodec @@ -160,5 +168,6 @@ func LoadSubmodules() map[cmtypes.ClaimType]Submodule { out[cmtypes.ClaimTypeLiquidToken] = &LiquidTokensModule{} out[cmtypes.ClaimTypeOsmosisPool] = &OsmosisModule{} out[cmtypes.ClaimTypeUmeeToken] = &UmeeModule{} + out[cmtypes.ClaimTypeCrescentPool] = &CrescentModule{} return out } diff --git a/x/participationrewards/keeper/keeper_test.go b/x/participationrewards/keeper/keeper_test.go index a2f11a019..23341664a 100644 --- a/x/participationrewards/keeper/keeper_test.go +++ b/x/participationrewards/keeper/keeper_test.go @@ -6,6 +6,8 @@ import ( "testing" "time" + umeetypes "github.com/ingenuity-build/quicksilver/third-party-chains/umee-types/leverage/types" + "cosmossdk.io/math" testsuite "github.com/stretchr/testify/suite" @@ -19,7 +21,6 @@ import ( ibctesting "github.com/cosmos/ibc-go/v5/testing" "github.com/ingenuity-build/quicksilver/app" - umeetypes "github.com/ingenuity-build/quicksilver/umee-types/leverage/types" "github.com/ingenuity-build/quicksilver/utils/addressutils" cmtypes "github.com/ingenuity-build/quicksilver/x/claimsmanager/types" epochtypes "github.com/ingenuity-build/quicksilver/x/epochs/types" @@ -29,10 +30,16 @@ import ( ) var ( - testAddress = addressutils.GenerateAddressForTestWithPrefix("cosmos") - umeeTestConnection = "connection-77003" - umeeTestChain = "umee-types-1" - umeeBaseDenom = "uumee" + testAddress = addressutils.GenerateAddressForTestWithPrefix("cosmos") + testCrescentAddress = addressutils.GenerateAddressForTestWithPrefix("cre") + umeeTestConnection = "connection-77003" + umeeTestChain = "umee-types-1" + umeeBaseDenom = "uumee" + + crescentTestConnection = "connection-7704" + crescentTestChain = "crescent-types-1" + cosmosIBCDenom = "ibc/3020922B7576FC75BBE057A0290A9AEEFF489BB1113E6E365CE472D4BFB7FFA3" + osmosisIBCDenom = "ibc/15E9C5CF5969080539DB395FA7D9C0868265217EFC528433671AAF9B1912D159" ) func init() { @@ -101,8 +108,8 @@ func (suite *KeeperTestSuite) coreTest() { suite.setupTestProtocolData() akpd = quicksilver.ParticipationRewardsKeeper.AllKeyedProtocolDatas(suite.chainA.GetContext()) - // added 6 in setupTestProtocolData - suite.Require().Equal(14, len(akpd)) + // added 19 in setupTestProtocolData + suite.Require().Equal(19, len(akpd)) // advance the chains suite.coordinator.CommitNBlocks(suite.chainA, 1) @@ -116,6 +123,9 @@ func (suite *KeeperTestSuite) coreTest() { suite.executeUmeeInterestScalarUpdateCallback() suite.executeUmeeLeverageModuleBalanceUpdateCallback() suite.executeUmeeUTokenSupplyUpdateCallback() + suite.executeCrescentPoolUpdateCallback() + suite.executeCrescentPoolCoinSupplyUpdateCallback() + suite.executeCrescentReserveBalanceUpdateCallback() suite.setupTestDeposits() suite.setupTestIntents() @@ -452,15 +462,50 @@ func (suite *KeeperTestSuite) setupTestProtocolData() { "{\"poolid\":%d,\"poolname\":%q,\"pooltype\":\"balancer\",\"denoms\":{%q:{\"chainid\": %q, \"denom\":%q}, %q:{\"chainid\": %q, \"denom\":%q}}}", 1, "atom/osmo", - "ibc/3020922B7576FC75BBE057A0290A9AEEFF489BB1113E6E365CE472D4BFB7FFA3", + cosmosIBCDenom, "cosmoshub-4", "uatom", - "ibc/15E9C5CF5969080539DB395FA7D9C0868265217EFC528433671AAF9B1912D159", + osmosisIBCDenom, "osmosis-1", "uosmo", )), ) - + // crescent params + suite.addProtocolData( + types.ProtocolDataTypeCrescentParams, + []byte(fmt.Sprintf("{\"ChainID\": %q}", crescentTestChain)), + ) + // crescent test chain + suite.addProtocolData( + types.ProtocolDataTypeConnection, + []byte(fmt.Sprintf("{\"connectionid\": %q,\"chainid\": %q,\"lastepoch\": %d}", crescentTestConnection, crescentTestChain, 0)), + ) + // crescent test pool + suite.addProtocolData( + types.ProtocolDataTypeCrescentPool, + []byte(fmt.Sprintf( + "{\"poolid\":%d,\"denoms\":{%q:{\"chainid\": %q, \"denom\":%q}, %q:{\"chainid\": %q, \"denom\":%q}}}", + 1, + cosmosIBCDenom, + "cosmoshub-4", + "uatom", + osmosisIBCDenom, + "osmosis-1", + "uosmo", + )), + ) + // crescent-types test supply + cpd, _ := json.Marshal(types.CrescentPoolCoinSupplyProtocolData{PoolCoinDenom: PoolCoinDenom}) + suite.addProtocolData( + types.ProtocolDataTypeCrescentPoolCoinSupply, + cpd, + ) + // crescent-types reserve address balance + cpd, _ = json.Marshal(types.CrescentReserveAddressBalanceProtocolData{ReserveAddress: testAddress, Denom: cosmosIBCDenom}) + suite.addProtocolData( + types.ProtocolDataTypeCrescentReserveAddressBalance, + cpd, + ) // atom (cosmoshub) on osmosis suite.addProtocolData( types.ProtocolDataTypeLiquidToken, @@ -468,7 +513,7 @@ func (suite *KeeperTestSuite) setupTestProtocolData() { "{\"chainid\":%q,\"registeredzonechainid\":%q,\"ibcdenom\":%q,\"qassetdenom\":%q}", "osmosis-1", "cosmoshub-4", - "ibc/3020922B7576FC75BBE057A0290A9AEEFF489BB1113E6E365CE472D4BFB7FFA3", + cosmosIBCDenom, "uqatom", )), ) @@ -478,7 +523,7 @@ func (suite *KeeperTestSuite) setupTestProtocolData() { "{\"chainid\":%q,\"registeredzonechainid\":%q,\"ibcdenom\":%q,\"qassetdenom\":%q}", "testchain1", "cosmoshub-4", - "ibc/3020922B7576FC75BBE057A0290A9AEEFF489BB1113E6E365CE472D4BFB7FFA3", + cosmosIBCDenom, "uqatom", )), ) diff --git a/x/participationrewards/keeper/msg_server_test.go b/x/participationrewards/keeper/msg_server_test.go index 70872bb90..9367bc059 100644 --- a/x/participationrewards/keeper/msg_server_test.go +++ b/x/participationrewards/keeper/msg_server_test.go @@ -14,8 +14,9 @@ import ( "github.com/tendermint/tendermint/proto/tendermint/crypto" "github.com/ingenuity-build/quicksilver/app" - osmolockup "github.com/ingenuity-build/quicksilver/osmosis-types/lockup" - umeetypes "github.com/ingenuity-build/quicksilver/umee-types/leverage/types" + lpfarm "github.com/ingenuity-build/quicksilver/third-party-chains/crescent-types/lpfarm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/lockup" + umeetypes "github.com/ingenuity-build/quicksilver/third-party-chains/umee-types/leverage/types" "github.com/ingenuity-build/quicksilver/utils" "github.com/ingenuity-build/quicksilver/utils/addressutils" cmtypes "github.com/ingenuity-build/quicksilver/x/claimsmanager/types" @@ -67,8 +68,8 @@ func (suite *KeeperTestSuite) Test_msgServer_SubmitClaim() { func() { userAddress := addressutils.GenerateAccAddressForTest() osmoAddress := addressutils.GenerateAddressForTestWithPrefix("osmo") - lockedResp := osmolockup.LockedResponse{ - Lock: &osmolockup.PeriodLock{ + lockedResp := lockup.LockedResponse{ + Lock: &lockup.PeriodLock{ ID: 1, Owner: osmoAddress, Duration: time.Hour * 72, @@ -107,8 +108,8 @@ func (suite *KeeperTestSuite) Test_msgServer_SubmitClaim() { func() { userAddress := addressutils.GenerateAccAddressForTest() osmoAddress := addressutils.MustEncodeAddressToBech32("osmo", userAddress) - lockedResp := osmolockup.LockedResponse{ - Lock: &osmolockup.PeriodLock{ + lockedResp := lockup.LockedResponse{ + Lock: &lockup.PeriodLock{ ID: 1, Owner: osmoAddress, Duration: time.Hour * 72, @@ -175,12 +176,114 @@ func (suite *KeeperTestSuite) Test_msgServer_SubmitClaim() { nil, "a", }, + { + "invalid_crescent_pool", + func() { + prk := suite.GetQuicksilverApp(suite.chainA).ParticipationRewardsKeeper + userAddress := addressutils.GenerateAccAddressForTest() + crescentAddress := addressutils.MustEncodeAddressToBech32("cre", userAddress) + + addr, _ := sdk.GetFromBech32(crescentAddress, "cre") + + key := lpfarm.GetPositionKey(addr, cosmosIBCDenom) + + cd := lpfarm.Position{Farmer: crescentAddress, FarmingAmount: math.NewInt(10000), Denom: "pool7"} + bz, err := prk.GetCodec().Marshal(&cd) + suite.Require().NoError(err) + + msg = types.MsgSubmitClaim{ + UserAddress: userAddress.String(), + Zone: "cosmoshub-4", + SrcZone: "testchain1", + ClaimType: cmtypes.ClaimTypeCrescentPool, + Proofs: []*cmtypes.Proof{ + { + Key: key, + Data: bz, + ProofOps: &crypto.ProofOps{}, + Height: 10, + ProofType: types.ProofTypePosition, + }, + }, + } + }, + nil, + "a", + }, + { + "invalid_crescent_user", + func() { + prk := suite.GetQuicksilverApp(suite.chainA).ParticipationRewardsKeeper + userAddress := addressutils.GenerateAccAddressForTest() + crescentAddress := addressutils.MustEncodeAddressToBech32("cre", addressutils.GenerateAccAddressForTest()) + + addr, _ := sdk.GetFromBech32(crescentAddress, "cre") + + key := lpfarm.GetPositionKey(addr, cosmosIBCDenom) + + cd := lpfarm.Position{Farmer: crescentAddress, FarmingAmount: math.NewInt(10000), Denom: "pool1"} + bz, err := prk.GetCodec().Marshal(&cd) + suite.Require().NoError(err) + + msg = types.MsgSubmitClaim{ + UserAddress: userAddress.String(), + Zone: "cosmoshub-4", + SrcZone: "testchain1", + ClaimType: cmtypes.ClaimTypeCrescentPool, + Proofs: []*cmtypes.Proof{ + { + Key: key, + Data: bz, + ProofOps: &crypto.ProofOps{}, + Height: 10, + ProofType: types.ProofTypePosition, + }, + }, + } + }, + nil, + "a", + }, + { + "negative_farming_amount", + func() { + prk := suite.GetQuicksilverApp(suite.chainA).ParticipationRewardsKeeper + userAddress := addressutils.GenerateAccAddressForTest() + crescentAddress := addressutils.MustEncodeAddressToBech32("cre", userAddress) + + addr, _ := sdk.GetFromBech32(crescentAddress, "cre") + + key := lpfarm.GetPositionKey(addr, cosmosIBCDenom) + + cd := lpfarm.Position{Farmer: crescentAddress, FarmingAmount: math.NewInt(-1), Denom: "pool1"} + bz, err := prk.GetCodec().Marshal(&cd) + suite.Require().NoError(err) + + msg = types.MsgSubmitClaim{ + UserAddress: userAddress.String(), + Zone: "cosmoshub-4", + SrcZone: "testchain1", + ClaimType: cmtypes.ClaimTypeCrescentPool, + Proofs: []*cmtypes.Proof{ + { + Key: key, + Data: bz, + ProofOps: &crypto.ProofOps{}, + Height: 10, + ProofType: types.ProofTypePosition, + }, + }, + } + }, + nil, + "a", + }, { "valid_osmosis", func() { userAddress := addressutils.GenerateAccAddressForTest() osmoAddress := addressutils.MustEncodeAddressToBech32("osmo", userAddress) - locked := &osmolockup.PeriodLock{ + locked := &lockup.PeriodLock{ ID: 1, Owner: osmoAddress, Duration: time.Hour * 72, @@ -316,6 +419,39 @@ func (suite *KeeperTestSuite) Test_msgServer_SubmitClaim() { &types.MsgSubmitClaimResponse{}, "", }, + { + name: "valid_crescent", + malleate: func() { + prk := suite.GetQuicksilverApp(suite.chainA).ParticipationRewardsKeeper + userAddress := addressutils.GenerateAccAddressForTest() + crescentAddress := addressutils.MustEncodeAddressToBech32("cre", userAddress) + + addr, _ := sdk.GetFromBech32(crescentAddress, "cre") + + key := lpfarm.GetPositionKey(addr, cosmosIBCDenom) + + cd := lpfarm.Position{Farmer: crescentAddress, FarmingAmount: math.NewInt(10000), Denom: "pool1"} + bz, err := prk.GetCodec().Marshal(&cd) + suite.Require().NoError(err) + + msg = types.MsgSubmitClaim{ + UserAddress: userAddress.String(), + Zone: "cosmoshub-4", + SrcZone: "testchain1", + ClaimType: cmtypes.ClaimTypeCrescentPool, + Proofs: []*cmtypes.Proof{ + { + Key: key, + Data: bz, + ProofOps: &crypto.ProofOps{}, + Height: 10, + ProofType: types.ProofTypePosition, + }, + }, + } + }, + want: &types.MsgSubmitClaimResponse{}, + }, } for _, tt := range tests { tt := tt diff --git a/x/participationrewards/keeper/submodule_crescent.go b/x/participationrewards/keeper/submodule_crescent.go new file mode 100644 index 000000000..8d7bd7c5c --- /dev/null +++ b/x/participationrewards/keeper/submodule_crescent.go @@ -0,0 +1,149 @@ +package keeper + +import ( + "encoding/json" + "errors" + "fmt" + + crescenttypes "github.com/ingenuity-build/quicksilver/third-party-chains/crescent-types" + liquiditytypes "github.com/ingenuity-build/quicksilver/third-party-chains/crescent-types/liquidity/types" + lpfarm "github.com/ingenuity-build/quicksilver/third-party-chains/crescent-types/lpfarm" + icstypes "github.com/ingenuity-build/quicksilver/x/interchainstaking/types" + "github.com/ingenuity-build/quicksilver/x/participationrewards/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/bech32" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +type CrescentModule struct{} + +var _ Submodule = &CrescentModule{} + +func (c CrescentModule) Hooks(ctx sdk.Context, k *Keeper) { + // crescent-types params + params, found := k.GetProtocolData(ctx, types.ProtocolDataTypeCrescentParams, types.CrescentParamsKey) + if !found { + k.Logger(ctx).Error("unable to query crescentparams in CrescentModule hook") + return + } + + paramsData := types.CrescentParamsProtocolData{} + if err := json.Unmarshal(params.Data, ¶msData); err != nil { + k.Logger(ctx).Error("unable to unmarshal crescentparams in CrescentModule hook", "error", err) + return + } + + data, found := k.GetProtocolData(ctx, types.ProtocolDataTypeConnection, paramsData.ChainID) + if !found { + k.Logger(ctx).Error(fmt.Sprintf("unable to query connection/%s in CrescentModule hook", paramsData.ChainID)) + return + } + + connectionData := types.ConnectionProtocolData{} + if err := json.Unmarshal(data.Data, &connectionData); err != nil { + k.Logger(ctx).Error(fmt.Sprintf("unable to unmarshal connection/%s in CrescentModule hook", paramsData.ChainID)) + return + } + + // update reserve address denom balance + k.IteratePrefixedProtocolDatas(ctx, types.GetPrefixProtocolDataKey(types.ProtocolDataTypeCrescentReserveAddressBalance), func(idx int64, _ []byte, data types.ProtocolData) bool { + ibalance, err := types.UnmarshalProtocolData(types.ProtocolDataTypeCrescentReserveAddressBalance, data.Data) + if err != nil { + return false + } + balance, _ := ibalance.(*types.CrescentReserveAddressBalanceProtocolData) + _, addrBytes, _ := bech32.DecodeAndConvert(balance.ReserveAddress) + lookupKey := banktypes.CreateAccountBalancesPrefix(addrBytes) + + k.IcqKeeper.MakeRequest( + ctx, + connectionData.ConnectionID, + connectionData.ChainID, + icstypes.BankStoreKey, + append(lookupKey, []byte(balance.Denom)...), + sdk.NewInt(-1), + types.ModuleName, + CrescentReserveBalanceUpdateCallbackID, + 0, + ) + return false + }) + + // update pool data + k.IteratePrefixedProtocolDatas(ctx, types.GetPrefixProtocolDataKey(types.ProtocolDataTypeCrescentPool), func(idx int64, _ []byte, data types.ProtocolData) bool { + ipool, err := types.UnmarshalProtocolData(types.ProtocolDataTypeCrescentPool, data.Data) + if err != nil { + return false + } + pool, _ := ipool.(*types.CrescentPoolProtocolData) + + poolKey := liquiditytypes.GetPoolKey(pool.PoolID) + + k.IcqKeeper.MakeRequest( + ctx, + connectionData.ConnectionID, + connectionData.ChainID, + "store/liquidity/key", + poolKey, + sdk.NewInt(-1), + types.ModuleName, + CrescentPoolUpdateCallbackID, + 0, + ) + return false + }) + + // update poolcoin supply + k.IteratePrefixedProtocolDatas(ctx, types.GetPrefixProtocolDataKey(types.ProtocolDataTypeCrescentPoolCoinSupply), func(idx int64, _ []byte, data types.ProtocolData) bool { + isupply, err := types.UnmarshalProtocolData(types.ProtocolDataTypeCrescentPoolCoinSupply, data.Data) + if err != nil { + return false + } + supply, _ := isupply.(*types.CrescentPoolCoinSupplyProtocolData) + + k.IcqKeeper.MakeRequest( + ctx, + connectionData.ConnectionID, + connectionData.ChainID, + icstypes.BankStoreKey, + append(banktypes.SupplyKey, []byte(supply.PoolCoinDenom)...), + sdk.NewInt(-1), + types.ModuleName, + CrescentPoolCoinSupplyUpdateCallbackID, + 0, + ) + return false + }) +} + +func (c CrescentModule) ValidateClaim(ctx sdk.Context, k *Keeper, msg *types.MsgSubmitClaim) (uint64, error) { + var amount uint64 + for _, proof := range msg.Proofs { + position := lpfarm.Position{} + err := k.cdc.Unmarshal(proof.Data, &position) + if err != nil { + return 0, err + } + + _, farmer, err := bech32.DecodeAndConvert(position.Farmer) + if err != nil { + return 0, err + } + + if sdk.AccAddress(farmer).String() != msg.UserAddress { + return 0, errors.New("not a valid proof for submitting user") + } + + sdkAmount, err := crescenttypes.DetermineApplicableTokensInPool(ctx, k, position, msg.Zone) + if err != nil { + return 0, err + } + + if sdkAmount.IsNil() || sdkAmount.IsNegative() { + return 0, errors.New("unexpected amount") + } + amount += sdkAmount.Uint64() + } + return amount, nil +} diff --git a/x/participationrewards/keeper/submodule_osmosis.go b/x/participationrewards/keeper/submodule_osmosis.go index 3a421b8b9..d2c2efb0d 100644 --- a/x/participationrewards/keeper/submodule_osmosis.go +++ b/x/participationrewards/keeper/submodule_osmosis.go @@ -5,11 +5,12 @@ import ( "errors" "fmt" + osmosistypes "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types" + osmolockup "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/lockup" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/bech32" - osmosistypes "github.com/ingenuity-build/quicksilver/osmosis-types" - osmolockup "github.com/ingenuity-build/quicksilver/osmosis-types/lockup" "github.com/ingenuity-build/quicksilver/x/participationrewards/types" ) diff --git a/x/participationrewards/keeper/submodule_umee.go b/x/participationrewards/keeper/submodule_umee.go index f09b45702..1b5750484 100644 --- a/x/participationrewards/keeper/submodule_umee.go +++ b/x/participationrewards/keeper/submodule_umee.go @@ -4,7 +4,8 @@ import ( "encoding/json" "fmt" - umee "github.com/ingenuity-build/quicksilver/umee-types" + umee "github.com/ingenuity-build/quicksilver/third-party-chains/umee-types" + leveragetypes "github.com/ingenuity-build/quicksilver/third-party-chains/umee-types/leverage/types" cmtypes "github.com/ingenuity-build/quicksilver/x/claimsmanager/types" @@ -15,7 +16,6 @@ import ( bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - umeetypes "github.com/ingenuity-build/quicksilver/umee-types/leverage/types" "github.com/ingenuity-build/quicksilver/utils" icstypes "github.com/ingenuity-build/quicksilver/x/interchainstaking/types" "github.com/ingenuity-build/quicksilver/x/participationrewards/types" @@ -65,7 +65,7 @@ func (u UmeeModule) Hooks(ctx sdk.Context, k *Keeper) { connectionData.ConnectionID, connectionData.ChainID, "store/leverage/key", - umeetypes.KeyReserveAmount(reserves.Denom), + leveragetypes.KeyReserveAmount(reserves.Denom), sdk.NewInt(-1), types.ModuleName, UmeeReservesUpdateCallbackID, @@ -87,7 +87,7 @@ func (u UmeeModule) Hooks(ctx sdk.Context, k *Keeper) { connectionData.ConnectionID, connectionData.ChainID, "store/leverage/key", - umeetypes.KeyInterestScalar(interest.Denom), + leveragetypes.KeyInterestScalar(interest.Denom), sdk.NewInt(-1), types.ModuleName, UmeeInterestScalarUpdateCallbackID, @@ -110,7 +110,7 @@ func (u UmeeModule) Hooks(ctx sdk.Context, k *Keeper) { connectionData.ConnectionID, connectionData.ChainID, "store/leverage/key", - umeetypes.KeyUTokenSupply(supply.Denom), + leveragetypes.KeyUTokenSupply(supply.Denom), sdk.NewInt(-1), types.ModuleName, UmeeUTokenSupplyUpdateCallbackID, @@ -120,16 +120,14 @@ func (u UmeeModule) Hooks(ctx sdk.Context, k *Keeper) { return false }) - // TODO: check module spendable coins retrieval - // assuming that module account is not a vesting account so there - // will be no locked coins to subtract from the total balance + // umee-types leverage module balance update k.IteratePrefixedProtocolDatas(ctx, types.GetPrefixProtocolDataKey(types.ProtocolDataTypeUmeeLeverageModuleBalance), func(idx int64, _ []byte, data types.ProtocolData) bool { ibalance, err := types.UnmarshalProtocolData(types.ProtocolDataTypeUmeeLeverageModuleBalance, data.Data) if err != nil { return false } balance, _ := ibalance.(*types.UmeeLeverageModuleBalanceProtocolData) - accountPrefix := banktypes.CreateAccountBalancesPrefix(authtypes.NewModuleAddress(umeetypes.LeverageModuleName)) + accountPrefix := banktypes.CreateAccountBalancesPrefix(authtypes.NewModuleAddress(leveragetypes.LeverageModuleName)) // update leverage module balance k.IcqKeeper.MakeRequest( @@ -160,7 +158,7 @@ func (u UmeeModule) Hooks(ctx sdk.Context, k *Keeper) { connectionData.ConnectionID, connectionData.ChainID, "store/leverage/key", - umeetypes.KeyAdjustedTotalBorrow(borrows.Denom), + leveragetypes.KeyAdjustedTotalBorrow(borrows.Denom), sdk.NewInt(-1), types.ModuleName, UmeeTotalBorrowsUpdateCallbackID, @@ -202,7 +200,7 @@ func (u UmeeModule) ValidateClaim(ctx sdk.Context, k *Keeper, msg *types.MsgSubm return 0, err } - denom := umeetypes.ToTokenDenom(udenom) + denom := leveragetypes.ToTokenDenom(udenom) data, found := k.GetProtocolData(ctx, types.ProtocolDataTypeLiquidToken, fmt.Sprintf("%s_%s", msg.SrcZone, denom)) if !found { diff --git a/x/participationrewards/types/codec.go b/x/participationrewards/types/codec.go index 34a8936b0..2d93b5bde 100644 --- a/x/participationrewards/types/codec.go +++ b/x/participationrewards/types/codec.go @@ -7,10 +7,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm/pool-models/balancer" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm/pool-models/stableswap" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm/pool-models/balancer" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm/pool-models/stableswap" ) var ( diff --git a/x/participationrewards/types/errors.go b/x/participationrewards/types/errors.go index ad03eeaeb..97303a91e 100644 --- a/x/participationrewards/types/errors.go +++ b/x/participationrewards/types/errors.go @@ -16,4 +16,5 @@ var ( ErrInvalidChainID = sdkioerrors.Register(ModuleName, 11, "invalid chain id") ErrInvalidDenom = sdkioerrors.Register(ModuleName, 12, "invalid denom") ErrCannotUnmarshal = sdkioerrors.Register(ModuleName, 13, "unable to unmarshal") + ErrInvalidBech32 = sdkioerrors.Register(ModuleName, 14, "invalid bech32") ) diff --git a/x/participationrewards/types/keys.go b/x/participationrewards/types/keys.go index bda373d6e..2c66243fe 100644 --- a/x/participationrewards/types/keys.go +++ b/x/participationrewards/types/keys.go @@ -16,8 +16,10 @@ const ( OsmosisParamsKey = "osmosisparams" UmeeParamsKey = "umeeparams" + CrescentParamsKey = "crescentparams" ProofTypeBank = "bank" ProofTypeLeverage = "leverage" + ProofTypePosition = "position" ) var KeyPrefixProtocolData = []byte{0x00} diff --git a/x/participationrewards/types/participationrewards.go b/x/participationrewards/types/participationrewards.go index 838c886f1..8ba3c1bec 100644 --- a/x/participationrewards/types/participationrewards.go +++ b/x/participationrewards/types/participationrewards.go @@ -5,6 +5,7 @@ import ( "fmt" "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ingenuity-build/multierror" @@ -111,63 +112,9 @@ func (pd *ProtocolData) ValidateBasic() error { // validateProtocolData unmarshals to appropriate concrete type and validate. func validateProtocolData(data json.RawMessage, pdt ProtocolDataType) error { - var pdi ProtocolDataI - switch pdt { - case ProtocolDataTypeLiquidToken: - pd := LiquidAllowedDenomProtocolData{} - err := json.Unmarshal(data, &pd) - if err != nil { - return err - } - pdi = &pd - case ProtocolDataTypeOsmosisPool: - pd := OsmosisPoolProtocolData{} - err := json.Unmarshal(data, &pd) - if err != nil { - return err - } - pdi = &pd - case ProtocolDataTypeUmeeReserves: - pd := UmeeReservesProtocolData{} - err := json.Unmarshal(data, &pd) - if err != nil { - return err - } - pdi = &pd - case ProtocolDataTypeUmeeInterestScalar: - pd := UmeeInterestScalarProtocolData{} - err := json.Unmarshal(data, &pd) - if err != nil { - return err - } - pdi = &pd - case ProtocolDataTypeUmeeTotalBorrows: - pd := UmeeTotalBorrowsProtocolData{} - err := json.Unmarshal(data, &pd) - if err != nil { - return err - } - pdi = &pd - case ProtocolDataTypeUmeeUTokenSupply: - pd := UmeeUTokenSupplyProtocolData{} - err := json.Unmarshal(data, &pd) - if err != nil { - return err - } - pdi = &pd - case ProtocolDataTypeUmeeLeverageModuleBalance: - pd := UmeeLeverageModuleBalanceProtocolData{} - err := json.Unmarshal(data, &pd) - if err != nil { - return err - } - pdi = &pd - case ProtocolDataTypeCrescentPool: - return ErrUnimplementedProtocolDataType - case ProtocolDataTypeSifchainPool: - return ErrUnimplementedProtocolDataType - default: - return ErrUnknownProtocolDataType + pdi, err := UnmarshalProtocolData(pdt, data) + if err != nil { + return err } return pdi.ValidateBasic() diff --git a/x/participationrewards/types/participationrewards.pb.go b/x/participationrewards/types/participationrewards.pb.go index c6f2c03fe..202a05fe0 100644 --- a/x/participationrewards/types/participationrewards.pb.go +++ b/x/participationrewards/types/participationrewards.pb.go @@ -30,19 +30,22 @@ type ProtocolDataType int32 const ( // Undefined action (per protobuf spec) - ProtocolDataTypeUndefined ProtocolDataType = 0 - ProtocolDataTypeConnection ProtocolDataType = 1 - ProtocolDataTypeOsmosisParams ProtocolDataType = 2 - ProtocolDataTypeLiquidToken ProtocolDataType = 3 - ProtocolDataTypeOsmosisPool ProtocolDataType = 4 - ProtocolDataTypeCrescentPool ProtocolDataType = 5 - ProtocolDataTypeSifchainPool ProtocolDataType = 6 - ProtocolDataTypeUmeeParams ProtocolDataType = 7 - ProtocolDataTypeUmeeReserves ProtocolDataType = 8 - ProtocolDataTypeUmeeInterestScalar ProtocolDataType = 9 - ProtocolDataTypeUmeeTotalBorrows ProtocolDataType = 10 - ProtocolDataTypeUmeeUTokenSupply ProtocolDataType = 11 - ProtocolDataTypeUmeeLeverageModuleBalance ProtocolDataType = 12 + ProtocolDataTypeUndefined ProtocolDataType = 0 + ProtocolDataTypeConnection ProtocolDataType = 1 + ProtocolDataTypeOsmosisParams ProtocolDataType = 2 + ProtocolDataTypeLiquidToken ProtocolDataType = 3 + ProtocolDataTypeOsmosisPool ProtocolDataType = 4 + ProtocolDataTypeCrescentPool ProtocolDataType = 5 + ProtocolDataTypeSifchainPool ProtocolDataType = 6 + ProtocolDataTypeUmeeParams ProtocolDataType = 7 + ProtocolDataTypeUmeeReserves ProtocolDataType = 8 + ProtocolDataTypeUmeeInterestScalar ProtocolDataType = 9 + ProtocolDataTypeUmeeTotalBorrows ProtocolDataType = 10 + ProtocolDataTypeUmeeUTokenSupply ProtocolDataType = 11 + ProtocolDataTypeUmeeLeverageModuleBalance ProtocolDataType = 12 + ProtocolDataTypeCrescentParams ProtocolDataType = 13 + ProtocolDataTypeCrescentReserveAddressBalance ProtocolDataType = 14 + ProtocolDataTypeCrescentPoolCoinSupply ProtocolDataType = 15 ) var ProtocolDataType_name = map[int32]string{ @@ -59,22 +62,28 @@ var ProtocolDataType_name = map[int32]string{ 10: "ProtocolDataTypeUmeeTotalBorrows", 11: "ProtocolDataTypeUmeeUTokenSupply", 12: "ProtocolDataTypeUmeeLeverageModuleBalance", + 13: "ProtocolDataTypeCrescentParams", + 14: "ProtocolDataTypeCrescentReserveAddressBalance", + 15: "ProtocolDataTypeCrescentPoolCoinSupply", } var ProtocolDataType_value = map[string]int32{ - "ProtocolDataTypeUndefined": 0, - "ProtocolDataTypeConnection": 1, - "ProtocolDataTypeOsmosisParams": 2, - "ProtocolDataTypeLiquidToken": 3, - "ProtocolDataTypeOsmosisPool": 4, - "ProtocolDataTypeCrescentPool": 5, - "ProtocolDataTypeSifchainPool": 6, - "ProtocolDataTypeUmeeParams": 7, - "ProtocolDataTypeUmeeReserves": 8, - "ProtocolDataTypeUmeeInterestScalar": 9, - "ProtocolDataTypeUmeeTotalBorrows": 10, - "ProtocolDataTypeUmeeUTokenSupply": 11, - "ProtocolDataTypeUmeeLeverageModuleBalance": 12, + "ProtocolDataTypeUndefined": 0, + "ProtocolDataTypeConnection": 1, + "ProtocolDataTypeOsmosisParams": 2, + "ProtocolDataTypeLiquidToken": 3, + "ProtocolDataTypeOsmosisPool": 4, + "ProtocolDataTypeCrescentPool": 5, + "ProtocolDataTypeSifchainPool": 6, + "ProtocolDataTypeUmeeParams": 7, + "ProtocolDataTypeUmeeReserves": 8, + "ProtocolDataTypeUmeeInterestScalar": 9, + "ProtocolDataTypeUmeeTotalBorrows": 10, + "ProtocolDataTypeUmeeUTokenSupply": 11, + "ProtocolDataTypeUmeeLeverageModuleBalance": 12, + "ProtocolDataTypeCrescentParams": 13, + "ProtocolDataTypeCrescentReserveAddressBalance": 14, + "ProtocolDataTypeCrescentPoolCoinSupply": 15, } func (x ProtocolDataType) String() string { @@ -285,52 +294,54 @@ func init() { } var fileDescriptor_d4fb4e5bb851c124 = []byte{ - // 705 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x41, 0x4f, 0x13, 0x41, - 0x14, 0xee, 0xd2, 0x8a, 0x30, 0x14, 0xb3, 0x8c, 0x26, 0x40, 0x85, 0x2d, 0x56, 0x25, 0x6a, 0xd2, - 0x56, 0xf0, 0x46, 0x88, 0x89, 0xa5, 0x1e, 0x8c, 0x10, 0xc9, 0xb6, 0x78, 0x30, 0x31, 0xcd, 0x74, - 0xf6, 0x51, 0xc6, 0x4e, 0x67, 0x96, 0x99, 0xdd, 0x62, 0x0f, 0x5c, 0x3c, 0x71, 0xf4, 0xe8, 0xd1, - 0xc4, 0xbf, 0xe0, 0xc1, 0x9f, 0xc0, 0x91, 0x78, 0x32, 0x1e, 0x88, 0x81, 0xf8, 0x27, 0x3c, 0x18, - 0xb3, 0xbb, 0x2d, 0xae, 0x75, 0x49, 0x38, 0x70, 0xea, 0xdb, 0xf7, 0xbe, 0xf9, 0xbe, 0x37, 0xef, - 0x7b, 0x1d, 0xf4, 0x78, 0xd7, 0x67, 0xb4, 0xad, 0x19, 0xef, 0x82, 0x2a, 0xbb, 0x44, 0x79, 0x8c, - 0x32, 0x97, 0x78, 0x4c, 0x0a, 0x05, 0x7b, 0x44, 0x39, 0xba, 0xdc, 0x5d, 0x4a, 0xcc, 0x97, 0x5c, - 0x25, 0x3d, 0x89, 0x6f, 0xc7, 0xce, 0x97, 0x12, 0x71, 0xdd, 0xa5, 0xdc, 0x2c, 0x95, 0xba, 0x23, - 0x75, 0x23, 0x3c, 0x52, 0x8e, 0x3e, 0xa2, 0xf3, 0xb9, 0x1b, 0x2d, 0xd9, 0x92, 0x51, 0x3e, 0x88, - 0xa2, 0x6c, 0xe1, 0xf7, 0x08, 0x9a, 0xae, 0x32, 0xed, 0x29, 0xd6, 0xf4, 0x03, 0xae, 0x4d, 0x25, - 0x5d, 0xa9, 0x82, 0x48, 0xe3, 0x77, 0x06, 0xb2, 0xba, 0x84, 0x33, 0x87, 0x78, 0x52, 0x35, 0x34, - 0x70, 0xa0, 0x41, 0xa1, 0x41, 0x38, 0x97, 0x34, 0x54, 0x9e, 0x31, 0x16, 0x8c, 0x7b, 0xe3, 0x95, - 0xd5, 0xc3, 0xe3, 0x7c, 0xea, 0xfb, 0x71, 0x7e, 0xb1, 0xc5, 0xbc, 0x1d, 0xbf, 0x59, 0xa2, 0xb2, - 0xd3, 0xd7, 0xee, 0xff, 0x14, 0xb5, 0xd3, 0x2e, 0x7b, 0x3d, 0x17, 0x74, 0xa9, 0x0a, 0xf4, 0xeb, - 0xe7, 0x22, 0xea, 0xb7, 0x56, 0x05, 0x6a, 0xcf, 0x9d, 0x69, 0xd4, 0x06, 0x12, 0x4f, 0xce, 0x14, - 0x70, 0x07, 0x5d, 0xdf, 0x91, 0xdc, 0x61, 0xa2, 0xa5, 0xe3, 0xc2, 0x23, 0x97, 0x20, 0x8c, 0x07, - 0xc4, 0x31, 0x39, 0x86, 0xa6, 0xb8, 0xa4, 0x6d, 0xdf, 0x8d, 0x8b, 0xa5, 0x2f, 0x41, 0xcc, 0x8c, - 0x68, 0xff, 0x4a, 0xad, 0x64, 0x0e, 0x3e, 0xe6, 0x53, 0x85, 0x2f, 0x06, 0x1a, 0xdd, 0x24, 0x8a, - 0x74, 0x34, 0xde, 0x47, 0x33, 0x4e, 0xcc, 0x8a, 0xc0, 0xc4, 0x81, 0x17, 0xe1, 0xa0, 0x27, 0x96, - 0x57, 0x4b, 0x17, 0x58, 0x82, 0xd2, 0x39, 0x7e, 0x56, 0x32, 0xc1, 0x05, 0xec, 0x69, 0xe7, 0x1c, - 0xbb, 0xef, 0xa2, 0x6b, 0x94, 0x13, 0xd6, 0xd1, 0x0d, 0x10, 0xa4, 0xc9, 0xc1, 0x09, 0x87, 0x3c, - 0x66, 0x4f, 0x46, 0xd9, 0xa7, 0x51, 0x72, 0x65, 0x2c, 0x68, 0xfb, 0x43, 0xd0, 0xfa, 0x3e, 0x9a, - 0x7a, 0x0e, 0x3d, 0x70, 0x36, 0x83, 0x4d, 0xa2, 0x92, 0x57, 0x89, 0x47, 0xb0, 0x89, 0xd2, 0x6d, - 0xe8, 0x45, 0x8b, 0x61, 0x07, 0x21, 0x7e, 0x89, 0x26, 0xdd, 0x3e, 0xa2, 0xe1, 0x10, 0x8f, 0x84, - 0xb4, 0x13, 0xcb, 0x4b, 0x17, 0xba, 0x4b, 0x9c, 0xdb, 0xce, 0xba, 0xb1, 0xaf, 0x42, 0x1d, 0x65, - 0xff, 0x51, 0xc6, 0x28, 0x13, 0x0c, 0xbf, 0x2f, 0x1d, 0xc6, 0xf8, 0x21, 0xca, 0x9c, 0x49, 0x66, - 0x2b, 0x73, 0xbf, 0x8e, 0xf3, 0x33, 0x20, 0xa8, 0x0c, 0x5c, 0x2f, 0xbf, 0xd1, 0x52, 0x94, 0x6c, - 0xb2, 0xb7, 0x01, 0x5a, 0x93, 0x16, 0xd8, 0x21, 0xf2, 0xc1, 0xcf, 0x34, 0x32, 0xe3, 0xb4, 0xf5, - 0x80, 0x66, 0x1e, 0xcd, 0x0e, 0xe7, 0xb6, 0x84, 0x03, 0xdb, 0x4c, 0x80, 0x63, 0xa6, 0xb0, 0x85, - 0x72, 0xc3, 0xe5, 0x35, 0x29, 0x44, 0xb4, 0xcb, 0xa6, 0x81, 0x6f, 0xa1, 0xf9, 0xe1, 0xfa, 0x8b, - 0x60, 0x31, 0x98, 0x8e, 0x9c, 0x37, 0x47, 0x70, 0x1e, 0xdd, 0x1c, 0x86, 0xac, 0xb3, 0x5d, 0x9f, - 0x39, 0x75, 0xd9, 0x06, 0x61, 0xa6, 0x93, 0x00, 0x03, 0x0e, 0x29, 0xb9, 0x99, 0xc1, 0x0b, 0x68, - 0xee, 0xbf, 0x26, 0x14, 0x68, 0x0a, 0xc2, 0x0b, 0x11, 0x57, 0x92, 0x10, 0x35, 0xb6, 0x4d, 0x77, - 0x08, 0x13, 0x21, 0x62, 0x34, 0xe9, 0x22, 0x5b, 0x1d, 0x80, 0x7e, 0x97, 0x57, 0x93, 0x18, 0x82, - 0xba, 0x0d, 0x1a, 0x54, 0x17, 0xb4, 0x39, 0x86, 0x17, 0x51, 0x21, 0x09, 0xf1, 0x4c, 0x78, 0xa0, - 0x40, 0x7b, 0x35, 0x4a, 0x38, 0x51, 0xe6, 0x38, 0xbe, 0x83, 0x16, 0x92, 0x70, 0x75, 0xe9, 0x11, - 0x5e, 0x91, 0x4a, 0xc9, 0x3d, 0x6d, 0xa2, 0xf3, 0x50, 0x5b, 0xe1, 0x50, 0x6a, 0xbe, 0xeb, 0xf2, - 0x9e, 0x39, 0x81, 0x8b, 0xe8, 0x7e, 0x12, 0x6a, 0x1d, 0xba, 0xa0, 0x48, 0x0b, 0x36, 0xa4, 0xe3, - 0x73, 0xa8, 0x10, 0x4e, 0x04, 0x05, 0x33, 0x9b, 0xcb, 0x1c, 0x7c, 0xb2, 0x52, 0x95, 0xd7, 0x87, - 0x27, 0x96, 0x71, 0x74, 0x62, 0x19, 0x3f, 0x4e, 0x2c, 0xe3, 0xfd, 0xa9, 0x95, 0x3a, 0x3a, 0xb5, - 0x52, 0xdf, 0x4e, 0xad, 0xd4, 0xab, 0xb5, 0xd8, 0xff, 0x9b, 0x89, 0x16, 0x08, 0x9f, 0x79, 0xbd, - 0x62, 0xd3, 0x67, 0xdc, 0x29, 0xc7, 0xdf, 0xf0, 0xb7, 0xc9, 0xaf, 0x78, 0xf8, 0x00, 0x34, 0x47, - 0xc3, 0x55, 0x7d, 0xf4, 0x27, 0x00, 0x00, 0xff, 0xff, 0x2e, 0x3f, 0xee, 0xd9, 0xf6, 0x05, 0x00, - 0x00, + // 747 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x3f, 0x4f, 0x23, 0x47, + 0x14, 0xf7, 0x82, 0x43, 0x60, 0x30, 0x64, 0x99, 0x44, 0x02, 0x1c, 0x58, 0x13, 0x27, 0x41, 0x09, + 0x92, 0xed, 0x98, 0x74, 0x08, 0x45, 0xc2, 0x38, 0x45, 0x14, 0x50, 0xd0, 0xda, 0xa4, 0x88, 0x14, + 0x59, 0xe3, 0x99, 0x87, 0x99, 0x78, 0x3c, 0xb3, 0xcc, 0xec, 0x9a, 0xb8, 0xa0, 0x49, 0x45, 0x99, + 0x32, 0x65, 0xa4, 0x7c, 0x85, 0x14, 0xf7, 0x11, 0x28, 0xd1, 0x55, 0xa7, 0x2b, 0xd0, 0x09, 0x9a, + 0xfb, 0x0c, 0x57, 0x9c, 0x4e, 0xbb, 0x6b, 0x73, 0x7b, 0xbe, 0xf5, 0x89, 0x82, 0xca, 0x6f, 0xdf, + 0xfb, 0xcd, 0xef, 0xf7, 0xfe, 0x79, 0x06, 0xfd, 0x70, 0x16, 0x70, 0xda, 0x35, 0x5c, 0xf4, 0x41, + 0x57, 0x3c, 0xa2, 0x7d, 0x4e, 0xb9, 0x47, 0x7c, 0xae, 0xa4, 0x86, 0x73, 0xa2, 0x99, 0xa9, 0xf4, + 0xab, 0xa9, 0xfe, 0xb2, 0xa7, 0x95, 0xaf, 0xf0, 0x97, 0x89, 0xf3, 0xe5, 0x54, 0x5c, 0xbf, 0x9a, + 0x5f, 0xa5, 0xca, 0xf4, 0x94, 0x69, 0x45, 0x47, 0x2a, 0xf1, 0x47, 0x7c, 0x3e, 0xff, 0x59, 0x47, + 0x75, 0x54, 0xec, 0x0f, 0xad, 0xd8, 0x5b, 0x7c, 0x3d, 0x85, 0x96, 0xeb, 0xdc, 0xf8, 0x9a, 0xb7, + 0x83, 0x90, 0xeb, 0x48, 0x2b, 0x4f, 0xe9, 0xd0, 0x32, 0xf8, 0x2f, 0x0b, 0x39, 0x7d, 0x22, 0x38, + 0x23, 0xbe, 0xd2, 0x2d, 0x03, 0x02, 0x68, 0x18, 0x68, 0x11, 0x21, 0x14, 0x8d, 0x94, 0x57, 0xac, + 0x0d, 0xeb, 0x9b, 0xb9, 0xda, 0xee, 0xd5, 0x4d, 0x21, 0xf3, 0xfc, 0xa6, 0xb0, 0xd9, 0xe1, 0xfe, + 0x69, 0xd0, 0x2e, 0x53, 0xd5, 0x1b, 0x6a, 0x0f, 0x7f, 0x4a, 0x86, 0x75, 0x2b, 0xfe, 0xc0, 0x03, + 0x53, 0xae, 0x03, 0x7d, 0xfa, 0x7f, 0x09, 0x0d, 0x53, 0xab, 0x03, 0x75, 0xd7, 0xee, 0x35, 0x1a, + 0x23, 0x89, 0xbd, 0x7b, 0x05, 0xdc, 0x43, 0x9f, 0x9e, 0x2a, 0xc1, 0xb8, 0xec, 0x98, 0xa4, 0xf0, + 0xd4, 0x23, 0x08, 0xe3, 0x11, 0x71, 0x42, 0x8e, 0xa3, 0x25, 0xa1, 0x68, 0x37, 0xf0, 0x92, 0x62, + 0xd3, 0x8f, 0x20, 0x66, 0xc7, 0xb4, 0x6f, 0xa5, 0x76, 0xb2, 0x97, 0xff, 0x16, 0x32, 0xc5, 0x27, + 0x16, 0x9a, 0x39, 0x22, 0x9a, 0xf4, 0x0c, 0xbe, 0x40, 0x2b, 0x2c, 0x31, 0x8a, 0x70, 0x88, 0xa3, + 0x59, 0x44, 0x8d, 0x9e, 0xdf, 0xde, 0x2d, 0x3f, 0x60, 0x09, 0xca, 0x13, 0xe6, 0x59, 0xcb, 0x86, + 0x05, 0xb8, 0xcb, 0x6c, 0xc2, 0xb8, 0xbf, 0x46, 0x8b, 0x54, 0x10, 0xde, 0x33, 0x2d, 0x90, 0xa4, + 0x2d, 0x80, 0x45, 0x4d, 0x9e, 0x75, 0x17, 0x62, 0xef, 0x8f, 0xb1, 0x73, 0x67, 0x36, 0x4c, 0xfb, + 0x9f, 0x30, 0xf5, 0x0b, 0xb4, 0xf4, 0x33, 0x0c, 0x80, 0x1d, 0x85, 0x9b, 0x44, 0x95, 0xa8, 0x13, + 0x9f, 0x60, 0x1b, 0x4d, 0x77, 0x61, 0x10, 0x2f, 0x86, 0x1b, 0x9a, 0xf8, 0x57, 0xb4, 0xe0, 0x0d, + 0x11, 0x2d, 0x46, 0x7c, 0x12, 0xd1, 0xce, 0x6f, 0x57, 0x1f, 0x54, 0x4b, 0x92, 0xdb, 0xcd, 0x79, + 0x89, 0xaf, 0x62, 0x13, 0xe5, 0xde, 0x51, 0xc6, 0x28, 0x1b, 0x36, 0x7f, 0x28, 0x1d, 0xd9, 0xf8, + 0x3b, 0x94, 0xbd, 0x97, 0xcc, 0xd5, 0xd6, 0x5e, 0xdd, 0x14, 0x56, 0x40, 0x52, 0x15, 0x4e, 0xbd, + 0xf2, 0x87, 0x51, 0xb2, 0xec, 0x92, 0xf3, 0x43, 0x30, 0x86, 0x74, 0xc0, 0x8d, 0x90, 0x5b, 0x2f, + 0xb3, 0xc8, 0x4e, 0xd2, 0x36, 0x43, 0x9a, 0x75, 0xb4, 0x3a, 0xee, 0x3b, 0x96, 0x0c, 0x4e, 0xb8, + 0x04, 0x66, 0x67, 0xb0, 0x83, 0xf2, 0xe3, 0xe1, 0x7d, 0x25, 0x65, 0xbc, 0xcb, 0xb6, 0x85, 0xbf, + 0x40, 0xeb, 0xe3, 0xf1, 0x5f, 0xc2, 0xc5, 0xe0, 0x26, 0x9e, 0xbc, 0x3d, 0x85, 0x0b, 0xe8, 0xf3, + 0x71, 0xc8, 0x01, 0x3f, 0x0b, 0x38, 0x6b, 0xaa, 0x2e, 0x48, 0x7b, 0x3a, 0x0d, 0x30, 0xe2, 0x50, + 0x4a, 0xd8, 0x59, 0xbc, 0x81, 0xd6, 0xde, 0x4b, 0x42, 0x83, 0xa1, 0x20, 0xfd, 0x08, 0xf1, 0x51, + 0x1a, 0xa2, 0xc1, 0x4f, 0xe8, 0x29, 0xe1, 0x32, 0x42, 0xcc, 0xa4, 0x15, 0x72, 0xdc, 0x03, 0x18, + 0x66, 0xf9, 0x71, 0x1a, 0x43, 0x18, 0x77, 0xc1, 0x80, 0xee, 0x83, 0xb1, 0x67, 0xf1, 0x26, 0x2a, + 0xa6, 0x21, 0x7e, 0x92, 0x3e, 0x68, 0x30, 0x7e, 0x83, 0x12, 0x41, 0xb4, 0x3d, 0x87, 0xbf, 0x42, + 0x1b, 0x69, 0xb8, 0xa6, 0xf2, 0x89, 0xa8, 0x29, 0xad, 0xd5, 0xb9, 0xb1, 0xd1, 0x24, 0xd4, 0x71, + 0xd4, 0x94, 0x46, 0xe0, 0x79, 0x62, 0x60, 0xcf, 0xe3, 0x12, 0xfa, 0x36, 0x0d, 0x75, 0x00, 0x7d, + 0xd0, 0xa4, 0x03, 0x87, 0x8a, 0x05, 0x02, 0x6a, 0x44, 0x10, 0x49, 0xc1, 0xce, 0xe1, 0x22, 0x72, + 0x26, 0x36, 0x2a, 0x2e, 0x74, 0x01, 0x57, 0x51, 0x69, 0x12, 0x66, 0x58, 0xec, 0x1e, 0x63, 0x1a, + 0x8c, 0x19, 0xd1, 0x2e, 0xe2, 0x2d, 0xb4, 0xf9, 0xa1, 0xfe, 0xef, 0x2b, 0x3e, 0xca, 0xf8, 0x93, + 0x7c, 0xf6, 0xf2, 0x3f, 0x27, 0x53, 0xfb, 0xfd, 0xea, 0xd6, 0xb1, 0xae, 0x6f, 0x1d, 0xeb, 0xc5, + 0xad, 0x63, 0xfd, 0x7d, 0xe7, 0x64, 0xae, 0xef, 0x9c, 0xcc, 0xb3, 0x3b, 0x27, 0xf3, 0xdb, 0x7e, + 0xe2, 0x8a, 0xe1, 0xb2, 0x03, 0x32, 0xe0, 0xfe, 0xa0, 0xd4, 0x0e, 0xb8, 0x60, 0x95, 0xe4, 0x33, + 0xf2, 0x67, 0xfa, 0x43, 0x12, 0xdd, 0x41, 0xed, 0x99, 0xe8, 0xdf, 0xf2, 0xfd, 0x9b, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x27, 0x2d, 0x9b, 0x14, 0x79, 0x06, 0x00, 0x00, } func (m *DistributionProportions) Marshal() (dAtA []byte, err error) { diff --git a/x/participationrewards/types/participationrewards_test.go b/x/participationrewards/types/participationrewards_test.go index d93dbdc89..6d95c220f 100644 --- a/x/participationrewards/types/participationrewards_test.go +++ b/x/participationrewards/types/participationrewards_test.go @@ -1,8 +1,13 @@ package types_test import ( + "encoding/json" "testing" + liquiditytypes "github.com/ingenuity-build/quicksilver/third-party-chains/crescent-types/liquidity/types" + + "github.com/ingenuity-build/quicksilver/utils/addressutils" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -72,6 +77,9 @@ func TestDistributionProportions_ValidateBasic(t *testing.T) { } func TestKeyedProtocolData_ValidateBasic(t *testing.T) { + testUmeeData := types.UmeeProtocolData{Denom: "test", Data: []byte{0x6e, 0x75, 0x6c, 0x6c}} + testAddress := addressutils.GenerateAddressForTestWithPrefix("cosmos") + invalidOsmosisData := `{ "poolname": "osmosispools/1", "denoms": { } @@ -189,6 +197,235 @@ func TestKeyedProtocolData_ValidateBasic(t *testing.T) { }, true, }, + { + "umee_params_invalid", + fields{ + "test", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeUmeeParams)], + Data: []byte("{}"), + }, + }, + true, + }, + { + "umee_params_valid", + fields{ + "test", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeUmeeParams)], + Data: []byte(`{"ChainID": "test-01"}`), + }, + }, + false, + }, + { + "umee_reserves_invalid", + fields{ + "test", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeUmeeReserves)], + Data: []byte(`{}`), + }, + }, + true, + }, + { + "umee_reserves_valid", + fields{ + "test", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeUmeeReserves)], + Data: marshalledUmeeData[types.UmeeReservesProtocolData](testUmeeData), + }, + }, + false, + }, + { + "umee_interest_scalar_invalid", + fields{ + "test", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeUmeeInterestScalar)], + Data: []byte(`{}`), + }, + }, + true, + }, + { + "umee_interest_scalar_valid", + fields{ + "test", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeUmeeInterestScalar)], + Data: marshalledUmeeData[types.UmeeInterestScalarProtocolData](testUmeeData), + }, + }, + false, + }, + { + "umee_utoken_supply_invalid", + fields{ + "test", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeUmeeUTokenSupply)], + Data: []byte(`{}`), + }, + }, + true, + }, + { + "umee_utoken_supply_valid", + fields{ + "test", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeUmeeUTokenSupply)], + Data: marshalledUmeeData[types.UmeeUTokenSupplyProtocolData](testUmeeData), + }, + }, + false, + }, + { + "umee_leverage_module_balance_invalid", + fields{ + "test", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeUmeeLeverageModuleBalance)], + Data: []byte(`{}`), + }, + }, + true, + }, + { + "umee_leverage_module_balance_valid", + fields{ + "test", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeUmeeLeverageModuleBalance)], + Data: marshalledUmeeData[types.UmeeLeverageModuleBalanceProtocolData](testUmeeData), + }, + }, + false, + }, + { + "umee_total_borrows_invalid", + fields{ + "test", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeUmeeTotalBorrows)], + Data: []byte(`{}`), + }, + }, + true, + }, + { + "umee_total_borrows_valid", + fields{ + "test", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeUmeeTotalBorrows)], + Data: marshalledUmeeData[types.UmeeTotalBorrowsProtocolData](testUmeeData), + }, + }, + false, + }, + { + "crescent_pool_invalid", + fields{ + "pool1", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeCrescentPool)], + Data: []byte(`{}`), + }, + }, + true, + }, + { + "crescent_pool_valid", + fields{ + "pool1", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeCrescentPool)], + Data: func() []byte { + pool := &liquiditytypes.Pool{ + PoolCoinDenom: "pool1", + Id: 1, + } + pooldata, _ := json.Marshal(pool) + pd := types.CrescentPoolProtocolData{ + PoolID: 1, + Denoms: map[string]types.DenomWithZone{ + "ibc/3020922B7576FC75BBE057A0290A9AEEFF489BB1113E6E365CE472D4BFB7FFA3": {ChainID: "cosmoshub-4", Denom: "uatom"}, + "ibc/15E9C5CF5969080539DB395FA7D9C0868265217EFC528433671AAF9B1912D159": {ChainID: "osmosis-1", Denom: "uosmo"}, + }, + PoolData: pooldata, + } + data, _ := json.Marshal(&pd) + return data + }(), + }, + }, + false, + }, + { + "crescent_pool_coin_supply_invalid", + fields{ + "pool1", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeCrescentPoolCoinSupply)], + Data: []byte(`{}`), + }, + }, + true, + }, + { + "crescent_pool_coin_supply_valid", + fields{ + "pool1", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeCrescentPoolCoinSupply)], + Data: func() []byte { + pd := &types.CrescentPoolCoinSupplyProtocolData{ + PoolCoinDenom: "pool1", + Supply: []byte{0x6e, 0x75, 0x6c, 0x6c}, + } + data, _ := json.Marshal(pd) + return data + }(), + }, + }, + false, + }, + { + "crescent_reserve_address_balance_invalid", + fields{ + "test", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeCrescentReserveAddressBalance)], + Data: []byte(`{}`), + }, + }, + true, + }, + { + "crescent_reserve_address_balance_valid", + fields{ + "uosmo", + &types.ProtocolData{ + Type: types.ProtocolDataType_name[int32(types.ProtocolDataTypeCrescentReserveAddressBalance)], + Data: func() []byte { + pd := &types.CrescentReserveAddressBalanceProtocolData{ + ReserveAddress: testAddress, + Denom: "uosmo", + Balance: []byte{0x6e, 0x75, 0x6c, 0x6c}, + } + data, _ := json.Marshal(pd) + return data + }(), + }, + }, + false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/x/participationrewards/types/protocol_data.go b/x/participationrewards/types/protocol_data.go index d78fbb7c7..24dd6613a 100644 --- a/x/participationrewards/types/protocol_data.go +++ b/x/participationrewards/types/protocol_data.go @@ -2,7 +2,6 @@ package types import ( "encoding/json" - "errors" "fmt" "reflect" @@ -13,124 +12,49 @@ func NewProtocolData(datatype string, data json.RawMessage) *ProtocolData { return &ProtocolData{Type: datatype, Data: data} } +func unmarshalProtocolData[V ProtocolDataI](data json.RawMessage) (ProtocolDataI, error) { + var cpd, blank V + _ = json.Unmarshal([]byte(`{}`), &blank) + err := json.Unmarshal(data, &cpd) + if err != nil { + return nil, fmt.Errorf("unable to unmarshal intermediary %s: %w", reflect.TypeOf(cpd).Name(), err) + } + if reflect.DeepEqual(cpd, blank) { + return nil, fmt.Errorf("unable to unmarshal %s from empty JSON object", reflect.TypeOf(cpd).Name()) + } + return cpd, nil +} + func UnmarshalProtocolData(datatype ProtocolDataType, data json.RawMessage) (ProtocolDataI, error) { switch datatype { case ProtocolDataTypeConnection: - cpd := ConnectionProtocolData{} - err := json.Unmarshal(data, &cpd) - if err != nil { - return nil, err - } - var blank ConnectionProtocolData - if reflect.DeepEqual(cpd, blank) { - return nil, errors.New("unable to unmarshal connection protocol data from empty JSON object") - } - return &cpd, nil + return unmarshalProtocolData[*ConnectionProtocolData](data) case ProtocolDataTypeOsmosisParams: - oppd := OsmosisParamsProtocolData{} - err := json.Unmarshal(data, &oppd) - if err != nil { - return nil, err - } - var blank OsmosisParamsProtocolData - if reflect.DeepEqual(oppd, blank) { - return nil, fmt.Errorf("unable to unmarshal osmosisparams protocol data from empty JSON object") - } - return &oppd, nil + return unmarshalProtocolData[*OsmosisParamsProtocolData](data) case ProtocolDataTypeLiquidToken: - ladpd := LiquidAllowedDenomProtocolData{} - err := json.Unmarshal(data, &ladpd) - if err != nil { - return nil, err - } - var blank LiquidAllowedDenomProtocolData - if reflect.DeepEqual(ladpd, blank) { - return nil, errors.New("unable to unmarshal liquid protocol data from empty JSON object") - } - return &ladpd, nil + return unmarshalProtocolData[*LiquidAllowedDenomProtocolData](data) case ProtocolDataTypeOsmosisPool: - oppd := OsmosisPoolProtocolData{} - err := json.Unmarshal(data, &oppd) - if err != nil { - return nil, fmt.Errorf("unable to unmarshal intermediary osmosisPoolProtocolData: %w", err) - } - var blank OsmosisPoolProtocolData - if reflect.DeepEqual(oppd, blank) { - return nil, fmt.Errorf("unable to unmarshal osmosispool protocol data from empty JSON object") - } - - return &oppd, nil + return unmarshalProtocolData[*OsmosisPoolProtocolData](data) case ProtocolDataTypeUmeeParams: - uppd := UmeeParamsProtocolData{} - err := json.Unmarshal(data, &uppd) - if err != nil { - return nil, err - } - var blank UmeeParamsProtocolData - if reflect.DeepEqual(uppd, blank) { - return nil, fmt.Errorf("unable to unmarshal umeeparams protocol data from empty JSON object") - } - return &uppd, nil + return unmarshalProtocolData[*UmeeParamsProtocolData](data) case ProtocolDataTypeUmeeReserves: - upd := UmeeReservesProtocolData{} - err := json.Unmarshal(data, &upd) - if err != nil { - return nil, fmt.Errorf("unable to unmarshal intermediary UmeeReservesProtocolData: %w", err) - } - var blank UmeeReservesProtocolData - if reflect.DeepEqual(upd, blank) { - return nil, fmt.Errorf("unable to unmarshal UmeeReservesProtocolData from empty JSON object") - } - - return &upd, nil + return unmarshalProtocolData[*UmeeReservesProtocolData](data) case ProtocolDataTypeUmeeUTokenSupply: - upd := UmeeUTokenSupplyProtocolData{} - err := json.Unmarshal(data, &upd) - if err != nil { - return nil, fmt.Errorf("unable to unmarshal intermediary UmeeUTokenSupplyProtocolData: %w", err) - } - var blank UmeeUTokenSupplyProtocolData - if reflect.DeepEqual(upd, blank) { - return nil, fmt.Errorf("unable to unmarshal UmeeUTokenSupplyProtocolData from empty JSON object") - } - - return &upd, nil + return unmarshalProtocolData[*UmeeUTokenSupplyProtocolData](data) case ProtocolDataTypeUmeeTotalBorrows: - upd := UmeeTotalBorrowsProtocolData{} - err := json.Unmarshal(data, &upd) - if err != nil { - return nil, fmt.Errorf("unable to unmarshal intermediary UmeeTotalBorrowsProtocolData: %w", err) - } - var blank UmeeTotalBorrowsProtocolData - if reflect.DeepEqual(upd, blank) { - return nil, fmt.Errorf("unable to unmarshal UmeeTotalBorrowsProtocolData from empty JSON object") - } - - return &upd, nil + return unmarshalProtocolData[*UmeeTotalBorrowsProtocolData](data) case ProtocolDataTypeUmeeInterestScalar: - upd := UmeeInterestScalarProtocolData{} - err := json.Unmarshal(data, &upd) - if err != nil { - return nil, fmt.Errorf("unable to unmarshal intermediary UmeeInterestScalarProtocolData: %w", err) - } - var blank UmeeInterestScalarProtocolData - if reflect.DeepEqual(upd, blank) { - return nil, fmt.Errorf("unable to unmarshal UmeeInterestScalarProtocolData from empty JSON object") - } - - return &upd, nil + return unmarshalProtocolData[*UmeeInterestScalarProtocolData](data) case ProtocolDataTypeUmeeLeverageModuleBalance: - upd := UmeeLeverageModuleBalanceProtocolData{} - err := json.Unmarshal(data, &upd) - if err != nil { - return nil, fmt.Errorf("unable to unmarshal intermediary UmeeLeverageModuleBalanceProtocolData: %w", err) - } - var blank UmeeLeverageModuleBalanceProtocolData - if reflect.DeepEqual(upd, blank) { - return nil, fmt.Errorf("unable to unmarshal UmeeLeverageModuleBalanceProtocolData from empty JSON object") - } - - return &upd, nil + return unmarshalProtocolData[*UmeeLeverageModuleBalanceProtocolData](data) + case ProtocolDataTypeCrescentParams: + return unmarshalProtocolData[*CrescentParamsProtocolData](data) + case ProtocolDataTypeCrescentPool: + return unmarshalProtocolData[*CrescentPoolProtocolData](data) + case ProtocolDataTypeCrescentPoolCoinSupply: + return unmarshalProtocolData[*CrescentPoolCoinSupplyProtocolData](data) + case ProtocolDataTypeCrescentReserveAddressBalance: + return unmarshalProtocolData[*CrescentReserveAddressBalanceProtocolData](data) default: return nil, ErrUnknownProtocolDataType } @@ -183,4 +107,8 @@ var ( _ ProtocolDataI = &LiquidAllowedDenomProtocolData{} _ ProtocolDataI = &UmeeProtocolData{} _ ProtocolDataI = &UmeeParamsProtocolData{} + _ ProtocolDataI = &CrescentParamsProtocolData{} + _ ProtocolDataI = &CrescentPoolProtocolData{} + _ ProtocolDataI = &CrescentReserveAddressBalanceProtocolData{} + _ ProtocolDataI = &CrescentPoolCoinSupplyProtocolData{} ) diff --git a/x/participationrewards/types/protocol_data_test.go b/x/participationrewards/types/protocol_data_test.go index f8004e6e3..1ee555dfb 100644 --- a/x/participationrewards/types/protocol_data_test.go +++ b/x/participationrewards/types/protocol_data_test.go @@ -4,9 +4,12 @@ import ( "encoding/json" "testing" - "github.com/stretchr/testify/require" + liquiditytypes "github.com/ingenuity-build/quicksilver/third-party-chains/crescent-types/liquidity/types" + "github.com/ingenuity-build/quicksilver/utils/addressutils" "github.com/ingenuity-build/quicksilver/x/participationrewards/types" + + "github.com/stretchr/testify/require" ) // tests that {} is an invalid string, and that an error is thrown when unmarshalled. @@ -113,7 +116,15 @@ func TestLiquidProtocolData_ValidateBasic(t *testing.T) { } } +func marshalledUmeeData[V types.UmeeInterestScalarProtocolData | types.UmeeUTokenSupplyProtocolData | types.UmeeLeverageModuleBalanceProtocolData | types.UmeeReservesProtocolData | types.UmeeTotalBorrowsProtocolData](data types.UmeeProtocolData) []byte { + result, _ := json.Marshal(&V{UmeeProtocolData: data}) + return result +} + func TestUnmarshalProtocolData(t *testing.T) { + testUmeeData := types.UmeeProtocolData{Denom: "test", Data: []byte{0x6e, 0x75, 0x6c, 0x6c}} + testAddress := addressutils.GenerateAddressForTestWithPrefix("cosmos") + type args struct { datatype types.ProtocolDataType data json.RawMessage @@ -142,7 +153,7 @@ func TestUnmarshalProtocolData(t *testing.T) { { "connection_data_empty", args{ - datatype: 0, + datatype: types.ProtocolDataTypeConnection, data: []byte(`{}`), }, nil, @@ -229,6 +240,220 @@ func TestUnmarshalProtocolData(t *testing.T) { }, false, }, + { + "umee_params_empty", + args{ + datatype: types.ProtocolDataTypeUmeeParams, + data: []byte(`{}`), + }, + nil, + true, + }, + { + "umee_params", + args{ + datatype: types.ProtocolDataTypeUmeeParams, + data: []byte(`{"ChainID": "test-01"}`), + }, + &types.UmeeParamsProtocolData{ + ChainID: "test-01", + }, + false, + }, + { + "umee_interest_scalar_empty", + args{ + datatype: types.ProtocolDataTypeUmeeInterestScalar, + data: []byte(`{}`), + }, + nil, + true, + }, + { + "umee_interest_scalar", + args{ + datatype: types.ProtocolDataTypeUmeeInterestScalar, + data: marshalledUmeeData[types.UmeeInterestScalarProtocolData](testUmeeData), + }, + &types.UmeeInterestScalarProtocolData{testUmeeData}, + false, + }, + { + "umee_utoken_supply_empty", + args{ + datatype: types.ProtocolDataTypeUmeeUTokenSupply, + data: []byte(`{}`), + }, + nil, + true, + }, + { + "umee_utoken_supply", + args{ + datatype: types.ProtocolDataTypeUmeeUTokenSupply, + data: marshalledUmeeData[types.UmeeUTokenSupplyProtocolData](testUmeeData), + }, + &types.UmeeUTokenSupplyProtocolData{testUmeeData}, + false, + }, + { + "umee_leverage_module_balance_empty", + args{ + datatype: types.ProtocolDataTypeUmeeLeverageModuleBalance, + data: []byte(`{}`), + }, + nil, + true, + }, + { + "umee_leverage_module_balance", + args{ + datatype: types.ProtocolDataTypeUmeeLeverageModuleBalance, + data: marshalledUmeeData[types.UmeeLeverageModuleBalanceProtocolData](testUmeeData), + }, + &types.UmeeLeverageModuleBalanceProtocolData{testUmeeData}, + false, + }, + { + "umee_reserves_data_empty", + args{ + datatype: types.ProtocolDataTypeUmeeReserves, + data: []byte(`{}`), + }, + nil, + true, + }, + { + "umee_reserves_data", + args{ + datatype: types.ProtocolDataTypeUmeeReserves, + data: marshalledUmeeData[types.UmeeReservesProtocolData](testUmeeData), + }, + &types.UmeeReservesProtocolData{testUmeeData}, + false, + }, + { + "umee_total_borrows_empty", + args{ + datatype: types.ProtocolDataTypeUmeeTotalBorrows, + data: []byte(`{}`), + }, + nil, + true, + }, + { + "umee_total_borrows", + args{ + datatype: types.ProtocolDataTypeUmeeTotalBorrows, + data: marshalledUmeeData[types.UmeeTotalBorrowsProtocolData](testUmeeData), + }, + &types.UmeeTotalBorrowsProtocolData{testUmeeData}, + false, + }, + { + "crescent_pool_empty", + args{ + datatype: types.ProtocolDataTypeCrescentPool, + data: []byte(`{}`), + }, + nil, + true, + }, + { + "crescent_pool", + args{ + datatype: types.ProtocolDataTypeCrescentPool, + data: func() []byte { + pool := &liquiditytypes.Pool{ + PoolCoinDenom: "pool1", + Id: 1, + } + pooldata, _ := json.Marshal(pool) + pd := types.CrescentPoolProtocolData{ + PoolID: 1, + Denoms: map[string]types.DenomWithZone{ + "ibc/3020922B7576FC75BBE057A0290A9AEEFF489BB1113E6E365CE472D4BFB7FFA3": {ChainID: "cosmoshub-4", Denom: "uatom"}, + "ibc/15E9C5CF5969080539DB395FA7D9C0868265217EFC528433671AAF9B1912D159": {ChainID: "osmosis-1", Denom: "uosmo"}, + }, + PoolData: pooldata, + } + data, _ := json.Marshal(&pd) + return data + }(), + }, + &types.CrescentPoolProtocolData{ + PoolID: 1, + Denoms: map[string]types.DenomWithZone{ + "ibc/3020922B7576FC75BBE057A0290A9AEEFF489BB1113E6E365CE472D4BFB7FFA3": {ChainID: "cosmoshub-4", Denom: "uatom"}, + "ibc/15E9C5CF5969080539DB395FA7D9C0868265217EFC528433671AAF9B1912D159": {ChainID: "osmosis-1", Denom: "uosmo"}, + }, + PoolData: func() []byte { + pool := &liquiditytypes.Pool{ + PoolCoinDenom: "pool1", + Id: 1, + } + pooldata, _ := json.Marshal(pool) + return pooldata + }(), + }, + false, + }, + { + "crescent_pool_coin_supply_empty", + args{ + datatype: types.ProtocolDataTypeCrescentPoolCoinSupply, + data: []byte(`{}`), + }, + nil, + true, + }, + { + "crescent_pool_coin_supply", + args{ + datatype: types.ProtocolDataTypeCrescentPoolCoinSupply, + data: func() []byte { + pd := &types.CrescentPoolCoinSupplyProtocolData{ + PoolCoinDenom: "pool1", + Supply: []byte{0x6e, 0x75, 0x6c, 0x6c}, + } + data, _ := json.Marshal(pd) + return data + }(), + }, + &types.CrescentPoolCoinSupplyProtocolData{ + PoolCoinDenom: "pool1", + Supply: []byte{0x6e, 0x75, 0x6c, 0x6c}, + }, + false, + }, + { + "crescent_reserve_address_balance_empty", + args{ + datatype: types.ProtocolDataTypeCrescentReserveAddressBalance, + data: []byte(`{}`), + }, + nil, + true, + }, + { + "crescent_reserve_address_balance", + args{ + datatype: types.ProtocolDataTypeCrescentReserveAddressBalance, + data: func() []byte { + pd := &types.CrescentReserveAddressBalanceProtocolData{ + ReserveAddress: testAddress, + Balance: []byte{0x6e, 0x75, 0x6c, 0x6c}, + } + data, _ := json.Marshal(pd) + return data + }(), + }, + &types.CrescentReserveAddressBalanceProtocolData{ + ReserveAddress: testAddress, + Balance: []byte{0x6e, 0x75, 0x6c, 0x6c}, + }, + false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/x/participationrewards/types/submodule_crescent.go b/x/participationrewards/types/submodule_crescent.go new file mode 100644 index 000000000..e4ed3f828 --- /dev/null +++ b/x/participationrewards/types/submodule_crescent.go @@ -0,0 +1,155 @@ +package types + +import ( + "encoding/json" + "fmt" + "strings" + "time" + + liquiditytypes "github.com/ingenuity-build/quicksilver/third-party-chains/crescent-types/liquidity/types" + + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/ingenuity-build/multierror" + "github.com/ingenuity-build/quicksilver/utils" +) + +type CrescentPoolProtocolData struct { + PoolID uint64 + Denoms map[string]DenomWithZone + PoolData json.RawMessage + LastUpdated time.Time +} + +func (cpd *CrescentPoolProtocolData) ValidateBasic() error { + errs := make(map[string]error) + + if cpd.PoolID == 0 { + errs["PoolId"] = ErrUndefinedAttribute + } + + i := 0 + for _, ibcdenom := range utils.Keys(cpd.Denoms) { + el := fmt.Sprintf("Denoms[%s]", ibcdenom) + + if cpd.Denoms[ibcdenom].ChainID == "" || len(strings.Split(cpd.Denoms[ibcdenom].ChainID, "-")) < 2 { + errs[el+" key"] = fmt.Errorf("%w, chainID", ErrInvalidChainID) + } + + if cpd.Denoms[ibcdenom].Denom == "" || sdk.ValidateDenom(cpd.Denoms[ibcdenom].Denom) != nil { + errs[el+" value"] = fmt.Errorf("%w, IBC/denom", ErrInvalidDenom) + } + + i++ + } + + if i == 0 { + errs["Denoms"] = ErrUndefinedAttribute + } + + if len(errs) > 0 { + return multierror.New(errs) + } + + return nil +} + +func (cpd *CrescentPoolProtocolData) GenerateKey() []byte { + return []byte(fmt.Sprintf("%d", cpd.PoolID)) +} + +func (cpd *CrescentPoolProtocolData) GetPool() (*liquiditytypes.Pool, error) { + var poolData liquiditytypes.Pool + if len(cpd.PoolData) > 0 { + err := json.Unmarshal(cpd.PoolData, &poolData) + if err != nil { + return nil, fmt.Errorf("1: unable to unmarshal concrete PoolData: %w", err) + } + } + return &poolData, nil +} + +type CrescentReserveAddressBalanceProtocolData struct { + ReserveAddress string + Denom string + Balance json.RawMessage + LastUpdated time.Time +} + +func (crd CrescentReserveAddressBalanceProtocolData) ValidateBasic() error { + errs := make(map[string]error) + + if crd.ReserveAddress == "" { + errs["ReserveAddress"] = ErrUndefinedAttribute + } + if _, err := sdk.AccAddressFromBech32(crd.ReserveAddress); err != nil { + errs["ReserveAddress"] = ErrInvalidBech32 + } + if err := sdk.ValidateDenom(crd.Denom); err != nil { + errs["Denom"] = ErrInvalidDenom + } + if len(errs) > 0 { + return multierror.New(errs) + } + + return nil +} + +func (crd CrescentReserveAddressBalanceProtocolData) GenerateKey() []byte { + return []byte(crd.ReserveAddress + crd.Denom) +} + +func (crd CrescentReserveAddressBalanceProtocolData) GetBalance() (math.Int, error) { + var balanceData math.Int + err := json.Unmarshal(crd.Balance, &balanceData) + if err != nil { + return balanceData, fmt.Errorf("1: unable to unmarshal concrete reservebalancedata: %w", err) + } + return balanceData, nil +} + +type CrescentPoolCoinSupplyProtocolData struct { + PoolCoinDenom string + Supply json.RawMessage + LastUpdated time.Time +} + +func (cpd CrescentPoolCoinSupplyProtocolData) ValidateBasic() error { + // poolcoindenom is always pool{poolid} + if len(cpd.PoolCoinDenom) <= 4 || cpd.PoolCoinDenom[0:4] != "pool" { + return ErrInvalidAssetName + } + + return nil +} + +func (cpd CrescentPoolCoinSupplyProtocolData) GenerateKey() []byte { + return []byte(cpd.PoolCoinDenom) +} + +func (cpd CrescentPoolCoinSupplyProtocolData) GetSupply() (math.Int, error) { + var supplyData math.Int + err := json.Unmarshal(cpd.Supply, &supplyData) + if err != nil { + return supplyData, fmt.Errorf("1: unable to unmarshal concrete supplydata: %w", err) + } + return supplyData, nil +} + +type CrescentParamsProtocolData struct { + ChainID string +} + +func (uppd CrescentParamsProtocolData) ValidateBasic() error { + if uppd.ChainID == "" { + return ErrUndefinedAttribute + } + + return nil +} + +func (uppd CrescentParamsProtocolData) GenerateKey() []byte { + return []byte(CrescentParamsKey) +} diff --git a/x/participationrewards/types/submodule_crescent_test.go b/x/participationrewards/types/submodule_crescent_test.go new file mode 100644 index 000000000..7eda65f80 --- /dev/null +++ b/x/participationrewards/types/submodule_crescent_test.go @@ -0,0 +1,45 @@ +package types + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestCrescentParamsProtocolData_ValidateBasic(t *testing.T) { + type fields struct { + ChainID string + } + tests := []struct { + name string + fields fields + wantErr bool + }{ + { + "blank", + fields{}, + true, + }, + { + "valid", + fields{ + ChainID: "test-01", + }, + false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + uppd := CrescentParamsProtocolData{ + ChainID: tt.fields.ChainID, + } + err := uppd.ValidateBasic() + if tt.wantErr { + t.Logf("Error:\n%v\n", err) + require.Error(t, err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/participationrewards/types/submodule_osmosis.go b/x/participationrewards/types/submodule_osmosis.go index 9ab0a3aa3..0c4118008 100644 --- a/x/participationrewards/types/submodule_osmosis.go +++ b/x/participationrewards/types/submodule_osmosis.go @@ -6,12 +6,12 @@ import ( "strings" "time" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm/pool-models/balancer" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/gamm/pool-models/stableswap" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ingenuity-build/multierror" - - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm/pool-models/balancer" - "github.com/ingenuity-build/quicksilver/osmosis-types/gamm/pool-models/stableswap" "github.com/ingenuity-build/quicksilver/utils" ) diff --git a/x/tokenfactory/simulation/operations.go b/x/tokenfactory/simulation/operations.go index fec01c517..07b79daad 100644 --- a/x/tokenfactory/simulation/operations.go +++ b/x/tokenfactory/simulation/operations.go @@ -3,6 +3,8 @@ package simulation import ( "math/rand" + "github.com/ingenuity-build/quicksilver/third-party-chains/osmosis-types/osmoutils" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" simappparams "github.com/cosmos/cosmos-sdk/simapp/params" @@ -11,7 +13,6 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/simulation" - "github.com/ingenuity-build/quicksilver/osmosis-types/osmoutils" "github.com/ingenuity-build/quicksilver/test/simulation/simtypes" "github.com/ingenuity-build/quicksilver/x/tokenfactory/keeper" "github.com/ingenuity-build/quicksilver/x/tokenfactory/types"