From 657663ecada5d12877aa6b109b3809d6ce5b8d1f Mon Sep 17 00:00:00 2001 From: Amit Yadav Date: Tue, 25 Jun 2024 01:06:03 +0530 Subject: [PATCH] Tier Module: Add hooks and queries (#609) * add amm hooks for portfolio calc * add perp hooks * refactor * add queries * update * get amm price * add liquid query * fix * add amm price * refactor and add more hooks * fix * fix --- app/app.go | 14 +- docs/static/openapi.yml | 209 ++ proto/elys/tier/query.proto | 78 +- x/accountedpool/keeper/hooks_perpetual.go | 42 +- x/perpetual/keeper/close_long.go | 2 +- x/perpetual/keeper/close_short.go | 2 +- x/perpetual/keeper/force_close_long.go | 2 +- x/perpetual/keeper/force_close_short.go | 2 +- x/perpetual/keeper/hooks_amm.go | 8 +- x/perpetual/keeper/open.go | 2 +- x/perpetual/keeper/open_consolidate.go | 2 +- x/perpetual/types/hooks.go | 42 +- x/tier/client/cli/query.go | 10 + x/tier/client/cli/query_get_amm_price.go | 52 + x/tier/client/cli/query_liquid_total.go | 46 + x/tier/client/cli/query_perpetual.go | 46 + x/tier/client/cli/query_rewards_total.go | 46 + x/tier/client/cli/query_staked_pool.go | 46 + x/tier/keeper/hooks_amm.go | 60 + x/tier/keeper/hooks_perpetual.go | 79 + x/tier/keeper/hooks_stable_stake.go | 39 + x/tier/keeper/hooks_staking.go | 94 + x/tier/keeper/portfolio.go | 204 +- x/tier/keeper/query_get_amm_price.go | 23 + x/tier/keeper/query_liquid_total.go | 24 + x/tier/keeper/query_perpetual.go | 24 + x/tier/keeper/query_rewards_total.go | 24 + x/tier/keeper/query_staked_pool.go | 24 + x/tier/types/expected_keepers.go | 7 + x/tier/types/query.pb.go | 2579 ++++++++++++++++++--- x/tier/types/query.pb.gw.go | 527 +++++ 31 files changed, 3907 insertions(+), 452 deletions(-) create mode 100644 x/tier/client/cli/query_get_amm_price.go create mode 100644 x/tier/client/cli/query_liquid_total.go create mode 100644 x/tier/client/cli/query_perpetual.go create mode 100644 x/tier/client/cli/query_rewards_total.go create mode 100644 x/tier/client/cli/query_staked_pool.go create mode 100644 x/tier/keeper/hooks_amm.go create mode 100644 x/tier/keeper/hooks_perpetual.go create mode 100644 x/tier/keeper/hooks_stable_stake.go create mode 100644 x/tier/keeper/hooks_staking.go create mode 100644 x/tier/keeper/query_get_amm_price.go create mode 100644 x/tier/keeper/query_liquid_total.go create mode 100644 x/tier/keeper/query_perpetual.go create mode 100644 x/tier/keeper/query_rewards_total.go create mode 100644 x/tier/keeper/query_staked_pool.go diff --git a/app/app.go b/app/app.go index bbb04434a..7232fd4af 100644 --- a/app/app.go +++ b/app/app.go @@ -835,11 +835,6 @@ func NewElysApp( ) masterchefModule := masterchefmodule.NewAppModule(appCodec, app.MasterchefKeeper, app.AccountKeeper, app.BankKeeper) - app.StablestakeKeeper = *app.StablestakeKeeper.SetHooks(stablestakekeeper.NewMultiStableStakeHooks( - app.MasterchefKeeper.StableStakeHooks(), - )) - stablestakeModule := stablestake.NewAppModule(appCodec, app.StablestakeKeeper, app.AccountKeeper, app.BankKeeper) - app.IncentiveKeeper = *incentivemodulekeeper.NewKeeper( appCodec, keys[incentivemoduletypes.StoreKey], @@ -1064,12 +1059,19 @@ func NewElysApp( // register hooks after all modules have been initialized + app.StablestakeKeeper = *app.StablestakeKeeper.SetHooks(stablestakekeeper.NewMultiStableStakeHooks( + app.MasterchefKeeper.StableStakeHooks(), + app.TierKeeper.StableStakeHooks(), + )) + stablestakeModule := stablestake.NewAppModule(appCodec, app.StablestakeKeeper, app.AccountKeeper, app.BankKeeper) + app.EstakingKeeper.SetHooks( stakingtypes.NewMultiStakingHooks( // insert staking hooks receivers here app.SlashingKeeper.Hooks(), app.DistrKeeper.Hooks(), app.EstakingKeeper.StakingHooks(), + app.TierKeeper.StakingHooks(), ), ) @@ -1085,6 +1087,7 @@ func NewElysApp( app.PerpetualKeeper.AmmHooks(), app.LeveragelpKeeper.AmmHooks(), app.MasterchefKeeper.AmmHooks(), + app.TierKeeper.AmmHooks(), ), ) ammModule := ammmodule.NewAppModule(appCodec, app.AmmKeeper, app.AccountKeeper, app.BankKeeper) @@ -1104,6 +1107,7 @@ func NewElysApp( perpetualmoduletypes.NewMultiPerpetualHooks( // insert perpetual hooks receivers here app.AccountedPoolKeeper.PerpetualHooks(), + app.TierKeeper.PerpetualHooks(), ), ) perpetualModule := perpetualmodule.NewAppModule(appCodec, app.PerpetualKeeper, app.AccountKeeper, app.BankKeeper) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 5c5e83d74..cfb0d7b7f 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -44884,6 +44884,45 @@ paths: type: string tags: - Query + /elys-network/elys/tier/get_amm_price/{denom}/{decimal}: + get: + summary: Queries a list of GetAmmPrice items. + operationId: ElysTierGetAmmPrice + responses: + '200': + description: A successful response. + schema: + type: object + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: denom + in: path + required: true + type: string + - name: decimal + in: path + required: true + type: integer + format: int32 + tags: + - Query /elys-network/elys/tier/leverage_lp_total/{user}: get: summary: Queries a list of LeverageLpTotal items. @@ -44921,6 +44960,154 @@ paths: type: string tags: - Query + /elys-network/elys/tier/liquid_total/{user}: + get: + summary: Queries a list of LiquidTotal items. + operationId: ElysTierLiquidTotal + responses: + '200': + description: A successful response. + schema: + type: object + properties: + total: + type: string + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: user + in: path + required: true + type: string + tags: + - Query + /elys-network/elys/tier/perpetual/{user}: + get: + summary: Queries a list of Perpetual items. + operationId: ElysTierPerpetual + responses: + '200': + description: A successful response. + schema: + type: object + properties: + total: + type: string + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: user + in: path + required: true + type: string + tags: + - Query + /elys-network/elys/tier/rewards_total/{user}: + get: + summary: Queries a list of RewardsTotal items. + operationId: ElysTierRewardsTotal + responses: + '200': + description: A successful response. + schema: + type: object + properties: + total: + type: string + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: user + in: path + required: true + type: string + tags: + - Query + /elys-network/elys/tier/staked_pool/{user}: + get: + summary: Queries a list of StakedPool items. + operationId: ElysTierStakedPool + responses: + '200': + description: A successful response. + schema: + type: object + properties: + total: + type: string + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: user + in: path + required: true + type: string + tags: + - Query /elys-network/elys/tokenomics/airdrop: get: operationId: ElysTokenomicsAirdropAll @@ -89252,6 +89439,8 @@ definitions: type: string portfolio: type: string + elys.tier.QueryGetAmmPriceResponse: + type: object elys.tier.QueryGetPortfolioResponse: type: object properties: @@ -89262,6 +89451,11 @@ definitions: properties: total: type: string + elys.tier.QueryLiquidTotalResponse: + type: object + properties: + total: + type: string elys.tier.QueryParamsResponse: type: object properties: @@ -89269,6 +89463,21 @@ definitions: description: params holds all the parameters of this module. type: object description: QueryParamsResponse is response type for the Query/Params RPC method. + elys.tier.QueryPerpetualResponse: + type: object + properties: + total: + type: string + elys.tier.QueryRewardsTotalResponse: + type: object + properties: + total: + type: string + elys.tier.QueryStakedPoolResponse: + type: object + properties: + total: + type: string elys.tokenomics.Airdrop: type: object properties: diff --git a/proto/elys/tier/query.proto b/proto/elys/tier/query.proto index c449033b1..e8ed19bfd 100644 --- a/proto/elys/tier/query.proto +++ b/proto/elys/tier/query.proto @@ -40,6 +40,36 @@ service Query { option (google.api.http).get = "/elys-network/elys/tier/leverage_lp_total/{user}"; } + + // Queries a list of RewardsTotal items. + rpc RewardsTotal (QueryRewardsTotalRequest) returns (QueryRewardsTotalResponse) { + option (google.api.http).get = "/elys-network/elys/tier/rewards_total/{user}"; + + } + + // Queries a list of StakedPool items. + rpc StakedPool (QueryStakedPoolRequest) returns (QueryStakedPoolResponse) { + option (google.api.http).get = "/elys-network/elys/tier/staked_pool/{user}"; + + } + + // Queries a list of Perpetual items. + rpc Perpetual (QueryPerpetualRequest) returns (QueryPerpetualResponse) { + option (google.api.http).get = "/elys-network/elys/tier/perpetual/{user}"; + + } + + // Queries a list of LiquidTotal items. + rpc LiquidTotal (QueryLiquidTotalRequest) returns (QueryLiquidTotalResponse) { + option (google.api.http).get = "/elys-network/elys/tier/liquid_total/{user}"; + + } + + // Queries a list of GetAmmPrice items. + rpc GetAmmPrice (QueryGetAmmPriceRequest) returns (QueryGetAmmPriceResponse) { + option (google.api.http).get = "/elys-network/elys/tier/get_amm_price/{denom}/{decimal}"; + + } } // QueryParamsRequest is request type for the Query/Params RPC method. message QueryParamsRequest {} @@ -80,13 +110,51 @@ message QueryCalculateDiscountResponse { } message QueryLeverageLpTotalRequest { - string user = 1; + string user = 1; } message QueryLeverageLpTotalResponse { - string total = 1 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; + string total = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; +} + +message QueryRewardsTotalRequest { + string user = 1; +} + +message QueryRewardsTotalResponse { + string total = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; +} + +message QueryStakedPoolRequest { + string user = 1; +} + +message QueryStakedPoolResponse { + string total = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; +} + +message QueryPerpetualRequest { + string user = 1; +} + +message QueryPerpetualResponse { + string total = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; +} + +message QueryLiquidTotalRequest { + string user = 1; +} + +message QueryLiquidTotalResponse { + string total = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; +} + +message QueryGetAmmPriceRequest { + string denom = 1; + int32 decimal = 2; +} + +message QueryGetAmmPriceResponse { + string total = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; } diff --git a/x/accountedpool/keeper/hooks_perpetual.go b/x/accountedpool/keeper/hooks_perpetual.go index d3409d151..937e4274d 100644 --- a/x/accountedpool/keeper/hooks_perpetual.go +++ b/x/accountedpool/keeper/hooks_perpetual.go @@ -6,35 +6,35 @@ import ( perpetualtypes "github.com/elys-network/elys/x/perpetual/types" ) -func (k Keeper) AfterPerpetualPositionOpen(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool) { +func (k Keeper) AfterPerpetualPositionOpen(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { k.UpdateAccountedPool(ctx, ammPool, perpetualPool) } -func (k Keeper) AfterPerpetualPositionModified(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool) { +func (k Keeper) AfterPerpetualPositionModified(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { k.UpdateAccountedPool(ctx, ammPool, perpetualPool) } -func (k Keeper) AfterPerpetualPositionClosed(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool) { +func (k Keeper) AfterPerpetualPositionClosed(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { k.UpdateAccountedPool(ctx, ammPool, perpetualPool) } // AfterPoolCreated is called after CreatePool -func (k Keeper) AfterAmmPoolCreated(ctx sdk.Context, ammPool ammtypes.Pool) { +func (k Keeper) AfterAmmPoolCreated(ctx sdk.Context, ammPool ammtypes.Pool, sender string) { k.InitiateAccountedPool(ctx, ammPool) } // AfterJoinPool is called after JoinPool, JoinSwapExternAmountIn, and JoinSwapShareAmountOut -func (k Keeper) AfterAmmJoinPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool) { +func (k Keeper) AfterAmmJoinPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { k.UpdateAccountedPool(ctx, ammPool, perpetualPool) } // AfterExitPool is called after ExitPool, ExitSwapShareAmountIn, and ExitSwapExternAmountOut -func (k Keeper) AfterAmmExitPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool) { +func (k Keeper) AfterAmmExitPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { k.UpdateAccountedPool(ctx, ammPool, perpetualPool) } // AfterSwap is called after SwapExactAmountIn and SwapExactAmountOut -func (k Keeper) AfterAmmSwap(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool) { +func (k Keeper) AfterAmmSwap(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { k.UpdateAccountedPool(ctx, ammPool, perpetualPool) } @@ -50,30 +50,30 @@ func (k Keeper) PerpetualHooks() PerpetualHooks { return PerpetualHooks{k} } -func (h PerpetualHooks) AfterPerpetualPositionOpen(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool) { - h.k.AfterPerpetualPositionOpen(ctx, ammPool, perpetualPool) +func (h PerpetualHooks) AfterPerpetualPositionOpen(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + h.k.AfterPerpetualPositionOpen(ctx, ammPool, perpetualPool, sender) } -func (h PerpetualHooks) AfterPerpetualPositionModified(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool) { - h.k.AfterPerpetualPositionModified(ctx, ammPool, perpetualPool) +func (h PerpetualHooks) AfterPerpetualPositionModified(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + h.k.AfterPerpetualPositionModified(ctx, ammPool, perpetualPool, sender) } -func (h PerpetualHooks) AfterPerpetualPositionClosed(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool) { - h.k.AfterPerpetualPositionClosed(ctx, ammPool, perpetualPool) +func (h PerpetualHooks) AfterPerpetualPositionClosed(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + h.k.AfterPerpetualPositionClosed(ctx, ammPool, perpetualPool, sender) } -func (h PerpetualHooks) AfterAmmPoolCreated(ctx sdk.Context, ammPool ammtypes.Pool) { - h.k.AfterAmmPoolCreated(ctx, ammPool) +func (h PerpetualHooks) AfterAmmPoolCreated(ctx sdk.Context, ammPool ammtypes.Pool, sender string) { + h.k.AfterAmmPoolCreated(ctx, ammPool, sender) } -func (h PerpetualHooks) AfterAmmJoinPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool) { - h.k.AfterAmmJoinPool(ctx, ammPool, perpetualPool) +func (h PerpetualHooks) AfterAmmJoinPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + h.k.AfterAmmJoinPool(ctx, ammPool, perpetualPool, sender) } -func (h PerpetualHooks) AfterAmmExitPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool) { - h.k.AfterAmmExitPool(ctx, ammPool, perpetualPool) +func (h PerpetualHooks) AfterAmmExitPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + h.k.AfterAmmExitPool(ctx, ammPool, perpetualPool, sender) } -func (h PerpetualHooks) AfterAmmSwap(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool) { - h.k.AfterAmmSwap(ctx, ammPool, perpetualPool) +func (h PerpetualHooks) AfterAmmSwap(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + h.k.AfterAmmSwap(ctx, ammPool, perpetualPool, sender) } diff --git a/x/perpetual/keeper/close_long.go b/x/perpetual/keeper/close_long.go index 5f6f96179..26e0958b1 100644 --- a/x/perpetual/keeper/close_long.go +++ b/x/perpetual/keeper/close_long.go @@ -49,7 +49,7 @@ func (k Keeper) CloseLong(ctx sdk.Context, msg *types.MsgClose, baseCurrency str // Hooks after perpetual position closed if k.hooks != nil { - k.hooks.AfterPerpetualPositionClosed(ctx, ammPool, pool) + k.hooks.AfterPerpetualPositionClosed(ctx, ammPool, pool, msg.Creator) } return &mtp, repayAmt, nil diff --git a/x/perpetual/keeper/close_short.go b/x/perpetual/keeper/close_short.go index ec785894b..361b4748d 100644 --- a/x/perpetual/keeper/close_short.go +++ b/x/perpetual/keeper/close_short.go @@ -49,7 +49,7 @@ func (k Keeper) CloseShort(ctx sdk.Context, msg *types.MsgClose, baseCurrency st // Hooks after perpetual position closed if k.hooks != nil { - k.hooks.AfterPerpetualPositionClosed(ctx, ammPool, pool) + k.hooks.AfterPerpetualPositionClosed(ctx, ammPool, pool, msg.Creator) } return &mtp, repayAmt, nil diff --git a/x/perpetual/keeper/force_close_long.go b/x/perpetual/keeper/force_close_long.go index f5275e6b7..528daf519 100644 --- a/x/perpetual/keeper/force_close_long.go +++ b/x/perpetual/keeper/force_close_long.go @@ -29,7 +29,7 @@ func (k Keeper) ForceCloseLong(ctx sdk.Context, mtp *types.MTP, pool *types.Pool // Hooks after perpetual position closed if k.hooks != nil { - k.hooks.AfterPerpetualPositionClosed(ctx, ammPool, *pool) + k.hooks.AfterPerpetualPositionClosed(ctx, ammPool, *pool, mtp.Address) } return repayAmount, nil diff --git a/x/perpetual/keeper/force_close_short.go b/x/perpetual/keeper/force_close_short.go index d5bb949b8..1336c7211 100644 --- a/x/perpetual/keeper/force_close_short.go +++ b/x/perpetual/keeper/force_close_short.go @@ -29,7 +29,7 @@ func (k Keeper) ForceCloseShort(ctx sdk.Context, mtp *types.MTP, pool *types.Poo // Hooks after perpetual position closed if k.hooks != nil { - k.hooks.AfterPerpetualPositionClosed(ctx, ammPool, *pool) + k.hooks.AfterPerpetualPositionClosed(ctx, ammPool, *pool, mtp.Address) } return repayAmount, nil diff --git a/x/perpetual/keeper/hooks_amm.go b/x/perpetual/keeper/hooks_amm.go index 27049e0fc..b1b891321 100644 --- a/x/perpetual/keeper/hooks_amm.go +++ b/x/perpetual/keeper/hooks_amm.go @@ -9,7 +9,7 @@ import ( // AfterPoolCreated is called after CreatePool func (k Keeper) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, ammPool ammtypes.Pool) { if k.hooks != nil { - k.hooks.AfterAmmPoolCreated(ctx, ammPool) + k.hooks.AfterAmmPoolCreated(ctx, ammPool, sender.String()) } } @@ -21,7 +21,7 @@ func (k Keeper) AfterJoinPool(ctx sdk.Context, sender sdk.AccAddress, ammPool am } if k.hooks != nil { - k.hooks.AfterAmmJoinPool(ctx, ammPool, perpetualPool) + k.hooks.AfterAmmJoinPool(ctx, ammPool, perpetualPool, sender.String()) } } @@ -33,7 +33,7 @@ func (k Keeper) AfterExitPool(ctx sdk.Context, sender sdk.AccAddress, ammPool am } if k.hooks != nil { - k.hooks.AfterAmmExitPool(ctx, ammPool, perpetualPool) + k.hooks.AfterAmmExitPool(ctx, ammPool, perpetualPool, sender.String()) } return nil } @@ -45,7 +45,7 @@ func (k Keeper) AfterSwap(ctx sdk.Context, sender sdk.AccAddress, ammPool ammtyp return nil } if k.hooks != nil { - k.hooks.AfterAmmSwap(ctx, ammPool, perpetualPool) + k.hooks.AfterAmmSwap(ctx, ammPool, perpetualPool, sender.String()) } return nil } diff --git a/x/perpetual/keeper/open.go b/x/perpetual/keeper/open.go index d00bb773a..83f18b2d0 100644 --- a/x/perpetual/keeper/open.go +++ b/x/perpetual/keeper/open.go @@ -76,7 +76,7 @@ func (k Keeper) Open(ctx sdk.Context, msg *types.MsgOpen, isBroker bool) (*types k.OpenChecker.EmitOpenEvent(ctx, mtp) if k.hooks != nil { - k.hooks.AfterPerpetualPositionOpen(ctx, ammPool, pool) + k.hooks.AfterPerpetualPositionOpen(ctx, ammPool, pool, msg.Creator) } return &types.MsgOpenResponse{ diff --git a/x/perpetual/keeper/open_consolidate.go b/x/perpetual/keeper/open_consolidate.go index d357d578d..76607f746 100644 --- a/x/perpetual/keeper/open_consolidate.go +++ b/x/perpetual/keeper/open_consolidate.go @@ -47,7 +47,7 @@ func (k Keeper) OpenConsolidate(ctx sdk.Context, existingMtp *types.MTP, newMtp k.EmitOpenEvent(ctx, existingMtp) if k.hooks != nil { - k.hooks.AfterPerpetualPositionModified(ctx, ammPool, pool) + k.hooks.AfterPerpetualPositionModified(ctx, ammPool, pool, msg.Creator) } return &types.MsgOpenResponse{ diff --git a/x/perpetual/types/hooks.go b/x/perpetual/types/hooks.go index 36c828527..9d9b924d2 100644 --- a/x/perpetual/types/hooks.go +++ b/x/perpetual/types/hooks.go @@ -7,25 +7,25 @@ import ( type PerpetualHooks interface { // AfterPerpetualPositionOpen is called after OpenLong or OpenShort position. - AfterPerpetualPositionOpen(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool) + AfterPerpetualPositionOpen(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool, sender string) // AfterPerpetualPositionModified is called after a position gets modified. - AfterPerpetualPositionModified(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool) + AfterPerpetualPositionModified(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool, sender string) // AfterPerpetualPositionClosed is called after a position gets closed. - AfterPerpetualPositionClosed(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool) + AfterPerpetualPositionClosed(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool, sender string) // AfterPoolCreated is called after CreatePool - AfterAmmPoolCreated(ctx sdk.Context, ammPool ammtypes.Pool) + AfterAmmPoolCreated(ctx sdk.Context, ammPool ammtypes.Pool, sender string) // AfterJoinPool is called after JoinPool, JoinSwapExternAmountIn, and JoinSwapShareAmountOut - AfterAmmJoinPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool) + AfterAmmJoinPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool, sender string) // AfterExitPool is called after ExitPool, ExitSwapShareAmountIn, and ExitSwapExternAmountOut - AfterAmmExitPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool) + AfterAmmExitPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool, sender string) // AfterSwap is called after SwapExactAmountIn and SwapExactAmountOut - AfterAmmSwap(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool) + AfterAmmSwap(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool, sender string) } var _ PerpetualHooks = MultiPerpetualHooks{} @@ -38,44 +38,44 @@ func NewMultiPerpetualHooks(hooks ...PerpetualHooks) MultiPerpetualHooks { return hooks } -func (h MultiPerpetualHooks) AfterPerpetualPositionOpen(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool) { +func (h MultiPerpetualHooks) AfterPerpetualPositionOpen(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool, sender string) { for i := range h { - h[i].AfterPerpetualPositionOpen(ctx, ammPool, perpetualPool) + h[i].AfterPerpetualPositionOpen(ctx, ammPool, perpetualPool, sender) } } -func (h MultiPerpetualHooks) AfterPerpetualPositionModified(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool) { +func (h MultiPerpetualHooks) AfterPerpetualPositionModified(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool, sender string) { for i := range h { - h[i].AfterPerpetualPositionModified(ctx, ammPool, perpetualPool) + h[i].AfterPerpetualPositionModified(ctx, ammPool, perpetualPool, sender) } } -func (h MultiPerpetualHooks) AfterPerpetualPositionClosed(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool) { +func (h MultiPerpetualHooks) AfterPerpetualPositionClosed(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool, sender string) { for i := range h { - h[i].AfterPerpetualPositionClosed(ctx, ammPool, perpetualPool) + h[i].AfterPerpetualPositionClosed(ctx, ammPool, perpetualPool, sender) } } -func (h MultiPerpetualHooks) AfterAmmPoolCreated(ctx sdk.Context, ammPool ammtypes.Pool) { +func (h MultiPerpetualHooks) AfterAmmPoolCreated(ctx sdk.Context, ammPool ammtypes.Pool, sender string) { for i := range h { - h[i].AfterAmmPoolCreated(ctx, ammPool) + h[i].AfterAmmPoolCreated(ctx, ammPool, sender) } } -func (h MultiPerpetualHooks) AfterAmmJoinPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool) { +func (h MultiPerpetualHooks) AfterAmmJoinPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool, sender string) { for i := range h { - h[i].AfterAmmJoinPool(ctx, ammPool, perpetualPool) + h[i].AfterAmmJoinPool(ctx, ammPool, perpetualPool, sender) } } -func (h MultiPerpetualHooks) AfterAmmExitPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool) { +func (h MultiPerpetualHooks) AfterAmmExitPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool, sender string) { for i := range h { - h[i].AfterAmmExitPool(ctx, ammPool, perpetualPool) + h[i].AfterAmmExitPool(ctx, ammPool, perpetualPool, sender) } } -func (h MultiPerpetualHooks) AfterAmmSwap(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool) { +func (h MultiPerpetualHooks) AfterAmmSwap(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool Pool, sender string) { for i := range h { - h[i].AfterAmmSwap(ctx, ammPool, perpetualPool) + h[i].AfterAmmSwap(ctx, ammPool, perpetualPool, sender) } } diff --git a/x/tier/client/cli/query.go b/x/tier/client/cli/query.go index c5a0c6038..b16f327b6 100644 --- a/x/tier/client/cli/query.go +++ b/x/tier/client/cli/query.go @@ -31,6 +31,16 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand(CmdLeverageLpTotal()) + cmd.AddCommand(CmdRewardsTotal()) + + cmd.AddCommand(CmdStakedPool()) + + cmd.AddCommand(CmdPerpetual()) + + cmd.AddCommand(CmdLiquidTotal()) + + cmd.AddCommand(CmdGetAmmPrice()) + // this line is used by starport scaffolding # 1 return cmd diff --git a/x/tier/client/cli/query_get_amm_price.go b/x/tier/client/cli/query_get_amm_price.go new file mode 100644 index 000000000..5b9917772 --- /dev/null +++ b/x/tier/client/cli/query_get_amm_price.go @@ -0,0 +1,52 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/elys-network/elys/x/tier/types" + "github.com/spf13/cast" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdGetAmmPrice() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-amm-price [denom] [decimal]", + Short: "Query get-amm-price", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + reqDenom := args[0] + reqDecimal, err := cast.ToInt32E(args[1]) + if err != nil { + return err + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryGetAmmPriceRequest{ + + Denom: reqDenom, + Decimal: reqDecimal, + } + + res, err := queryClient.GetAmmPrice(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/tier/client/cli/query_liquid_total.go b/x/tier/client/cli/query_liquid_total.go new file mode 100644 index 000000000..b6111e992 --- /dev/null +++ b/x/tier/client/cli/query_liquid_total.go @@ -0,0 +1,46 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/elys-network/elys/x/tier/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdLiquidTotal() *cobra.Command { + cmd := &cobra.Command{ + Use: "liquid-total [user]", + Short: "Query liquid-total", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + reqUser := args[0] + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryLiquidTotalRequest{ + + User: reqUser, + } + + res, err := queryClient.LiquidTotal(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/tier/client/cli/query_perpetual.go b/x/tier/client/cli/query_perpetual.go new file mode 100644 index 000000000..4a7fefc4a --- /dev/null +++ b/x/tier/client/cli/query_perpetual.go @@ -0,0 +1,46 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/elys-network/elys/x/tier/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdPerpetual() *cobra.Command { + cmd := &cobra.Command{ + Use: "perpetual [user]", + Short: "Query perpetual", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + reqUser := args[0] + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryPerpetualRequest{ + + User: reqUser, + } + + res, err := queryClient.Perpetual(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/tier/client/cli/query_rewards_total.go b/x/tier/client/cli/query_rewards_total.go new file mode 100644 index 000000000..58e8e66ed --- /dev/null +++ b/x/tier/client/cli/query_rewards_total.go @@ -0,0 +1,46 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/elys-network/elys/x/tier/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdRewardsTotal() *cobra.Command { + cmd := &cobra.Command{ + Use: "rewards-total [user]", + Short: "Query rewards-total", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + reqUser := args[0] + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryRewardsTotalRequest{ + + User: reqUser, + } + + res, err := queryClient.RewardsTotal(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/tier/client/cli/query_staked_pool.go b/x/tier/client/cli/query_staked_pool.go new file mode 100644 index 000000000..2a1b8d690 --- /dev/null +++ b/x/tier/client/cli/query_staked_pool.go @@ -0,0 +1,46 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/elys-network/elys/x/tier/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdStakedPool() *cobra.Command { + cmd := &cobra.Command{ + Use: "staked-pool [user]", + Short: "Query staked-pool", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + reqUser := args[0] + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryStakedPoolRequest{ + + User: reqUser, + } + + res, err := queryClient.StakedPool(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/tier/keeper/hooks_amm.go b/x/tier/keeper/hooks_amm.go new file mode 100644 index 000000000..d5a697fad --- /dev/null +++ b/x/tier/keeper/hooks_amm.go @@ -0,0 +1,60 @@ +package keeper + +import ( + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + ammtypes "github.com/elys-network/elys/x/amm/types" +) + +// AfterPoolCreated is called after CreatePool +func (k Keeper) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, poolId uint64) { +} + +// AfterJoinPool is called after JoinPool, JoinSwapExternAmountIn, and JoinSwapShareAmountOut +func (k Keeper) AfterJoinPool(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, enterCoins sdk.Coins, shareOutAmount math.Int) { + k.RetreiveAllPortfolio(ctx, sender.String()) +} + +// AfterExitPool is called after ExitPool, ExitSwapShareAmountIn, and ExitSwapExternAmountOut +func (k Keeper) AfterExitPool(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, shareInAmount math.Int, exitCoins sdk.Coins) error { + k.RetreiveAllPortfolio(ctx, sender.String()) + return nil +} + +// AfterSwap is called after SwapExactAmountIn and SwapExactAmountOut +func (k Keeper) AfterSwap(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, input sdk.Coins, output sdk.Coins) error { + k.RetreiveAllPortfolio(ctx, sender.String()) + return nil +} + +// Hooks wrapper struct for incentive keeper +type AmmHooks struct { + k Keeper +} + +var _ ammtypes.AmmHooks = AmmHooks{} + +// Return the wrapper struct +func (k Keeper) AmmHooks() AmmHooks { + return AmmHooks{k} +} + +// AfterPoolCreated is called after CreatePool +func (h AmmHooks) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool) { + h.k.AfterPoolCreated(ctx, sender, pool.PoolId) +} + +// AfterJoinPool is called after JoinPool, JoinSwapExternAmountIn, and JoinSwapShareAmountOut +func (h AmmHooks) AfterJoinPool(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool, enterCoins sdk.Coins, shareOutAmount math.Int) { + h.k.AfterJoinPool(ctx, sender, pool.PoolId, enterCoins, shareOutAmount) +} + +// AfterExitPool is called after ExitPool, ExitSwapShareAmountIn, and ExitSwapExternAmountOut +func (h AmmHooks) AfterExitPool(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool, shareInAmount math.Int, exitCoins sdk.Coins) error { + return h.k.AfterExitPool(ctx, sender, pool.PoolId, shareInAmount, exitCoins) +} + +// AfterSwap is called after SwapExactAmountIn and SwapExactAmountOut +func (h AmmHooks) AfterSwap(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool, input sdk.Coins, output sdk.Coins) error { + return h.k.AfterSwap(ctx, sender, pool.PoolId, input, output) +} diff --git a/x/tier/keeper/hooks_perpetual.go b/x/tier/keeper/hooks_perpetual.go new file mode 100644 index 000000000..7e3280b3b --- /dev/null +++ b/x/tier/keeper/hooks_perpetual.go @@ -0,0 +1,79 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + ammtypes "github.com/elys-network/elys/x/amm/types" + perpetualtypes "github.com/elys-network/elys/x/perpetual/types" +) + +func (k Keeper) AfterPerpetualPositionOpen(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + k.RetreiveAllPortfolio(ctx, sender) +} + +func (k Keeper) AfterPerpetualPositionModified(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + k.RetreiveAllPortfolio(ctx, sender) +} + +func (k Keeper) AfterPerpetualPositionClosed(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + k.RetreiveAllPortfolio(ctx, sender) +} + +// AfterPoolCreated is called after CreatePool +func (k Keeper) AfterAmmPoolCreated(ctx sdk.Context, ammPool ammtypes.Pool, sender string) { + k.RetreiveAllPortfolio(ctx, sender) +} + +// AfterJoinPool is called after JoinPool, JoinSwapExternAmountIn, and JoinSwapShareAmountOut +func (k Keeper) AfterAmmJoinPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + k.RetreiveAllPortfolio(ctx, sender) +} + +// AfterExitPool is called after ExitPool, ExitSwapShareAmountIn, and ExitSwapExternAmountOut +func (k Keeper) AfterAmmExitPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + k.RetreiveAllPortfolio(ctx, sender) +} + +// AfterSwap is called after SwapExactAmountIn and SwapExactAmountOut +func (k Keeper) AfterAmmSwap(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + k.RetreiveAllPortfolio(ctx, sender) +} + +// Hooks wrapper struct for tvl keeper +type PerpetualHooks struct { + k Keeper +} + +var _ perpetualtypes.PerpetualHooks = PerpetualHooks{} + +// Return the wrapper struct +func (k Keeper) PerpetualHooks() PerpetualHooks { + return PerpetualHooks{k} +} + +func (h PerpetualHooks) AfterPerpetualPositionOpen(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + h.k.AfterPerpetualPositionOpen(ctx, ammPool, perpetualPool, sender) +} + +func (h PerpetualHooks) AfterPerpetualPositionModified(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + h.k.AfterPerpetualPositionModified(ctx, ammPool, perpetualPool, sender) +} + +func (h PerpetualHooks) AfterPerpetualPositionClosed(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + h.k.AfterPerpetualPositionClosed(ctx, ammPool, perpetualPool, sender) +} + +func (h PerpetualHooks) AfterAmmPoolCreated(ctx sdk.Context, ammPool ammtypes.Pool, sender string) { + h.k.AfterAmmPoolCreated(ctx, ammPool, sender) +} + +func (h PerpetualHooks) AfterAmmJoinPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + h.k.AfterAmmJoinPool(ctx, ammPool, perpetualPool, sender) +} + +func (h PerpetualHooks) AfterAmmExitPool(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + h.k.AfterAmmExitPool(ctx, ammPool, perpetualPool, sender) +} + +func (h PerpetualHooks) AfterAmmSwap(ctx sdk.Context, ammPool ammtypes.Pool, perpetualPool perpetualtypes.Pool, sender string) { + h.k.AfterAmmSwap(ctx, ammPool, perpetualPool, sender) +} diff --git a/x/tier/keeper/hooks_stable_stake.go b/x/tier/keeper/hooks_stable_stake.go new file mode 100644 index 000000000..918aea292 --- /dev/null +++ b/x/tier/keeper/hooks_stable_stake.go @@ -0,0 +1,39 @@ +package keeper + +import ( + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + stablestaketypes "github.com/elys-network/elys/x/stablestake/types" +) + +func (k Keeper) AfterBond(ctx sdk.Context, sender string, shareAmount math.Int) error { + k.RetreiveAllPortfolio(ctx, sender) + return nil +} + +func (k Keeper) AfterUnbond(ctx sdk.Context, sender string, shareAmount math.Int) error { + k.RetreiveAllPortfolio(ctx, sender) + return nil +} + +// Hooks wrapper struct for incentive keeper +type StableStakeHooks struct { + k Keeper +} + +var _ stablestaketypes.StableStakeHooks = StableStakeHooks{} + +// Return the wrapper struct +func (k Keeper) StableStakeHooks() StableStakeHooks { + return StableStakeHooks{k} +} + +func (h StableStakeHooks) AfterBond(ctx sdk.Context, sender string, shareAmount math.Int) error { + h.k.AfterBond(ctx, sender, shareAmount) + return nil +} + +func (h StableStakeHooks) AfterUnbond(ctx sdk.Context, sender string, shareAmount math.Int) error { + h.k.AfterUnbond(ctx, sender, shareAmount) + return nil +} diff --git a/x/tier/keeper/hooks_staking.go b/x/tier/keeper/hooks_staking.go new file mode 100644 index 000000000..a33f04c72 --- /dev/null +++ b/x/tier/keeper/hooks_staking.go @@ -0,0 +1,94 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +// Creating a commitment object for a delegator if one does not exist: +func (k Keeper) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + return nil +} + +// Updating portfolio on delegation changes +func (k Keeper) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + k.RetreiveAllPortfolio(ctx, delAddr.String()) + return nil +} + +func (k Keeper) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + return nil +} + +func (k Keeper) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + return nil +} + +// ________________________________________________________________________________________ + +// StakingHooks wrapper struct for slashing keeper +type StakingHooks struct { + k Keeper +} + +var _ stakingtypes.StakingHooks = StakingHooks{} + +// Return the wrapper struct +func (k Keeper) StakingHooks() StakingHooks { + return StakingHooks{k} +} + +// staking StakingHooks +// Must be called when a validator is created +func (h StakingHooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error { + return nil +} + +// staking StakingHooks +// Must be called when a validator is created +func (h StakingHooks) AfterUnbondingInitiated(ctx sdk.Context, id uint64) error { + return nil +} + +// Must be called when a validator's state changes +func (h StakingHooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) error { + return nil +} + +// Must be called when a validator is deleted +func (h StakingHooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { + return nil +} + +// Must be called when a validator is bonded +func (h StakingHooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { + return nil +} + +// Must be called when a validator begins unbonding +func (h StakingHooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { + return nil +} + +// Must be called when a delegation is created +func (h StakingHooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + return h.k.BeforeDelegationCreated(ctx, delAddr, valAddr) +} + +// Must be called when a delegation's shares are modified +func (h StakingHooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + return h.k.BeforeDelegationSharesModified(ctx, delAddr, valAddr) +} + +// Must be called when a delegation is removed +func (h StakingHooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + return h.k.BeforeDelegationRemoved(ctx, delAddr, valAddr) +} + +func (h StakingHooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + return h.k.AfterDelegationModified(ctx, delAddr, valAddr) +} + +func (h StakingHooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error { + return nil +} diff --git a/x/tier/keeper/portfolio.go b/x/tier/keeper/portfolio.go index 008843bc1..8e2dc7d46 100644 --- a/x/tier/keeper/portfolio.go +++ b/x/tier/keeper/portfolio.go @@ -26,63 +26,37 @@ func (k Keeper) RetreiveAllPortfolio(ctx sdk.Context, user string) { return } - // Liquid assets - balances := k.bankKeeper.GetAllBalances(ctx, sender) totalValue := sdk.NewDec(0) - for _, balance := range balances { - tokenPrice := k.oracleKeeper.GetAssetPriceFromDenom(ctx, balance.Denom) - asset, found := k.assetProfileKeeper.GetEntryByDenom(ctx, balance.Denom) - if !found { - continue - } - amount := balance.Amount.ToLegacyDec().Quo(Pow10(asset.Decimals)) - totalValue = totalValue.Add(amount.Mul(tokenPrice)) - } + + // Liquid assets + liq := k.RetreiveLiquidAssetsTotal(ctx, sender) + totalValue = totalValue.Add(liq) // Rewards - estaking, err1 := k.estaking.Rewards(ctx, &estakingtypes.QueryRewardsRequest{Address: user}) - masterchef, err2 := k.masterchef.UserPendingReward(ctx, &mastercheftypes.QueryUserPendingRewardRequest{User: user}) + rew := k.RetreiveRewardsTotal(ctx, sender) + totalValue = totalValue.Add(rew) - if err1 == nil { - for _, balance := range estaking.Total { - tokenPrice := k.oracleKeeper.GetAssetPriceFromDenom(ctx, balance.Denom) - asset, found := k.assetProfileKeeper.GetEntryByDenom(ctx, balance.Denom) - if !found { - continue - } - amount := balance.Amount.ToLegacyDec().Quo(Pow10(asset.Decimals)) - totalValue = totalValue.Add(amount.Mul(tokenPrice)) - } - } + // Perpetual + perp := k.RetreivePerpetualTotal(ctx, sender) + totalValue = totalValue.Add(perp) - if err2 == nil { - for _, balance := range masterchef.TotalRewards { - tokenPrice := k.oracleKeeper.GetAssetPriceFromDenom(ctx, balance.Denom) - asset, found := k.assetProfileKeeper.GetEntryByDenom(ctx, balance.Denom) - if !found { - continue - } - amount := balance.Amount.ToLegacyDec().Quo(Pow10(asset.Decimals)) - totalValue = totalValue.Add(amount.Mul(tokenPrice)) - } - } + // Staked+Pool assets + staked := k.RetreiveStakedAndPoolTotal(ctx, sender) + totalValue = totalValue.Add(staked) - // Perpetual - perpetuals, _, err := k.perpetual.GetMTPsForAddress(ctx, sender, &query.PageRequest{}) - if err == nil { - for _, perpetual := range perpetuals { - asset, found := k.assetProfileKeeper.GetEntryByDenom(ctx, perpetual.GetTradingAsset()) - if !found { - continue - } - tokenPrice := k.oracleKeeper.GetAssetPriceFromDenom(ctx, asset.Denom) - amount := perpetual.Custody.ToLegacyDec().Quo(Pow10(asset.Decimals)) - totalValue = totalValue.Add((amount.Mul(tokenPrice))) - } - } + // LeverageLp + lev := k.RetreiveLeverageLpTotal(ctx, sender) + totalValue = totalValue.Add(lev) + + k.SetPortfolio(ctx, todayDate, sender.String(), types.Portfolio{ + Creator: user, + Portfolio: totalValue, + }) +} - // Staked assets - commitments := k.commitement.GetCommitments(ctx, user) +func (k Keeper) RetreiveStakedAndPoolTotal(ctx sdk.Context, user sdk.AccAddress) sdk.Dec { + totalValue := sdk.NewDec(0) + commitments := k.commitement.GetCommitments(ctx, user.String()) for _, commitment := range commitments.CommittedTokens { // Pool balance if strings.HasPrefix(commitment.Denom, "amm/pool") { @@ -92,27 +66,36 @@ func (k Keeper) RetreiveAllPortfolio(ctx sdk.Context, user string) { } pool, found := k.amm.GetPool(ctx, poolId) if !found { - return + continue } info := k.amm.PoolExtraInfo(ctx, pool) - amount := commitment.Amount.ToLegacyDec().Quo(Pow10(18)) - totalValue = totalValue.Add(amount.Mul(info.LpTokenPrice)) + amount := commitment.Amount.ToLegacyDec() + totalValue = totalValue.Add(amount.Mul(info.LpTokenPrice).QuoInt(ammtypes.OneShare)) } else { + if commitment.Denom == "ueden" { + commitment.Denom = "uelys" + } tokenPrice := k.oracleKeeper.GetAssetPriceFromDenom(ctx, commitment.Denom) asset, found := k.assetProfileKeeper.GetEntryByDenom(ctx, commitment.Denom) if !found { continue } + if tokenPrice == sdk.ZeroDec() { + tokenPrice = k.CalcAmmPrice(ctx, asset.Denom, asset.Decimals) + } amount := commitment.Amount.ToLegacyDec().Quo(Pow10(asset.Decimals)) totalValue = totalValue.Add(amount.Mul(tokenPrice)) } } // Delegations - delegations := k.stakingKeeper.GetAllDelegatorDelegations(ctx, sender) + delegations := k.stakingKeeper.GetAllDelegatorDelegations(ctx, user) bondDenom := k.stakingKeeper.BondDenom(ctx) tokenPrice := k.oracleKeeper.GetAssetPriceFromDenom(ctx, bondDenom) asset, found := k.assetProfileKeeper.GetEntryByDenom(ctx, bondDenom) + if tokenPrice == sdk.ZeroDec() { + tokenPrice = k.CalcAmmPrice(ctx, asset.Denom, asset.Decimals) + } if found { for _, delegation := range delegations { amount := delegation.Shares.Quo(Pow10(asset.Decimals)) @@ -120,7 +103,7 @@ func (k Keeper) RetreiveAllPortfolio(ctx sdk.Context, user string) { } } // Max could be 7 for an account - unbondingDelegations := k.stakingKeeper.GetUnbondingDelegations(ctx, sender, 100) + unbondingDelegations := k.stakingKeeper.GetUnbondingDelegations(ctx, user, 100) if found { for _, delegation := range unbondingDelegations { for _, entry := range delegation.Entries { @@ -129,15 +112,91 @@ func (k Keeper) RetreiveAllPortfolio(ctx sdk.Context, user string) { } } } + return totalValue +} - // LeverageLp - lev := k.RetreiveLeverageLpTotal(ctx, sender) - totalValue = totalValue.Add(lev) +func (k Keeper) RetreiveRewardsTotal(ctx sdk.Context, user sdk.AccAddress) sdk.Dec { + totalValue := sdk.NewDec(0) + estaking, err1 := k.estaking.Rewards(ctx, &estakingtypes.QueryRewardsRequest{Address: user.String()}) + masterchef, err2 := k.masterchef.UserPendingReward(ctx, &mastercheftypes.QueryUserPendingRewardRequest{User: user.String()}) - k.SetPortfolio(ctx, todayDate, sender.String(), types.Portfolio{ - Creator: user, - Portfolio: totalValue, - }) + if err1 == nil { + for _, balance := range estaking.Total { + if balance.Denom == "ueden" { + balance.Denom = "uelys" + } + tokenPrice := k.oracleKeeper.GetAssetPriceFromDenom(ctx, balance.Denom) + asset, found := k.assetProfileKeeper.GetEntryByDenom(ctx, balance.Denom) + if !found { + continue + } + if tokenPrice == sdk.ZeroDec() { + tokenPrice = k.CalcAmmPrice(ctx, asset.Denom, asset.Decimals) + } + amount := balance.Amount.ToLegacyDec().Quo(Pow10(asset.Decimals)) + totalValue = totalValue.Add(amount.Mul(tokenPrice)) + } + } + + if err2 == nil { + for _, balance := range masterchef.TotalRewards { + if balance.Denom == "ueden" { + balance.Denom = "uelys" + } + tokenPrice := k.oracleKeeper.GetAssetPriceFromDenom(ctx, balance.Denom) + asset, found := k.assetProfileKeeper.GetEntryByDenom(ctx, balance.Denom) + if !found { + continue + } + if tokenPrice == sdk.ZeroDec() { + tokenPrice = k.CalcAmmPrice(ctx, asset.Denom, asset.Decimals) + } + amount := balance.Amount.ToLegacyDec().Quo(Pow10(asset.Decimals)) + totalValue = totalValue.Add(amount.Mul(tokenPrice)) + } + } + return totalValue +} + +func (k Keeper) RetreivePerpetualTotal(ctx sdk.Context, user sdk.AccAddress) sdk.Dec { + totalValue := sdk.NewDec(0) + perpetuals, _, err := k.perpetual.GetMTPsForAddress(ctx, user, &query.PageRequest{}) + if err == nil { + for _, perpetual := range perpetuals { + asset, found := k.assetProfileKeeper.GetEntryByDenom(ctx, perpetual.GetTradingAsset()) + if !found { + continue + } + tokenPrice := k.oracleKeeper.GetAssetPriceFromDenom(ctx, asset.Denom) + if tokenPrice == sdk.ZeroDec() { + tokenPrice = k.CalcAmmPrice(ctx, asset.Denom, asset.Decimals) + } + amount := perpetual.Custody.ToLegacyDec().Quo(Pow10(asset.Decimals)) + totalValue = totalValue.Add((amount.Mul(tokenPrice))) + } + } + return totalValue +} + +func (k Keeper) RetreiveLiquidAssetsTotal(ctx sdk.Context, user sdk.AccAddress) sdk.Dec { + balances := k.bankKeeper.GetAllBalances(ctx, user) + totalValue := sdk.NewDec(0) + for _, balance := range balances { + if balance.Denom == "ueden" { + balance.Denom = "uelys" + } + tokenPrice := k.oracleKeeper.GetAssetPriceFromDenom(ctx, balance.Denom) + asset, found := k.assetProfileKeeper.GetEntryByDenom(ctx, balance.Denom) + if !found { + continue + } + if tokenPrice == sdk.ZeroDec() { + tokenPrice = k.CalcAmmPrice(ctx, balance.Denom, asset.Decimals) + } + amount := balance.Amount.ToLegacyDec() + totalValue = totalValue.Add(amount.Mul(tokenPrice).Quo(Pow10(asset.Decimals))) + } + return totalValue } func (k Keeper) RetreiveLeverageLpTotal(ctx sdk.Context, user sdk.AccAddress) sdk.Dec { @@ -157,6 +216,27 @@ func (k Keeper) RetreiveLeverageLpTotal(ctx sdk.Context, user sdk.AccAddress) sd return totalValue } +func (k Keeper) CalcAmmPrice(ctx sdk.Context, denom string, decimal uint64) sdk.Dec { + usdcDenom, found := k.assetProfileKeeper.GetUsdcDenom(ctx) + if !found { + return sdk.ZeroDec() + } + usdcPrice := k.oracleKeeper.GetAssetPriceFromDenom(ctx, usdcDenom) + resp, err := k.amm.InRouteByDenom(sdk.WrapSDKContext(ctx), &ammtypes.QueryInRouteByDenomRequest{DenomIn: denom, DenomOut: usdcDenom}) + if err != nil { + return sdk.ZeroDec() + } + + routes := resp.InRoute + tokenIn := sdk.NewCoin(denom, sdk.NewInt(Pow10(decimal).TruncateInt64())) + discount := sdk.NewDec(1) + spotPrice, _, _, _, _, _, _, _, err := k.amm.CalcInRouteSpotPrice(ctx, tokenIn, routes, discount, sdk.ZeroDec()) + if err != nil { + return sdk.ZeroDec() + } + return spotPrice.Mul(usdcPrice) +} + // SetPortfolio set a specific portfolio in the store from its index func (k Keeper) SetPortfolio(ctx sdk.Context, todayDate string, user string, portfolio types.Portfolio) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(todayDate)) diff --git a/x/tier/keeper/query_get_amm_price.go b/x/tier/keeper/query_get_amm_price.go new file mode 100644 index 000000000..d1526f0e3 --- /dev/null +++ b/x/tier/keeper/query_get_amm_price.go @@ -0,0 +1,23 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/tier/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) GetAmmPrice(goCtx context.Context, req *types.QueryGetAmmPriceRequest) (*types.QueryGetAmmPriceResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + resp := k.CalcAmmPrice(ctx, req.Denom, uint64(req.Decimal)) + + return &types.QueryGetAmmPriceResponse{ + Total: resp, + }, nil +} diff --git a/x/tier/keeper/query_liquid_total.go b/x/tier/keeper/query_liquid_total.go new file mode 100644 index 000000000..88ce9e89d --- /dev/null +++ b/x/tier/keeper/query_liquid_total.go @@ -0,0 +1,24 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/tier/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) LiquidTotal(goCtx context.Context, req *types.QueryLiquidTotalRequest) (*types.QueryLiquidTotalResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + sender := sdk.MustAccAddressFromBech32(req.User) + total := k.RetreiveLiquidAssetsTotal(ctx, sender) + + return &types.QueryLiquidTotalResponse{ + Total: total, + }, nil +} diff --git a/x/tier/keeper/query_perpetual.go b/x/tier/keeper/query_perpetual.go new file mode 100644 index 000000000..8d16ba88f --- /dev/null +++ b/x/tier/keeper/query_perpetual.go @@ -0,0 +1,24 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/tier/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) Perpetual(goCtx context.Context, req *types.QueryPerpetualRequest) (*types.QueryPerpetualResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + sender := sdk.MustAccAddressFromBech32(req.User) + total := k.RetreivePerpetualTotal(ctx, sender) + + return &types.QueryPerpetualResponse{ + Total: total, + }, nil +} diff --git a/x/tier/keeper/query_rewards_total.go b/x/tier/keeper/query_rewards_total.go new file mode 100644 index 000000000..5d9de3616 --- /dev/null +++ b/x/tier/keeper/query_rewards_total.go @@ -0,0 +1,24 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/tier/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) RewardsTotal(goCtx context.Context, req *types.QueryRewardsTotalRequest) (*types.QueryRewardsTotalResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + sender := sdk.MustAccAddressFromBech32(req.User) + total := k.RetreiveRewardsTotal(ctx, sender) + + return &types.QueryRewardsTotalResponse{ + Total: total, + }, nil +} diff --git a/x/tier/keeper/query_staked_pool.go b/x/tier/keeper/query_staked_pool.go new file mode 100644 index 000000000..88974e190 --- /dev/null +++ b/x/tier/keeper/query_staked_pool.go @@ -0,0 +1,24 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/tier/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) StakedPool(goCtx context.Context, req *types.QueryStakedPoolRequest) (*types.QueryStakedPoolResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + sender := sdk.MustAccAddressFromBech32(req.User) + total := k.RetreiveStakedAndPoolTotal(ctx, sender) + + return &types.QueryStakedPoolResponse{ + Total: total, + }, nil +} diff --git a/x/tier/types/expected_keepers.go b/x/tier/types/expected_keepers.go index 57c8d7a6a..f9bfedd73 100644 --- a/x/tier/types/expected_keepers.go +++ b/x/tier/types/expected_keepers.go @@ -64,6 +64,13 @@ type AmmKeeper interface { // IterateCommitments iterates over all Commitments and performs a callback. IterateLiquidityPools(sdk.Context, func(ammtypes.Pool) bool) PoolExtraInfo(ctx sdk.Context, pool ammtypes.Pool) ammtypes.PoolExtraInfo + InRouteByDenom(goCtx context.Context, req *ammtypes.QueryInRouteByDenomRequest) (*ammtypes.QueryInRouteByDenomResponse, error) + CalcInRouteSpotPrice(ctx sdk.Context, + tokenIn sdk.Coin, + routes []*ammtypes.SwapAmountInRoute, + discount sdk.Dec, + overrideSwapFee sdk.Dec, + ) (sdk.Dec, sdk.Dec, sdk.Coin, sdk.Dec, sdk.Dec, sdk.Coin, sdk.Dec, sdk.Dec, error) } type EstakingKeeper interface { diff --git a/x/tier/types/query.pb.go b/x/tier/types/query.pb.go index e371bfae0..c7ddf2e94 100644 --- a/x/tier/types/query.pb.go +++ b/x/tier/types/query.pb.go @@ -491,6 +491,419 @@ func (m *QueryLeverageLpTotalResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryLeverageLpTotalResponse proto.InternalMessageInfo +type QueryRewardsTotalRequest struct { + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (m *QueryRewardsTotalRequest) Reset() { *m = QueryRewardsTotalRequest{} } +func (m *QueryRewardsTotalRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRewardsTotalRequest) ProtoMessage() {} +func (*QueryRewardsTotalRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_461504ebf74c9a97, []int{10} +} +func (m *QueryRewardsTotalRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRewardsTotalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRewardsTotalRequest.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 *QueryRewardsTotalRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRewardsTotalRequest.Merge(m, src) +} +func (m *QueryRewardsTotalRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRewardsTotalRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRewardsTotalRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRewardsTotalRequest proto.InternalMessageInfo + +func (m *QueryRewardsTotalRequest) GetUser() string { + if m != nil { + return m.User + } + return "" +} + +type QueryRewardsTotalResponse struct { + Total github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=total,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"total"` +} + +func (m *QueryRewardsTotalResponse) Reset() { *m = QueryRewardsTotalResponse{} } +func (m *QueryRewardsTotalResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRewardsTotalResponse) ProtoMessage() {} +func (*QueryRewardsTotalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_461504ebf74c9a97, []int{11} +} +func (m *QueryRewardsTotalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRewardsTotalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRewardsTotalResponse.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 *QueryRewardsTotalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRewardsTotalResponse.Merge(m, src) +} +func (m *QueryRewardsTotalResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRewardsTotalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRewardsTotalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRewardsTotalResponse proto.InternalMessageInfo + +type QueryStakedPoolRequest struct { + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (m *QueryStakedPoolRequest) Reset() { *m = QueryStakedPoolRequest{} } +func (m *QueryStakedPoolRequest) String() string { return proto.CompactTextString(m) } +func (*QueryStakedPoolRequest) ProtoMessage() {} +func (*QueryStakedPoolRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_461504ebf74c9a97, []int{12} +} +func (m *QueryStakedPoolRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStakedPoolRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStakedPoolRequest.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 *QueryStakedPoolRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStakedPoolRequest.Merge(m, src) +} +func (m *QueryStakedPoolRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryStakedPoolRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStakedPoolRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStakedPoolRequest proto.InternalMessageInfo + +func (m *QueryStakedPoolRequest) GetUser() string { + if m != nil { + return m.User + } + return "" +} + +type QueryStakedPoolResponse struct { + Total github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=total,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"total"` +} + +func (m *QueryStakedPoolResponse) Reset() { *m = QueryStakedPoolResponse{} } +func (m *QueryStakedPoolResponse) String() string { return proto.CompactTextString(m) } +func (*QueryStakedPoolResponse) ProtoMessage() {} +func (*QueryStakedPoolResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_461504ebf74c9a97, []int{13} +} +func (m *QueryStakedPoolResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStakedPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStakedPoolResponse.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 *QueryStakedPoolResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStakedPoolResponse.Merge(m, src) +} +func (m *QueryStakedPoolResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryStakedPoolResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStakedPoolResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStakedPoolResponse proto.InternalMessageInfo + +type QueryPerpetualRequest struct { + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (m *QueryPerpetualRequest) Reset() { *m = QueryPerpetualRequest{} } +func (m *QueryPerpetualRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPerpetualRequest) ProtoMessage() {} +func (*QueryPerpetualRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_461504ebf74c9a97, []int{14} +} +func (m *QueryPerpetualRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPerpetualRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPerpetualRequest.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 *QueryPerpetualRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPerpetualRequest.Merge(m, src) +} +func (m *QueryPerpetualRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPerpetualRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPerpetualRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPerpetualRequest proto.InternalMessageInfo + +func (m *QueryPerpetualRequest) GetUser() string { + if m != nil { + return m.User + } + return "" +} + +type QueryPerpetualResponse struct { + Total github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=total,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"total"` +} + +func (m *QueryPerpetualResponse) Reset() { *m = QueryPerpetualResponse{} } +func (m *QueryPerpetualResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPerpetualResponse) ProtoMessage() {} +func (*QueryPerpetualResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_461504ebf74c9a97, []int{15} +} +func (m *QueryPerpetualResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPerpetualResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPerpetualResponse.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 *QueryPerpetualResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPerpetualResponse.Merge(m, src) +} +func (m *QueryPerpetualResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPerpetualResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPerpetualResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPerpetualResponse proto.InternalMessageInfo + +type QueryLiquidTotalRequest struct { + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (m *QueryLiquidTotalRequest) Reset() { *m = QueryLiquidTotalRequest{} } +func (m *QueryLiquidTotalRequest) String() string { return proto.CompactTextString(m) } +func (*QueryLiquidTotalRequest) ProtoMessage() {} +func (*QueryLiquidTotalRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_461504ebf74c9a97, []int{16} +} +func (m *QueryLiquidTotalRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLiquidTotalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLiquidTotalRequest.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 *QueryLiquidTotalRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLiquidTotalRequest.Merge(m, src) +} +func (m *QueryLiquidTotalRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryLiquidTotalRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLiquidTotalRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLiquidTotalRequest proto.InternalMessageInfo + +func (m *QueryLiquidTotalRequest) GetUser() string { + if m != nil { + return m.User + } + return "" +} + +type QueryLiquidTotalResponse struct { + Total github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=total,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"total"` +} + +func (m *QueryLiquidTotalResponse) Reset() { *m = QueryLiquidTotalResponse{} } +func (m *QueryLiquidTotalResponse) String() string { return proto.CompactTextString(m) } +func (*QueryLiquidTotalResponse) ProtoMessage() {} +func (*QueryLiquidTotalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_461504ebf74c9a97, []int{17} +} +func (m *QueryLiquidTotalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLiquidTotalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLiquidTotalResponse.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 *QueryLiquidTotalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLiquidTotalResponse.Merge(m, src) +} +func (m *QueryLiquidTotalResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryLiquidTotalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLiquidTotalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLiquidTotalResponse proto.InternalMessageInfo + +type QueryGetAmmPriceRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Decimal int32 `protobuf:"varint,2,opt,name=decimal,proto3" json:"decimal,omitempty"` +} + +func (m *QueryGetAmmPriceRequest) Reset() { *m = QueryGetAmmPriceRequest{} } +func (m *QueryGetAmmPriceRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetAmmPriceRequest) ProtoMessage() {} +func (*QueryGetAmmPriceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_461504ebf74c9a97, []int{18} +} +func (m *QueryGetAmmPriceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetAmmPriceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetAmmPriceRequest.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 *QueryGetAmmPriceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetAmmPriceRequest.Merge(m, src) +} +func (m *QueryGetAmmPriceRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetAmmPriceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetAmmPriceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetAmmPriceRequest proto.InternalMessageInfo + +func (m *QueryGetAmmPriceRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *QueryGetAmmPriceRequest) GetDecimal() int32 { + if m != nil { + return m.Decimal + } + return 0 +} + +type QueryGetAmmPriceResponse struct { + Total github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=total,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"total"` +} + +func (m *QueryGetAmmPriceResponse) Reset() { *m = QueryGetAmmPriceResponse{} } +func (m *QueryGetAmmPriceResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetAmmPriceResponse) ProtoMessage() {} +func (*QueryGetAmmPriceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_461504ebf74c9a97, []int{19} +} +func (m *QueryGetAmmPriceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetAmmPriceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetAmmPriceResponse.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 *QueryGetAmmPriceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetAmmPriceResponse.Merge(m, src) +} +func (m *QueryGetAmmPriceResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetAmmPriceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetAmmPriceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetAmmPriceResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "elys.tier.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "elys.tier.QueryParamsResponse") @@ -502,58 +915,86 @@ func init() { proto.RegisterType((*QueryCalculateDiscountResponse)(nil), "elys.tier.QueryCalculateDiscountResponse") proto.RegisterType((*QueryLeverageLpTotalRequest)(nil), "elys.tier.QueryLeverageLpTotalRequest") proto.RegisterType((*QueryLeverageLpTotalResponse)(nil), "elys.tier.QueryLeverageLpTotalResponse") + proto.RegisterType((*QueryRewardsTotalRequest)(nil), "elys.tier.QueryRewardsTotalRequest") + proto.RegisterType((*QueryRewardsTotalResponse)(nil), "elys.tier.QueryRewardsTotalResponse") + proto.RegisterType((*QueryStakedPoolRequest)(nil), "elys.tier.QueryStakedPoolRequest") + proto.RegisterType((*QueryStakedPoolResponse)(nil), "elys.tier.QueryStakedPoolResponse") + proto.RegisterType((*QueryPerpetualRequest)(nil), "elys.tier.QueryPerpetualRequest") + proto.RegisterType((*QueryPerpetualResponse)(nil), "elys.tier.QueryPerpetualResponse") + proto.RegisterType((*QueryLiquidTotalRequest)(nil), "elys.tier.QueryLiquidTotalRequest") + proto.RegisterType((*QueryLiquidTotalResponse)(nil), "elys.tier.QueryLiquidTotalResponse") + proto.RegisterType((*QueryGetAmmPriceRequest)(nil), "elys.tier.QueryGetAmmPriceRequest") + proto.RegisterType((*QueryGetAmmPriceResponse)(nil), "elys.tier.QueryGetAmmPriceResponse") } func init() { proto.RegisterFile("elys/tier/query.proto", fileDescriptor_461504ebf74c9a97) } var fileDescriptor_461504ebf74c9a97 = []byte{ - // 723 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0xcf, 0x4f, 0x13, 0x41, - 0x14, 0xc7, 0xbb, 0xfc, 0x68, 0xec, 0x60, 0x24, 0x8c, 0x68, 0x60, 0x85, 0xc5, 0xac, 0x06, 0x0a, - 0x86, 0x1d, 0x28, 0x17, 0x12, 0xa3, 0x11, 0x68, 0xe0, 0xc2, 0x01, 0x1b, 0x4e, 0x5e, 0x9a, 0x69, - 0x19, 0x97, 0x0d, 0xdb, 0x9d, 0x65, 0x67, 0x8a, 0x36, 0x84, 0x8b, 0xde, 0x8d, 0x89, 0x57, 0xc3, - 0x7f, 0xe0, 0xff, 0xc1, 0x91, 0xc4, 0x8b, 0xf1, 0x40, 0x0c, 0xf8, 0x87, 0x98, 0x9d, 0x79, 0xdd, - 0x6e, 0xdb, 0xe5, 0x87, 0xa7, 0xce, 0xbe, 0x79, 0xef, 0xfb, 0x3e, 0xf3, 0x7e, 0xa4, 0xe8, 0x11, - 0xf3, 0x5b, 0x82, 0x48, 0x8f, 0x45, 0xe4, 0xb0, 0xc9, 0xa2, 0x96, 0x13, 0x46, 0x5c, 0x72, 0x5c, - 0x88, 0xcd, 0x4e, 0x6c, 0x36, 0xc7, 0x5d, 0xee, 0x72, 0x65, 0x25, 0xf1, 0x49, 0x3b, 0x98, 0x53, - 0x2e, 0xe7, 0xae, 0xcf, 0x08, 0x0d, 0x3d, 0x42, 0x83, 0x80, 0x4b, 0x2a, 0x3d, 0x1e, 0x08, 0xb8, - 0x5d, 0xa8, 0x73, 0xd1, 0xe0, 0x82, 0xd4, 0xa8, 0x60, 0x5a, 0x97, 0x1c, 0x2d, 0xd7, 0x98, 0xa4, - 0xcb, 0x24, 0xa4, 0xae, 0x17, 0x28, 0x67, 0xf0, 0x7d, 0xdc, 0x21, 0x08, 0x69, 0x44, 0x1b, 0x6d, - 0x8d, 0xc9, 0x94, 0x9d, 0x47, 0xf2, 0x3d, 0xf7, 0x3d, 0x48, 0x6e, 0x8f, 0x23, 0xfc, 0x36, 0x16, - 0xdd, 0x51, 0xfe, 0x15, 0x76, 0xd8, 0x64, 0x42, 0xda, 0x9b, 0xe8, 0x61, 0x97, 0x55, 0x84, 0x3c, - 0x10, 0x0c, 0x13, 0x94, 0xd7, 0xba, 0x13, 0xc6, 0x53, 0xa3, 0x38, 0x52, 0x1a, 0x73, 0x92, 0xb7, - 0x39, 0xda, 0x75, 0x7d, 0xe8, 0xec, 0x62, 0x26, 0x57, 0x01, 0x37, 0x7b, 0x1b, 0x4d, 0x28, 0x9d, - 0x2d, 0x26, 0x77, 0xda, 0x89, 0x21, 0x07, 0xc6, 0x68, 0xa8, 0x29, 0x58, 0xa4, 0xa4, 0x0a, 0x15, - 0x75, 0xc6, 0x53, 0xa8, 0x40, 0x85, 0x60, 0x72, 0xb7, 0x15, 0xb2, 0x89, 0x01, 0x75, 0xd1, 0x31, - 0xd8, 0x65, 0x34, 0x99, 0xa1, 0x06, 0x6c, 0x73, 0x68, 0x54, 0x72, 0x49, 0xfd, 0x6a, 0xf2, 0x42, - 0x50, 0x7e, 0xa0, 0xcc, 0x49, 0x80, 0x5d, 0x03, 0xa6, 0x35, 0xdf, 0xef, 0x63, 0xda, 0x44, 0xa8, - 0x53, 0x54, 0x78, 0xe4, 0xac, 0xa3, 0x3b, 0xe0, 0xc4, 0x1d, 0x70, 0x74, 0x67, 0xa1, 0x03, 0xce, - 0x0e, 0x75, 0x19, 0xc4, 0x56, 0x52, 0x91, 0xf6, 0xa9, 0x01, 0xa8, 0xdd, 0x49, 0x00, 0x75, 0x15, - 0x15, 0xd2, 0x90, 0x83, 0xc5, 0x91, 0xd2, 0x78, 0xba, 0x92, 0xed, 0x3b, 0x28, 0x66, 0xc7, 0x19, - 0x6f, 0x75, 0xf1, 0x0d, 0x28, 0xbe, 0xb9, 0x5b, 0xf9, 0x74, 0xda, 0x2e, 0xc0, 0x15, 0x34, 0xad, - 0xf8, 0x36, 0xa8, 0x5f, 0x6f, 0xfa, 0x54, 0xb2, 0xb2, 0x27, 0xea, 0xbc, 0x19, 0xc8, 0x1b, 0xba, - 0x63, 0x07, 0xc8, 0xba, 0x2e, 0x08, 0x5e, 0x66, 0xa2, 0x7b, 0x7b, 0x60, 0x83, 0xc8, 0xe4, 0x3b, - 0x56, 0x8c, 0x9f, 0x07, 0x6d, 0x55, 0xe7, 0xb8, 0xdf, 0x9d, 0x4a, 0x0c, 0xea, 0x7e, 0x27, 0x06, - 0x7b, 0x19, 0x3d, 0x51, 0xf9, 0xb6, 0xd9, 0x11, 0x8b, 0xa8, 0xcb, 0xb6, 0xc3, 0xdd, 0xb8, 0x95, - 0x37, 0x21, 0xee, 0xa1, 0xa9, 0xec, 0x10, 0x00, 0x2c, 0xa3, 0x61, 0x35, 0x0e, 0x3a, 0x68, 0xdd, - 0x89, 0x0b, 0xfc, 0xfb, 0x62, 0x66, 0xd6, 0xf5, 0xe4, 0x7e, 0xb3, 0xe6, 0xd4, 0x79, 0x83, 0xc0, - 0xbe, 0xe9, 0x9f, 0x45, 0xb1, 0x77, 0x40, 0x64, 0x2b, 0x64, 0xc2, 0x29, 0xb3, 0x7a, 0x45, 0x07, - 0x97, 0x3e, 0xe7, 0xd1, 0xb0, 0x4a, 0x83, 0x5b, 0x28, 0xaf, 0x07, 0x1f, 0x4f, 0xa7, 0x3a, 0xd8, - 0xbf, 0x51, 0xa6, 0x75, 0xdd, 0xb5, 0x06, 0xb3, 0x97, 0x3e, 0xfd, 0xfc, 0xfb, 0x6d, 0x60, 0x01, - 0x17, 0x49, 0xec, 0xb7, 0x18, 0x30, 0xf9, 0x81, 0x47, 0x07, 0xea, 0x83, 0x34, 0x58, 0xa3, 0xc6, - 0x22, 0xb1, 0xef, 0x85, 0xa9, 0xd5, 0xc6, 0xa7, 0x06, 0x2a, 0x24, 0xa3, 0x82, 0x9f, 0xf5, 0xea, - 0x67, 0xac, 0x9c, 0xf9, 0xfc, 0x66, 0x27, 0x40, 0xd9, 0x54, 0x28, 0x6f, 0xf0, 0xeb, 0x3b, 0xa0, - 0xb4, 0x83, 0xc9, 0x71, 0x5c, 0xfe, 0x13, 0x72, 0x9c, 0x6c, 0xeb, 0x09, 0xfe, 0x62, 0xa0, 0xfb, - 0x89, 0xfa, 0x9a, 0xef, 0xf7, 0x33, 0x66, 0xac, 0x60, 0x3f, 0x63, 0xd6, 0x0a, 0xd9, 0x2b, 0x8a, - 0x71, 0x11, 0xbf, 0xf8, 0x0f, 0x46, 0xfc, 0xc3, 0x40, 0x63, 0x7d, 0xb3, 0x8b, 0x8b, 0xbd, 0x09, - 0xaf, 0xdb, 0x09, 0x73, 0xfe, 0x0e, 0x9e, 0xc0, 0xb7, 0xa1, 0xf8, 0x5e, 0xe1, 0x97, 0xb7, 0xf3, - 0xd5, 0xdb, 0x22, 0xd5, 0xf6, 0xaa, 0x40, 0x31, 0xf1, 0x77, 0x03, 0x8d, 0xf6, 0x0c, 0x32, 0x9e, - 0xed, 0x65, 0xc8, 0x5e, 0x0e, 0x73, 0xee, 0x56, 0x3f, 0x20, 0x5d, 0x55, 0xa4, 0x25, 0xbc, 0x94, - 0x41, 0xaa, 0xf8, 0x7c, 0x08, 0xac, 0xfa, 0x61, 0x55, 0x8d, 0x3f, 0xe0, 0xad, 0x6f, 0x9c, 0x5d, - 0x5a, 0xc6, 0xf9, 0xa5, 0x65, 0xfc, 0xb9, 0xb4, 0x8c, 0xaf, 0x57, 0x56, 0xee, 0xfc, 0xca, 0xca, - 0xfd, 0xba, 0xb2, 0x72, 0xef, 0xe6, 0x53, 0xeb, 0xd4, 0xaf, 0xfa, 0x51, 0xeb, 0xaa, 0xad, 0xaa, - 0xe5, 0xd5, 0xdf, 0xd0, 0xca, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x39, 0x78, 0x52, 0x26, 0x3d, - 0x07, 0x00, 0x00, + // 1018 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x97, 0xcf, 0x6f, 0xdc, 0x44, + 0x14, 0xc7, 0xe3, 0xb4, 0x09, 0xec, 0x6c, 0x45, 0xd5, 0x21, 0x2d, 0xa9, 0x49, 0xb7, 0xad, 0x83, + 0x92, 0x34, 0x4d, 0xec, 0x66, 0x83, 0x44, 0x11, 0xe2, 0x47, 0x7e, 0x28, 0x11, 0x52, 0x0e, 0xcb, + 0xd2, 0x13, 0x07, 0x96, 0xd9, 0xdd, 0xc1, 0xb5, 0x62, 0x7b, 0x1c, 0xcf, 0x6c, 0xcb, 0x2a, 0xca, + 0xa5, 0x17, 0x0e, 0x48, 0x80, 0xc4, 0x81, 0x0b, 0xea, 0x7f, 0xc0, 0xff, 0xd1, 0x03, 0x87, 0x4a, + 0x5c, 0x10, 0x87, 0x08, 0x25, 0xfc, 0x21, 0xc8, 0x33, 0xcf, 0x5e, 0x7b, 0xed, 0xf5, 0x2e, 0xd2, + 0x9e, 0xd6, 0x7e, 0xfe, 0xbe, 0xf7, 0x3e, 0x33, 0x6f, 0xe6, 0x3d, 0x2d, 0xba, 0x49, 0xdd, 0x3e, + 0xb7, 0x84, 0x43, 0x43, 0xeb, 0xa4, 0x47, 0xc3, 0xbe, 0x19, 0x84, 0x4c, 0x30, 0x5c, 0x89, 0xcc, + 0x66, 0x64, 0xd6, 0x17, 0x6c, 0x66, 0x33, 0x69, 0xb5, 0xa2, 0x27, 0x25, 0xd0, 0x97, 0x6c, 0xc6, + 0x6c, 0x97, 0x5a, 0x24, 0x70, 0x2c, 0xe2, 0xfb, 0x4c, 0x10, 0xe1, 0x30, 0x9f, 0xc3, 0xd7, 0xf5, + 0x0e, 0xe3, 0x1e, 0xe3, 0x56, 0x9b, 0x70, 0xaa, 0xe2, 0x5a, 0xcf, 0xb6, 0xda, 0x54, 0x90, 0x2d, + 0x2b, 0x20, 0xb6, 0xe3, 0x4b, 0x31, 0x68, 0x6f, 0x0d, 0x08, 0x02, 0x12, 0x12, 0x2f, 0x8e, 0x71, + 0x3b, 0x65, 0x67, 0xa1, 0xf8, 0x96, 0xb9, 0x0e, 0x24, 0x37, 0x16, 0x10, 0xfe, 0x22, 0x0a, 0xda, + 0x90, 0xfa, 0x26, 0x3d, 0xe9, 0x51, 0x2e, 0x8c, 0x03, 0xf4, 0x76, 0xc6, 0xca, 0x03, 0xe6, 0x73, + 0x8a, 0x2d, 0x34, 0xaf, 0xe2, 0x2e, 0x6a, 0xf7, 0xb4, 0xb5, 0x6a, 0xfd, 0x86, 0x99, 0xac, 0xcd, + 0x54, 0xd2, 0xdd, 0xab, 0xaf, 0xce, 0xef, 0xce, 0x34, 0x41, 0x66, 0x1c, 0xa1, 0x45, 0x19, 0xe7, + 0x90, 0x8a, 0x46, 0x9c, 0x18, 0x72, 0x60, 0x8c, 0xae, 0xf6, 0x38, 0x0d, 0x65, 0xa8, 0x4a, 0x53, + 0x3e, 0xe3, 0x25, 0x54, 0x21, 0x9c, 0x53, 0xf1, 0xa4, 0x1f, 0xd0, 0xc5, 0x59, 0xf9, 0x61, 0x60, + 0x30, 0xf6, 0xd1, 0xed, 0x82, 0x68, 0xc0, 0xb6, 0x8a, 0xae, 0x0b, 0x26, 0x88, 0xdb, 0x4a, 0x56, + 0x08, 0x91, 0xdf, 0x92, 0xe6, 0xc4, 0xc1, 0x68, 0x03, 0xd3, 0x8e, 0xeb, 0xe6, 0x98, 0x0e, 0x10, + 0x1a, 0x6c, 0x2a, 0x2c, 0x72, 0xc5, 0x54, 0x15, 0x30, 0xa3, 0x0a, 0x98, 0xaa, 0xb2, 0x50, 0x01, + 0xb3, 0x41, 0x6c, 0x0a, 0xbe, 0xcd, 0x94, 0xa7, 0xf1, 0x52, 0x03, 0xd4, 0x6c, 0x12, 0x40, 0x7d, + 0x8c, 0x2a, 0x69, 0xc8, 0x2b, 0x6b, 0xd5, 0xfa, 0x42, 0x7a, 0x27, 0xe3, 0x6f, 0xb0, 0x99, 0x03, + 0x31, 0x3e, 0xcc, 0xf0, 0xcd, 0x4a, 0xbe, 0xd5, 0xb1, 0x7c, 0x2a, 0x6d, 0x06, 0x70, 0x1b, 0xdd, + 0x91, 0x7c, 0x7b, 0xc4, 0xed, 0xf4, 0x5c, 0x22, 0xe8, 0xbe, 0xc3, 0x3b, 0xac, 0xe7, 0x8b, 0x92, + 0xea, 0x18, 0x3e, 0xaa, 0x8d, 0x72, 0x82, 0x95, 0xe9, 0xe8, 0xcd, 0x2e, 0xd8, 0xc0, 0x33, 0x79, + 0x8f, 0x22, 0x46, 0xcb, 0x83, 0xb2, 0xca, 0xe7, 0xa8, 0xde, 0x83, 0x9d, 0xb8, 0xa2, 0xea, 0x9d, + 0x18, 0x8c, 0x2d, 0xf4, 0xae, 0xcc, 0x77, 0x44, 0x9f, 0xd1, 0x90, 0xd8, 0xf4, 0x28, 0x78, 0x12, + 0x95, 0xb2, 0x0c, 0xb1, 0x8b, 0x96, 0x8a, 0x5d, 0x00, 0x70, 0x1f, 0xcd, 0xc9, 0xe3, 0xa0, 0x9c, + 0x76, 0xcd, 0x68, 0x83, 0xff, 0x3e, 0xbf, 0xbb, 0x62, 0x3b, 0xe2, 0x69, 0xaf, 0x6d, 0x76, 0x98, + 0x67, 0xc1, 0x7d, 0x53, 0x3f, 0x9b, 0xbc, 0x7b, 0x6c, 0x89, 0x7e, 0x40, 0xb9, 0xb9, 0x4f, 0x3b, + 0x4d, 0xe5, 0x6c, 0x98, 0x70, 0x84, 0x9a, 0xf4, 0x39, 0x09, 0xbb, 0x7c, 0x2c, 0x15, 0x81, 0xd3, + 0x90, 0xd5, 0x4f, 0x15, 0x69, 0x03, 0xdd, 0x92, 0x29, 0xbe, 0x14, 0xe4, 0x98, 0x76, 0x1b, 0x8c, + 0x95, 0x02, 0xb5, 0xd0, 0x3b, 0x39, 0xf5, 0x54, 0x71, 0x1e, 0xa2, 0x9b, 0xaa, 0x81, 0xd0, 0x30, + 0xa0, 0xa2, 0x57, 0xbe, 0x3d, 0x5f, 0x03, 0x7b, 0x4a, 0x3c, 0x55, 0x98, 0x4d, 0x58, 0xed, 0x91, + 0x73, 0xd2, 0x73, 0xba, 0x63, 0xab, 0xf5, 0x0d, 0x54, 0x37, 0x23, 0x9f, 0x2a, 0xd0, 0xe7, 0x00, + 0x74, 0x48, 0xc5, 0x8e, 0xe7, 0x35, 0x42, 0xa7, 0x13, 0x77, 0x11, 0xbc, 0x80, 0xe6, 0xba, 0xd4, + 0x67, 0x1e, 0x10, 0xa9, 0x17, 0xbc, 0x88, 0xde, 0xe8, 0xd2, 0x8e, 0xe3, 0x11, 0x57, 0x5e, 0x9f, + 0xb9, 0x66, 0xfc, 0x9a, 0xc0, 0x66, 0x42, 0x4d, 0x13, 0xb6, 0xfe, 0x47, 0x15, 0xcd, 0xc9, 0x14, + 0xb8, 0x8f, 0xe6, 0x55, 0x97, 0xc7, 0x77, 0x52, 0xed, 0x2a, 0x3f, 0x3e, 0xf4, 0xda, 0xa8, 0xcf, + 0x0a, 0xcc, 0x78, 0xf4, 0xe2, 0xcf, 0x7f, 0x7f, 0x99, 0x5d, 0xc7, 0x6b, 0x56, 0xa4, 0xdb, 0xf4, + 0xa9, 0x78, 0xce, 0xc2, 0x63, 0xf9, 0x62, 0x79, 0xd4, 0x6b, 0xd3, 0x90, 0x3f, 0x75, 0x82, 0xd4, + 0x1c, 0xc3, 0x2f, 0x35, 0x54, 0x49, 0xfa, 0x22, 0x5e, 0x1e, 0x8e, 0x5f, 0x30, 0x5f, 0xf4, 0xf7, + 0xca, 0x45, 0x80, 0x72, 0x20, 0x51, 0x3e, 0xc3, 0x9f, 0x4c, 0x80, 0x12, 0x3b, 0x5b, 0xa7, 0xd1, + 0x39, 0x39, 0xb3, 0x4e, 0x93, 0xd1, 0x74, 0x86, 0x7f, 0xd4, 0xd0, 0xb5, 0x24, 0xfa, 0x8e, 0xeb, + 0xe6, 0x19, 0x0b, 0xe6, 0x4d, 0x9e, 0xb1, 0x68, 0x5e, 0x18, 0xdb, 0x92, 0x71, 0x13, 0x3f, 0xfc, + 0x1f, 0x8c, 0xf8, 0x77, 0x0d, 0xdd, 0xc8, 0x35, 0x6a, 0xbc, 0x36, 0x9c, 0x70, 0xd4, 0x00, 0xd0, + 0x1f, 0x4c, 0xa0, 0x04, 0xbe, 0x3d, 0xc9, 0xf7, 0x31, 0xfe, 0x68, 0x3c, 0x5f, 0x27, 0x0e, 0xd2, + 0x8a, 0xe7, 0x02, 0x6c, 0x26, 0xfe, 0x4d, 0x43, 0xd7, 0x87, 0xba, 0x36, 0x5e, 0x19, 0x66, 0x28, + 0x9e, 0x04, 0xfa, 0xea, 0x58, 0x1d, 0x90, 0x3e, 0x96, 0xa4, 0x75, 0xfc, 0xa8, 0x80, 0x54, 0xf2, + 0xb9, 0xe0, 0xd8, 0x72, 0x83, 0x96, 0x3c, 0xfe, 0x31, 0xde, 0x4f, 0x1a, 0xba, 0x96, 0x6e, 0xdf, + 0xf9, 0xfa, 0x16, 0x0c, 0x83, 0x7c, 0x7d, 0x8b, 0x26, 0x80, 0xf1, 0xbe, 0xa4, 0x32, 0xf1, 0xc6, + 0x28, 0xaa, 0x50, 0x79, 0x65, 0x89, 0xbe, 0xd7, 0x10, 0x1a, 0xf4, 0x6f, 0x7c, 0x7f, 0x38, 0x55, + 0x6e, 0x12, 0xe8, 0x46, 0x99, 0x04, 0x58, 0xea, 0x92, 0x65, 0x03, 0xaf, 0x8f, 0x62, 0xe1, 0xd2, + 0xa7, 0x15, 0x30, 0x96, 0x90, 0xbc, 0x88, 0x2e, 0x67, 0xdc, 0xbb, 0xf1, 0xbd, 0xdc, 0xe5, 0x1f, + 0x9a, 0x01, 0xfa, 0xfd, 0x12, 0xc5, 0x04, 0x1d, 0x42, 0x1d, 0xf4, 0xd8, 0x25, 0x86, 0xf8, 0x41, + 0x43, 0xd5, 0x54, 0xc7, 0xc6, 0xb9, 0xc5, 0xe6, 0xbb, 0xbf, 0xbe, 0x5c, 0xaa, 0x99, 0xe0, 0xf6, + 0xa9, 0x33, 0x23, 0x9d, 0xb2, 0xc5, 0xf9, 0x55, 0x43, 0xd5, 0x54, 0x4b, 0xce, 0xd3, 0xe4, 0x5b, + 0xbf, 0xbe, 0x5c, 0xaa, 0x01, 0x9a, 0x4f, 0x25, 0xcd, 0x87, 0xf8, 0x83, 0x51, 0x34, 0x36, 0x15, + 0x2d, 0xe2, 0x79, 0xad, 0x20, 0x72, 0xb3, 0x4e, 0xe5, 0xfc, 0x38, 0x8b, 0x7e, 0xe5, 0xbc, 0x38, + 0xdb, 0xdd, 0x7b, 0x75, 0x51, 0xd3, 0x5e, 0x5f, 0xd4, 0xb4, 0x7f, 0x2e, 0x6a, 0xda, 0xcf, 0x97, + 0xb5, 0x99, 0xd7, 0x97, 0xb5, 0x99, 0xbf, 0x2e, 0x6b, 0x33, 0x5f, 0x3d, 0x48, 0xcd, 0x85, 0x7c, + 0xf0, 0xef, 0x54, 0x78, 0x39, 0x1e, 0xda, 0xf3, 0xf2, 0xcf, 0xc3, 0xf6, 0x7f, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x06, 0x10, 0x42, 0xea, 0xf3, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -577,6 +1018,16 @@ type QueryClient interface { CalculateDiscount(ctx context.Context, in *QueryCalculateDiscountRequest, opts ...grpc.CallOption) (*QueryCalculateDiscountResponse, error) // Queries a list of LeverageLpTotal items. LeverageLpTotal(ctx context.Context, in *QueryLeverageLpTotalRequest, opts ...grpc.CallOption) (*QueryLeverageLpTotalResponse, error) + // Queries a list of RewardsTotal items. + RewardsTotal(ctx context.Context, in *QueryRewardsTotalRequest, opts ...grpc.CallOption) (*QueryRewardsTotalResponse, error) + // Queries a list of StakedPool items. + StakedPool(ctx context.Context, in *QueryStakedPoolRequest, opts ...grpc.CallOption) (*QueryStakedPoolResponse, error) + // Queries a list of Perpetual items. + Perpetual(ctx context.Context, in *QueryPerpetualRequest, opts ...grpc.CallOption) (*QueryPerpetualResponse, error) + // Queries a list of LiquidTotal items. + LiquidTotal(ctx context.Context, in *QueryLiquidTotalRequest, opts ...grpc.CallOption) (*QueryLiquidTotalResponse, error) + // Queries a list of GetAmmPrice items. + GetAmmPrice(ctx context.Context, in *QueryGetAmmPriceRequest, opts ...grpc.CallOption) (*QueryGetAmmPriceResponse, error) } type queryClient struct { @@ -632,10 +1083,55 @@ func (c *queryClient) LeverageLpTotal(ctx context.Context, in *QueryLeverageLpTo return out, nil } -// QueryServer is the server API for Query service. -type QueryServer interface { - // Parameters queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +func (c *queryClient) RewardsTotal(ctx context.Context, in *QueryRewardsTotalRequest, opts ...grpc.CallOption) (*QueryRewardsTotalResponse, error) { + out := new(QueryRewardsTotalResponse) + err := c.cc.Invoke(ctx, "/elys.tier.Query/RewardsTotal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) StakedPool(ctx context.Context, in *QueryStakedPoolRequest, opts ...grpc.CallOption) (*QueryStakedPoolResponse, error) { + out := new(QueryStakedPoolResponse) + err := c.cc.Invoke(ctx, "/elys.tier.Query/StakedPool", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Perpetual(ctx context.Context, in *QueryPerpetualRequest, opts ...grpc.CallOption) (*QueryPerpetualResponse, error) { + out := new(QueryPerpetualResponse) + err := c.cc.Invoke(ctx, "/elys.tier.Query/Perpetual", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) LiquidTotal(ctx context.Context, in *QueryLiquidTotalRequest, opts ...grpc.CallOption) (*QueryLiquidTotalResponse, error) { + out := new(QueryLiquidTotalResponse) + err := c.cc.Invoke(ctx, "/elys.tier.Query/LiquidTotal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetAmmPrice(ctx context.Context, in *QueryGetAmmPriceRequest, opts ...grpc.CallOption) (*QueryGetAmmPriceResponse, error) { + out := new(QueryGetAmmPriceResponse) + err := c.cc.Invoke(ctx, "/elys.tier.Query/GetAmmPrice", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // Queries a list of Portfolio items. Portfolio(context.Context, *QueryGetPortfolioRequest) (*QueryGetPortfolioResponse, error) PortfolioAll(context.Context, *QueryAllPortfolioRequest) (*QueryAllPortfolioResponse, error) @@ -643,6 +1139,16 @@ type QueryServer interface { CalculateDiscount(context.Context, *QueryCalculateDiscountRequest) (*QueryCalculateDiscountResponse, error) // Queries a list of LeverageLpTotal items. LeverageLpTotal(context.Context, *QueryLeverageLpTotalRequest) (*QueryLeverageLpTotalResponse, error) + // Queries a list of RewardsTotal items. + RewardsTotal(context.Context, *QueryRewardsTotalRequest) (*QueryRewardsTotalResponse, error) + // Queries a list of StakedPool items. + StakedPool(context.Context, *QueryStakedPoolRequest) (*QueryStakedPoolResponse, error) + // Queries a list of Perpetual items. + Perpetual(context.Context, *QueryPerpetualRequest) (*QueryPerpetualResponse, error) + // Queries a list of LiquidTotal items. + LiquidTotal(context.Context, *QueryLiquidTotalRequest) (*QueryLiquidTotalResponse, error) + // Queries a list of GetAmmPrice items. + GetAmmPrice(context.Context, *QueryGetAmmPriceRequest) (*QueryGetAmmPriceResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -664,6 +1170,21 @@ func (*UnimplementedQueryServer) CalculateDiscount(ctx context.Context, req *Que func (*UnimplementedQueryServer) LeverageLpTotal(ctx context.Context, req *QueryLeverageLpTotalRequest) (*QueryLeverageLpTotalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method LeverageLpTotal not implemented") } +func (*UnimplementedQueryServer) RewardsTotal(ctx context.Context, req *QueryRewardsTotalRequest) (*QueryRewardsTotalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RewardsTotal not implemented") +} +func (*UnimplementedQueryServer) StakedPool(ctx context.Context, req *QueryStakedPoolRequest) (*QueryStakedPoolResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StakedPool not implemented") +} +func (*UnimplementedQueryServer) Perpetual(ctx context.Context, req *QueryPerpetualRequest) (*QueryPerpetualResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Perpetual not implemented") +} +func (*UnimplementedQueryServer) LiquidTotal(ctx context.Context, req *QueryLiquidTotalRequest) (*QueryLiquidTotalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LiquidTotal not implemented") +} +func (*UnimplementedQueryServer) GetAmmPrice(ctx context.Context, req *QueryGetAmmPriceRequest) (*QueryGetAmmPriceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAmmPrice not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -759,6 +1280,96 @@ func _Query_LeverageLpTotal_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Query_RewardsTotal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRewardsTotalRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RewardsTotal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.tier.Query/RewardsTotal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RewardsTotal(ctx, req.(*QueryRewardsTotalRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_StakedPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryStakedPoolRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).StakedPool(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.tier.Query/StakedPool", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).StakedPool(ctx, req.(*QueryStakedPoolRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Perpetual_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPerpetualRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Perpetual(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.tier.Query/Perpetual", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Perpetual(ctx, req.(*QueryPerpetualRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_LiquidTotal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryLiquidTotalRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).LiquidTotal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.tier.Query/LiquidTotal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LiquidTotal(ctx, req.(*QueryLiquidTotalRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetAmmPrice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetAmmPriceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAmmPrice(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/elys.tier.Query/GetAmmPrice", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAmmPrice(ctx, req.(*QueryGetAmmPriceRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "elys.tier.Query", HandlerType: (*QueryServer)(nil), @@ -783,6 +1394,26 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "LeverageLpTotal", Handler: _Query_LeverageLpTotal_Handler, }, + { + MethodName: "RewardsTotal", + Handler: _Query_RewardsTotal_Handler, + }, + { + MethodName: "StakedPool", + Handler: _Query_StakedPool_Handler, + }, + { + MethodName: "Perpetual", + Handler: _Query_Perpetual_Handler, + }, + { + MethodName: "LiquidTotal", + Handler: _Query_LiquidTotal_Handler, + }, + { + MethodName: "GetAmmPrice", + Handler: _Query_GetAmmPrice_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "elys/tier/query.proto", @@ -1132,164 +1763,1452 @@ func (m *QueryLeverageLpTotalResponse) MarshalToSizedBuffer(dAtA []byte) (int, e 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 +func (m *QueryRewardsTotalRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -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 *QueryRewardsTotalRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetPortfolioRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryRewardsTotalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.User) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.AssetType) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintQuery(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryGetPortfolioResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.TotalPortfolio) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryRewardsTotalResponse) 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 n + return dAtA[:n], nil } -func (m *QueryAllPortfolioRequest) 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 *QueryRewardsTotalResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllPortfolioResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryRewardsTotalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Portfolio) > 0 { - for _, e := range m.Portfolio { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + { + size := m.Total.Size() + i -= size + if _, err := m.Total.MarshalTo(dAtA[i:]); err != nil { + return 0, err } + i = encodeVarintQuery(dAtA, i, uint64(size)) } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *QueryCalculateDiscountRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryStakedPoolRequest) 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 *QueryStakedPoolRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStakedPoolRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.User) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintQuery(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryCalculateDiscountResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Discount) +func (m *QueryStakedPoolResponse) 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 *QueryStakedPoolResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStakedPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Total.Size() + i -= size + if _, err := m.Total.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryPerpetualRequest) 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 *QueryPerpetualRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPerpetualRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintQuery(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryPerpetualResponse) 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 *QueryPerpetualResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPerpetualResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Total.Size() + i -= size + if _, err := m.Total.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryLiquidTotalRequest) 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 *QueryLiquidTotalRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLiquidTotalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintQuery(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryLiquidTotalResponse) 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 *QueryLiquidTotalResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLiquidTotalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Total.Size() + i -= size + if _, err := m.Total.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryGetAmmPriceRequest) 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 *QueryGetAmmPriceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetAmmPriceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Decimal != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Decimal)) + i-- + dAtA[i] = 0x10 + } + 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 *QueryGetAmmPriceResponse) 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 *QueryGetAmmPriceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetAmmPriceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Total.Size() + i -= size + if _, err := m.Total.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *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 *QueryGetPortfolioRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.User) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.Tier) + l = len(m.AssetType) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.Portfolio) + return n +} + +func (m *QueryGetPortfolioResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TotalPortfolio) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - return n -} + return n +} + +func (m *QueryAllPortfolioRequest) 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 *QueryAllPortfolioResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Portfolio) > 0 { + for _, e := range m.Portfolio { + 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 *QueryCalculateDiscountRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.User) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCalculateDiscountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Discount) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Tier) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Portfolio) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryLeverageLpTotalRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.User) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryLeverageLpTotalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Total.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryRewardsTotalRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.User) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRewardsTotalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Total.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryStakedPoolRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.User) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryStakedPoolResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Total.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryPerpetualRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.User) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPerpetualResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Total.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryLiquidTotalRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.User) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryLiquidTotalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Total.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetAmmPriceRequest) 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.Decimal != 0 { + n += 1 + sovQuery(uint64(m.Decimal)) + } + return n +} + +func (m *QueryGetAmmPriceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Total.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *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 *QueryGetPortfolioRequest) 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: QueryGetPortfolioRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetPortfolioRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field User", 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.User = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AssetType", 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.AssetType = 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 *QueryGetPortfolioResponse) 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: QueryGetPortfolioResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetPortfolioResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalPortfolio", 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.TotalPortfolio = 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 *QueryAllPortfolioRequest) 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: QueryAllPortfolioRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllPortfolioRequest: 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 *QueryAllPortfolioResponse) 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: QueryAllPortfolioResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllPortfolioResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Portfolio", 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.Portfolio = append(m.Portfolio, Portfolio{}) + if err := m.Portfolio[len(m.Portfolio)-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 *QueryCalculateDiscountRequest) 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: QueryCalculateDiscountRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCalculateDiscountRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field User", 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.User = 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 *QueryCalculateDiscountResponse) 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: QueryCalculateDiscountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCalculateDiscountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Discount", 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.Discount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tier", 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.Tier = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Portfolio", 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.Portfolio = 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 + } + } -func (m *QueryLeverageLpTotalRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.User) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if iNdEx > l { + return io.ErrUnexpectedEOF } - return n + return nil } - -func (m *QueryLeverageLpTotalResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryLeverageLpTotalRequest) 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: QueryLeverageLpTotalRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLeverageLpTotalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field User", 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.User = 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 + } } - var l int - _ = l - l = m.Total.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryLeverageLpTotalResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1312,12 +3231,46 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryLeverageLpTotalResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryLeverageLpTotalResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Total", 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 + } + if err := m.Total.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -1339,7 +3292,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryRewardsTotalRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1362,17 +3315,17 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRewardsTotalRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRewardsTotalRequest: 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) + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1382,24 +3335,23 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.User = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1422,7 +3374,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetPortfolioRequest) Unmarshal(dAtA []byte) error { +func (m *QueryRewardsTotalResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1445,15 +3397,15 @@ func (m *QueryGetPortfolioRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetPortfolioRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRewardsTotalResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetPortfolioRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRewardsTotalResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1481,39 +3433,9 @@ func (m *QueryGetPortfolioRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.User = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetType", 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 + if err := m.Total.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.AssetType = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1536,7 +3458,7 @@ func (m *QueryGetPortfolioRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetPortfolioResponse) Unmarshal(dAtA []byte) error { +func (m *QueryStakedPoolRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1559,15 +3481,15 @@ func (m *QueryGetPortfolioResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetPortfolioResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryStakedPoolRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetPortfolioResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryStakedPoolRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalPortfolio", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1595,7 +3517,7 @@ func (m *QueryGetPortfolioResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TotalPortfolio = string(dAtA[iNdEx:postIndex]) + m.User = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1618,7 +3540,7 @@ func (m *QueryGetPortfolioResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllPortfolioRequest) Unmarshal(dAtA []byte) error { +func (m *QueryStakedPoolResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1641,17 +3563,17 @@ func (m *QueryAllPortfolioRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllPortfolioRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryStakedPoolResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllPortfolioRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryStakedPoolResponse: 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) + return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1661,25 +3583,23 @@ func (m *QueryAllPortfolioRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen 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 { + if err := m.Total.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1704,7 +3624,7 @@ func (m *QueryAllPortfolioRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllPortfolioResponse) Unmarshal(dAtA []byte) error { +func (m *QueryPerpetualRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1727,51 +3647,17 @@ func (m *QueryAllPortfolioResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllPortfolioResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryPerpetualRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllPortfolioResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryPerpetualRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Portfolio", 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.Portfolio = append(m.Portfolio, Portfolio{}) - if err := m.Portfolio[len(m.Portfolio)-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) + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1781,27 +3667,23 @@ func (m *QueryAllPortfolioResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen 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 - } + m.User = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1824,7 +3706,7 @@ func (m *QueryAllPortfolioResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCalculateDiscountRequest) Unmarshal(dAtA []byte) error { +func (m *QueryPerpetualResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1847,15 +3729,15 @@ func (m *QueryCalculateDiscountRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCalculateDiscountRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryPerpetualResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCalculateDiscountRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryPerpetualResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1883,7 +3765,9 @@ func (m *QueryCalculateDiscountRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.User = string(dAtA[iNdEx:postIndex]) + if err := m.Total.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -1906,7 +3790,7 @@ func (m *QueryCalculateDiscountRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCalculateDiscountResponse) Unmarshal(dAtA []byte) error { +func (m *QueryLiquidTotalRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1929,15 +3813,15 @@ func (m *QueryCalculateDiscountResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCalculateDiscountResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryLiquidTotalRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCalculateDiscountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryLiquidTotalRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Discount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1965,43 +3849,61 @@ func (m *QueryCalculateDiscountResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Discount = string(dAtA[iNdEx:postIndex]) + m.User = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tier", 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 - } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLiquidTotalResponse) 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 } - m.Tier = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: + 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: QueryLiquidTotalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLiquidTotalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Portfolio", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2029,7 +3931,9 @@ func (m *QueryCalculateDiscountResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Portfolio = string(dAtA[iNdEx:postIndex]) + if err := m.Total.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -2052,7 +3956,7 @@ func (m *QueryCalculateDiscountResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryLeverageLpTotalRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetAmmPriceRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2075,15 +3979,15 @@ func (m *QueryLeverageLpTotalRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryLeverageLpTotalRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetAmmPriceRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLeverageLpTotalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetAmmPriceRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2111,8 +4015,27 @@ func (m *QueryLeverageLpTotalRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.User = string(dAtA[iNdEx:postIndex]) + m.Denom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Decimal", wireType) + } + m.Decimal = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Decimal |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -2134,7 +4057,7 @@ func (m *QueryLeverageLpTotalRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryLeverageLpTotalResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetAmmPriceResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2157,10 +4080,10 @@ func (m *QueryLeverageLpTotalResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryLeverageLpTotalResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetAmmPriceResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLeverageLpTotalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetAmmPriceResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/tier/types/query.pb.gw.go b/x/tier/types/query.pb.gw.go index 3cc04ef61..1a2e68e4f 100644 --- a/x/tier/types/query.pb.gw.go +++ b/x/tier/types/query.pb.gw.go @@ -271,6 +271,298 @@ func local_request_Query_LeverageLpTotal_0(ctx context.Context, marshaler runtim } +func request_Query_RewardsTotal_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRewardsTotalRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["user"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user") + } + + protoReq.User, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user", err) + } + + msg, err := client.RewardsTotal(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RewardsTotal_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRewardsTotalRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["user"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user") + } + + protoReq.User, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user", err) + } + + msg, err := server.RewardsTotal(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_StakedPool_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStakedPoolRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["user"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user") + } + + protoReq.User, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user", err) + } + + msg, err := client.StakedPool(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_StakedPool_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStakedPoolRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["user"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user") + } + + protoReq.User, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user", err) + } + + msg, err := server.StakedPool(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Perpetual_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPerpetualRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["user"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user") + } + + protoReq.User, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user", err) + } + + msg, err := client.Perpetual(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Perpetual_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPerpetualRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["user"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user") + } + + protoReq.User, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user", err) + } + + msg, err := server.Perpetual(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_LiquidTotal_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLiquidTotalRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["user"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user") + } + + protoReq.User, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user", err) + } + + msg, err := client.LiquidTotal(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_LiquidTotal_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLiquidTotalRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["user"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user") + } + + protoReq.User, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user", err) + } + + msg, err := server.LiquidTotal(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetAmmPrice_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetAmmPriceRequest + 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) + } + + val, ok = pathParams["decimal"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "decimal") + } + + protoReq.Decimal, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "decimal", err) + } + + msg, err := client.GetAmmPrice(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetAmmPrice_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetAmmPriceRequest + 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) + } + + val, ok = pathParams["decimal"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "decimal") + } + + protoReq.Decimal, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "decimal", err) + } + + msg, err := server.GetAmmPrice(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. @@ -392,6 +684,121 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_RewardsTotal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_RewardsTotal_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RewardsTotal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_StakedPool_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_StakedPool_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_StakedPool_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Perpetual_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Perpetual_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Perpetual_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LiquidTotal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_LiquidTotal_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LiquidTotal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAmmPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetAmmPrice_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetAmmPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -533,6 +940,106 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_RewardsTotal_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_RewardsTotal_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_RewardsTotal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_StakedPool_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_StakedPool_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_StakedPool_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Perpetual_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_Perpetual_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_Perpetual_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LiquidTotal_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_LiquidTotal_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_LiquidTotal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAmmPrice_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_GetAmmPrice_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_GetAmmPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -546,6 +1053,16 @@ var ( pattern_Query_CalculateDiscount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"elys-network", "elys", "membershiptier", "calculate_discount", "user"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_LeverageLpTotal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"elys-network", "elys", "tier", "leverage_lp_total", "user"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_RewardsTotal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"elys-network", "elys", "tier", "rewards_total", "user"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_StakedPool_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"elys-network", "elys", "tier", "staked_pool", "user"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Perpetual_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"elys-network", "elys", "tier", "perpetual", "user"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_LiquidTotal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"elys-network", "elys", "tier", "liquid_total", "user"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetAmmPrice_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{"elys-network", "elys", "tier", "get_amm_price", "denom", "decimal"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -558,4 +1075,14 @@ var ( forward_Query_CalculateDiscount_0 = runtime.ForwardResponseMessage forward_Query_LeverageLpTotal_0 = runtime.ForwardResponseMessage + + forward_Query_RewardsTotal_0 = runtime.ForwardResponseMessage + + forward_Query_StakedPool_0 = runtime.ForwardResponseMessage + + forward_Query_Perpetual_0 = runtime.ForwardResponseMessage + + forward_Query_LiquidTotal_0 = runtime.ForwardResponseMessage + + forward_Query_GetAmmPrice_0 = runtime.ForwardResponseMessage )