diff --git a/proto/elys/amm/query.proto b/proto/elys/amm/query.proto index c3a718c29..45c711034 100644 --- a/proto/elys/amm/query.proto +++ b/proto/elys/amm/query.proto @@ -133,11 +133,15 @@ message QueryAllDenomLiquidityResponse { message QuerySwapEstimationRequest { repeated SwapAmountInRoute routes = 1; cosmos.base.v1beta1.Coin token_in = 2 [(gogoproto.nullable) = false]; + string discount = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; } message QuerySwapEstimationResponse { string spot_price = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; cosmos.base.v1beta1.Coin token_out = 2 [(gogoproto.nullable) = false ] ; + string swapFee = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string discount = 4 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin available_liquidity = 5 [(gogoproto.nullable) = false ] ; } message QuerySlippageTrackRequest { @@ -185,6 +189,7 @@ message QuerySwapEstimationByDenomRequest { cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; string denom_in = 2; string denom_out = 3; + string discount = 4 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; } message QuerySwapEstimationByDenomResponse { @@ -192,8 +197,12 @@ message QuerySwapEstimationByDenomResponse { repeated SwapAmountOutRoute out_route = 2; string spot_price = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; cosmos.base.v1beta1.Coin amount = 4 [(gogoproto.nullable) = false]; + string swapFee = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string discount = 6 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin available_liquidity = 7 [(gogoproto.nullable) = false ] ; } message QueryAMMPriceRequest { cosmos.base.v1beta1.Coin token_in = 1 [(gogoproto.nullable) = false]; + string discount = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; } diff --git a/proto/elys/amm/tx.proto b/proto/elys/amm/tx.proto index 6c4a2bc98..8b65103f7 100644 --- a/proto/elys/amm/tx.proto +++ b/proto/elys/amm/tx.proto @@ -68,7 +68,8 @@ message MsgSwapExactAmountIn { message MsgSwapExactAmountInResponse { string token_out_amount = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; - string discount = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string swap_fee = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string discount = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; } message MsgSwapExactAmountOut { @@ -81,7 +82,8 @@ message MsgSwapExactAmountOut { message MsgSwapExactAmountOutResponse { string token_in_amount = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; - string discount = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string swap_fee = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string discount = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; } message MsgFeedMultipleExternalLiquidity { @@ -118,5 +120,6 @@ message MsgSwapByDenomResponse { repeated SwapAmountInRoute in_route = 2; repeated SwapAmountOutRoute out_route = 3; string spot_price = 4 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; - string discount = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string swap_fee = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string discount = 6 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; } diff --git a/x/amm/client/cli/query_swap_estimation.go b/x/amm/client/cli/query_swap_estimation.go index a4e783662..5e45396e2 100644 --- a/x/amm/client/cli/query_swap_estimation.go +++ b/x/amm/client/cli/query_swap_estimation.go @@ -40,6 +40,15 @@ func CmdSwapEstimation() *cobra.Command { }) } + discountStr, err := cmd.Flags().GetString(FlagDiscount) + if err != nil { + return err + } + discount, err := sdk.NewDecFromStr(discountStr) + if err != nil { + return err + } + clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err @@ -48,8 +57,9 @@ func CmdSwapEstimation() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) params := &types.QuerySwapEstimationRequest{ - Routes: reqRoutes, - TokenIn: reqTokenIn, + Routes: reqRoutes, + TokenIn: reqTokenIn, + Discount: discount, } res, err := queryClient.SwapEstimation(cmd.Context(), params) @@ -63,5 +73,7 @@ func CmdSwapEstimation() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) + cmd.Flags().String(FlagDiscount, "0.0", "discount to apply to the swap fee") + return cmd } diff --git a/x/amm/client/cli/query_swap_estimation_by_denom.go b/x/amm/client/cli/query_swap_estimation_by_denom.go index f4f0bfe6e..da4f080ff 100644 --- a/x/amm/client/cli/query_swap_estimation_by_denom.go +++ b/x/amm/client/cli/query_swap_estimation_by_denom.go @@ -26,6 +26,15 @@ func CmdSwapEstimationByDenom() *cobra.Command { reqDenomIn := args[1] reqDenomOut := args[2] + discountStr, err := cmd.Flags().GetString(FlagDiscount) + if err != nil { + return err + } + discount, err := sdk.NewDecFromStr(discountStr) + if err != nil { + return err + } + clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err @@ -34,10 +43,10 @@ func CmdSwapEstimationByDenom() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) params := &types.QuerySwapEstimationByDenomRequest{ - Amount: reqAmount, DenomIn: reqDenomIn, DenomOut: reqDenomOut, + Discount: discount, } res, err := queryClient.SwapEstimationByDenom(cmd.Context(), params) @@ -51,5 +60,7 @@ func CmdSwapEstimationByDenom() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) + cmd.Flags().String(FlagDiscount, "0.0", "discount to apply to the swap fee") + return cmd } diff --git a/x/amm/client/wasm/query_amm_price_by_denom.go b/x/amm/client/wasm/query_amm_price_by_denom.go index 08bd0c465..5314e7582 100644 --- a/x/amm/client/wasm/query_amm_price_by_denom.go +++ b/x/amm/client/wasm/query_amm_price_by_denom.go @@ -36,8 +36,9 @@ func (oq *Querier) queryAmmPriceByDenom(ctx sdk.Context, query *ammtypes.QueryAM routes := resp.InRoute tokenIn := query.TokenIn + discount := query.Discount - spotPrice, _, err := oq.keeper.CalcInRouteSpotPrice(ctx, tokenIn, routes) + spotPrice, _, _, _, _, err := oq.keeper.CalcInRouteSpotPrice(ctx, tokenIn, routes, discount) if err != nil { return nil, errorsmod.Wrap(err, "failed to get in route by denom") } diff --git a/x/amm/keeper/abci.go b/x/amm/keeper/abci.go index 08ba8304d..c0c020b7d 100644 --- a/x/amm/keeper/abci.go +++ b/x/amm/keeper/abci.go @@ -28,7 +28,7 @@ func (k Keeper) ApplySwapRequest(ctx sdk.Context, msg sdk.Msg) error { if err != nil { return err } - _, err = k.RouteExactAmountIn(ctx, sender, msg.Routes, msg.TokenIn, math.Int(msg.TokenOutMinAmount), msg.Discount) + _, _, _, err = k.RouteExactAmountIn(ctx, sender, msg.Routes, msg.TokenIn, math.Int(msg.TokenOutMinAmount), msg.Discount) if err != nil { return err } @@ -38,7 +38,7 @@ func (k Keeper) ApplySwapRequest(ctx sdk.Context, msg sdk.Msg) error { if err != nil { return err } - _, err = k.RouteExactAmountOut(ctx, sender, msg.Routes, msg.TokenInMaxAmount, msg.TokenOut, msg.Discount) + _, _, _, err = k.RouteExactAmountOut(ctx, sender, msg.Routes, msg.TokenInMaxAmount, msg.TokenOut, msg.Discount) if err != nil { return err } diff --git a/x/amm/keeper/calc_in_route_spot_price.go b/x/amm/keeper/calc_in_route_spot_price.go index 32a758108..b10f95153 100644 --- a/x/amm/keeper/calc_in_route_spot_price.go +++ b/x/amm/keeper/calc_in_route_spot_price.go @@ -6,9 +6,9 @@ import ( ) // CalcInRouteSpotPrice calculates the spot price of the given token and in route -func (k Keeper) CalcInRouteSpotPrice(ctx sdk.Context, tokenIn sdk.Coin, routes []*types.SwapAmountInRoute) (sdk.Dec, sdk.Coin, error) { +func (k Keeper) CalcInRouteSpotPrice(ctx sdk.Context, tokenIn sdk.Coin, routes []*types.SwapAmountInRoute, discount sdk.Dec) (sdk.Dec, sdk.Coin, sdk.Dec, sdk.Dec, sdk.Coin, error) { if routes == nil || len(routes) == 0 { - return sdk.ZeroDec(), sdk.Coin{}, types.ErrEmptyRoutes + return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, types.ErrEmptyRoutes } // Start with the initial token input @@ -17,29 +17,54 @@ func (k Keeper) CalcInRouteSpotPrice(ctx sdk.Context, tokenIn sdk.Coin, routes [ // The final token out denom var tokenOutDenom string + // Initialize the total discounted swap fee + totalDiscountedSwapFee := sdk.ZeroDec() + + // Track the total available liquidity in the pool for final token out denom + var availableLiquidity sdk.Coin + for _, route := range routes { poolId := route.PoolId tokenOutDenom = route.TokenOutDenom pool, found := k.GetPool(ctx, poolId) if !found { - return sdk.ZeroDec(), sdk.Coin{}, types.ErrPoolNotFound + return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, types.ErrPoolNotFound + } + + // Get Pool swap fee + swapFee := pool.GetPoolParams().SwapFee + + // Apply discount to swap fee if applicable + swapFee, _, err := k.ApplyDiscount(ctx, swapFee, discount, k.BrokerAddress(ctx)) + if err != nil { + return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, err } + // Calculate the total discounted swap fee + totalDiscountedSwapFee = totalDiscountedSwapFee.Add(swapFee) + // Estimate swap snapshot := k.GetPoolSnapshotOrSet(ctx, pool) - swapResult, err := k.CalcOutAmtGivenIn(ctx, pool.PoolId, k.oracleKeeper, &snapshot, tokensIn, tokenOutDenom, sdk.ZeroDec()) + swapResult, err := k.CalcOutAmtGivenIn(ctx, pool.PoolId, k.oracleKeeper, &snapshot, tokensIn, tokenOutDenom, swapFee) if err != nil { - return sdk.ZeroDec(), sdk.Coin{}, err + return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, err } if swapResult.IsZero() { - return sdk.ZeroDec(), sdk.Coin{}, types.ErrAmountTooLow + return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, types.ErrAmountTooLow } // Use the current swap result as the input for the next iteration tokensIn = sdk.Coins{swapResult} + + // Get the available liquidity for the final token out denom + _, poolAsset, err := pool.GetPoolAssetAndIndex(tokenOutDenom) + if err != nil { + return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, err + } + availableLiquidity = poolAsset.Token } // Calculate the spot price given the initial token in and the final token out @@ -51,5 +76,5 @@ func (k Keeper) CalcInRouteSpotPrice(ctx sdk.Context, tokenIn sdk.Coin, routes [ // Construct the token out coin tokenOut := sdk.NewCoin(tokenOutDenom, tokenOutAmt.TruncateInt()) - return spotPrice, tokenOut, nil + return spotPrice, tokenOut, totalDiscountedSwapFee, discount, availableLiquidity, nil } diff --git a/x/amm/keeper/calc_in_route_spot_price_test.go b/x/amm/keeper/calc_in_route_spot_price_test.go index 0624ce351..e0be32dd8 100644 --- a/x/amm/keeper/calc_in_route_spot_price_test.go +++ b/x/amm/keeper/calc_in_route_spot_price_test.go @@ -20,7 +20,7 @@ func TestCalcInRouteSpotPrice(t *testing.T) { accountedPoolKeeper.On("GetAccountedBalance", ctx, uint64(1), "denom1").Return(sdk.NewInt(1000)) accountedPoolKeeper.On("GetAccountedBalance", ctx, uint64(1), "denom2").Return(sdk.NewInt(1000)) routes := []*types.SwapAmountInRoute{{PoolId: 1, TokenOutDenom: "denom2"}} - spotPrice, _, err := k.CalcInRouteSpotPrice(ctx, tokenIn, routes) + spotPrice, _, _, _, _, err := k.CalcInRouteSpotPrice(ctx, tokenIn, routes, sdk.ZeroDec()) require.NoError(t, err) require.NotZero(t, spotPrice) accountedPoolKeeper.AssertExpectations(t) @@ -34,17 +34,17 @@ func TestCalcInRouteSpotPrice(t *testing.T) { {PoolId: 2, TokenOutDenom: "baseCurrency"}, {PoolId: 3, TokenOutDenom: "denom3"}, } - spotPrice, _, err = k.CalcInRouteSpotPrice(ctx, tokenIn, routes) + spotPrice, _, _, _, _, err = k.CalcInRouteSpotPrice(ctx, tokenIn, routes, sdk.ZeroDec()) require.NoError(t, err) require.NotZero(t, spotPrice) accountedPoolKeeper.AssertExpectations(t) // Test no routes - _, _, err = k.CalcInRouteSpotPrice(ctx, tokenIn, nil) + _, _, _, _, _, err = k.CalcInRouteSpotPrice(ctx, tokenIn, nil, sdk.ZeroDec()) require.Error(t, err) // Test invalid pool routes = []*types.SwapAmountInRoute{{PoolId: 9999, TokenOutDenom: "denom2"}} - _, _, err = k.CalcInRouteSpotPrice(ctx, tokenIn, routes) + _, _, _, _, _, err = k.CalcInRouteSpotPrice(ctx, tokenIn, routes, sdk.ZeroDec()) require.Error(t, err) } diff --git a/x/amm/keeper/calc_out_route_spot_price.go b/x/amm/keeper/calc_out_route_spot_price.go index c56a5e7e9..fa9766561 100644 --- a/x/amm/keeper/calc_out_route_spot_price.go +++ b/x/amm/keeper/calc_out_route_spot_price.go @@ -6,9 +6,9 @@ import ( ) // CalcOutRouteSpotPrice calculates the spot price of the given token and out route -func (k Keeper) CalcOutRouteSpotPrice(ctx sdk.Context, tokenOut sdk.Coin, routes []*types.SwapAmountOutRoute) (sdk.Dec, sdk.Coin, error) { +func (k Keeper) CalcOutRouteSpotPrice(ctx sdk.Context, tokenOut sdk.Coin, routes []*types.SwapAmountOutRoute, discount sdk.Dec) (sdk.Dec, sdk.Coin, sdk.Dec, sdk.Dec, sdk.Coin, error) { if routes == nil || len(routes) == 0 { - return sdk.ZeroDec(), sdk.Coin{}, types.ErrEmptyRoutes + return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, types.ErrEmptyRoutes } // Start with the initial token input @@ -17,29 +17,54 @@ func (k Keeper) CalcOutRouteSpotPrice(ctx sdk.Context, tokenOut sdk.Coin, routes // The final token in denom var tokenInDenom string + // Initialize the total discounted swap fee + totalDiscountedSwapFee := sdk.ZeroDec() + + // Track the total available liquidity in the pool for final token out denom + var availableLiquidity sdk.Coin + for _, route := range routes { poolId := route.PoolId tokenInDenom = route.TokenInDenom pool, found := k.GetPool(ctx, poolId) if !found { - return sdk.ZeroDec(), sdk.Coin{}, types.ErrPoolNotFound + return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, types.ErrPoolNotFound + } + + // Get Pool swap fee + swapFee := pool.GetPoolParams().SwapFee + + // Apply discount to swap fee if applicable + swapFee, _, err := k.ApplyDiscount(ctx, swapFee, discount, k.BrokerAddress(ctx)) + if err != nil { + return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, err } + // Calculate the total discounted swap fee + totalDiscountedSwapFee = totalDiscountedSwapFee.Add(swapFee) + // Estimate swap snapshot := k.GetPoolSnapshotOrSet(ctx, pool) - swapResult, err := k.CalcInAmtGivenOut(ctx, pool.PoolId, k.oracleKeeper, &snapshot, tokensOut, tokenInDenom, sdk.ZeroDec()) + swapResult, err := k.CalcInAmtGivenOut(ctx, pool.PoolId, k.oracleKeeper, &snapshot, tokensOut, tokenInDenom, swapFee) if err != nil { - return sdk.ZeroDec(), sdk.Coin{}, err + return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, err } if swapResult.IsZero() { - return sdk.ZeroDec(), sdk.Coin{}, types.ErrAmountTooLow + return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, types.ErrAmountTooLow } // Use the current swap result as the input for the next iteration tokensOut = sdk.Coins{swapResult} + + // Get the available liquidity for the final token in denom + _, poolAsset, err := pool.GetPoolAssetAndIndex(tokenInDenom) + if err != nil { + return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, err + } + availableLiquidity = poolAsset.Token } // Calculate the spot price given the initial token in and the final token in @@ -51,5 +76,5 @@ func (k Keeper) CalcOutRouteSpotPrice(ctx sdk.Context, tokenOut sdk.Coin, routes // Construct the token out coin tokenIn := sdk.NewCoin(tokenInDenom, tokenInAmt.TruncateInt()) - return spotPrice, tokenIn, nil + return spotPrice, tokenIn, totalDiscountedSwapFee, discount, availableLiquidity, nil } diff --git a/x/amm/keeper/calc_out_route_spot_price_test.go b/x/amm/keeper/calc_out_route_spot_price_test.go index b2896904b..b72e85777 100644 --- a/x/amm/keeper/calc_out_route_spot_price_test.go +++ b/x/amm/keeper/calc_out_route_spot_price_test.go @@ -18,7 +18,7 @@ func TestCalcOutRouteSpotPrice(t *testing.T) { accountedPoolKeeper.On("GetAccountedBalance", ctx, uint64(1), "denom2").Return(sdk.NewInt(1000)) accountedPoolKeeper.On("GetAccountedBalance", ctx, uint64(1), "denom1").Return(sdk.NewInt(1000)) routes := []*types.SwapAmountOutRoute{{PoolId: 1, TokenInDenom: "denom1"}} - spotPrice, _, err := k.CalcOutRouteSpotPrice(ctx, tokenOut, routes) + spotPrice, _, _, _, _, err := k.CalcOutRouteSpotPrice(ctx, tokenOut, routes, sdk.ZeroDec()) require.NoError(t, err) require.NotZero(t, spotPrice) accountedPoolKeeper.AssertExpectations(t) @@ -33,17 +33,17 @@ func TestCalcOutRouteSpotPrice(t *testing.T) { {PoolId: 3, TokenInDenom: "baseCurrency"}, {PoolId: 2, TokenInDenom: "denom1"}, } - spotPrice, _, err = k.CalcOutRouteSpotPrice(ctx, tokenOut, routes) + spotPrice, _, _, _, _, err = k.CalcOutRouteSpotPrice(ctx, tokenOut, routes, sdk.ZeroDec()) require.NoError(t, err) require.NotZero(t, spotPrice) accountedPoolKeeper.AssertExpectations(t) // Test no routes - _, _, err = k.CalcOutRouteSpotPrice(ctx, tokenOut, nil) + _, _, _, _, _, err = k.CalcOutRouteSpotPrice(ctx, tokenOut, nil, sdk.ZeroDec()) require.Error(t, err) // Test invalid pool routes = []*types.SwapAmountOutRoute{{PoolId: 9999, TokenInDenom: "denom2"}} - _, _, err = k.CalcOutRouteSpotPrice(ctx, tokenOut, routes) + _, _, _, _, _, err = k.CalcOutRouteSpotPrice(ctx, tokenOut, routes, sdk.ZeroDec()) require.Error(t, err) } diff --git a/x/amm/keeper/calc_swap_estimation_by_denom.go b/x/amm/keeper/calc_swap_estimation_by_denom.go index cfd4e8968..8b21f01d5 100644 --- a/x/amm/keeper/calc_swap_estimation_by_denom.go +++ b/x/amm/keeper/calc_swap_estimation_by_denom.go @@ -12,39 +12,43 @@ func (k Keeper) CalcSwapEstimationByDenom( denomIn string, denomOut string, baseCurrency string, + discount sdk.Dec, ) ( inRoute []*types.SwapAmountInRoute, outRoute []*types.SwapAmountOutRoute, outAmount sdk.Coin, spotPrice sdk.Dec, + swapFee sdk.Dec, + discountOut sdk.Dec, + availableLiquidity sdk.Coin, err error, ) { // if amount denom is equal to denomIn, calculate swap estimation by denomIn if amount.Denom == denomIn { inRoute, err := k.CalcInRouteByDenom(ctx, denomIn, denomOut, baseCurrency) if err != nil { - return nil, nil, sdk.Coin{}, sdk.ZeroDec(), err + return nil, nil, sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, err } - spotPrice, tokenOut, err := k.CalcInRouteSpotPrice(ctx, amount, inRoute) + spotPrice, tokenOut, swapFee, _, availableLiquidity, err := k.CalcInRouteSpotPrice(ctx, amount, inRoute, discount) if err != nil { - return nil, nil, sdk.Coin{}, sdk.ZeroDec(), err + return nil, nil, sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, err } - return inRoute, nil, tokenOut, spotPrice, nil + return inRoute, nil, tokenOut, spotPrice, swapFee, discount, availableLiquidity, nil } // if amount denom is equal to denomOut, calculate swap estimation by denomOut if amount.Denom == denomOut { outRoute, err := k.CalcOutRouteByDenom(ctx, denomIn, denomOut, baseCurrency) if err != nil { - return nil, nil, sdk.Coin{}, sdk.ZeroDec(), err + return nil, nil, sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, err } - spotPrice, tokenIn, err := k.CalcOutRouteSpotPrice(ctx, amount, outRoute) + spotPrice, tokenIn, swapFee, _, availableLiquidity, err := k.CalcOutRouteSpotPrice(ctx, amount, outRoute, discount) if err != nil { - return nil, nil, sdk.Coin{}, sdk.ZeroDec(), err + return nil, nil, sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, err } - return nil, outRoute, tokenIn, spotPrice, nil + return nil, outRoute, tokenIn, spotPrice, swapFee, discount, availableLiquidity, nil } // if amount denom is neither equal to denomIn nor denomOut, return error - return nil, nil, sdk.Coin{}, sdk.ZeroDec(), types.ErrInvalidDenom + return nil, nil, sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, types.ErrInvalidDenom } diff --git a/x/amm/keeper/calc_swap_estimation_by_denom_test.go b/x/amm/keeper/calc_swap_estimation_by_denom_test.go index 8875a7e74..47e516b28 100644 --- a/x/amm/keeper/calc_swap_estimation_by_denom_test.go +++ b/x/amm/keeper/calc_swap_estimation_by_denom_test.go @@ -16,7 +16,7 @@ func TestCalcSwapEstimationByDenom(t *testing.T) { amount := sdk.NewCoin("denom1", sdk.NewInt(100)) accountedPoolKeeper.On("GetAccountedBalance", ctx, uint64(1), "denom1").Return(sdk.NewInt(1000)) accountedPoolKeeper.On("GetAccountedBalance", ctx, uint64(1), "denom2").Return(sdk.NewInt(1000)) - inRoute, outRoute, tokenOut, spotPrice, err := k.CalcSwapEstimationByDenom(ctx, amount, "denom1", "denom2", "baseCurrency") + inRoute, outRoute, tokenOut, spotPrice, _, _, err := k.CalcSwapEstimationByDenom(ctx, amount, "denom1", "denom2", "baseCurrency", sdk.ZeroDec()) require.NoError(t, err) require.NotNil(t, inRoute) require.Nil(t, outRoute) @@ -27,7 +27,7 @@ func TestCalcSwapEstimationByDenom(t *testing.T) { amount = sdk.NewCoin("denom2", sdk.NewInt(100)) accountedPoolKeeper.On("GetAccountedBalance", ctx, uint64(1), "denom2").Return(sdk.NewInt(1000)) accountedPoolKeeper.On("GetAccountedBalance", ctx, uint64(1), "denom1").Return(sdk.NewInt(1000)) - inRoute, outRoute, tokenOut, spotPrice, err = k.CalcSwapEstimationByDenom(ctx, amount, "denom1", "denom2", "baseCurrency") + inRoute, outRoute, tokenOut, spotPrice, _, _, err = k.CalcSwapEstimationByDenom(ctx, amount, "denom1", "denom2", "baseCurrency", sdk.ZeroDec()) require.NoError(t, err) require.Nil(t, inRoute) require.NotNil(t, outRoute) @@ -36,6 +36,6 @@ func TestCalcSwapEstimationByDenom(t *testing.T) { // Test with invalid amount denom amount = sdk.NewCoin("invalid", sdk.NewInt(1000)) - _, _, _, _, err = k.CalcSwapEstimationByDenom(ctx, amount, "denom1", "denom2", "baseCurrency") + _, _, _, _, _, _, err = k.CalcSwapEstimationByDenom(ctx, amount, "denom1", "denom2", "baseCurrency", sdk.ZeroDec()) require.Error(t, err) } diff --git a/x/amm/keeper/msg_server_swap_by_denom.go b/x/amm/keeper/msg_server_swap_by_denom.go index 35960fda2..1880fbc21 100644 --- a/x/amm/keeper/msg_server_swap_by_denom.go +++ b/x/amm/keeper/msg_server_swap_by_denom.go @@ -24,7 +24,7 @@ func (k msgServer) SwapByDenom(goCtx context.Context, msg *types.MsgSwapByDenom) } baseCurrency := entry.Denom - inRoute, outRoute, _, spotPrice, err := k.CalcSwapEstimationByDenom(ctx, msg.Amount, msg.DenomIn, msg.DenomOut, baseCurrency) + inRoute, outRoute, _, spotPrice, _, _, _, err := k.CalcSwapEstimationByDenom(ctx, msg.Amount, msg.DenomIn, msg.DenomOut, baseCurrency, msg.Discount) if err != nil { return nil, err } @@ -61,7 +61,8 @@ func (k msgServer) SwapByDenom(goCtx context.Context, msg *types.MsgSwapByDenom) InRoute: inRoute, OutRoute: nil, SpotPrice: spotPrice, - Discount: msg.Discount, + SwapFee: res.SwapFee, + Discount: res.Discount, }, nil } @@ -97,7 +98,8 @@ func (k msgServer) SwapByDenom(goCtx context.Context, msg *types.MsgSwapByDenom) InRoute: nil, OutRoute: outRoute, SpotPrice: spotPrice, - Discount: msg.Discount, + SwapFee: res.SwapFee, + Discount: res.Discount, }, nil } diff --git a/x/amm/keeper/msg_server_swap_exact_amount_in.go b/x/amm/keeper/msg_server_swap_exact_amount_in.go index 48bf4d733..5bc8e233c 100644 --- a/x/amm/keeper/msg_server_swap_exact_amount_in.go +++ b/x/amm/keeper/msg_server_swap_exact_amount_in.go @@ -19,7 +19,7 @@ func (k msgServer) SwapExactAmountIn(goCtx context.Context, msg *types.MsgSwapEx // Try executing the tx on cached context environment, to filter invalid transactions out cacheCtx, _ := ctx.CacheContext() - tokenOutAmount, err := k.RouteExactAmountIn(cacheCtx, sender, msg.Routes, msg.TokenIn, math.Int(msg.TokenOutMinAmount), msg.Discount) + tokenOutAmount, swapFee, discount, err := k.RouteExactAmountIn(cacheCtx, sender, msg.Routes, msg.TokenIn, math.Int(msg.TokenOutMinAmount), msg.Discount) if err != nil { return nil, err } @@ -37,5 +37,9 @@ func (k msgServer) SwapExactAmountIn(goCtx context.Context, msg *types.MsgSwapEx ), }) - return &types.MsgSwapExactAmountInResponse{TokenOutAmount: tokenOutAmount}, nil + return &types.MsgSwapExactAmountInResponse{ + TokenOutAmount: tokenOutAmount, + SwapFee: swapFee, + Discount: discount, + }, nil } diff --git a/x/amm/keeper/msg_server_swap_exact_amount_out.go b/x/amm/keeper/msg_server_swap_exact_amount_out.go index e2ab0e9de..dee066072 100644 --- a/x/amm/keeper/msg_server_swap_exact_amount_out.go +++ b/x/amm/keeper/msg_server_swap_exact_amount_out.go @@ -17,7 +17,7 @@ func (k msgServer) SwapExactAmountOut(goCtx context.Context, msg *types.MsgSwapE // Try executing the tx on cached context environment, to filter invalid transactions out cacheCtx, _ := ctx.CacheContext() - tokenInAmount, err := k.RouteExactAmountOut(cacheCtx, sender, msg.Routes, msg.TokenInMaxAmount, msg.TokenOut, msg.Discount) + tokenInAmount, swapFee, discount, err := k.RouteExactAmountOut(cacheCtx, sender, msg.Routes, msg.TokenInMaxAmount, msg.TokenOut, msg.Discount) if err != nil { return nil, err } @@ -35,5 +35,9 @@ func (k msgServer) SwapExactAmountOut(goCtx context.Context, msg *types.MsgSwapE ), }) - return &types.MsgSwapExactAmountOutResponse{TokenInAmount: tokenInAmount}, nil + return &types.MsgSwapExactAmountOutResponse{ + TokenInAmount: tokenInAmount, + SwapFee: swapFee, + Discount: discount, + }, nil } diff --git a/x/amm/keeper/query_swap_estimation.go b/x/amm/keeper/query_swap_estimation.go index 0893d7594..5737e5ce7 100644 --- a/x/amm/keeper/query_swap_estimation.go +++ b/x/amm/keeper/query_swap_estimation.go @@ -16,13 +16,16 @@ func (k Keeper) SwapEstimation(goCtx context.Context, req *types.QuerySwapEstima ctx := sdk.UnwrapSDKContext(goCtx) - spotPrice, tokenOut, err := k.CalcInRouteSpotPrice(ctx, req.TokenIn, req.Routes) + spotPrice, tokenOut, swapFee, discount, availableLiquidity, err := k.CalcInRouteSpotPrice(ctx, req.TokenIn, req.Routes, req.Discount) if err != nil { return nil, err } return &types.QuerySwapEstimationResponse{ - SpotPrice: spotPrice, - TokenOut: tokenOut, + SpotPrice: spotPrice, + TokenOut: tokenOut, + SwapFee: swapFee, + Discount: discount, + AvailableLiquidity: availableLiquidity, }, nil } diff --git a/x/amm/keeper/query_swap_estimation_by_denom.go b/x/amm/keeper/query_swap_estimation_by_denom.go index bf797a898..7b4600e5b 100644 --- a/x/amm/keeper/query_swap_estimation_by_denom.go +++ b/x/amm/keeper/query_swap_estimation_by_denom.go @@ -27,15 +27,18 @@ func (k Keeper) SwapEstimationByDenom(goCtx context.Context, req *types.QuerySwa _ = baseCurrency - inRoute, outRoute, amount, spotPrice, err := k.CalcSwapEstimationByDenom(ctx, req.Amount, req.DenomIn, req.DenomOut, baseCurrency) + inRoute, outRoute, amount, spotPrice, swapFee, discount, availableLiquidity, err := k.CalcSwapEstimationByDenom(ctx, req.Amount, req.DenomIn, req.DenomOut, baseCurrency, req.Discount) if err != nil { return nil, err } return &types.QuerySwapEstimationByDenomResponse{ - InRoute: inRoute, - OutRoute: outRoute, - Amount: amount, - SpotPrice: spotPrice, + InRoute: inRoute, + OutRoute: outRoute, + Amount: amount, + SpotPrice: spotPrice, + SwapFee: swapFee, + Discount: discount, + AvailableLiquidity: availableLiquidity, }, nil } diff --git a/x/amm/keeper/route_exact_amount_in.go b/x/amm/keeper/route_exact_amount_in.go index 6a9166cfa..99edcbf5d 100644 --- a/x/amm/keeper/route_exact_amount_in.go +++ b/x/amm/keeper/route_exact_amount_in.go @@ -16,16 +16,11 @@ func (k Keeper) RouteExactAmountIn( tokenIn sdk.Coin, tokenOutMinAmount math.Int, discount sdk.Dec, -) (tokenOutAmount math.Int, err error) { - var ( - isMultiHopRouted bool - routeSwapFee sdk.Dec - sumOfSwapFees sdk.Dec - ) - +) (tokenOutAmount math.Int, totalDiscountedSwapFee sdk.Dec, discountOut sdk.Dec, err error) { + isMultiHopRouted, routeSwapFee, sumOfSwapFees := false, sdk.Dec{}, sdk.Dec{} route := types.SwapAmountInRoutes(routes) if err := route.Validate(); err != nil { - return math.Int{}, err + return math.Int{}, sdk.ZeroDec(), sdk.ZeroDec(), err } // In this loop, we check if: @@ -42,10 +37,13 @@ func (k Keeper) RouteExactAmountIn( isMultiHopRouted = true routeSwapFee, sumOfSwapFees, err = k.getElysRoutedMultihopTotalSwapFee(ctx, route) if err != nil { - return math.Int{}, err + return math.Int{}, sdk.ZeroDec(), sdk.ZeroDec(), err } } + // Initialize the total discounted swap fee + totalDiscountedSwapFee = sdk.ZeroDec() + for i, route := range routes { // To prevent the multihop swap from being interrupted prematurely, we keep // the minimum expected output at a very low number until the last pool @@ -57,7 +55,7 @@ func (k Keeper) RouteExactAmountIn( // Execute the expected swap on the current routed pool pool, poolExists := k.GetPool(ctx, route.PoolId) if !poolExists { - return math.Int{}, types.ErrInvalidPoolId + return math.Int{}, sdk.ZeroDec(), sdk.ZeroDec(), types.ErrInvalidPoolId } // // check if pool is active, if not error @@ -74,19 +72,23 @@ func (k Keeper) RouteExactAmountIn( } // Apply discount to swap fee if applicable - swapFee, discount, err = k.ApplyDiscount(ctx, swapFee, discount, sender.String()) + swapFee, _, err = k.ApplyDiscount(ctx, swapFee, discount, sender.String()) if err != nil { - return math.Int{}, err + return math.Int{}, sdk.ZeroDec(), sdk.ZeroDec(), err } + // Calculate the total discounted swap fee + totalDiscountedSwapFee = totalDiscountedSwapFee.Add(swapFee) + tokenOutAmount, err = k.SwapExactAmountIn(ctx, sender, pool, tokenIn, route.TokenOutDenom, _outMinAmount, swapFee) if err != nil { ctx.Logger().Error(err.Error()) - return math.Int{}, err + return math.Int{}, sdk.ZeroDec(), sdk.ZeroDec(), err } // Chain output of current pool as the input for the next routed pool tokenIn = sdk.NewCoin(route.TokenOutDenom, tokenOutAmount) } - return tokenOutAmount, nil + + return tokenOutAmount, totalDiscountedSwapFee, discount, nil } diff --git a/x/amm/keeper/route_exact_amount_in_test.go b/x/amm/keeper/route_exact_amount_in_test.go index 739a5d9e0..1928f212c 100644 --- a/x/amm/keeper/route_exact_amount_in_test.go +++ b/x/amm/keeper/route_exact_amount_in_test.go @@ -177,7 +177,7 @@ func (suite *KeeperTestSuite) TestRouteExactAmountIn() { // TODO: add multiple route case // TODO: add invalid route case // TODO: add Elys token involved route case - tokenOut, err := suite.app.AmmKeeper.RouteExactAmountIn( + tokenOut, _, _, err := suite.app.AmmKeeper.RouteExactAmountIn( suite.ctx, sender, []types.SwapAmountInRoute{ diff --git a/x/amm/keeper/route_exact_amount_out.go b/x/amm/keeper/route_exact_amount_out.go index a8b00c356..2826a8e4f 100644 --- a/x/amm/keeper/route_exact_amount_out.go +++ b/x/amm/keeper/route_exact_amount_out.go @@ -18,11 +18,11 @@ func (k Keeper) RouteExactAmountOut(ctx sdk.Context, tokenInMaxAmount math.Int, tokenOut sdk.Coin, discount sdk.Dec, -) (tokenInAmount math.Int, err error) { +) (tokenInAmount math.Int, totalDiscountedSwapFee sdk.Dec, discountOut sdk.Dec, err error) { isMultiHopRouted, routeSwapFee, sumOfSwapFees := false, sdk.Dec{}, sdk.Dec{} route := types.SwapAmountOutRoutes(routes) if err := route.Validate(); err != nil { - return math.Int{}, err + return math.Int{}, sdk.ZeroDec(), sdk.ZeroDec(), err } defer func() { @@ -44,10 +44,13 @@ func (k Keeper) RouteExactAmountOut(ctx sdk.Context, isMultiHopRouted = true routeSwapFee, sumOfSwapFees, err = k.getElysRoutedMultihopTotalSwapFee(ctx, route) if err != nil { - return math.Int{}, err + return math.Int{}, sdk.ZeroDec(), sdk.ZeroDec(), err } } + // Initialize the total discounted swap fee + totalDiscountedSwapFee = sdk.ZeroDec() + // Determine what the estimated input would be for each pool along the multi-hop route // if we determined the route is an osmo multi-hop and both routes are incentivized, // we utilize a separate function that calculates the discounted swap fees @@ -58,10 +61,10 @@ func (k Keeper) RouteExactAmountOut(ctx sdk.Context, insExpected, err = k.createMultihopExpectedSwapOuts(ctx, routes, tokenOut) } if err != nil { - return math.Int{}, err + return math.Int{}, sdk.ZeroDec(), sdk.ZeroDec(), err } if len(insExpected) == 0 { - return math.Int{}, nil + return math.Int{}, sdk.ZeroDec(), sdk.ZeroDec(), nil } insExpected[0] = tokenInMaxAmount @@ -81,7 +84,7 @@ func (k Keeper) RouteExactAmountOut(ctx sdk.Context, // Execute the expected swap on the current routed pool pool, poolExists := k.GetPool(ctx, route.PoolId) if !poolExists { - return math.Int{}, types.ErrInvalidPoolId + return math.Int{}, sdk.ZeroDec(), sdk.ZeroDec(), types.ErrInvalidPoolId } // // check if pool is active, if not error @@ -97,12 +100,15 @@ func (k Keeper) RouteExactAmountOut(ctx sdk.Context, // Apply discount to swap fee if applicable swapFee, discount, err = k.ApplyDiscount(ctx, swapFee, discount, sender.String()) if err != nil { - return math.Int{}, err + return math.Int{}, sdk.ZeroDec(), sdk.ZeroDec(), err } + // Calculate the total discounted swap fee + totalDiscountedSwapFee = totalDiscountedSwapFee.Add(swapFee) + _tokenInAmount, swapErr := k.SwapExactAmountOut(ctx, sender, pool, route.TokenInDenom, insExpected[i], _tokenOut, swapFee) if swapErr != nil { - return math.Int{}, swapErr + return math.Int{}, sdk.ZeroDec(), sdk.ZeroDec(), swapErr } // Sets the final amount of tokens that need to be input into the first pool. Even though this is the final return value for the @@ -113,5 +119,5 @@ func (k Keeper) RouteExactAmountOut(ctx sdk.Context, } } - return tokenInAmount, nil + return tokenInAmount, totalDiscountedSwapFee, discount, nil } diff --git a/x/amm/keeper/route_exact_amount_out_test.go b/x/amm/keeper/route_exact_amount_out_test.go index 4dc83d627..f577c66d6 100644 --- a/x/amm/keeper/route_exact_amount_out_test.go +++ b/x/amm/keeper/route_exact_amount_out_test.go @@ -176,7 +176,7 @@ func (suite *KeeperTestSuite) TestRouteExactAmountOut() { // TODO: add multiple route case // TODO: add invalid route case // TODO: add Elys token involved route case - tokenInAmount, err := suite.app.AmmKeeper.RouteExactAmountOut( + tokenInAmount, _, _, err := suite.app.AmmKeeper.RouteExactAmountOut( suite.ctx, sender, []types.SwapAmountOutRoute{ { PoolId: pool.PoolId, diff --git a/x/amm/types/query.pb.go b/x/amm/types/query.pb.go index 3af38f9b5..a5d4bbe73 100644 --- a/x/amm/types/query.pb.go +++ b/x/amm/types/query.pb.go @@ -484,8 +484,9 @@ func (m *QueryAllDenomLiquidityResponse) GetPagination() *query.PageResponse { } type QuerySwapEstimationRequest struct { - Routes []*SwapAmountInRoute `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"` - TokenIn types.Coin `protobuf:"bytes,2,opt,name=token_in,json=tokenIn,proto3" json:"token_in"` + Routes []*SwapAmountInRoute `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"` + TokenIn types.Coin `protobuf:"bytes,2,opt,name=token_in,json=tokenIn,proto3" json:"token_in"` + Discount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=discount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"discount"` } func (m *QuerySwapEstimationRequest) Reset() { *m = QuerySwapEstimationRequest{} } @@ -536,8 +537,11 @@ func (m *QuerySwapEstimationRequest) GetTokenIn() types.Coin { } type QuerySwapEstimationResponse struct { - SpotPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=spot_price,json=spotPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"spot_price"` - TokenOut types.Coin `protobuf:"bytes,2,opt,name=token_out,json=tokenOut,proto3" json:"token_out"` + SpotPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=spot_price,json=spotPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"spot_price"` + TokenOut types.Coin `protobuf:"bytes,2,opt,name=token_out,json=tokenOut,proto3" json:"token_out"` + SwapFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=swapFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"swapFee"` + Discount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=discount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"discount"` + AvailableLiquidity types.Coin `protobuf:"bytes,5,opt,name=available_liquidity,json=availableLiquidity,proto3" json:"available_liquidity"` } func (m *QuerySwapEstimationResponse) Reset() { *m = QuerySwapEstimationResponse{} } @@ -580,6 +584,13 @@ func (m *QuerySwapEstimationResponse) GetTokenOut() types.Coin { return types.Coin{} } +func (m *QuerySwapEstimationResponse) GetAvailableLiquidity() types.Coin { + if m != nil { + return m.AvailableLiquidity + } + return types.Coin{} +} + type QuerySlippageTrackRequest struct { PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` } @@ -1037,9 +1048,10 @@ func (m *QueryOutRouteByDenomResponse) GetOutRoute() []*SwapAmountOutRoute { } type QuerySwapEstimationByDenomRequest struct { - Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` - DenomIn string `protobuf:"bytes,2,opt,name=denom_in,json=denomIn,proto3" json:"denom_in,omitempty"` - DenomOut string `protobuf:"bytes,3,opt,name=denom_out,json=denomOut,proto3" json:"denom_out,omitempty"` + Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` + DenomIn string `protobuf:"bytes,2,opt,name=denom_in,json=denomIn,proto3" json:"denom_in,omitempty"` + DenomOut string `protobuf:"bytes,3,opt,name=denom_out,json=denomOut,proto3" json:"denom_out,omitempty"` + Discount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=discount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"discount"` } func (m *QuerySwapEstimationByDenomRequest) Reset() { *m = QuerySwapEstimationByDenomRequest{} } @@ -1097,10 +1109,13 @@ func (m *QuerySwapEstimationByDenomRequest) GetDenomOut() string { } type QuerySwapEstimationByDenomResponse struct { - InRoute []*SwapAmountInRoute `protobuf:"bytes,1,rep,name=in_route,json=inRoute,proto3" json:"in_route,omitempty"` - OutRoute []*SwapAmountOutRoute `protobuf:"bytes,2,rep,name=out_route,json=outRoute,proto3" json:"out_route,omitempty"` - SpotPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=spot_price,json=spotPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"spot_price"` - Amount types.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount"` + InRoute []*SwapAmountInRoute `protobuf:"bytes,1,rep,name=in_route,json=inRoute,proto3" json:"in_route,omitempty"` + OutRoute []*SwapAmountOutRoute `protobuf:"bytes,2,rep,name=out_route,json=outRoute,proto3" json:"out_route,omitempty"` + SpotPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=spot_price,json=spotPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"spot_price"` + Amount types.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount"` + SwapFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=swapFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"swapFee"` + Discount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=discount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"discount"` + AvailableLiquidity types.Coin `protobuf:"bytes,7,opt,name=available_liquidity,json=availableLiquidity,proto3" json:"available_liquidity"` } func (m *QuerySwapEstimationByDenomResponse) Reset() { *m = QuerySwapEstimationByDenomResponse{} } @@ -1157,8 +1172,16 @@ func (m *QuerySwapEstimationByDenomResponse) GetAmount() types.Coin { return types.Coin{} } +func (m *QuerySwapEstimationByDenomResponse) GetAvailableLiquidity() types.Coin { + if m != nil { + return m.AvailableLiquidity + } + return types.Coin{} +} + type QueryAMMPriceRequest struct { - TokenIn types.Coin `protobuf:"bytes,1,opt,name=token_in,json=tokenIn,proto3" json:"token_in"` + TokenIn types.Coin `protobuf:"bytes,1,opt,name=token_in,json=tokenIn,proto3" json:"token_in"` + Discount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=discount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"discount"` } func (m *QueryAMMPriceRequest) Reset() { *m = QueryAMMPriceRequest{} } @@ -1232,90 +1255,96 @@ func init() { func init() { proto.RegisterFile("elys/amm/query.proto", fileDescriptor_763da04a7298bbac) } var fileDescriptor_763da04a7298bbac = []byte{ - // 1323 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x98, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xc0, 0xb3, 0x4e, 0x62, 0xc7, 0x0f, 0x35, 0x2d, 0xd3, 0x54, 0x24, 0x4e, 0xe2, 0xd0, 0x6d, - 0xf3, 0x21, 0x20, 0xbb, 0x4d, 0x0a, 0x2d, 0x20, 0x50, 0x6b, 0xd3, 0x12, 0x22, 0x11, 0x25, 0x35, - 0xe5, 0x00, 0x08, 0x99, 0xb5, 0xbd, 0x32, 0xab, 0xac, 0x77, 0x36, 0xde, 0x31, 0xc1, 0x8a, 0x72, - 0xe9, 0x8d, 0x43, 0x25, 0xa4, 0x20, 0x2e, 0x1c, 0xb8, 0x71, 0x28, 0x37, 0xfe, 0x8a, 0x1e, 0x2b, - 0x21, 0x21, 0xc4, 0xa1, 0x42, 0x09, 0x7f, 0x08, 0xda, 0x99, 0x37, 0xb6, 0x67, 0x77, 0xfd, 0x11, - 0xb5, 0xa7, 0x7a, 0x67, 0xde, 0xc7, 0xef, 0xbd, 0x79, 0xf3, 0xe6, 0x35, 0x30, 0x63, 0xbb, 0xed, - 0xc0, 0xb4, 0x1a, 0x0d, 0xf3, 0xa0, 0x65, 0x37, 0xdb, 0x86, 0xdf, 0xa4, 0x8c, 0x92, 0xa9, 0x70, - 0xd5, 0xb0, 0x1a, 0x8d, 0xdc, 0x4c, 0x9d, 0xd6, 0x29, 0x5f, 0x34, 0xc3, 0x5f, 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3c, 0x8a, 0x31, 0xd8, 0x90, 0xb0, 0x07, 0x9c, 0xfc, 0xae, 0xc1, 0x95, 0xc4, 0xb7, 0x99, - 0xbc, 0x39, 0xf0, 0xde, 0x45, 0xc0, 0xdf, 0x1a, 0x4d, 0x78, 0xd4, 0xeb, 0xa1, 0xde, 0xd5, 0x4e, - 0x10, 0xc5, 0xe2, 0xd3, 0xd3, 0xbc, 0xf6, 0xec, 0x34, 0xaf, 0xfd, 0x7b, 0x9a, 0xd7, 0x7e, 0x3c, - 0xcb, 0x8f, 0x3d, 0x3b, 0xcb, 0x8f, 0xfd, 0x7d, 0x96, 0x1f, 0xfb, 0x72, 0xad, 0xe7, 0xc9, 0x8e, - 0x1b, 0xfd, 0x9e, 0x9b, 0xe5, 0x0f, 0x77, 0x25, 0xcd, 0xff, 0xea, 0x71, 0xf3, 0xff, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x04, 0xed, 0xfd, 0x19, 0x35, 0x12, 0x00, 0x00, + // 1411 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x98, 0xdd, 0x6f, 0xdb, 0x54, + 0x14, 0xc0, 0xeb, 0x24, 0xcd, 0xc7, 0x41, 0xeb, 0xc6, 0x5d, 0x27, 0xda, 0x74, 0xcd, 0x98, 0xb7, + 0xb5, 0x15, 0x30, 0x7b, 0x1f, 0xb0, 0x01, 0x02, 0x6d, 0x09, 0xdb, 0xba, 0x22, 0xa6, 0x76, 0x61, + 0x3c, 0x00, 0x42, 0xe1, 0x26, 0xb9, 0x0a, 0x56, 0x1d, 0x5f, 0x2f, 0x76, 0x36, 0xa2, 0xa9, 0x2f, + 0x7b, 0x41, 0x3c, 0x20, 0x21, 0x26, 0xf1, 0x82, 0xc4, 0x23, 0x0f, 0xf0, 0xc6, 0x5f, 0xb1, 0xc7, + 0x49, 0x48, 0x08, 0x78, 0x98, 0xa6, 0x95, 0x3f, 0x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a, 0xad, 0x3a, + 0x36, 0xb7, 0x1c, 0x46, 0x34, 0xc8, 0xfb, 0x5c, 0x0b, 0xca, 0xab, 0xca, 0xda, 0x4b, 0x17, 0x8e, + 0x68, 0x41, 0x96, 0x35, 0x5f, 0xb2, 0x96, 0x7b, 0xfc, 0xf4, 0xc4, 0x4c, 0x1d, 0xa5, 0x54, 0x0d, + 0xcd, 0xac, 0x33, 0x77, 0x8b, 0x73, 0x13, 0xad, 0x93, 0x57, 0xa0, 0x20, 0x62, 0x34, 0xda, 0xc2, + 0x4e, 0xae, 0x9e, 0xf7, 0x1e, 0x37, 0xda, 0xea, 0x55, 0x98, 0x97, 0xe5, 0xd1, 0xef, 0x1a, 0xe4, + 0x3c, 0x09, 0xf4, 0x3a, 0x17, 0xf1, 0xca, 0xb9, 0x89, 0x3e, 0x85, 0x84, 0xfa, 0x05, 0x7a, 0xac, + 0x9a, 0x66, 0xd4, 0xe3, 0x0d, 0x80, 0xe1, 0xb9, 0xa1, 0x99, 0x15, 0xcd, 0xcf, 0xaa, 0xe6, 0x65, + 0x55, 0xf3, 0x6b, 0x07, 0x73, 0xab, 0x6d, 0xd1, 0x0e, 0x43, 0xdd, 0x7a, 0x44, 0x53, 0xfd, 0x56, + 0x41, 0xc2, 0xd0, 0x7e, 0x82, 0x30, 0x3b, 0x9e, 0x90, 0xac, 0x4b, 0x28, 0x19, 0x81, 0xb2, 0x3a, + 0x11, 0xc5, 0x77, 0x23, 0xb1, 0xbc, 0x05, 0xcb, 0x41, 0xb2, 0xae, 0x79, 0xa7, 0xfe, 0x51, 0x70, + 0xe8, 0x41, 0xd0, 0xf3, 0x30, 0x2b, 0xca, 0x41, 0xc4, 0x5b, 0xaa, 0xfb, 0x0f, 0xaa, 0x01, 0x95, + 0x51, 0x6a, 0x18, 0xcb, 0x3a, 0x1c, 0x8e, 0x95, 0x11, 0x66, 0x6c, 0x61, 0x18, 0x96, 0xac, 0x8a, + 0x01, 0xce, 0xb5, 0xa5, 0x55, 0x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 0x8f, 0x17, 0x42, 0x98, 0xcb, + 0x02, 0xe6, 0x3c, 0xd1, 0x47, 0xc1, 0xa0, 0x56, 0x43, 0xcc, 0x4d, 0x91, 0x5a, 0x7e, 0xa4, 0xc0, + 0x91, 0xf8, 0x78, 0x46, 0x56, 0xc6, 0xf9, 0x1c, 0xce, 0x77, 0xe5, 0xd5, 0x89, 0x72, 0xd3, 0xe6, + 0x4a, 0xc2, 0x73, 0xc8, 0x43, 0x05, 0x0a, 0x38, 0x8b, 0x25, 0xae, 0x98, 0x3c, 0xea, 0x25, 0xae, + 0x58, 0x6c, 0x84, 0x53, 0xdf, 0x16, 0xae, 0x2f, 0x90, 0x73, 0x23, 0x5c, 0xe3, 0xbc, 0xa6, 0x3f, + 0xc0, 0x09, 0x71, 0x27, 0xac, 0xec, 0x5f, 0x14, 0x98, 0x93, 0xe7, 0xac, 0x44, 0x01, 0xa5, 0x0e, + 0x77, 0x89, 0x02, 0x4a, 0x1f, 0xd6, 0xd4, 0x75, 0x41, 0x56, 0x25, 0x57, 0x46, 0x90, 0x05, 0x6f, + 0xf5, 0x46, 0x73, 0xd0, 0x10, 0x48, 0x48, 0xd6, 0x30, 0xac, 0x00, 0xd2, 0x9b, 0x41, 0x76, 0xc8, + 0xaf, 0x0a, 0x1c, 0x8e, 0x8d, 0x58, 0x24, 0xce, 0x90, 0x3e, 0xd9, 0x95, 0x57, 0x26, 0x89, 0x21, + 0xeb, 0x4d, 0xc1, 0x5a, 0x23, 0x57, 0x47, 0xb0, 0x86, 0x93, 0x44, 0x02, 0xd6, 0x23, 0x8c, 0x80, + 0x93, 0xdf, 0x14, 0x38, 0x96, 0x3a, 0xd0, 0x90, 0xd7, 0xc7, 0xde, 0xbb, 0x18, 0xf8, 0x1b, 0xd3, + 0x09, 0x4f, 0x7b, 0x3d, 0xe4, 0xbb, 0x1a, 0x06, 0x51, 0xab, 0x3d, 0x7e, 0x5e, 0x51, 0x9e, 0x3c, + 0xaf, 0x28, 0xcf, 0x9e, 0x57, 0x94, 0xef, 0x77, 0x2b, 0x33, 0x4f, 0x76, 0x2b, 0x33, 0x7f, 0xed, + 0x56, 0x66, 0x3e, 0x5b, 0x8b, 0xbc, 0x24, 0x93, 0x46, 0xbf, 0x16, 0x66, 0xc5, 0xab, 0xb2, 0x99, + 0x17, 0xff, 0xaa, 0xbb, 0xf8, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x15, 0x37, 0x46, 0xea, + 0x14, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2182,6 +2211,16 @@ func (m *QuerySwapEstimationRequest) MarshalToSizedBuffer(dAtA []byte) (int, err _ = i var l int _ = l + { + size := m.Discount.Size() + i -= size + if _, err := m.Discount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a { size, err := m.TokenIn.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -2229,6 +2268,36 @@ func (m *QuerySwapEstimationResponse) MarshalToSizedBuffer(dAtA []byte) (int, er _ = i var l int _ = l + { + size, err := m.AvailableLiquidity.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.Discount.Size() + i -= size + if _, err := m.Discount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.SwapFee.Size() + i -= size + if _, err := m.SwapFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a { size, err := m.TokenOut.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -2611,6 +2680,16 @@ func (m *QuerySwapEstimationByDenomRequest) MarshalToSizedBuffer(dAtA []byte) (i _ = i var l int _ = l + { + size := m.Discount.Size() + i -= size + if _, err := m.Discount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 if len(m.DenomOut) > 0 { i -= len(m.DenomOut) copy(dAtA[i:], m.DenomOut) @@ -2658,6 +2737,36 @@ func (m *QuerySwapEstimationByDenomResponse) MarshalToSizedBuffer(dAtA []byte) ( _ = i var l int _ = l + { + size, err := m.AvailableLiquidity.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.Discount.Size() + i -= size + if _, err := m.Discount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.SwapFee.Size() + i -= size + if _, err := m.SwapFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a { size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -2729,6 +2838,16 @@ func (m *QueryAMMPriceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.Discount.Size() + i -= size + if _, err := m.Discount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 { size, err := m.TokenIn.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -2898,6 +3017,8 @@ func (m *QuerySwapEstimationRequest) Size() (n int) { } l = m.TokenIn.Size() n += 1 + l + sovQuery(uint64(l)) + l = m.Discount.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -2911,6 +3032,12 @@ func (m *QuerySwapEstimationResponse) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) l = m.TokenOut.Size() n += 1 + l + sovQuery(uint64(l)) + l = m.SwapFee.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.Discount.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.AvailableLiquidity.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -3069,6 +3196,8 @@ func (m *QuerySwapEstimationByDenomRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + l = m.Discount.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -3094,6 +3223,12 @@ func (m *QuerySwapEstimationByDenomResponse) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) l = m.Amount.Size() n += 1 + l + sovQuery(uint64(l)) + l = m.SwapFee.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.Discount.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.AvailableLiquidity.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -3105,6 +3240,8 @@ func (m *QueryAMMPriceRequest) Size() (n int) { _ = l l = m.TokenIn.Size() n += 1 + l + sovQuery(uint64(l)) + l = m.Discount.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -4072,6 +4209,40 @@ func (m *QuerySwapEstimationRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + 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 + } + if err := m.Discount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4189,6 +4360,107 @@ func (m *QuerySwapEstimationResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapFee", 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.SwapFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + 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 + } + if err := m.Discount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AvailableLiquidity", 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.AvailableLiquidity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5215,6 +5487,40 @@ func (m *QuerySwapEstimationByDenomRequest) Unmarshal(dAtA []byte) error { } m.DenomOut = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + 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 + } + if err := m.Discount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5400,6 +5706,107 @@ func (m *QuerySwapEstimationByDenomResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapFee", 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.SwapFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + 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 + } + if err := m.Discount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AvailableLiquidity", 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.AvailableLiquidity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5483,6 +5890,40 @@ func (m *QueryAMMPriceRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + 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 + } + if err := m.Discount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/amm/types/tx.pb.go b/x/amm/types/tx.pb.go index bb6d309a6..8764258bc 100644 --- a/x/amm/types/tx.pb.go +++ b/x/amm/types/tx.pb.go @@ -425,7 +425,8 @@ func (m *MsgSwapExactAmountIn) GetTokenIn() types.Coin { type MsgSwapExactAmountInResponse struct { TokenOutAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=token_out_amount,json=tokenOutAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"token_out_amount"` - Discount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=discount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"discount"` + SwapFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=swap_fee,json=swapFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"swap_fee"` + Discount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=discount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"discount"` } func (m *MsgSwapExactAmountInResponse) Reset() { *m = MsgSwapExactAmountInResponse{} } @@ -525,7 +526,8 @@ func (m *MsgSwapExactAmountOut) GetTokenOut() types.Coin { type MsgSwapExactAmountOutResponse struct { TokenInAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=token_in_amount,json=tokenInAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"token_in_amount"` - Discount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=discount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"discount"` + SwapFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=swap_fee,json=swapFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"swap_fee"` + Discount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=discount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"discount"` } func (m *MsgSwapExactAmountOutResponse) Reset() { *m = MsgSwapExactAmountOutResponse{} } @@ -840,7 +842,8 @@ type MsgSwapByDenomResponse struct { InRoute []*SwapAmountInRoute `protobuf:"bytes,2,rep,name=in_route,json=inRoute,proto3" json:"in_route,omitempty"` OutRoute []*SwapAmountOutRoute `protobuf:"bytes,3,rep,name=out_route,json=outRoute,proto3" json:"out_route,omitempty"` SpotPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=spot_price,json=spotPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"spot_price"` - Discount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=discount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"discount"` + SwapFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=swap_fee,json=swapFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"swap_fee"` + Discount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=discount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"discount"` } func (m *MsgSwapByDenomResponse) Reset() { *m = MsgSwapByDenomResponse{} } @@ -919,82 +922,84 @@ func init() { func init() { proto.RegisterFile("elys/amm/tx.proto", fileDescriptor_ed7ddafd861f6b7f) } var fileDescriptor_ed7ddafd861f6b7f = []byte{ - // 1191 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x41, 0x4f, 0x1b, 0xc7, - 0x17, 0x67, 0x0d, 0x18, 0xfb, 0x39, 0x84, 0xb0, 0x40, 0x30, 0x4e, 0x30, 0xfe, 0xef, 0x5f, 0xa2, - 0x56, 0xa4, 0xac, 0x15, 0xaa, 0xb6, 0x0a, 0x8a, 0xda, 0xc6, 0x01, 0x2a, 0x47, 0xb1, 0x40, 0x1b, - 0x29, 0xaa, 0x5a, 0xb5, 0xab, 0xc5, 0x9e, 0x98, 0x15, 0xde, 0x99, 0xad, 0x67, 0xb6, 0x98, 0xf6, - 0x50, 0xa9, 0x97, 0x5e, 0x7b, 0xee, 0x57, 0xe8, 0xbd, 0x5f, 0xa0, 0x3d, 0xe4, 0x18, 0x55, 0x3d, - 0x54, 0x39, 0xd0, 0x0a, 0xd4, 0xef, 0x51, 0xcd, 0xec, 0xec, 0xac, 0x17, 0xdb, 0x60, 0x1c, 0x7a, - 0xc2, 0xfb, 0xde, 0xbc, 0xdf, 0xce, 0xfb, 0xbd, 0xdf, 0xbc, 0x37, 0x0b, 0xcc, 0xa3, 0xf6, 0x31, - 0xad, 0x38, 0x9e, 0x57, 0x61, 0x5d, 0xd3, 0xef, 0x10, 0x46, 0xf4, 0x0c, 0x37, 0x99, 0x8e, 0xe7, - 0x15, 0x16, 0x5b, 0xa4, 0x45, 0x84, 0xb1, 0xc2, 0x7f, 0x85, 0xfe, 0x42, 0xb1, 0x41, 0xa8, 0x47, - 0x68, 0x65, 0xdf, 0xa1, 0xa8, 0xf2, 0xf5, 0x83, 0x7d, 0xc4, 0x9c, 0x07, 0x95, 0x06, 0x71, 0xb1, - 0xf4, 0x2f, 0x29, 0x48, 0xdf, 0xe9, 0x38, 0x1e, 0x95, 0xe6, 0x15, 0x65, 0xa6, 0x47, 0x8e, 0x6f, - 0x77, 0x48, 0xc0, 0x90, 0x74, 0x15, 0xe2, 0x08, 0x42, 0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0xb9, 0xde, 0xb6, 0x92, 0xef, 0x8b, 0x93, 0x9e, 0x42, 0x69, - 0x98, 0x47, 0x41, 0x7d, 0x07, 0xab, 0x17, 0x0f, 0xa0, 0x7b, 0x09, 0x88, 0x0b, 0xd7, 0x16, 0x36, - 0x46, 0x5f, 0x1b, 0x6d, 0xa0, 0x5a, 0x7d, 0x75, 0x5a, 0xd4, 0x5e, 0x9f, 0x16, 0xb5, 0xbf, 0x4f, - 0x8b, 0xda, 0x8f, 0x67, 0xc5, 0x89, 0xd7, 0x67, 0xc5, 0x89, 0x3f, 0xcf, 0x8a, 0x13, 0x9f, 0x95, - 0x7b, 0x84, 0xca, 0x71, 0xef, 0x63, 0xc4, 0x8e, 0x48, 0xe7, 0x50, 0x3c, 0x54, 0xba, 0xe1, 0xbf, - 0x06, 0xb8, 0x5c, 0xf7, 0xd3, 0xe2, 0xab, 0xfb, 0xdd, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xb8, - 0x24, 0x05, 0x69, 0x33, 0x10, 0x00, 0x00, + // 1217 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcf, 0x6f, 0xe3, 0xc4, + 0x17, 0xaf, 0x93, 0x36, 0x3f, 0x5e, 0xb6, 0xbf, 0xdc, 0x76, 0x9b, 0x66, 0xb7, 0x69, 0xbe, 0xfe, + 0x4a, 0x25, 0x5a, 0x69, 0x1d, 0x6d, 0x11, 0xa0, 0xad, 0x56, 0xc0, 0x66, 0xdb, 0xa2, 0xac, 0x36, + 0x6a, 0xe5, 0x95, 0x56, 0x08, 0x04, 0x96, 0x9b, 0x4c, 0x53, 0xab, 0xf1, 0x8c, 0xc9, 0x8c, 0x69, + 0x0a, 0x07, 0x24, 0x2e, 0xdc, 0x80, 0x33, 0x7f, 0x02, 0xdc, 0xf9, 0x1b, 0xf6, 0xb8, 0x42, 0x1c, + 0xd0, 0x1e, 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0x89, 0xcf, 0xca, 0x3d, 0x85, 0xca, 0x79, 0x1f, 0x62, + 0xc4, 0x8e, 0x49, 0xe7, 0x48, 0xbc, 0x54, 0xba, 0xfe, 0x7f, 0x1f, 0xbc, 0x5c, 0xf7, 0x53, 0xe2, + 0x6f, 0x85, 0x77, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x67, 0x6b, 0x83, 0xb4, 0x14, 0x11, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1699,6 +1704,16 @@ func (m *MsgSwapExactAmountInResponse) MarshalToSizedBuffer(dAtA []byte) (int, e i = encodeVarintTx(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x1a + { + size := m.SwapFee.Size() + i -= size + if _, err := m.SwapFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 { size := m.TokenOutAmount.Size() @@ -1816,6 +1831,16 @@ func (m *MsgSwapExactAmountOutResponse) MarshalToSizedBuffer(dAtA []byte) (int, i = encodeVarintTx(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x1a + { + size := m.SwapFee.Size() + i -= size + if _, err := m.SwapFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 { size := m.TokenInAmount.Size() @@ -2102,6 +2127,16 @@ func (m *MsgSwapByDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) i = encodeVarintTx(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x32 + { + size := m.SwapFee.Size() + i -= size + if _, err := m.SwapFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x2a { size := m.SpotPrice.Size() @@ -2320,6 +2355,8 @@ func (m *MsgSwapExactAmountInResponse) Size() (n int) { _ = l l = m.TokenOutAmount.Size() n += 1 + l + sovTx(uint64(l)) + l = m.SwapFee.Size() + n += 1 + l + sovTx(uint64(l)) l = m.Discount.Size() n += 1 + l + sovTx(uint64(l)) return n @@ -2358,6 +2395,8 @@ func (m *MsgSwapExactAmountOutResponse) Size() (n int) { _ = l l = m.TokenInAmount.Size() n += 1 + l + sovTx(uint64(l)) + l = m.SwapFee.Size() + n += 1 + l + sovTx(uint64(l)) l = m.Discount.Size() n += 1 + l + sovTx(uint64(l)) return n @@ -2477,6 +2516,8 @@ func (m *MsgSwapByDenomResponse) Size() (n int) { } l = m.SpotPrice.Size() n += 1 + l + sovTx(uint64(l)) + l = m.SwapFee.Size() + n += 1 + l + sovTx(uint64(l)) l = m.Discount.Size() n += 1 + l + sovTx(uint64(l)) return n @@ -3582,6 +3623,40 @@ func (m *MsgSwapExactAmountInResponse) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SwapFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Discount", wireType) } @@ -3917,6 +3992,40 @@ func (m *MsgSwapExactAmountOutResponse) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SwapFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Discount", wireType) } @@ -4834,6 +4943,40 @@ func (m *MsgSwapByDenomResponse) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SwapFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Discount", wireType) }