From 1a9279f660565e791568d5474a4f3e8f9ec83865 Mon Sep 17 00:00:00 2001 From: Deividas Petraitis Date: Tue, 21 Jan 2025 17:58:05 +0200 Subject: [PATCH 1/9] BE-676 | Implement InGivenOut APIs for CL pool --- domain/errors.go | 5 +- .../pools/routable_concentrated_pool.go | 117 +++++++++++++++++- 2 files changed, 118 insertions(+), 4 deletions(-) diff --git a/domain/errors.go b/domain/errors.go index 68413abc2..0e8554e19 100644 --- a/domain/errors.go +++ b/domain/errors.go @@ -137,8 +137,9 @@ func (e ConcentratedZeroCurrentSqrtPriceError) Error() string { } type ConcentratedNotEnoughLiquidityToCompleteSwapError struct { - PoolId uint64 - AmountIn string + PoolId uint64 + AmountIn string + AmountOut string } func (e ConcentratedNotEnoughLiquidityToCompleteSwapError) Error() string { diff --git a/router/usecase/pools/routable_concentrated_pool.go b/router/usecase/pools/routable_concentrated_pool.go index 5775d31d7..2b31c861a 100644 --- a/router/usecase/pools/routable_concentrated_pool.go +++ b/router/usecase/pools/routable_concentrated_pool.go @@ -2,7 +2,6 @@ package pools import ( "context" - "errors" "fmt" "cosmossdk.io/math" @@ -195,8 +194,122 @@ func (r *routableConcentratedPoolImpl) CalculateTokenOutByTokenIn(ctx context.Co } // CalculateTokenInByTokenOut implements domain.RoutablePool. +// It calculates the amount of token in given the amount of token out for a concentrated liquidity pool. +// Fails if: +// - the underlying chain pool set on the routable pool is not of concentrated type +// - fails to retrieve the tick model for the pool +// - the current tick is not within the specified current bucket range +// - tick model has no liquidity flag set +// - the current sqrt price is zero +// - rans out of ticks during swap (token out is too high for liquidity in the pool) func (r *routableConcentratedPoolImpl) CalculateTokenInByTokenOut(ctx context.Context, tokenOut sdk.Coin) (sdk.Coin, error) { - return sdk.Coin{}, errors.New("not implemented") + concentratedPool := r.ChainPool + tickModel := r.TickModel + + if tickModel == nil { + return sdk.Coin{}, domain.ConcentratedPoolNoTickModelError{ + PoolId: r.ChainPool.Id, + } + } + + // Ensure pool has liquidity. + if tickModel.HasNoLiquidity { + return sdk.Coin{}, domain.ConcentratedNoLiquidityError{ + PoolId: concentratedPool.Id, + } + } + + // Ensure that the current bucket is within the available bucket range. + currentBucketIndex := tickModel.CurrentTickIndex + + if currentBucketIndex < 0 || currentBucketIndex >= int64(len(tickModel.Ticks)) { + return sdk.Coin{}, domain.ConcentratedCurrentTickNotWithinBucketError{ + PoolId: concentratedPool.Id, + CurrentBucketIndex: currentBucketIndex, + TotalBuckets: int64(len(tickModel.Ticks)), + } + } + + currentBucket := tickModel.Ticks[currentBucketIndex] + + isCurrentTickWithinBucket := concentratedPool.IsCurrentTickInRange(currentBucket.LowerTick, currentBucket.UpperTick) + if !isCurrentTickWithinBucket { + return sdk.Coin{}, domain.ConcentratedCurrentTickAndBucketMismatchError{ + PoolID: concentratedPool.Id, + CurrentTick: concentratedPool.CurrentTick, + LowerTick: currentBucket.LowerTick, + UpperTick: currentBucket.UpperTick, + } + } + + // Set the appropriate token out denom. + isZeroForOne := tokenOut.Denom == concentratedPool.Token0 + tokenInDenom := concentratedPool.Token0 + if isZeroForOne { + tokenInDenom = concentratedPool.Token1 + } + + // Initialize the swap strategy. + swapStrategy := swapstrategy.New(isZeroForOne, smallestDec, &storetypes.KVStoreKey{}, concentratedPool.SpreadFactor) + + var ( + // Swap state + currentSqrtPrice = concentratedPool.GetCurrentSqrtPrice() + + amountRemainingOut = tokenOut.Amount.ToLegacyDec() + amountInTotal = osmomath.ZeroDec() + ) + + if currentSqrtPrice.IsZero() { + return sdk.Coin{}, domain.ConcentratedZeroCurrentSqrtPriceError{ + PoolId: concentratedPool.Id, + } + } + + // Compute swap over all buckets. + for amountRemainingOut.IsPositive() { + if currentBucketIndex >= int64(len(tickModel.Ticks)) || currentBucketIndex < 0 { + // This happens when there is not enough liquidity in the pool to complete the swap + // for a given amount of token in. + return sdk.Coin{}, domain.ConcentratedNotEnoughLiquidityToCompleteSwapError{ + PoolId: concentratedPool.Id, + AmountOut: sdk.NewCoins(tokenOut).String(), + } + } + + currentBucket = tickModel.Ticks[currentBucketIndex] + + // Compute the next initialized tick index depending on the swap direction. + // Zero for one - in the lower tick direction. + // One for zero - in the upper tick direction. + var nextInitializedTickIndex int64 + if isZeroForOne { + nextInitializedTickIndex = currentBucket.LowerTick + currentBucketIndex-- + } else { + nextInitializedTickIndex = currentBucket.UpperTick + currentBucketIndex++ + } + + // Get the sqrt price for the next initialized tick index. + sqrtPriceTarget, err := getTickToSqrtPrice(nextInitializedTickIndex) + if err != nil { + return sdk.Coin{}, err + } + + // Compute the swap within current bucket + sqrtPriceNext, amountOutConsumed, amountInComputed, spreadRewardChargeTotal := swapStrategy.ComputeSwapWithinBucketInGivenOut(currentSqrtPrice, sqrtPriceTarget, currentBucket.LiquidityAmount, amountRemainingOut) + + // Update swap state for next iteration + amountRemainingOut = amountRemainingOut.SubMut(amountOutConsumed).SubMut(spreadRewardChargeTotal) + amountInTotal = amountInTotal.AddMut(amountInComputed) + + // Update current sqrt price + currentSqrtPrice = sqrtPriceNext + } + + // Return the total amount in. + return sdk.Coin{Denom: tokenInDenom, Amount: amountInTotal.TruncateInt()}, nil } // GetTokenOutDenom implements RoutablePool. From acf6e4e6e25d2004850d94298b10dfa62494fce2 Mon Sep 17 00:00:00 2001 From: Deividas Petraitis Date: Tue, 21 Jan 2025 18:05:35 +0200 Subject: [PATCH 2/9] BE-676 | Implement ChargeTakerFeeExactOut --- router/usecase/pools/routable_concentrated_pool.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/router/usecase/pools/routable_concentrated_pool.go b/router/usecase/pools/routable_concentrated_pool.go index 2b31c861a..d6886e136 100644 --- a/router/usecase/pools/routable_concentrated_pool.go +++ b/router/usecase/pools/routable_concentrated_pool.go @@ -328,17 +328,18 @@ func (r *routableConcentratedPoolImpl) String() string { return fmt.Sprintf("pool (%d), pool type (%d), pool denoms (%v), token out (%s)", concentratedPool.Id, poolmanagertypes.Concentrated, concentratedPool.GetPoolDenoms(sdk.Context{}), r.TokenOutDenom) } -// ChargeTakerFee implements domain.RoutablePool. +// ChargeTakerFeeExactIn implements domain.RoutablePool. // Charges the taker fee for the given token in and returns the token in after the fee has been charged. func (r *routableConcentratedPoolImpl) ChargeTakerFeeExactIn(tokenIn sdk.Coin) (tokenInAfterFee sdk.Coin) { tokenInAfterTakerFee, _ := poolmanager.CalcTakerFeeExactIn(tokenIn, r.GetTakerFee()) return tokenInAfterTakerFee } -// ChargeTakerFee implements domain.RoutablePool. +// ChargeTakerFeeExactOut implements domain.RoutablePool. // Charges the taker fee for the given token out and returns the token out after the fee has been charged. func (r *routableConcentratedPoolImpl) ChargeTakerFeeExactOut(tokenOut sdk.Coin) (tokenOutAfterFee sdk.Coin) { - return sdk.Coin{} + tokenOutAfterTakerFee, _ := poolmanager.CalcTakerFeeExactOut(tokenOut, r.GetTakerFee()) + return tokenOutAfterTakerFee } // SetTokenInDenom implements domain.RoutablePool. From 69d18a4dd5d804e5607974076b848de52e252489 Mon Sep 17 00:00:00 2001 From: Deividas Petraitis Date: Tue, 21 Jan 2025 18:45:26 +0200 Subject: [PATCH 3/9] BE-676 | fmt --- router/usecase/pools/routable_concentrated_pool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/router/usecase/pools/routable_concentrated_pool.go b/router/usecase/pools/routable_concentrated_pool.go index d6886e136..8a26fe887 100644 --- a/router/usecase/pools/routable_concentrated_pool.go +++ b/router/usecase/pools/routable_concentrated_pool.go @@ -257,7 +257,7 @@ func (r *routableConcentratedPoolImpl) CalculateTokenInByTokenOut(ctx context.Co currentSqrtPrice = concentratedPool.GetCurrentSqrtPrice() amountRemainingOut = tokenOut.Amount.ToLegacyDec() - amountInTotal = osmomath.ZeroDec() + amountInTotal = osmomath.ZeroDec() ) if currentSqrtPrice.IsZero() { From d254c1b650e16440bf12aa3c89f6b737e3be82f3 Mon Sep 17 00:00:00 2001 From: Deividas Petraitis Date: Tue, 21 Jan 2025 18:51:37 +0200 Subject: [PATCH 4/9] BE-676 | Edge cases test for InGivenOut for CL pool --- .../pools/routable_concentrated_pool_test.go | 184 ++++++++++++++++++ 1 file changed, 184 insertions(+) diff --git a/router/usecase/pools/routable_concentrated_pool_test.go b/router/usecase/pools/routable_concentrated_pool_test.go index 20fc5ff00..c2b227f16 100644 --- a/router/usecase/pools/routable_concentrated_pool_test.go +++ b/router/usecase/pools/routable_concentrated_pool_test.go @@ -286,3 +286,187 @@ func (s *RoutablePoolTestSuite) TestCalculateTokenOutByTokenIn_Concentrated_Erro }) } } + +// This test cases focuses on testing error and edge cases for CL quote calculation in by token out. +func (s *RoutablePoolTestSuite) TestCalculateTokenInByTokenOut_Concentrated_ErrorAndEdgeCases() { + const ( + defaultCurrentTick = int64(0) + ) + + tests := map[string]struct { + tokenOut sdk.Coin + tokenInDenom string + + tickModelOverwrite *ingesttypes.TickModel + isTickModelNil bool + shouldCreateDefaultPosition bool + + expectedTokenIn sdk.Coin + expectError error + }{ + "error: failed to get tick model": { + tokenOut: DefaultCoin1, + tokenInDenom: Denom0, + + isTickModelNil: true, + + expectError: domain.ConcentratedPoolNoTickModelError{ + PoolId: defaultPoolID, + }, + }, + "error: current bucket index is negative": { + tokenOut: DefaultCoin1, + tokenInDenom: Denom0, + + tickModelOverwrite: withCurrentTickIndex(defaultTickModel, -1), + + expectError: domain.ConcentratedCurrentTickNotWithinBucketError{ + PoolId: defaultPoolID, + CurrentBucketIndex: -1, + TotalBuckets: 0, + }, + }, + "error: current bucket index is greater than or equal to total buckets": { + tokenOut: DefaultCoin1, + tokenInDenom: Denom0, + + tickModelOverwrite: defaultTickModel, + + expectError: domain.ConcentratedCurrentTickNotWithinBucketError{ + PoolId: defaultPoolID, + CurrentBucketIndex: defaultCurrentTick, + TotalBuckets: defaultCurrentTick, + }, + }, + "error: has no liquidity": { + tokenOut: DefaultCoin1, + tokenInDenom: Denom0, + + tickModelOverwrite: withHasNoLiquidity(defaultTickModel), + + expectError: domain.ConcentratedNoLiquidityError{ + PoolId: defaultPoolID, + }, + }, + "error: current tick is not within current bucket": { + tokenOut: DefaultCoin1, + tokenInDenom: Denom0, + + tickModelOverwrite: withTicks(defaultTickModel, []ingesttypes.LiquidityDepthsWithRange{ + { + LowerTick: defaultCurrentTick - 2, + UpperTick: defaultCurrentTick - 1, + LiquidityAmount: DefaultLiquidityAmt, + }, + }), + + expectError: domain.ConcentratedCurrentTickAndBucketMismatchError{ + CurrentTick: defaultCurrentTick, + LowerTick: defaultCurrentTick - 2, + UpperTick: defaultCurrentTick - 1, + }, + }, + "error: zero current sqrt price": { + tokenOut: DefaultCoin1, + tokenInDenom: Denom0, + + tickModelOverwrite: &ingesttypes.TickModel{ + Ticks: []ingesttypes.LiquidityDepthsWithRange{ + { + LowerTick: defaultCurrentTick, + UpperTick: defaultCurrentTick + 1, + LiquidityAmount: DefaultLiquidityAmt, + }, + }, + CurrentTickIndex: defaultCurrentTick, + + // Note that despite setting HasNoLiquidity to false, + // the pool is in invalid state. We expect that the ingester + // will not allow this to happen. + HasNoLiquidity: false, + }, + + expectError: domain.ConcentratedZeroCurrentSqrtPriceError{PoolId: defaultPoolID}, + }, + "error: not enough liquidity to complete swap": { + tokenOut: DefaultCoin1, + tokenInDenom: Denom0, + + shouldCreateDefaultPosition: true, + + tickModelOverwrite: withTicks(defaultTickModel, []ingesttypes.LiquidityDepthsWithRange{ + { + LowerTick: DefaultCurrentTick, + UpperTick: DefaultCurrentTick + 1, + LiquidityAmount: DefaultLiquidityAmt, + }, + }), + + expectError: domain.ConcentratedNotEnoughLiquidityToCompleteSwapError{ + PoolId: defaultPoolID, + AmountOut: DefaultCoin1.String(), + }, + }, + } + + for name, tc := range tests { + s.Run(name, func() { + s.SetupTest() + + var ( + tickModel *ingesttypes.TickModel + err error + ) + + pool := s.PrepareConcentratedPool() + concentratedPool, ok := pool.(*concentratedmodel.Pool) + s.Require().True(ok) + + if tc.shouldCreateDefaultPosition { + s.SetupDefaultPosition(concentratedPool.Id) + } + + // refetch the pool + pool, err = s.App.ConcentratedLiquidityKeeper.GetConcentratedPoolById(s.Ctx, concentratedPool.Id) + s.Require().NoError(err) + concentratedPool, ok = pool.(*concentratedmodel.Pool) + s.Require().True(ok) + + if tc.tickModelOverwrite != nil { + tickModel = tc.tickModelOverwrite + + } else if tc.isTickModelNil { + // For clarity: + tickModel = nil + } else { + // Get liquidity for full range + ticks, currentTickIndex, err := s.App.ConcentratedLiquidityKeeper.GetTickLiquidityForFullRange(s.Ctx, concentratedPool.Id) + s.Require().NoError(err) + + tickModel = &ingesttypes.TickModel{ + Ticks: ticks, + CurrentTickIndex: currentTickIndex, + HasNoLiquidity: false, + } + } + + routablePool := pools.RoutableConcentratedPoolImpl{ + ChainPool: concentratedPool, + TickModel: tickModel, + TokenInDenom: tc.tokenInDenom, + TakerFee: osmomath.ZeroDec(), + } + + tokenIn, err := routablePool.CalculateTokenInByTokenOut(context.TODO(), tc.tokenOut) + + if tc.expectError != nil { + s.Require().Error(err) + s.Require().ErrorContains(err, tc.expectError.Error()) + return + } + s.Require().NoError(err) + + s.Require().Equal(tc.expectedTokenIn.String(), tokenIn.String()) + }) + } +} From fa7aef9a8f9337c3c35d10cb83957cb322c95aa8 Mon Sep 17 00:00:00 2001 From: Deividas Petraitis Date: Wed, 22 Jan 2025 18:03:45 +0200 Subject: [PATCH 5/9] BE-676 | Update ConcentratedNotEnoughLiquidityToCompleteSwapError for AmountOut error --- domain/errors.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/domain/errors.go b/domain/errors.go index 0e8554e19..e69e7cfdc 100644 --- a/domain/errors.go +++ b/domain/errors.go @@ -143,7 +143,11 @@ type ConcentratedNotEnoughLiquidityToCompleteSwapError struct { } func (e ConcentratedNotEnoughLiquidityToCompleteSwapError) Error() string { - return fmt.Sprintf("not enough liquidity to complete swap in pool (%d) with amount in (%s)", e.PoolId, e.AmountIn) + if e.AmountIn != "" { + return fmt.Sprintf("not enough liquidity to complete swap in pool (%d) with amount in (%s)", e.PoolId, e.AmountIn) + } + + return fmt.Sprintf("not enough liquidity to complete swap in pool (%d) with amount out (%s)", e.PoolId, e.AmountOut) } type ConcentratedTickModelNotSetError struct { From f2088a2607f0b9f2ac4bb14c2902539b57910ca9 Mon Sep 17 00:00:00 2001 From: Deividas Petraitis Date: Wed, 22 Jan 2025 18:21:05 +0200 Subject: [PATCH 6/9] BE-676 | Add test cases for CL pools --- go.mod | 44 +++++---- go.sum | 95 +++++++++++-------- .../pools/routable_concentrated_pool_test.go | 60 ++++++++++++ 3 files changed, 137 insertions(+), 62 deletions(-) diff --git a/go.mod b/go.mod index 1ca348692..6a77f3d6f 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.22.7 toolchain go1.23.3 require ( - cosmossdk.io/math v1.4.0 + cosmossdk.io/math v1.5.0 cosmossdk.io/store v1.1.1 cosmossdk.io/x/tx v0.13.7 github.com/CosmWasm/wasmd v0.53.2 @@ -22,11 +22,11 @@ require ( github.com/swaggo/echo-swagger v1.4.1 github.com/swaggo/swag v1.16.3 go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho v0.53.0 - go.opentelemetry.io/otel v1.33.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0 - go.opentelemetry.io/otel/sdk v1.33.0 + go.opentelemetry.io/otel v1.34.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 + go.opentelemetry.io/otel/sdk v1.34.0 go.uber.org/zap v1.26.0 - google.golang.org/grpc v1.68.1 + google.golang.org/grpc v1.69.4 ) require ( @@ -46,6 +46,7 @@ require ( github.com/bytedance/sonic/loader v0.2.0 // indirect github.com/cloudwego/base64x v0.1.4 // indirect github.com/cloudwego/iasm v0.2.0 // indirect + github.com/cockroachdb/apd/v3 v3.2.1 // indirect github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2 // indirect github.com/cosmos/ibc-apps/modules/async-icq/v8 v8.0.0 // indirect @@ -56,9 +57,9 @@ require ( github.com/getsentry/sentry-go v0.27.0 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/google/flatbuffers v23.5.26+incompatible // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect - github.com/hashicorp/go-metrics v0.5.3 // indirect + github.com/hashicorp/go-metrics v0.5.4 // indirect github.com/hashicorp/go-plugin v1.6.0 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/iancoleman/strcase v0.3.0 // indirect @@ -70,8 +71,8 @@ require ( github.com/skip-mev/block-sdk/v2 v2.1.5 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 // indirect - go.opentelemetry.io/proto/otlp v1.4.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect + go.opentelemetry.io/proto/otlp v1.5.0 // indirect golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect gotest.tools/v3 v3.5.1 // indirect ) @@ -86,7 +87,7 @@ require ( require ( cloud.google.com/go v0.115.1 // indirect - cloud.google.com/go/compute/metadata v0.5.0 // indirect + cloud.google.com/go/compute/metadata v0.5.2 // indirect cloud.google.com/go/iam v1.2.1 // indirect cloud.google.com/go/storage v1.43.0 // indirect cosmossdk.io/api v0.7.6 @@ -230,26 +231,26 @@ require ( github.com/zondax/ledger-go v0.14.3 // indirect go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.58.0 + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 - go.opentelemetry.io/otel/metric v1.33.0 // indirect - go.opentelemetry.io/otel/trace v1.33.0 + go.opentelemetry.io/otel/metric v1.34.0 // indirect + go.opentelemetry.io/otel/trace v1.34.0 go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.31.0 // indirect + golang.org/x/crypto v0.32.0 // indirect golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 - golang.org/x/net v0.32.0 // indirect + golang.org/x/net v0.34.0 // indirect golang.org/x/oauth2 v0.24.0 // indirect golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/term v0.27.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/term v0.28.0 // indirect golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.6.0 // indirect golang.org/x/tools v0.22.0 // indirect google.golang.org/api v0.197.0 // indirect google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 - google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect - google.golang.org/protobuf v1.35.2 + google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f + google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/protobuf v1.36.3 gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -282,6 +283,9 @@ replace ( github.com/osmosis-labs/osmosis/osmoutils => github.com/osmosis-labs/osmosis/osmoutils v0.0.12-0.20240825083448-87db4447a1ff github.com/osmosis-labs/osmosis/v28 => github.com/osmosis-labs/osmosis/v28 v28.0.2 + // Temp replacement + github.com/osmosis-labs/osmosis/v28 v28.0.2 => github.com/osmosis-labs/osmosis/v28 v28.0.0-20250122160533-f8cd1e9a2869 + github.com/osmosis-labs/osmosis/x/epochs => github.com/osmosis-labs/osmosis/x/epochs v0.0.5-0.20240825083448-87db4447a1ff github.com/osmosis-labs/osmosis/x/ibc-hooks => github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.0-20240825083448-87db4447a1ff diff --git a/go.sum b/go.sum index 5aa3fc2ac..4bc58bd5e 100644 --- a/go.sum +++ b/go.sum @@ -72,8 +72,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= -cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= +cloud.google.com/go/compute/metadata v0.5.2 h1:UxK4uu/Tn+I3p2dYWTfiX4wva7aYlKixAHn3fyqngqo= +cloud.google.com/go/compute/metadata v0.5.2/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= @@ -206,8 +206,8 @@ cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/log v1.5.0 h1:dVdzPJW9kMrnAYyMf1duqacoidB9uZIl+7c6z0mnq0g= cosmossdk.io/log v1.5.0/go.mod h1:Tr46PUJjiUthlwQ+hxYtUtPn4D/oCZXAkYevBeh5+FI= -cosmossdk.io/math v1.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ= -cosmossdk.io/math v1.4.0/go.mod h1:O5PkD4apz2jZs4zqFdTr16e1dcaQCc5z6lkEnrrppuk= +cosmossdk.io/math v1.5.0 h1:sbOASxee9Zxdjd6OkzogvBZ25/hP929vdcYcBJQbkLc= +cosmossdk.io/math v1.5.0/go.mod h1:AAwwBmUhqtk2nlku174JwSll+/DepUXW3rWIXN5q+Nw= cosmossdk.io/x/circuit v0.1.1 h1:KPJCnLChWrxD4jLwUiuQaf5mFD/1m7Omyo7oooefBVQ= cosmossdk.io/x/circuit v0.1.1/go.mod h1:B6f/urRuQH8gjt4eLIXfZJucrbreuYrKh5CSjaOxr+Q= cosmossdk.io/x/evidence v0.1.1 h1:Ks+BLTa3uftFpElLTDp9L76t2b58htjVbSZ86aoK/E4= @@ -266,6 +266,7 @@ github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= @@ -337,6 +338,8 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= +github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg= +github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877 h1:1MLK4YpFtIEo3ZtMA5C795Wtv5VuUnrXX7mQG+aHg6o= github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= @@ -654,8 +657,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 h1:TmHmbvxPmaegwhDubVz0lICL0J5Ka2vwTzhoePEXsGE= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0/go.mod h1:qztMSjm835F2bXf+5HKAPIS5qsmQDqZna/PgVt4rWtI= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 h1:VNqngBF40hVlDloBruUehVYC3ArSgIyScOAyMRqBxRg= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1/go.mod h1:RBRO7fro65R6tjKzYgLAFo0t1QEXY1Dp+i/bvpRiqiQ= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= @@ -672,8 +675,8 @@ github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVH github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= -github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= +github.com/hashicorp/go-metrics v0.5.4 h1:8mmPiIJkTPPEbAiV97IxdAGNdRdaWwVap1BU6elejKY= +github.com/hashicorp/go-metrics v0.5.4/go.mod h1:CG5yz4NZ/AI/aQt9Ucm/vdBnbh7fvmv4lxZ350i+QQI= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= @@ -745,6 +748,7 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= @@ -894,8 +898,8 @@ github.com/osmosis-labs/osmosis/osmomath v0.0.12-0.20240825083448-87db4447a1ff h github.com/osmosis-labs/osmosis/osmomath v0.0.12-0.20240825083448-87db4447a1ff/go.mod h1:hbw0oWTlkv3ls2S/4jBHlqZUdrejCQOGLhYeDm/CUgU= github.com/osmosis-labs/osmosis/osmoutils v0.0.12-0.20240825083448-87db4447a1ff h1:1LPvH9S3/djTec2eXjJzEHbO7RTKVjhv8aQgwF4+9NY= github.com/osmosis-labs/osmosis/osmoutils v0.0.12-0.20240825083448-87db4447a1ff/go.mod h1:TGr6mFCyOZFL0TZMKvOqjqmZRkT7Z1RNzeGUP9b6ygc= -github.com/osmosis-labs/osmosis/v28 v28.0.2 h1:4fTbqDc9y+QOh5m7mzMgZMo9OVfy3kAITnCygigjv0U= -github.com/osmosis-labs/osmosis/v28 v28.0.2/go.mod h1:blZcGNiMqmr/QETNWMA+TG/6mGj0Pcsa3ZplzFELo6A= +github.com/osmosis-labs/osmosis/v28 v28.0.0-20250122160533-f8cd1e9a2869 h1:OnMgCPSIGXKH+rw2rsddemlLgLQdqP5fTW8YDvaEHRs= +github.com/osmosis-labs/osmosis/v28 v28.0.0-20250122160533-f8cd1e9a2869/go.mod h1:ZryJjWT1x5vlU6uwZjfly1GI5xdaR36L7u+do8rHkNk= github.com/osmosis-labs/osmosis/x/epochs v0.0.5-0.20240825083448-87db4447a1ff h1:oQ8iKv4vzkBjbV3mRuw1/bPgcpYDO64GRYUrIR9u8ko= github.com/osmosis-labs/osmosis/x/epochs v0.0.5-0.20240825083448-87db4447a1ff/go.mod h1:7ylCTvH4gEtZ5E8paiwSjmOzOKOOls8Br45W9uwWnP0= github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.0-20240825083448-87db4447a1ff h1:OZGMwv/Km6xnIB16d4zghFf0x7K9JlWqRaxgOVBIv7Y= @@ -930,6 +934,7 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= @@ -946,6 +951,7 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc= github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -954,6 +960,7 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= @@ -1106,27 +1113,29 @@ go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJyS go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho v0.53.0 h1:85yXs++3rTVZNNkcXYlc1wCbUOvZvpiA5QvMSaX+SUI= go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho v0.53.0/go.mod h1:25X27kodOL0ZXxaHcxe7R+O7iaj7yEJeZFMlm7r0EAg= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.58.0 h1:PS8wXpbyaDJQ2VDHHncMe9Vct0Zn1fEjpsjrLxGJoSc= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.58.0/go.mod h1:HDBUsEjOuRC0EzKZ1bSaRGZWUBAzo+MhAcUUORSr4D0= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 h1:rgMkmiGfix9vFJDcDi1PK8WEQP4FLQwLDfhp5ZLpFeE= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0/go.mod h1:ijPqXp5P6IRRByFVVg9DY8P5HkxkHE5ARIa+86aXPf4= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8= go.opentelemetry.io/contrib/propagators/b3 v1.28.0 h1:XR6CFQrQ/ttAYmTBX2loUEFGdk1h17pxYI8828dk/1Y= go.opentelemetry.io/contrib/propagators/b3 v1.28.0/go.mod h1:DWRkzJONLquRz7OJPh2rRbZ7MugQj62rk7g6HRnEqh0= -go.opentelemetry.io/otel v1.33.0 h1:/FerN9bax5LoK51X/sI0SVYrjSE0/yUL7DpxW4K3FWw= -go.opentelemetry.io/otel v1.33.0/go.mod h1:SUUkR6csvUQl+yjReHu5uM3EtVV7MBm5FHKRlNx4I8I= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 h1:Vh5HayB/0HHfOQA7Ctx69E/Y/DcQSMPpKANYVMQ7fBA= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0/go.mod h1:cpgtDBaqD/6ok/UG0jT15/uKjAY8mRA53diogHBg3UI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0 h1:5pojmb1U1AogINhN3SurB+zm/nIcusopeBNp42f45QM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0/go.mod h1:57gTHJSE5S1tqg+EKsLPlTWhpHMsWlVmer+LA926XiA= -go.opentelemetry.io/otel/metric v1.33.0 h1:r+JOocAyeRVXD8lZpjdQjzMadVZp2M4WmQ+5WtEnklQ= -go.opentelemetry.io/otel/metric v1.33.0/go.mod h1:L9+Fyctbp6HFTddIxClbQkjtubW6O9QS3Ann/M82u6M= -go.opentelemetry.io/otel/sdk v1.33.0 h1:iax7M131HuAm9QkZotNHEfstof92xM+N8sr3uHXc2IM= -go.opentelemetry.io/otel/sdk v1.33.0/go.mod h1:A1Q5oi7/9XaMlIWzPSxLRWOI8nG3FnzHJNbiENQuihM= -go.opentelemetry.io/otel/trace v1.33.0 h1:cCJuF7LRjUFso9LPnEAHJDB2pqzp+hbO8eu1qqW2d/s= -go.opentelemetry.io/otel/trace v1.33.0/go.mod h1:uIcdVUZMpTAmz0tI1z04GoVSezK37CbGV4fr1f2nBck= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 h1:OeNbIYk/2C15ckl7glBlOBp5+WlYsOElzTNmiPW/x60= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0/go.mod h1:7Bept48yIeqxP2OZ9/AqIpYS94h2or0aB4FypJTc8ZM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 h1:tgJ0uaNS4c98WRNUEx5U3aDlrDOI5Rs+1Vifcw4DJ8U= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0/go.mod h1:U7HYyW0zt/a9x5J1Kjs+r1f/d4ZHnYFclhYY2+YbeoE= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= +go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v1.4.0 h1:TA9WRvW6zMwP+Ssb6fLoUIuirti1gGbP28GcKG1jgeg= -go.opentelemetry.io/proto/otlp v1.4.0/go.mod h1:PPBWZIP98o2ElSqI35IHfu7hIhSwvc5N38Jw8pXuGFY= +go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= +go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -1159,8 +1168,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1261,8 +1270,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= -golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1358,6 +1367,7 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1366,6 +1376,7 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1401,13 +1412,13 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= -golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= +golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1664,10 +1675,10 @@ google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 h1:BulPr26Jqjnd4eYDVe+YvyR7Yc2vJGkO5/0UxD0/jZU= google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:hL97c3SYopEHblzpxRL4lSs523++l8DYxGM1FQiYmb4= -google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 h1:CkkIfIt50+lT6NHAVoRYEyAvQGFM7xEwXUUywFvEb3Q= -google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576/go.mod h1:1R3kvZ1dtP3+4p4d3G8uJ8rFk/fWlScl38vanWACI08= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 h1:8ZmaLZE4XWrtU3MyClkYqqtl6Oegr3235h7jxsDyqCY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f h1:gap6+3Gk41EItBuyi4XX/bp4oqJ3UwuIMl25yGinuAA= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:Ic02D47M+zbarjYYUlK57y316f2MoN0gjAwI3f2S95o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f h1:OxYkA3wjPsZyBylwymxSHa7ViiW1Sml4ToBrncvFehI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1709,8 +1720,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0= -google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw= +google.golang.org/grpc v1.69.4 h1:MF5TftSMkd8GLw/m0KM6V8CMOCY6NZ1NQDPGFgbTt4A= +google.golang.org/grpc v1.69.4/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1727,8 +1738,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= -google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU= +google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/router/usecase/pools/routable_concentrated_pool_test.go b/router/usecase/pools/routable_concentrated_pool_test.go index c2b227f16..07de69a13 100644 --- a/router/usecase/pools/routable_concentrated_pool_test.go +++ b/router/usecase/pools/routable_concentrated_pool_test.go @@ -103,6 +103,66 @@ func (s *RoutablePoolTestSuite) TestCalculateTokenOutByTokenIn_Concentrated_Succ } } +// Tests the CalculateTokenInByTokenOut method of the RoutableConcentratedPoolImpl struct +// when the pool is concentrated. +// +// It uses the same success test cases as the chain logic. +// The error cases are tested in a separate fixture because the edge cases are different.. +func (s *RoutablePoolTestSuite) TestCalculateTokenInByTokenOut_Concentrated_SuccessChainVectors() { + tests := apptesting.SwapInGivenOutCases + + for name, tc := range tests { + s.Run(name, func() { + // Note: router quote tests do not have the concept of slippage protection. + // These quotes are used to derive the slippage protection amount. + // So we skip these tests. + if strings.Contains(name, "slippage protection") { + s.T().Skip("no slippage protection in router quote tests") + } + + s.SetupAndFundSwapTest() + concentratedPool := s.PreparePoolWithCustSpread(tc.SpreadFactor) + // add default position + s.SetupDefaultPosition(concentratedPool.GetId()) + s.SetupSecondPosition(tc, concentratedPool) + + // Refetch the pool + concentratedPool, err := s.App.ConcentratedLiquidityKeeper.GetConcentratedPoolById(s.Ctx, concentratedPool.GetId()) + s.Require().NoError(err) + + // Get liquidity for full range + ticks, currentTickIndex, err := s.App.ConcentratedLiquidityKeeper.GetTickLiquidityForFullRange(s.Ctx, concentratedPool.GetId()) + s.Require().NoError(err) + + poolWrapper := &ingesttypes.PoolWrapper{ + ChainModel: concentratedPool, + TickModel: &ingesttypes.TickModel{ + Ticks: ticks, + CurrentTickIndex: currentTickIndex, + HasNoLiquidity: false, + }, + SQSModel: ingesttypes.SQSPool{ + PoolLiquidityCap: osmomath.NewInt(100), + PoolLiquidityCapError: "", + Balances: sdk.Coins{}, + PoolDenoms: []string{"foo", "bar"}, + }, + } + cosmWasmPoolsParams := cosmwasmdomain.CosmWasmPoolsParams{ + ScalingFactorGetterCb: domain.UnsetScalingFactorGetterCb, + } + + routablePool, err := pools.NewRoutablePool(poolWrapper, tc.TokenInDenom, tc.TokenOutDenom, noTakerFee, cosmWasmPoolsParams) + s.Require().NoError(err) + + tokenIn, err := routablePool.CalculateTokenInByTokenOut(context.TODO(), tc.TokenOut) + + s.Require().NoError(err) + s.Require().Equal(tc.ExpectedTokenIn.String(), tokenIn.String()) + }) + } +} + // This test cases focuses on testing error and edge cases for CL quote calculation out by token in. func (s *RoutablePoolTestSuite) TestCalculateTokenOutByTokenIn_Concentrated_ErrorAndEdgeCases() { const ( From 39d0d3a9304e8f000cf4ddaed53c682ae3bba1af Mon Sep 17 00:00:00 2001 From: Deividas Petraitis Date: Thu, 23 Jan 2025 17:51:25 +0200 Subject: [PATCH 7/9] BE-676 | Fix CalculateTokenOutByTokenIn --- go.mod | 2 +- go.sum | 4 ++-- router/usecase/pools/routable_concentrated_pool.go | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 6a77f3d6f..a1e6e19f0 100644 --- a/go.mod +++ b/go.mod @@ -284,7 +284,7 @@ replace ( github.com/osmosis-labs/osmosis/v28 => github.com/osmosis-labs/osmosis/v28 v28.0.2 // Temp replacement - github.com/osmosis-labs/osmosis/v28 v28.0.2 => github.com/osmosis-labs/osmosis/v28 v28.0.0-20250122160533-f8cd1e9a2869 + github.com/osmosis-labs/osmosis/v28 v28.0.2 => github.com/osmosis-labs/osmosis/v28 v28.0.0-20250123151709-6bb88cccbfe6 github.com/osmosis-labs/osmosis/x/epochs => github.com/osmosis-labs/osmosis/x/epochs v0.0.5-0.20240825083448-87db4447a1ff github.com/osmosis-labs/osmosis/x/ibc-hooks => github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.0-20240825083448-87db4447a1ff diff --git a/go.sum b/go.sum index 4bc58bd5e..036290397 100644 --- a/go.sum +++ b/go.sum @@ -898,8 +898,8 @@ github.com/osmosis-labs/osmosis/osmomath v0.0.12-0.20240825083448-87db4447a1ff h github.com/osmosis-labs/osmosis/osmomath v0.0.12-0.20240825083448-87db4447a1ff/go.mod h1:hbw0oWTlkv3ls2S/4jBHlqZUdrejCQOGLhYeDm/CUgU= github.com/osmosis-labs/osmosis/osmoutils v0.0.12-0.20240825083448-87db4447a1ff h1:1LPvH9S3/djTec2eXjJzEHbO7RTKVjhv8aQgwF4+9NY= github.com/osmosis-labs/osmosis/osmoutils v0.0.12-0.20240825083448-87db4447a1ff/go.mod h1:TGr6mFCyOZFL0TZMKvOqjqmZRkT7Z1RNzeGUP9b6ygc= -github.com/osmosis-labs/osmosis/v28 v28.0.0-20250122160533-f8cd1e9a2869 h1:OnMgCPSIGXKH+rw2rsddemlLgLQdqP5fTW8YDvaEHRs= -github.com/osmosis-labs/osmosis/v28 v28.0.0-20250122160533-f8cd1e9a2869/go.mod h1:ZryJjWT1x5vlU6uwZjfly1GI5xdaR36L7u+do8rHkNk= +github.com/osmosis-labs/osmosis/v28 v28.0.0-20250123151709-6bb88cccbfe6 h1:VbJxWAfHDr8eGsF/jupE+3hzZPCMvtM6De8DVQJUUmM= +github.com/osmosis-labs/osmosis/v28 v28.0.0-20250123151709-6bb88cccbfe6/go.mod h1:ZryJjWT1x5vlU6uwZjfly1GI5xdaR36L7u+do8rHkNk= github.com/osmosis-labs/osmosis/x/epochs v0.0.5-0.20240825083448-87db4447a1ff h1:oQ8iKv4vzkBjbV3mRuw1/bPgcpYDO64GRYUrIR9u8ko= github.com/osmosis-labs/osmosis/x/epochs v0.0.5-0.20240825083448-87db4447a1ff/go.mod h1:7ylCTvH4gEtZ5E8paiwSjmOzOKOOls8Br45W9uwWnP0= github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.0-20240825083448-87db4447a1ff h1:OZGMwv/Km6xnIB16d4zghFf0x7K9JlWqRaxgOVBIv7Y= diff --git a/router/usecase/pools/routable_concentrated_pool.go b/router/usecase/pools/routable_concentrated_pool.go index 8a26fe887..c96ffdf02 100644 --- a/router/usecase/pools/routable_concentrated_pool.go +++ b/router/usecase/pools/routable_concentrated_pool.go @@ -243,10 +243,10 @@ func (r *routableConcentratedPoolImpl) CalculateTokenInByTokenOut(ctx context.Co } // Set the appropriate token out denom. - isZeroForOne := tokenOut.Denom == concentratedPool.Token0 - tokenInDenom := concentratedPool.Token0 + isZeroForOne := tokenOut.Denom == concentratedPool.Token1 + tokenInDenom := concentratedPool.Token1 if isZeroForOne { - tokenInDenom = concentratedPool.Token1 + tokenInDenom = concentratedPool.Token0 } // Initialize the swap strategy. From fb3dbab0048ee03af00ffc2e62da909beca517de Mon Sep 17 00:00:00 2001 From: Deividas Petraitis Date: Fri, 24 Jan 2025 12:50:11 +0200 Subject: [PATCH 8/9] BE-676 | Improve docs --- router/usecase/pools/routable_concentrated_pool.go | 2 ++ router/usecase/pools/routable_cw_transmuter_pool.go | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/router/usecase/pools/routable_concentrated_pool.go b/router/usecase/pools/routable_concentrated_pool.go index c96ffdf02..a9543184e 100644 --- a/router/usecase/pools/routable_concentrated_pool.go +++ b/router/usecase/pools/routable_concentrated_pool.go @@ -75,6 +75,7 @@ func (r *routableConcentratedPoolImpl) GetTakerFee() math.LegacyDec { // CalculateTokenOutByTokenIn implements domain.RoutablePool. // It calculates the amount of token out given the amount of token in for a concentrated liquidity pool. +// Because ChainPool operates on the chain store we simulate the store by operating on the custom data representation that is ingested from chain. // Fails if: // - the underlying chain pool set on the routable pool is not of concentrated type // - fails to retrieve the tick model for the pool @@ -195,6 +196,7 @@ func (r *routableConcentratedPoolImpl) CalculateTokenOutByTokenIn(ctx context.Co // CalculateTokenInByTokenOut implements domain.RoutablePool. // It calculates the amount of token in given the amount of token out for a concentrated liquidity pool. +// Because ChainPool operates on the chain store we simulate the store by operating on the custom data representation that is ingested from chain. // Fails if: // - the underlying chain pool set on the routable pool is not of concentrated type // - fails to retrieve the tick model for the pool diff --git a/router/usecase/pools/routable_cw_transmuter_pool.go b/router/usecase/pools/routable_cw_transmuter_pool.go index e90a4df22..77d2abda9 100644 --- a/router/usecase/pools/routable_cw_transmuter_pool.go +++ b/router/usecase/pools/routable_cw_transmuter_pool.go @@ -48,6 +48,7 @@ func (r *routableTransmuterPoolImpl) GetSpreadFactor() math.LegacyDec { // CalculateTokenOutByTokenIn implements domain.RoutablePool. // It calculates the amount of token out given the amount of token in for a transmuter pool. +// Because ChainPool operates on the chain store we simulate the store by operating on the custom data representation that is ingested from chain. // Transmuter pool allows no slippage swaps. It just returns the same amount of token out as token in // Returns error if: // - the underlying chain pool set on the routable pool is not of transmuter type @@ -74,6 +75,13 @@ func (r *routableTransmuterPoolImpl) CalculateTokenOutByTokenIn(ctx context.Cont } // CalculateTokenInByTokenOut implements domain.RoutablePool. +// It calculates the amount of token in given the amount of token out for a transmuter pool. +// Because ChainPool operates on the chain store we simulate the store by operating on the custom data representation that is ingested from chain. +// Transmuter pool allows no slippage swaps. It just returns the same amount of token in as token out +// Returns error if: +// - the underlying chain pool set on the routable pool is not of transmuter type +// - the token out amount is greater than the balance of the token out +// - the token out amount is greater than the balance of the token in func (r *routableTransmuterPoolImpl) CalculateTokenInByTokenOut(ctx context.Context, tokenOut sdk.Coin) (sdk.Coin, error) { poolType := r.GetType() From 0213a9c25c7283c9f697f23f55c31a634d3dbd2f Mon Sep 17 00:00:00 2001 From: Deividas Petraitis Date: Tue, 28 Jan 2025 09:11:28 +0200 Subject: [PATCH 9/9] BE-676 | Update dependencies --- go.mod | 5 +++-- go.sum | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index a1e6e19f0..79015ab47 100644 --- a/go.mod +++ b/go.mod @@ -283,8 +283,9 @@ replace ( github.com/osmosis-labs/osmosis/osmoutils => github.com/osmosis-labs/osmosis/osmoutils v0.0.12-0.20240825083448-87db4447a1ff github.com/osmosis-labs/osmosis/v28 => github.com/osmosis-labs/osmosis/v28 v28.0.2 - // Temp replacement - github.com/osmosis-labs/osmosis/v28 v28.0.2 => github.com/osmosis-labs/osmosis/v28 v28.0.0-20250123151709-6bb88cccbfe6 + // This replacement can be removed once Osmosis v28.0.3 or higher is released + // It is required to pull in test cases for BE-676 from backport branch: https://github.com/osmosis-labs/osmosis/pull/8962 + github.com/osmosis-labs/osmosis/v28 v28.0.2 => github.com/osmosis-labs/osmosis/v28 v28.0.3-0.20250128064600-532afea930f9 github.com/osmosis-labs/osmosis/x/epochs => github.com/osmosis-labs/osmosis/x/epochs v0.0.5-0.20240825083448-87db4447a1ff github.com/osmosis-labs/osmosis/x/ibc-hooks => github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.0-20240825083448-87db4447a1ff diff --git a/go.sum b/go.sum index 036290397..2e3dbce4f 100644 --- a/go.sum +++ b/go.sum @@ -898,8 +898,8 @@ github.com/osmosis-labs/osmosis/osmomath v0.0.12-0.20240825083448-87db4447a1ff h github.com/osmosis-labs/osmosis/osmomath v0.0.12-0.20240825083448-87db4447a1ff/go.mod h1:hbw0oWTlkv3ls2S/4jBHlqZUdrejCQOGLhYeDm/CUgU= github.com/osmosis-labs/osmosis/osmoutils v0.0.12-0.20240825083448-87db4447a1ff h1:1LPvH9S3/djTec2eXjJzEHbO7RTKVjhv8aQgwF4+9NY= github.com/osmosis-labs/osmosis/osmoutils v0.0.12-0.20240825083448-87db4447a1ff/go.mod h1:TGr6mFCyOZFL0TZMKvOqjqmZRkT7Z1RNzeGUP9b6ygc= -github.com/osmosis-labs/osmosis/v28 v28.0.0-20250123151709-6bb88cccbfe6 h1:VbJxWAfHDr8eGsF/jupE+3hzZPCMvtM6De8DVQJUUmM= -github.com/osmosis-labs/osmosis/v28 v28.0.0-20250123151709-6bb88cccbfe6/go.mod h1:ZryJjWT1x5vlU6uwZjfly1GI5xdaR36L7u+do8rHkNk= +github.com/osmosis-labs/osmosis/v28 v28.0.3-0.20250128064600-532afea930f9 h1:M9cvUYQITPjBIGo7WQsf6zJwuagciZ23wpdgsZrDsGA= +github.com/osmosis-labs/osmosis/v28 v28.0.3-0.20250128064600-532afea930f9/go.mod h1:blZcGNiMqmr/QETNWMA+TG/6mGj0Pcsa3ZplzFELo6A= github.com/osmosis-labs/osmosis/x/epochs v0.0.5-0.20240825083448-87db4447a1ff h1:oQ8iKv4vzkBjbV3mRuw1/bPgcpYDO64GRYUrIR9u8ko= github.com/osmosis-labs/osmosis/x/epochs v0.0.5-0.20240825083448-87db4447a1ff/go.mod h1:7ylCTvH4gEtZ5E8paiwSjmOzOKOOls8Br45W9uwWnP0= github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.0-20240825083448-87db4447a1ff h1:OZGMwv/Km6xnIB16d4zghFf0x7K9JlWqRaxgOVBIv7Y=