From 7408a8e88dfaa0190fcb7bc4b9a11b0778f8325d Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Tue, 22 Mar 2022 21:51:14 -0500 Subject: [PATCH 1/6] Delete obsolete math.go --- osmomath/math.go | 4 + x/gamm/keeper/invariants.go | 2 +- x/gamm/keeper/math.go | 203 -------------------------- x/gamm/keeper/math_test.go | 280 ------------------------------------ 4 files changed, 5 insertions(+), 484 deletions(-) delete mode 100644 x/gamm/keeper/math.go delete mode 100644 x/gamm/keeper/math_test.go diff --git a/osmomath/math.go b/osmomath/math.go index 765485d751d..e868747ee83 100644 --- a/osmomath/math.go +++ b/osmomath/math.go @@ -16,6 +16,10 @@ var one_half sdk.Dec = sdk.MustNewDecFromStr("0.5") var one sdk.Dec = sdk.OneDec() var two sdk.Dec = sdk.MustNewDecFromStr("2") +func GetPowPrecision() sdk.Dec { + return powPrecision.Clone() +} + /*********************************************************/ // AbsDifferenceWithSign returns | a - b |, (a - b).sign() diff --git a/x/gamm/keeper/invariants.go b/x/gamm/keeper/invariants.go index 28e676ac0a7..6aa34977874 100644 --- a/x/gamm/keeper/invariants.go +++ b/x/gamm/keeper/invariants.go @@ -90,7 +90,7 @@ func genericPow(base, exp sdk.Dec) sdk.Dec { if !base.GTE(sdk.NewDec(2)) { return osmomath.Pow(base, exp) } - return osmomath.PowApprox(sdk.OneDec().Quo(base), exp.Neg(), powPrecision) + return osmomath.PowApprox(sdk.OneDec().Quo(base), exp.Neg(), osmomath.GetPowPrecision()) } // constantChange returns the multiplicative factor difference in the pool constant, between two different pools. diff --git a/x/gamm/keeper/math.go b/x/gamm/keeper/math.go deleted file mode 100644 index 7d3bf67d45d..00000000000 --- a/x/gamm/keeper/math.go +++ /dev/null @@ -1,203 +0,0 @@ -package keeper - -import ( - "github.com/osmosis-labs/osmosis/v7/osmomath" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// Don't EVER change after initializing -// TODO: Analyze choice here -var powPrecision, _ = sdk.NewDecFromStr("0.00000001") - -// Singletons -var zero sdk.Dec = sdk.ZeroDec() -var one_half sdk.Dec = sdk.MustNewDecFromStr("0.5") -var one sdk.Dec = sdk.OneDec() -var two sdk.Dec = sdk.MustNewDecFromStr("2") - -// calcSpotPrice returns the spot price of the pool -// This is the weight-adjusted balance of the tokens in the pool. -// so spot_price = (B_in / W_in) / (B_out / W_out) -func calcSpotPrice( - tokenBalanceIn, - tokenWeightIn, - tokenBalanceOut, - tokenWeightOut sdk.Dec, -) sdk.Dec { - number := tokenBalanceIn.Quo(tokenWeightIn) - denom := tokenBalanceOut.Quo(tokenWeightOut) - ratio := number.Quo(denom) - - return ratio -} - -// calcSpotPriceWithSwapFee returns the spot price of the pool accounting for -// the input taken by the swap fee. -// This is the weight-adjusted balance of the tokens in the pool. -// so spot_price = (B_in / W_in) / (B_out / W_out) -// and spot_price_with_fee = spot_price / (1 - swapfee) -func calcSpotPriceWithSwapFee( - tokenBalanceIn, - tokenWeightIn, - tokenBalanceOut, - tokenWeightOut, - swapFee sdk.Dec, -) sdk.Dec { - spotPrice := calcSpotPrice(tokenBalanceIn, tokenWeightIn, tokenBalanceOut, tokenWeightOut) - // Q: Why is this not just (1 - swapfee) - // A: Its because its being applied to the other asset. - // TODO: write this up more coherently - // 1 / (1 - swapfee) - scale := sdk.OneDec().Quo(sdk.OneDec().Sub(swapFee)) - - return spotPrice.Mul(scale) -} - -// solveConstantFunctionInvariant solves the constant function of an AMM -// that determines the relationship between the differences of two sides -// of assets inside the pool. -// For fixed balanceXBefore, balanceXAfter, weightX, balanceY, weightY, -// we could deduce the balanceYDelta, calculated by: -// balanceYDelta = balanceY * (1 - (balanceXBefore/balanceXAfter)^(weightX/weightY)) -// balanceYDelta is positive when the balance liquidity decreases. -// balanceYDelta is negative when the balance liquidity increases. -func solveConstantFunctionInvariant( - tokenBalanceFixedBefore, - tokenBalanceFixedAfter, - tokenWeightFixed, - tokenBalanceUnknownBefore, - tokenWeightUnknown sdk.Dec, -) sdk.Dec { - // weightRatio = (weightX/weightY) - weightRatio := tokenWeightFixed.Quo(tokenWeightUnknown) - - // y = balanceXBefore/balanceYAfter - y := tokenBalanceFixedBefore.Quo(tokenBalanceFixedAfter) - - // amountY = balanceY * (1 - (y ^ weightRatio)) - foo := osmomath.Pow(y, weightRatio) - multiplier := sdk.OneDec().Sub(foo) - return tokenBalanceUnknownBefore.Mul(multiplier) -} - -// calcOutGivenIn calculates token to be swapped out given -// the provided amount, fee deducted, using solveConstantFunctionInvariant -func calcOutGivenIn( - tokenBalanceIn, - tokenWeightIn, - tokenBalanceOut, - tokenWeightOut, - tokenAmountIn, - swapFee sdk.Dec, -) sdk.Dec { - // deduct swapfee on the in asset - tokenAmountInAfterFee := tokenAmountIn.Mul(sdk.OneDec().Sub(swapFee)) - // delta balanceOut is positive(tokens inside the pool decreases) - tokenAmountOut := solveConstantFunctionInvariant(tokenBalanceIn, tokenBalanceIn.Add(tokenAmountInAfterFee), tokenWeightIn, tokenBalanceOut, tokenWeightOut) - return tokenAmountOut -} - -// calcInGivenOut calculates token to be provided, fee added, -// given the swapped out amount, using solveConstantFunctionInvariant -func calcInGivenOut( - tokenBalanceIn, - tokenWeightIn, - tokenBalanceOut, - tokenWeightOut, - tokenAmountOut, - swapFee sdk.Dec, -) sdk.Dec { - // delta balanceIn is negative(amount of tokens inside the pool increases) - tokenAmountIn := solveConstantFunctionInvariant(tokenBalanceOut, tokenBalanceOut.Sub(tokenAmountOut), tokenWeightOut, tokenBalanceIn, tokenWeightIn).Neg() - // We deduct a swap fee on the input asset. The swap happens by following the invariant curve on the input * (1 - swap fee) - // and then the swap fee is added to the pool. - // Thus in order to give X amount out, we solve the invariant for the invariant input. However invariant input = (1 - swapfee) * trade input. - // Therefore we divide by (1 - swapfee) here - tokenAmountInBeforeFee := tokenAmountIn.Quo(sdk.OneDec().Sub(swapFee)) - return tokenAmountInBeforeFee - -} - -func feeRatio( - normalizedWeight, - swapFee sdk.Dec, -) sdk.Dec { - zar := (sdk.OneDec().Sub(normalizedWeight)).Mul(swapFee) - return sdk.OneDec().Sub(zar) -} - -// calcSingleInGivenPoolOut calculates token to be provided, fee added, -// given the swapped out shares amount, using solveConstantFunctionInvariant -func calcSingleInGivenPoolOut( - tokenBalanceIn, - normalizedTokenWeightIn, - poolSupply, - poolAmountOut, - swapFee sdk.Dec, -) sdk.Dec { - // delta balanceIn is negative(tokens inside the pool increases) - // pool weight is always 1 - tokenAmountIn := solveConstantFunctionInvariant(poolSupply.Add(poolAmountOut), poolSupply, sdk.OneDec(), tokenBalanceIn, normalizedTokenWeightIn).Neg() - // deduct swapfee on the in asset - tokenAmountInBeforeFee := tokenAmountIn.Quo(feeRatio(normalizedTokenWeightIn, swapFee)) - return tokenAmountInBeforeFee -} - -// pAo -func calcPoolOutGivenSingleIn( - tokenBalanceIn, - normalizedTokenWeightIn, - poolSupply, - tokenAmountIn, - swapFee sdk.Dec, -) sdk.Dec { - // deduct swapfee on the in asset - tokenAmountInAfterFee := tokenAmountIn.Mul(feeRatio(normalizedTokenWeightIn, swapFee)) - // delta poolSupply is negative(total pool shares increases) - // pool weight is always 1 - poolAmountOut := solveConstantFunctionInvariant(tokenBalanceIn.Add(tokenAmountInAfterFee), tokenBalanceIn, normalizedTokenWeightIn, poolSupply, sdk.OneDec()).Neg() - return poolAmountOut -} - -// tAo -func calcSingleOutGivenPoolIn( - tokenBalanceOut, - normalizedTokenWeightOut, - poolSupply, - poolAmountIn, - swapFee sdk.Dec, - exitFee sdk.Dec, -) sdk.Dec { - // charge exit fee on the pool token side - // pAiAfterExitFee = pAi*(1-exitFee) - poolAmountInAfterExitFee := poolAmountIn.Mul(sdk.OneDec().Sub(exitFee)) - - // delta balanceOut is positive(tokens inside the pool decreases) - // pool weight is always 1 - tokenAmountOut := solveConstantFunctionInvariant(poolSupply.Sub(poolAmountInAfterExitFee), poolSupply, sdk.OneDec(), tokenBalanceOut, normalizedTokenWeightOut) - // deduct - tokenAmountOutAfterFee := tokenAmountOut.Mul(feeRatio(normalizedTokenWeightOut, swapFee)) - return tokenAmountOutAfterFee -} - -// pAi -func calcPoolInGivenSingleOut( - tokenBalanceOut, - normalizedTokenWeightOut, - poolSupply, - tokenAmountOut, - swapFee sdk.Dec, - exitFee sdk.Dec, -) sdk.Dec { - tokenAmountOutBeforeFee := tokenAmountOut.Quo(feeRatio(normalizedTokenWeightOut, swapFee)) - - // delta poolSupply is positive(total pool shares decreases) - // pool weight is always 1 - poolAmountIn := solveConstantFunctionInvariant(tokenBalanceOut.Sub(tokenAmountOutBeforeFee), tokenBalanceOut, normalizedTokenWeightOut, poolSupply, sdk.OneDec()) - - // charge exit fee on the pool token side - // pAi = pAiAfterExitFee/(1-exitFee) - poolAmountInBeforeFee := poolAmountIn.Quo(sdk.OneDec().Sub(exitFee)) - return poolAmountInBeforeFee -} diff --git a/x/gamm/keeper/math_test.go b/x/gamm/keeper/math_test.go deleted file mode 100644 index 133569e4903..00000000000 --- a/x/gamm/keeper/math_test.go +++ /dev/null @@ -1,280 +0,0 @@ -package keeper - -import ( - "math/rand" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/stretchr/testify/require" -) - -func TestCalcSpotPrice(t *testing.T) { - tc := tc(t, "100", "0.1", "200", "0.3", "", "0", "0", "0") - - actual_spot_price := calcSpotPrice(tc.tokenBalanceIn, tc.tokenWeightIn, tc.tokenBalanceOut, tc.tokenWeightOut) - // s = (100/.1) / (200 / .3) = (1000) / (2000 / 3) = 1.5 - expected_spot_price, err := sdk.NewDecFromStr("1.5") - require.NoError(t, err) - - // assert that the spot prices are within the error margin from one another. - require.True( - t, - expected_spot_price.Sub(actual_spot_price).Abs().LTE(powPrecision), - "expected value & actual value's difference should less than precision", - ) - -} - -// TODO: Create test vectors with balancer contract -func TestCalcSpotPriceWithSwapFee(t *testing.T) { - tc := tc(t, "100", "0.1", "200", "0.3", "", "0", "0.01", "0") - - s := calcSpotPriceWithSwapFee(tc.tokenBalanceIn, tc.tokenWeightIn, tc.tokenBalanceOut, tc.tokenWeightOut, tc.swapFee) - - expectedDec, err := sdk.NewDecFromStr("1.51515151") - require.NoError(t, err) - - require.True( - t, - expectedDec.Sub(s).Abs().LTE(powPrecision), - "expected value & actual value's difference should less than precision", - ) - -} - -func TestCalcOutGivenIn(t *testing.T) { - tc := tc(t, "100", "0.1", "200", "0.3", "", "0", "0.01", "0") - - tokenAmountIn, err := sdk.NewDecFromStr("40") - require.NoError(t, err) - - s := tc.calcOutGivenIn(tokenAmountIn) - - expectedDec, err := sdk.NewDecFromStr("21.0487006") - require.NoError(t, err) - - require.True( - t, - expectedDec.Sub(s).Abs().LTE(powPrecision.MulInt64(10000)), - "expected value & actual value's difference should less than precision*10000", - ) - -} - -func TestCalcInGivenOut(t *testing.T) { - tc := tc(t, "100", "0.1", "200", "0.3", "", "0", "0.01", "0") - tokenAmountOut, err := sdk.NewDecFromStr("70") - require.NoError(t, err) - - s := tc.calcInGivenOut(tokenAmountOut) - - expectedDec, err := sdk.NewDecFromStr("266.8009177") - require.NoError(t, err) - - require.True( - t, - expectedDec.Sub(s).Abs().LTE(powPrecision.MulInt64(10)), - "expected value & actual value's difference should less than precision*10", - ) -} - -func TestCalcPoolOutGivenSingleIn(t *testing.T) { - tc := tc(t, "100", "0.2", "200", "0.8", "1", "300", "0.15", "0") - - tokenAmountIn, err := sdk.NewDecFromStr("40") - require.NoError(t, err) - - s := tc.calcPoolOutGivenSingleIn(tokenAmountIn) - - expectedDec, err := sdk.NewDecFromStr("18.6519592") - require.NoError(t, err) - - require.True( - t, - expectedDec.Sub(s).Abs().LTE(powPrecision.MulInt64(10000)), - "expected value & actual value's difference should less than precision*10000", - ) -} - -/* -func TestCalcSingleInGivenPoolOut(t *testing.T) { - - tokenBalanceIn, err := sdk.NewDecFromStr("100") - require.NoError(t, err) - tokenWeightIn, err := sdk.NewDecFromStr("0.2") - require.NoError(t, err) - poolSupply, err := sdk.NewDecFromStr("300") - require.NoError(t, err) - totalWeight, err := sdk.NewDecFromStr("1") - require.NoError(t, err) - poolAmountOut, err := sdk.NewDecFromStr("70") - require.NoError(t, err) - swapFee, err := sdk.NewDecFromStr("0.15") - require.NoError(t, err) - - normalizedWeight := tokenWeightIn.Quo(totalWeight) - s := calcSingleInGivenPoolOut(tokenBalanceIn, normalizedWeight, poolSupply, poolAmountOut, swapFee) - - expectedDec, err := sdk.NewDecFromStr(".") - require.NoError(t, err) - - require.True( - t, - expectedDec.Sub(s).Abs().LTE(powPrecision.MulInt64(10000)), - "expected value & actual value's difference should less than precision*10000", - ) -} -*/ - -func TestCalcSingleOutGivenPoolIn(t *testing.T) { - tc := tc(t, "100", "0.2", "200", "0.8", "1", "300", "0.15", "0") - poolAmountIn, err := sdk.NewDecFromStr("40") - require.NoError(t, err) - - s := tc.calcSingleOutGivenPoolIn(poolAmountIn) - - expectedDec, err := sdk.NewDecFromStr("31.77534976") - require.NoError(t, err) - - require.True( - t, - expectedDec.Sub(s).Abs().LTE(powPrecision.MulInt64(10000)), - "expected value & actual value's difference should less than precision*10000", - ) -} - -func TestCalcPoolInGivenSingleOut(t *testing.T) { - tc := tc(t, "100", "0.2", "200", "0.8", "1", "300", "0.15", "0") - - tokenAmountOut, err := sdk.NewDecFromStr("70") - require.NoError(t, err) - - s := tc.calcPoolInGivenSingleOut(tokenAmountOut) - - expectedDec, err := sdk.NewDecFromStr("90.29092777") - require.NoError(t, err) - - require.True( - t, - expectedDec.Sub(s).Abs().LTE(powPrecision.MulInt64(10000)), - "expected value & actual value's difference should less than precision*10000", - ) -} - -type testCase struct { - tokenBalanceIn, tokenWeightIn sdk.Dec - tokenBalanceOut, tokenWeightOut sdk.Dec - totalWeight sdk.Dec - poolSupply sdk.Dec - swapFee, exitFee sdk.Dec -} - -func (tc testCase) reverse() testCase { - return testCase{ - tc.tokenBalanceOut, tc.tokenWeightOut, - tc.tokenBalanceIn, tc.tokenWeightIn, - tc.totalWeight, - tc.poolSupply, - tc.swapFee, tc.exitFee, - } -} - -func tc(t *testing.T, tokenBalanceIn, tokenWeightIn, tokenBalanceOut, tokenWeightOut, totalWeight, poolSupply, swapFee, exitFee string) (res testCase) { - var err error - res.tokenBalanceIn, err = sdk.NewDecFromStr(tokenBalanceIn) - require.NoError(t, err) - res.tokenWeightIn, err = sdk.NewDecFromStr(tokenWeightIn) - require.NoError(t, err) - res.tokenBalanceOut, err = sdk.NewDecFromStr(tokenBalanceOut) - require.NoError(t, err) - res.tokenWeightOut, err = sdk.NewDecFromStr(tokenWeightOut) - require.NoError(t, err) - if totalWeight == "" { - res.totalWeight = res.tokenWeightIn.Add(res.tokenWeightOut) - } else { - res.totalWeight, err = sdk.NewDecFromStr(totalWeight) - } - require.NoError(t, err) - res.poolSupply, err = sdk.NewDecFromStr(poolSupply) - require.NoError(t, err) - res.swapFee, err = sdk.NewDecFromStr(swapFee) - require.NoError(t, err) - res.exitFee, err = sdk.NewDecFromStr(exitFee) - require.NoError(t, err) - - return -} - -func randtc(t *testing.T, swapFee, exitFee sdk.Dec) (res testCase) { - res.tokenBalanceIn = sdk.NewInt(rand.Int63()).ToDec() - res.tokenWeightIn = sdk.NewInt(rand.Int63n(90) + 10).ToDec() - res.tokenBalanceOut = sdk.NewInt(rand.Int63()).ToDec() - res.tokenWeightOut = sdk.NewInt(rand.Int63n(90) + 10).ToDec() - res.totalWeight = res.tokenWeightIn.Add(res.tokenWeightOut) - res.poolSupply = sdk.NewInt(rand.Int63()).ToDec() - res.swapFee = swapFee - res.exitFee = exitFee - return -} - -func (tc testCase) calcInGivenOut(amount sdk.Dec) sdk.Dec { - return calcInGivenOut(tc.tokenBalanceIn, tc.tokenWeightIn, tc.tokenBalanceOut, tc.tokenWeightOut, amount, tc.swapFee) -} - -func (tc testCase) calcOutGivenIn(amount sdk.Dec) sdk.Dec { - return calcOutGivenIn(tc.tokenBalanceIn, tc.tokenWeightIn, tc.tokenBalanceOut, tc.tokenWeightOut, amount, tc.swapFee) -} - -func (tc testCase) calcPoolOutGivenSingleIn(amount sdk.Dec) sdk.Dec { - return calcPoolOutGivenSingleIn(tc.tokenBalanceIn, tc.tokenWeightIn.Quo(tc.totalWeight), tc.poolSupply, amount, tc.swapFee) -} - -func (tc testCase) calcPoolInGivenSingleOut(amount sdk.Dec) sdk.Dec { - return calcPoolInGivenSingleOut(tc.tokenBalanceOut, tc.tokenWeightOut.Quo(tc.totalWeight), tc.poolSupply, amount, tc.swapFee, tc.exitFee) -} - -func (tc testCase) calcSingleInGivenPoolOut(amount sdk.Dec) sdk.Dec { - return calcSingleInGivenPoolOut(tc.tokenBalanceIn, tc.tokenWeightIn.Quo(tc.totalWeight), tc.poolSupply, amount, tc.swapFee) -} - -func (tc testCase) calcSingleOutGivenPoolIn(amount sdk.Dec) sdk.Dec { - return calcSingleOutGivenPoolIn(tc.tokenBalanceOut, tc.tokenWeightOut.Quo(tc.totalWeight), tc.poolSupply, amount, tc.swapFee, tc.exitFee) -} - -func equalWithError(t *testing.T, x, y sdk.Dec, precision int64) { - require.True(t, x.Quo(y).Sub(sdk.OneDec()).Abs().LTE(sdk.OneDec().Quo(sdk.NewInt(precision).ToDec())), - "Not equal within error margin with difference %s: %s, %s", x.Quo(y).Sub(sdk.OneDec()), x, y) -} - -func TestCalcInverseInvariant(t *testing.T) { - tcs := make([]testCase, 10000) - for i := range tcs { - tcs[i] = randtc(t, sdk.NewInt(rand.Int63n(100)).ToDec().Quo(sdk.NewInt(1000).ToDec()), sdk.NewInt(rand.Int63n(100)).ToDec().Quo(sdk.NewInt(500).ToDec())) - } - - for _, tc := range tcs { - for i := 0; i < 10; i++ { - amount := sdk.NewInt(rand.Int63n(tc.tokenBalanceIn.TruncateInt().Int64() / 20)).ToDec() - - { - amountOut := tc.calcOutGivenIn(amount) - amount2 := tc.calcInGivenOut(amountOut) - equalWithError(t, amount, amount2, 100000) - } - - { - shareOut := tc.calcPoolOutGivenSingleIn(amount) - amount2 := tc.calcSingleInGivenPoolOut(shareOut) - equalWithError(t, amount, amount2, 100000) - } - - { - amountOut := sdk.NewInt(rand.Int63n(tc.tokenBalanceOut.TruncateInt().Int64() / 20)).ToDec() - shareIn := tc.calcPoolInGivenSingleOut(amountOut) - amount2 := tc.calcSingleOutGivenPoolIn(shareIn) - equalWithError(t, amountOut, amount2, 100000) - } - } - } -} From 6d53e1dbc367337a0a499c6fed37ef38ba04611b Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Tue, 22 Mar 2022 21:51:59 -0500 Subject: [PATCH 2/6] Delete Legacy pool interface --- x/gamm/types/pool.go | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/x/gamm/types/pool.go b/x/gamm/types/pool.go index 96bc7692de2..58daf98d534 100644 --- a/x/gamm/types/pool.go +++ b/x/gamm/types/pool.go @@ -36,7 +36,6 @@ type PoolI interface { // expected to Set the pool into state as well. ApplySwap(ctx sdk.Context, tokenIn sdk.Coins, tokenOut sdk.Coins) error - // TODO: Swap base and quote asset around, so that it makes more sense later SpotPrice(ctx sdk.Context, baseAssetDenom string, quoteAssetDenom string) (sdk.Dec, error) // JoinPool joins the pool, and uses all of the tokensIn provided. @@ -47,36 +46,6 @@ type PoolI interface { ExitPool(ctx sdk.Context, numShares sdk.Int, exitFee sdk.Dec) (exitedCoins sdk.Coins, err error) } -// LegacyPoolI defines an interface for pools that hold tokens. -type LegacyPoolI interface { - proto.Message - - GetAddress() sdk.AccAddress - String() string - - GetId() uint64 - GetPoolSwapFee() sdk.Dec - GetPoolExitFee() sdk.Dec - GetTotalWeight() sdk.Int - GetTotalShares() sdk.Coin - AddTotalShares(amt sdk.Int) - SubTotalShares(amt sdk.Int) - GetPoolAsset(denom string) (PoolAsset, error) - // UpdatePoolAssetBalance updates the balances for - // the token with denomination coin.denom - UpdatePoolAssetBalance(coin sdk.Coin) error - // UpdatePoolAssetBalances calls UpdatePoolAssetBalance - // on each constituent coin. - UpdatePoolAssetBalances(coins sdk.Coins) error - GetPoolAssets(denoms ...string) ([]PoolAsset, error) - GetAllPoolAssets() []PoolAsset - PokeTokenWeights(blockTime time.Time) - GetTokenWeight(denom string) (sdk.Int, error) - GetTokenBalance(denom string) (sdk.Int, error) - NumAssets() int - IsActive(curBlockTime time.Time) bool -} - var ( MaxUserSpecifiedWeight sdk.Int = sdk.NewIntFromUint64(1 << 20) GuaranteedWeightPrecision int64 = 1 << 30 From b7d8bb7c22e918f2548986e3a8815963f2ff8101 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Tue, 22 Mar 2022 21:52:10 -0500 Subject: [PATCH 3/6] Refactor event creation to types/events.go --- x/gamm/keeper/keeper.go | 38 ----------------------------------- x/gamm/keeper/pool.go | 3 ++- x/gamm/keeper/pool_service.go | 4 ++-- x/gamm/keeper/share.go | 4 ++-- x/gamm/keeper/swap.go | 2 +- x/gamm/types/events.go | 37 ++++++++++++++++++++++++++++++++++ 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/x/gamm/keeper/keeper.go b/x/gamm/keeper/keeper.go index e02b39cf5e1..a7e15bff2f9 100644 --- a/x/gamm/keeper/keeper.go +++ b/x/gamm/keeper/keeper.go @@ -2,7 +2,6 @@ package keeper import ( "fmt" - "strconv" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -60,43 +59,6 @@ func NewKeeper(cdc codec.BinaryCodec, storeKey sdk.StoreKey, paramSpace paramtyp } } -func (k *Keeper) createSwapEvent(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, input sdk.Coins, output sdk.Coins) { - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.TypeEvtTokenSwapped, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, sender.String()), - sdk.NewAttribute(types.AttributeKeyPoolId, strconv.FormatUint(poolId, 10)), - sdk.NewAttribute(types.AttributeKeyTokensIn, input.String()), - sdk.NewAttribute(types.AttributeKeyTokensOut, output.String()), - ), - }) -} - -func (k *Keeper) createAddLiquidityEvent(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, liquidity sdk.Coins) { - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.TypeEvtPoolJoined, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, sender.String()), - sdk.NewAttribute(types.AttributeKeyPoolId, strconv.FormatUint(poolId, 10)), - sdk.NewAttribute(types.AttributeKeyTokensIn, liquidity.String()), - ), - }) -} - -func (k *Keeper) createRemoveLiquidityEvent(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, liquidity sdk.Coins) { - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.TypeEvtPoolExited, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, sender.String()), - sdk.NewAttribute(types.AttributeKeyPoolId, strconv.FormatUint(poolId, 10)), - sdk.NewAttribute(types.AttributeKeyTokensOut, liquidity.String()), - ), - }) -} - // Set the gamm hooks func (k *Keeper) SetHooks(gh types.GammHooks) *Keeper { if k.hooks != nil { diff --git a/x/gamm/keeper/pool.go b/x/gamm/keeper/pool.go index 00ed70992e3..61b780b13b8 100644 --- a/x/gamm/keeper/pool.go +++ b/x/gamm/keeper/pool.go @@ -42,7 +42,8 @@ func (k Keeper) GetPool(ctx sdk.Context, poolId uint64) (types.PoolI, error) { return pool, nil } -func (k Keeper) GetPoolForSwap(ctx sdk.Context, poolId uint64) (types.PoolI, error) { +// Get pool, and check if the pool is active / allowed to be swapped against +func (k Keeper) getPoolForSwap(ctx sdk.Context, poolId uint64) (types.PoolI, error) { pool, err := k.GetPool(ctx, poolId) if err != nil { return &balancer.Pool{}, err diff --git a/x/gamm/keeper/pool_service.go b/x/gamm/keeper/pool_service.go index 569270edecd..0b78b92acc0 100644 --- a/x/gamm/keeper/pool_service.go +++ b/x/gamm/keeper/pool_service.go @@ -196,7 +196,7 @@ func (k Keeper) JoinSwapExactAmountIn( tokensIn sdk.Coins, shareOutMinAmount sdk.Int, ) (shareOutAmount sdk.Int, err error) { - pool, err := k.GetPoolForSwap(ctx, poolId) + pool, err := k.getPoolForSwap(ctx, poolId) if err != nil { return sdk.Int{}, err } @@ -228,7 +228,7 @@ func (k Keeper) JoinSwapShareAmountOut( shareOutAmount sdk.Int, tokenInMaxAmount sdk.Int, ) (tokenInAmount sdk.Int, err error) { - pool, err := k.GetPoolForSwap(ctx, poolId) + pool, err := k.getPoolForSwap(ctx, poolId) if err != nil { return sdk.Int{}, err } diff --git a/x/gamm/keeper/share.go b/x/gamm/keeper/share.go index 0b52312e15a..bcd2b6004ac 100644 --- a/x/gamm/keeper/share.go +++ b/x/gamm/keeper/share.go @@ -22,7 +22,7 @@ func (k Keeper) applyJoinPoolStateChange(ctx sdk.Context, pool types.PoolI, join return err } - k.createAddLiquidityEvent(ctx, joiner, pool.GetId(), joinCoins) + ctx.EventManager().EmitEvent(types.CreateAddLiquidityEvent(ctx, joiner, pool.GetId(), joinCoins)) k.hooks.AfterJoinPool(ctx, joiner, pool.GetId(), joinCoins, numShares) k.RecordTotalLiquidityIncrease(ctx, joinCoins) return nil @@ -44,7 +44,7 @@ func (k Keeper) applyExitPoolStateChange(ctx sdk.Context, pool types.PoolI, exit return err } - k.createRemoveLiquidityEvent(ctx, exiter, pool.GetId(), exitCoins) + ctx.EventManager().EmitEvent(types.CreateRemoveLiquidityEvent(ctx, exiter, pool.GetId(), exitCoins)) k.hooks.AfterExitPool(ctx, exiter, pool.GetId(), numShares, exitCoins) k.RecordTotalLiquidityDecrease(ctx, exitCoins) return nil diff --git a/x/gamm/keeper/swap.go b/x/gamm/keeper/swap.go index 81f60c14ef1..c434196b32d 100644 --- a/x/gamm/keeper/swap.go +++ b/x/gamm/keeper/swap.go @@ -142,7 +142,7 @@ func (k Keeper) updatePoolForSwap( return err } - k.createSwapEvent(ctx, sender, pool.GetId(), tokensIn, tokensOut) + ctx.EventManager().EmitEvent(types.CreateSwapEvent(ctx, sender, pool.GetId(), tokensIn, tokensOut)) k.hooks.AfterSwap(ctx, sender, pool.GetId(), tokensIn, tokensOut) k.RecordTotalLiquidityIncrease(ctx, tokensIn) k.RecordTotalLiquidityDecrease(ctx, tokensOut) diff --git a/x/gamm/types/events.go b/x/gamm/types/events.go index baed080cf77..e65c07f42d1 100644 --- a/x/gamm/types/events.go +++ b/x/gamm/types/events.go @@ -1,5 +1,11 @@ package types +import ( + "strconv" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + const ( TypeEvtPoolJoined = "pool_joined" TypeEvtPoolExited = "pool_exited" @@ -12,3 +18,34 @@ const ( AttributeKeyTokensIn = "tokens_in" AttributeKeyTokensOut = "tokens_out" ) + +func CreateSwapEvent(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, input sdk.Coins, output sdk.Coins) sdk.Event { + return sdk.NewEvent( + TypeEvtTokenSwapped, + sdk.NewAttribute(sdk.AttributeKeyModule, AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, sender.String()), + sdk.NewAttribute(AttributeKeyPoolId, strconv.FormatUint(poolId, 10)), + sdk.NewAttribute(AttributeKeyTokensIn, input.String()), + sdk.NewAttribute(AttributeKeyTokensOut, output.String()), + ) +} + +func CreateAddLiquidityEvent(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, liquidity sdk.Coins) sdk.Event { + return sdk.NewEvent( + TypeEvtPoolJoined, + sdk.NewAttribute(sdk.AttributeKeyModule, AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, sender.String()), + sdk.NewAttribute(AttributeKeyPoolId, strconv.FormatUint(poolId, 10)), + sdk.NewAttribute(AttributeKeyTokensIn, liquidity.String()), + ) +} + +func CreateRemoveLiquidityEvent(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, liquidity sdk.Coins) sdk.Event { + return sdk.NewEvent( + TypeEvtPoolExited, + sdk.NewAttribute(sdk.AttributeKeyModule, AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, sender.String()), + sdk.NewAttribute(AttributeKeyPoolId, strconv.FormatUint(poolId, 10)), + sdk.NewAttribute(AttributeKeyTokensOut, liquidity.String()), + ) +} From e4bc4ed7de0e854a59f3765c7f3749eea1f676d3 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Tue, 22 Mar 2022 22:12:11 -0500 Subject: [PATCH 4/6] Move pool_asset from types to balancer --- app/apptesting/test_suite.go | 6 +- go.sum | 52 ++ .../pool-models/balancer/balancerPool.proto | 28 +- .../gamm/pool-models/balancer/tx.proto | 1 - proto/osmosis/gamm/v1beta1/pool.proto | 30 - proto/osmosis/gamm/v1beta1/query.proto | 14 +- x/gamm/client/cli/query.go | 43 -- x/gamm/client/cli/tx.go | 8 +- x/gamm/genesis_test.go | 9 +- x/gamm/keeper/gas_test.go | 6 +- x/gamm/keeper/grpc_query.go | 19 - x/gamm/keeper/keeper_test.go | 3 +- x/gamm/keeper/marshal_bench_test.go | 7 +- x/gamm/keeper/pool.go | 2 +- x/gamm/keeper/pool_service.go | 2 +- x/gamm/keeper/pool_service_test.go | 21 +- .../pool-models/balancer/balancerPool.pb.go | 352 +++++++++-- x/gamm/pool-models/balancer/balancer_pool.go | 76 +-- .../balancer/balancer_pool_test.go | 42 +- x/gamm/pool-models/balancer/marshal.go | 16 +- x/gamm/pool-models/balancer/marshal_test.go | 7 +- x/gamm/pool-models/balancer/msgs.go | 2 +- x/gamm/pool-models/balancer/msgs_test.go | 6 +- .../balancer}/pool_asset.go | 11 +- x/gamm/pool-models/balancer/tx.pb.go | 67 +- x/gamm/simulation/operations.go | 10 +- x/gamm/types/pool.pb.go | 377 ----------- x/gamm/types/query.pb.go | 592 +++--------------- x/gamm/types/query.pb.gw.go | 98 --- x/gamm/types/tx.pb.go | 10 +- x/pool-incentives/keeper/keeper_test.go | 2 +- x/superfluid/keeper/gov/gov_test.go | 5 +- x/superfluid/keeper/keeper_test.go | 4 +- x/txfees/keeper/keeper_test.go | 9 +- 34 files changed, 622 insertions(+), 1315 deletions(-) delete mode 100644 proto/osmosis/gamm/v1beta1/pool.proto rename x/gamm/{types => pool-models/balancer}/pool_asset.go (90%) delete mode 100644 x/gamm/types/pool.pb.go diff --git a/app/apptesting/test_suite.go b/app/apptesting/test_suite.go index d26d9278783..176ecb3dd17 100644 --- a/app/apptesting/test_suite.go +++ b/app/apptesting/test_suite.go @@ -154,15 +154,15 @@ func (keeperTestHelper *KeeperTestHelper) SetupGammPoolsWithBondDenomMultiplier( defaultFutureGovernor = "" // pool assets - defaultFooAsset gammtypes.PoolAsset = gammtypes.PoolAsset{ + defaultFooAsset balancer.PoolAsset = balancer.PoolAsset{ Weight: sdk.NewInt(100), Token: sdk.NewCoin(bondDenom, uosmoAmount), } - defaultBarAsset gammtypes.PoolAsset = gammtypes.PoolAsset{ + defaultBarAsset balancer.PoolAsset = balancer.PoolAsset{ Weight: sdk.NewInt(100), Token: sdk.NewCoin(token, sdk.NewInt(10000)), } - poolAssets []gammtypes.PoolAsset = []gammtypes.PoolAsset{defaultFooAsset, defaultBarAsset} + poolAssets []balancer.PoolAsset = []balancer.PoolAsset{defaultFooAsset, defaultBarAsset} ) poolId, err := keeperTestHelper.App.GAMMKeeper.CreateBalancerPool(keeperTestHelper.Ctx, acc1, balancer.PoolParams{ diff --git a/go.sum b/go.sum index 440a4536189..663dbcedc5b 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -83,6 +84,7 @@ github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXY github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Microsoft/go-winio v0.5.1 h1:aPJp2QD7OOrhO5tQXqQoGSJc+DjDtWTGLOmNyAm6FgY= github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= @@ -90,6 +92,7 @@ github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEV github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= @@ -100,6 +103,7 @@ github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3 github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSaq37xZZh7Yig= github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= +github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/adlio/schema v1.1.13/go.mod h1:L5Z7tw+7lRK1Fnpi/LT/ooCP1elkXn0krMWBQHUhEDE= github.com/adlio/schema v1.2.3 h1:GfKThfEsjS9cCz7gaF8zdXv4cpTdUqdljkKGDTbJjys= github.com/adlio/schema v1.2.3/go.mod h1:nD7ZWmMMbwU12Pqwg+qL0rTvHBrBXfNz+5UQxTfy38M= @@ -112,6 +116,7 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= @@ -124,7 +129,9 @@ github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8 github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/avast/retry-go v2.6.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= @@ -168,6 +175,8 @@ github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= +github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -194,12 +203,14 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/coinbase/rosetta-sdk-go v0.6.10/go.mod h1:J/JFMsfcePrjJZkwQFLh+hJErkAmdm9Iyy3D5Y0LfXo= github.com/coinbase/rosetta-sdk-go v0.7.0 h1:lmTO/JEpCvZgpbkOITL95rA80CPKb5CtMzLaqF2mCNg= github.com/coinbase/rosetta-sdk-go v0.7.0/go.mod h1:7nD3oBPIiHqhRprqvMgPoGxe/nyq3yftRmpsy29coWE= github.com/confio/ics23/go v0.6.6 h1:pkOy18YxxJ/r0XFDCnrl4Bjv6h4LkBSpLS6F38mrKL8= github.com/confio/ics23/go v0.6.6/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM= github.com/containerd/continuity v0.2.1 h1:/EeEo2EtN3umhbbgCveyjifoMYg0pS+nMMEemaYw634= github.com/containerd/continuity v0.2.1/go.mod h1:wCYX+dRqZdImhGucXOqTQn05AhX6EUDaGEMUzTFFpLg= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -224,12 +235,14 @@ github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6 github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI= +github.com/cosmos/relayer v1.0.0/go.mod h1:jIFz7lytxGMCC3mcI9pQ0/IBMMaaNEyTP0OMmzzq0p4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= @@ -270,6 +283,8 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1 github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= +github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25/go.mod h1:hTr8+TLQmkUkgcuh3mcr5fjrT9c64ZzsBCdCEC6UppY= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= @@ -277,10 +292,12 @@ github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= @@ -290,6 +307,7 @@ github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYF github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= @@ -308,6 +326,12 @@ github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= +github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= +github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= +github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= +github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= +github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -535,6 +559,7 @@ github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3 github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/improbable-eng/grpc-web v0.14.1 h1:NrN4PY71A6tAz2sKDvC5JCauENWp0ykG8Oq1H3cpFvw= github.com/improbable-eng/grpc-web v0.14.1/go.mod h1:zEjGHa8DAlkoOXmswrNvhUGEYQA9UI7DhrGeHR1DMGU= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= @@ -543,9 +568,11 @@ github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZ github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/jhump/protoreflect v1.9.0 h1:npqHz788dryJiR/l6K/RUQAyh2SwV91+d1dnh4RjO9w= github.com/jhump/protoreflect v1.9.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -572,17 +599,20 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/kkdai/bstream v1.0.0/go.mod h1:FDnDOHt5Yx4p3FaHcioFT0QjDOtgUpvjeZqAs+NVZZA= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -597,6 +627,7 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/lib/pq v0.0.0-20180327071824-d34b9ff171c2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk= @@ -611,6 +642,7 @@ github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -660,6 +692,8 @@ github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= +github.com/moby/term v0.0.0-20200915141129-7f0af18e79f2/go.mod h1:TjQg8pa4iejrUrjiz0MCtMV38jdMNW4doKSiBrEvCQQ= +github.com/moby/term v0.0.0-20201101162038-25d840ce174a/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -722,6 +756,7 @@ github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zM github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= github.com/opencontainers/runc v1.0.3 h1:1hbqejyQWCJBvtKAfdO0b1FmaEf2z/bxnjqbARass5k= github.com/opencontainers/runc v1.0.3/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= @@ -739,6 +774,7 @@ github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa4YDFlwRYAMyE= github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= +github.com/ory/dockertest/v3 v3.6.2/go.mod h1:EFLcVUOl8qCwp9NyDAcCDtq/QviLtYswW/VbWzUnTNE= github.com/osmosis-labs/bech32-ibc v0.2.0-rc2 h1:7xy1pLtNiF2KaRSkolayZf4z3OfCJsO3eqBtEAXg2VA= github.com/osmosis-labs/bech32-ibc v0.2.0-rc2/go.mod h1:0JCaioRNOVUiw7c3MngmKACnumaQ2sjPenXCnwxCttI= github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220311195527-87988f9e28b1 h1:cKcaMdiUZiZsQcQ2BL5Ta2OkhcWOri3HQe9lcoHypmA= @@ -863,6 +899,7 @@ github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F7 github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= @@ -976,6 +1013,7 @@ github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17 github.com/vmihailenco/msgpack/v5 v5.1.4/go.mod h1:C5gboKD0TJPqWDTVTtrQNfRbiBwHZGo8UTqP/9/XvLI= github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= +github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE= @@ -1029,6 +1067,7 @@ golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -1043,10 +1082,14 @@ golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -1118,6 +1161,7 @@ golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191003171128-d98b1b443823/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1144,6 +1188,7 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= @@ -1209,6 +1254,7 @@ golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1243,6 +1289,7 @@ golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1259,10 +1306,12 @@ golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7w 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= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/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= @@ -1316,6 +1365,7 @@ golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1537,6 +1587,7 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= @@ -1545,6 +1596,7 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/proto/osmosis/gamm/pool-models/balancer/balancerPool.proto b/proto/osmosis/gamm/pool-models/balancer/balancerPool.proto index eac1be4a0aa..96951585feb 100644 --- a/proto/osmosis/gamm/pool-models/balancer/balancerPool.proto +++ b/proto/osmosis/gamm/pool-models/balancer/balancerPool.proto @@ -11,8 +11,6 @@ import "google/protobuf/timestamp.proto"; import "cosmos/auth/v1beta1/auth.proto"; import "cosmos/base/v1beta1/coin.proto"; -import "osmosis/gamm/v1beta1/pool.proto"; - option go_package = "github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer"; // Parameters for changing the weights in a balancer pool smoothly from @@ -89,6 +87,32 @@ message PoolParams { ]; } +// Pool asset is an internal struct that combines the amount of the +// token in the pool, and its balancer weight. +// This is an awkward packaging of data, +// and should be revisited in a future state migration. +message PoolAsset { + // Coins we are talking about, + // the denomination must be unique amongst all PoolAssets for this pool. + cosmos.base.v1beta1.Coin token = 1 + [ (gogoproto.moretags) = "yaml:\"token\"", (gogoproto.nullable) = false ]; + // Weight that is not normalized. This weight must be less than 2^50 + string weight = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"weight\"", + (gogoproto.nullable) = false + ]; + + // Weight that is normalized s.t. the sum of all pool assets' weights + // equals 1. If the user provides this value, it is ignored. This should only + // ever be set by the state machine. This is left as a TODO for a future PR. + // string normalizedWeight = 3 [ + // (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + // (gogoproto.moretags) = "yaml:\"normalized_weight\"", + // (gogoproto.nullable) = true + // ]; +} + message Pool { option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; diff --git a/proto/osmosis/gamm/pool-models/balancer/tx.proto b/proto/osmosis/gamm/pool-models/balancer/tx.proto index 02951704214..9063c5a06af 100644 --- a/proto/osmosis/gamm/pool-models/balancer/tx.proto +++ b/proto/osmosis/gamm/pool-models/balancer/tx.proto @@ -3,7 +3,6 @@ package osmosis.gamm.v1beta1; import "gogoproto/gogo.proto"; import "osmosis/gamm/pool-models/balancer/balancerPool.proto"; -import "osmosis/gamm/v1beta1/pool.proto"; option go_package = "github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer"; diff --git a/proto/osmosis/gamm/v1beta1/pool.proto b/proto/osmosis/gamm/v1beta1/pool.proto deleted file mode 100644 index 9fa42651ee7..00000000000 --- a/proto/osmosis/gamm/v1beta1/pool.proto +++ /dev/null @@ -1,30 +0,0 @@ -syntax = "proto3"; -package osmosis.gamm.v1beta1; - -import "gogoproto/gogo.proto"; - -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/osmosis-labs/osmosis/v7/x/gamm/types"; - -message PoolAsset { - // Coins we are talking about, - // the denomination must be unique amongst all PoolAssets for this pool. - cosmos.base.v1beta1.Coin token = 1 - [ (gogoproto.moretags) = "yaml:\"token\"", (gogoproto.nullable) = false ]; - // Weight that is not normalized. This weight must be less than 2^50 - string weight = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.moretags) = "yaml:\"weight\"", - (gogoproto.nullable) = false - ]; - - // Weight that is normalized s.t. the sum of all pool assets' weights - // equals 1. If the user provides this value, it is ignored. This should only - // ever be set by the state machine. This is left as a TODO for a future PR. - // string normalizedWeight = 3 [ - // (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - // (gogoproto.moretags) = "yaml:\"normalized_weight\"", - // (gogoproto.nullable) = true - // ]; -} diff --git a/proto/osmosis/gamm/v1beta1/query.proto b/proto/osmosis/gamm/v1beta1/query.proto index 6530a6b5f65..6be1ffebdb4 100644 --- a/proto/osmosis/gamm/v1beta1/query.proto +++ b/proto/osmosis/gamm/v1beta1/query.proto @@ -3,7 +3,6 @@ package osmosis.gamm.v1beta1; import "gogoproto/gogo.proto"; import "osmosis/gamm/v1beta1/tx.proto"; -import "osmosis/gamm/v1beta1/pool.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; @@ -38,10 +37,7 @@ service Query { option (google.api.http).get = "/osmosis/gamm/v1beta1/pools/{poolId}/total_shares"; } - rpc PoolAssets(QueryPoolAssetsRequest) returns (QueryPoolAssetsResponse) { - option (google.api.http).get = - "/osmosis/gamm/v1beta1/pools/{poolId}/tokens"; - } + rpc SpotPrice(QuerySpotPriceRequest) returns (QuerySpotPriceResponse) { option (google.api.http).get = "/osmosis/gamm/v1beta1/pools/{poolId}/prices"; @@ -104,14 +100,6 @@ message QueryTotalSharesResponse { ]; } -//=============================== PoolAssets -message QueryPoolAssetsRequest { - uint64 poolId = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; -} -message QueryPoolAssetsResponse { - repeated PoolAsset poolAssets = 1 [ (gogoproto.nullable) = false ]; -} - //=============================== SpotPrice message QuerySpotPriceRequest { uint64 poolId = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; diff --git a/x/gamm/client/cli/query.go b/x/gamm/client/cli/query.go index 4f7e2c2a9d2..dad88d3114e 100644 --- a/x/gamm/client/cli/query.go +++ b/x/gamm/client/cli/query.go @@ -31,7 +31,6 @@ func GetQueryCmd() *cobra.Command { GetCmdNumPools(), GetCmdPoolParams(), GetCmdTotalShares(), - GetCmdPoolAssets(), GetCmdSpotPrice(), GetCmdQueryTotalLiquidity(), GetCmdEstimateSwapExactAmountIn(), @@ -315,48 +314,6 @@ $ %s query gamm total-liquidity return cmd } -// GetCmdPoolAssets return pool-assets for a pool -func GetCmdPoolAssets() *cobra.Command { - cmd := &cobra.Command{ - Use: "pool-assets ", - Short: "Query pool-assets", - Long: strings.TrimSpace( - fmt.Sprintf(`Query pool assets. -Example: -$ %s query gamm pool-assets 1 -`, - version.AppName, - ), - ), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - poolID, err := strconv.Atoi(args[0]) - if err != nil { - return err - } - - res, err := queryClient.PoolAssets(cmd.Context(), &types.QueryPoolAssetsRequest{ - PoolId: uint64(poolID), - }) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - // GetCmdSpotPrice returns spot price func GetCmdSpotPrice() *cobra.Command { cmd := &cobra.Command{ diff --git a/x/gamm/client/cli/tx.go b/x/gamm/client/cli/tx.go index 5616ad251fa..a512d1e8ce3 100644 --- a/x/gamm/client/cli/tx.go +++ b/x/gamm/client/cli/tx.go @@ -363,14 +363,14 @@ func NewBuildCreateBalancerPoolMsg(clientCtx client.Context, txf tx.Factory, fs return txf, nil, err } - var poolAssets []types.PoolAsset + var poolAssets []balancer.PoolAsset for i := 0; i < len(poolAssetCoins); i++ { if poolAssetCoins[i].Denom != deposit[i].Denom { return txf, nil, errors.New("deposit tokens and token weights should have same denom order") } - poolAssets = append(poolAssets, types.PoolAsset{ + poolAssets = append(poolAssets, balancer.PoolAsset{ Weight: poolAssetCoins[i].Amount.RoundInt(), Token: deposit[i], }) @@ -399,14 +399,14 @@ func NewBuildCreateBalancerPoolMsg(clientCtx client.Context, txf tx.Factory, fs return txf, nil, err } - var targetPoolAssets []types.PoolAsset + var targetPoolAssets []balancer.PoolAsset for i := 0; i < len(targetPoolAssetCoins); i++ { if targetPoolAssetCoins[i].Denom != poolAssetCoins[i].Denom { return txf, nil, errors.New("initial pool weights and target pool weights should have same denom order") } - targetPoolAssets = append(targetPoolAssets, types.PoolAsset{ + targetPoolAssets = append(targetPoolAssets, balancer.PoolAsset{ Weight: targetPoolAssetCoins[i].Amount.RoundInt(), Token: deposit[i], // TODO: This doesn't make sense. Should only use denom, not an sdk.Coin diff --git a/x/gamm/genesis_test.go b/x/gamm/genesis_test.go index 703ed1c53b0..ba2daad90c4 100644 --- a/x/gamm/genesis_test.go +++ b/x/gamm/genesis_test.go @@ -8,7 +8,6 @@ import ( osmoapp "github.com/osmosis-labs/osmosis/v7/app" "github.com/osmosis-labs/osmosis/v7/x/gamm" "github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer" - "github.com/osmosis-labs/osmosis/v7/x/gamm/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto/ed25519" @@ -22,7 +21,7 @@ import ( // balancerPool, err := balancer.NewBalancerPool(1, balancer.PoolParams{ // SwapFee: sdk.NewDecWithPrec(1, 2), // ExitFee: sdk.NewDecWithPrec(1, 2), -// }, []types.PoolAsset{ +// }, []balancerbalancer.PoolAsset{ // { // Weight: sdk.NewInt(1), // Token: sdk.NewInt64Coin(sdk.DefaultBondDenom, 10), @@ -79,7 +78,7 @@ func TestGammExportGenesis(t *testing.T) { _, err = app.GAMMKeeper.CreateBalancerPool(ctx, acc1, balancer.PoolParams{ SwapFee: sdk.NewDecWithPrec(1, 2), ExitFee: sdk.NewDecWithPrec(1, 2), - }, []types.PoolAsset{{ + }, []balancer.PoolAsset{{ Weight: sdk.NewInt(100), Token: sdk.NewCoin("foo", sdk.NewInt(10000)), }, { @@ -91,7 +90,7 @@ func TestGammExportGenesis(t *testing.T) { _, err = app.GAMMKeeper.CreateBalancerPool(ctx, acc1, balancer.PoolParams{ SwapFee: sdk.NewDecWithPrec(1, 2), ExitFee: sdk.NewDecWithPrec(1, 2), - }, []types.PoolAsset{{ + }, []balancer.PoolAsset{{ Weight: sdk.NewInt(70), Token: sdk.NewCoin("foo", sdk.NewInt(10000)), }, { @@ -123,7 +122,7 @@ func TestMarshalUnmarshalGenesis(t *testing.T) { _, err = app.GAMMKeeper.CreateBalancerPool(ctx, acc1, balancer.PoolParams{ SwapFee: sdk.NewDecWithPrec(1, 2), ExitFee: sdk.NewDecWithPrec(1, 2), - }, []types.PoolAsset{{ + }, []balancer.PoolAsset{{ Weight: sdk.NewInt(100), Token: sdk.NewCoin("foo", sdk.NewInt(10000)), }, { diff --git a/x/gamm/keeper/gas_test.go b/x/gamm/keeper/gas_test.go index 2e0a7afac29..83dbea4d728 100644 --- a/x/gamm/keeper/gas_test.go +++ b/x/gamm/keeper/gas_test.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - balanacertypes "github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer" + balancertypes "github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer" "github.com/osmosis-labs/osmosis/v7/x/gamm/types" ) @@ -103,7 +103,7 @@ func (suite *KeeperTestSuite) TestRepeatedJoinPoolDistinctDenom() { err = simapp.FundAccount(suite.app.BankKeeper, suite.ctx, defaultAddr, coins) suite.Require().NoError(err) - defaultPoolParams := balanacertypes.PoolParams{ + defaultPoolParams := balancertypes.PoolParams{ SwapFee: sdk.NewDec(0), ExitFee: sdk.NewDec(0), } @@ -115,7 +115,7 @@ func (suite *KeeperTestSuite) TestRepeatedJoinPoolDistinctDenom() { err = simapp.FundAccount(suite.app.BankKeeper, suite.ctx, defaultAddr, coins) suite.Require().NoError(err) - poolAssets := []types.PoolAsset{ + poolAssets := []balancertypes.PoolAsset{ { Weight: sdk.NewInt(100), Token: sdk.NewCoin(prevRandToken, sdk.NewInt(10)), diff --git a/x/gamm/keeper/grpc_query.go b/x/gamm/keeper/grpc_query.go index de534094b17..fcd4dfa6e70 100644 --- a/x/gamm/keeper/grpc_query.go +++ b/x/gamm/keeper/grpc_query.go @@ -166,25 +166,6 @@ func (k Keeper) TotalShares(ctx context.Context, req *types.QueryTotalSharesRequ }, nil } -// TODO: Fix -func (k Keeper) PoolAssets(ctx context.Context, req *types.QueryPoolAssetsRequest) (*types.QueryPoolAssetsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - return nil, status.Error(codes.Unimplemented, "unimplemented") - - // sdkCtx := sdk.UnwrapSDKContext(ctx) - - // pool, err := k.GetPool(sdkCtx, req.PoolId) - // if err != nil { - // return nil, status.Error(codes.Internal, err.Error()) - // } - // return &types.QueryPoolAssetsResponse{ - // PoolAssets: pool.GetAllPoolAssets(), - // }, nil -} - func (k Keeper) SpotPrice(ctx context.Context, req *types.QuerySpotPriceRequest) (*types.QuerySpotPriceResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") diff --git a/x/gamm/keeper/keeper_test.go b/x/gamm/keeper/keeper_test.go index ac2ebc05651..c7beb1094b4 100644 --- a/x/gamm/keeper/keeper_test.go +++ b/x/gamm/keeper/keeper_test.go @@ -15,6 +15,7 @@ import ( "github.com/osmosis-labs/osmosis/v7/app" "github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer" + balancertypes "github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer" "github.com/osmosis-labs/osmosis/v7/x/gamm/types" ) @@ -59,7 +60,7 @@ func (suite *KeeperTestSuite) prepareBalancerPoolWithPoolParams(PoolParams balan } } - poolId, err := suite.app.GAMMKeeper.CreateBalancerPool(suite.ctx, acc1, PoolParams, []types.PoolAsset{ + poolId, err := suite.app.GAMMKeeper.CreateBalancerPool(suite.ctx, acc1, PoolParams, []balancertypes.PoolAsset{ { Weight: sdk.NewInt(100), Token: sdk.NewCoin("foo", sdk.NewInt(5000000)), diff --git a/x/gamm/keeper/marshal_bench_test.go b/x/gamm/keeper/marshal_bench_test.go index 6754cc0a9c2..fc5a04d0516 100644 --- a/x/gamm/keeper/marshal_bench_test.go +++ b/x/gamm/keeper/marshal_bench_test.go @@ -9,17 +9,18 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/osmosis-labs/osmosis/v7/app" "github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer" + balancertypes "github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer" gammtypes "github.com/osmosis-labs/osmosis/v7/x/gamm/types" ) -func genPoolAssets(r *rand.Rand) []gammtypes.PoolAsset { +func genPoolAssets(r *rand.Rand) []balancertypes.PoolAsset { denoms := []string{"IBC/0123456789ABCDEF012346789ABCDEF", "IBC/denom56789ABCDEF012346789ABCDEF"} - assets := []gammtypes.PoolAsset{} + assets := []balancertypes.PoolAsset{} for _, denom := range denoms { amt, _ := simtypes.RandPositiveInt(r, sdk.NewIntWithDecimal(1, 40)) reserveAmt := sdk.NewCoin(denom, amt) weight := sdk.NewInt(r.Int63n(9) + 1) - assets = append(assets, gammtypes.PoolAsset{Token: reserveAmt, Weight: weight}) + assets = append(assets, balancertypes.PoolAsset{Token: reserveAmt, Weight: weight}) } return assets diff --git a/x/gamm/keeper/pool.go b/x/gamm/keeper/pool.go index 61b780b13b8..037eff11013 100644 --- a/x/gamm/keeper/pool.go +++ b/x/gamm/keeper/pool.go @@ -198,7 +198,7 @@ func (k Keeper) DeletePool(ctx sdk.Context, poolId uint64) error { // newBalancerPool is an internal function that creates a new Balancer Pool object with the provided // parameters, initial assets, and future governor. -func (k Keeper) newBalancerPool(ctx sdk.Context, balancerPoolParams balancer.PoolParams, assets []types.PoolAsset, futureGovernor string) (types.PoolI, error) { +func (k Keeper) newBalancerPool(ctx sdk.Context, balancerPoolParams balancer.PoolParams, assets []balancer.PoolAsset, futureGovernor string) (types.PoolI, error) { poolId := k.GetNextPoolNumberAndIncrement(ctx) pool, err := balancer.NewBalancerPool(poolId, balancerPoolParams, assets, futureGovernor, ctx.BlockTime()) diff --git a/x/gamm/keeper/pool_service.go b/x/gamm/keeper/pool_service.go index 0b78b92acc0..6f12f43db82 100644 --- a/x/gamm/keeper/pool_service.go +++ b/x/gamm/keeper/pool_service.go @@ -31,7 +31,7 @@ func (k Keeper) CreateBalancerPool( ctx sdk.Context, sender sdk.AccAddress, BalancerPoolParams balancer.PoolParams, - poolAssets []types.PoolAsset, + poolAssets []balancer.PoolAsset, futurePoolGovernor string, ) (uint64, error) { if len(poolAssets) < types.MinPoolAssets { diff --git a/x/gamm/keeper/pool_service_test.go b/x/gamm/keeper/pool_service_test.go index 4494c97afc2..d3040da64bb 100644 --- a/x/gamm/keeper/pool_service_test.go +++ b/x/gamm/keeper/pool_service_test.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer" + balancertypes "github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer" "github.com/osmosis-labs/osmosis/v7/x/gamm/types" ) @@ -20,16 +21,16 @@ var ( defaultFutureGovernor = "" // pool assets - defaultFooAsset types.PoolAsset = types.PoolAsset{ + defaultFooAsset = balancertypes.PoolAsset{ Weight: sdk.NewInt(100), Token: sdk.NewCoin("foo", sdk.NewInt(10000)), } - defaultBarAsset types.PoolAsset = types.PoolAsset{ + defaultBarAsset = balancertypes.PoolAsset{ Weight: sdk.NewInt(100), Token: sdk.NewCoin("bar", sdk.NewInt(10000)), } - defaultPoolAssets []types.PoolAsset = []types.PoolAsset{defaultFooAsset, defaultBarAsset} - defaultAcctFunds sdk.Coins = sdk.NewCoins( + defaultPoolAssets = []balancertypes.PoolAsset{defaultFooAsset, defaultBarAsset} + defaultAcctFunds sdk.Coins = sdk.NewCoins( sdk.NewCoin("uosmo", sdk.NewInt(10000000000)), sdk.NewCoin("foo", sdk.NewInt(10000000)), sdk.NewCoin("bar", sdk.NewInt(10000000)), @@ -111,7 +112,7 @@ func (suite *KeeperTestSuite) TestCreateBalancerPool() { _, err := keeper.CreateBalancerPool(suite.ctx, acc1, balancer.PoolParams{ SwapFee: sdk.NewDecWithPrec(1, 2), ExitFee: sdk.NewDecWithPrec(1, 2), - }, []types.PoolAsset{}, defaultFutureGovernor) + }, []balancertypes.PoolAsset{}, defaultFutureGovernor) suite.Require().Error(err, "can't create the pool with empty PoolAssets") }, }, { @@ -120,7 +121,7 @@ func (suite *KeeperTestSuite) TestCreateBalancerPool() { _, err := keeper.CreateBalancerPool(suite.ctx, acc1, balancer.PoolParams{ SwapFee: sdk.NewDecWithPrec(1, 2), ExitFee: sdk.NewDecWithPrec(1, 2), - }, []types.PoolAsset{{ + }, []balancertypes.PoolAsset{{ Weight: sdk.NewInt(0), Token: sdk.NewCoin("foo", sdk.NewInt(10000)), }, { @@ -135,7 +136,7 @@ func (suite *KeeperTestSuite) TestCreateBalancerPool() { _, err := keeper.CreateBalancerPool(suite.ctx, acc1, balancer.PoolParams{ SwapFee: sdk.NewDecWithPrec(1, 2), ExitFee: sdk.NewDecWithPrec(1, 2), - }, []types.PoolAsset{{ + }, []balancertypes.PoolAsset{{ Weight: sdk.NewInt(-1), Token: sdk.NewCoin("foo", sdk.NewInt(10000)), }, { @@ -150,7 +151,7 @@ func (suite *KeeperTestSuite) TestCreateBalancerPool() { _, err := keeper.CreateBalancerPool(suite.ctx, acc1, balancer.PoolParams{ SwapFee: sdk.NewDecWithPrec(1, 2), ExitFee: sdk.NewDecWithPrec(1, 2), - }, []types.PoolAsset{{ + }, []balancertypes.PoolAsset{{ Weight: sdk.NewInt(100), Token: sdk.NewCoin("foo", sdk.NewInt(0)), }, { @@ -165,7 +166,7 @@ func (suite *KeeperTestSuite) TestCreateBalancerPool() { _, err := keeper.CreateBalancerPool(suite.ctx, acc1, balancer.PoolParams{ SwapFee: sdk.NewDecWithPrec(1, 2), ExitFee: sdk.NewDecWithPrec(1, 2), - }, []types.PoolAsset{{ + }, []balancertypes.PoolAsset{{ Weight: sdk.NewInt(100), Token: sdk.Coin{ Denom: "foo", @@ -183,7 +184,7 @@ func (suite *KeeperTestSuite) TestCreateBalancerPool() { _, err := keeper.CreateBalancerPool(suite.ctx, acc1, balancer.PoolParams{ SwapFee: sdk.NewDecWithPrec(1, 2), ExitFee: sdk.NewDecWithPrec(1, 2), - }, []types.PoolAsset{{ + }, []balancertypes.PoolAsset{{ Weight: sdk.NewInt(100), Token: sdk.NewCoin("foo", sdk.NewInt(10000)), }, { diff --git a/x/gamm/pool-models/balancer/balancerPool.pb.go b/x/gamm/pool-models/balancer/balancerPool.pb.go index 1822eb0b1ff..d30c40d2882 100644 --- a/x/gamm/pool-models/balancer/balancerPool.pb.go +++ b/x/gamm/pool-models/balancer/balancerPool.pb.go @@ -8,12 +8,11 @@ package balancer import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types1 "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/x/auth/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - types "github.com/osmosis-labs/osmosis/v7/x/gamm/types" _ "github.com/regen-network/cosmos-proto" _ "google.golang.org/protobuf/types/known/durationpb" _ "google.golang.org/protobuf/types/known/timestamppb" @@ -58,12 +57,12 @@ type SmoothWeightChangeParams struct { // The amount PoolAsset.token.amount field is ignored if present, // future type refactorings should just have a type with the denom & weight // here. - InitialPoolWeights []types.PoolAsset `protobuf:"bytes,3,rep,name=initialPoolWeights,proto3" json:"initialPoolWeights" yaml:"initial_pool_weights"` + InitialPoolWeights []PoolAsset `protobuf:"bytes,3,rep,name=initialPoolWeights,proto3" json:"initialPoolWeights" yaml:"initial_pool_weights"` // The target pool weights. The pool weights will change linearly with respect // to time between start_time, and start_time + duration. The amount // PoolAsset.token.amount field is ignored if present, future type // refactorings should just have a type with the denom & weight here. - TargetPoolWeights []types.PoolAsset `protobuf:"bytes,4,rep,name=targetPoolWeights,proto3" json:"targetPoolWeights" yaml:"target_pool_weights"` + TargetPoolWeights []PoolAsset `protobuf:"bytes,4,rep,name=targetPoolWeights,proto3" json:"targetPoolWeights" yaml:"target_pool_weights"` } func (m *SmoothWeightChangeParams) Reset() { *m = SmoothWeightChangeParams{} } @@ -113,14 +112,14 @@ func (m *SmoothWeightChangeParams) GetDuration() time.Duration { return 0 } -func (m *SmoothWeightChangeParams) GetInitialPoolWeights() []types.PoolAsset { +func (m *SmoothWeightChangeParams) GetInitialPoolWeights() []PoolAsset { if m != nil { return m.InitialPoolWeights } return nil } -func (m *SmoothWeightChangeParams) GetTargetPoolWeights() []types.PoolAsset { +func (m *SmoothWeightChangeParams) GetTargetPoolWeights() []PoolAsset { if m != nil { return m.TargetPoolWeights } @@ -177,6 +176,58 @@ func (m *PoolParams) GetSmoothWeightChangeParams() *SmoothWeightChangeParams { return nil } +// Pool asset is an internal struct that combines the amount of the +// token in the pool, and its balancer weight. +// This is an awkward packaging of data, +// and should be revisited in a future state migration. +type PoolAsset struct { + // Coins we are talking about, + // the denomination must be unique amongst all PoolAssets for this pool. + Token types.Coin `protobuf:"bytes,1,opt,name=token,proto3" json:"token" yaml:"token"` + // Weight that is not normalized. This weight must be less than 2^50 + Weight github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"weight" yaml:"weight"` +} + +func (m *PoolAsset) Reset() { *m = PoolAsset{} } +func (m *PoolAsset) String() string { return proto.CompactTextString(m) } +func (*PoolAsset) ProtoMessage() {} +func (*PoolAsset) Descriptor() ([]byte, []int) { + return fileDescriptor_7e991f749f68c2a4, []int{2} +} +func (m *PoolAsset) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PoolAsset) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PoolAsset.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PoolAsset) XXX_Merge(src proto.Message) { + xxx_messageInfo_PoolAsset.Merge(m, src) +} +func (m *PoolAsset) XXX_Size() int { + return m.Size() +} +func (m *PoolAsset) XXX_DiscardUnknown() { + xxx_messageInfo_PoolAsset.DiscardUnknown(m) +} + +var xxx_messageInfo_PoolAsset proto.InternalMessageInfo + +func (m *PoolAsset) GetToken() types.Coin { + if m != nil { + return m.Token + } + return types.Coin{} +} + type Pool struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` Id uint64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` @@ -192,10 +243,10 @@ type Pool struct { // TODO: Further improve these docs FuturePoolGovernor string `protobuf:"bytes,4,opt,name=future_pool_governor,json=futurePoolGovernor,proto3" json:"future_pool_governor,omitempty" yaml:"future_pool_governor"` // sum of all LP tokens sent out - TotalShares types1.Coin `protobuf:"bytes,5,opt,name=totalShares,proto3" json:"totalShares" yaml:"total_shares"` + TotalShares types.Coin `protobuf:"bytes,5,opt,name=totalShares,proto3" json:"totalShares" yaml:"total_shares"` // These are assumed to be sorted by denomiation. // They contain the pool asset and the information about the weight - PoolAssets []types.PoolAsset `protobuf:"bytes,6,rep,name=poolAssets,proto3" json:"poolAssets" yaml:"pool_assets"` + PoolAssets []PoolAsset `protobuf:"bytes,6,rep,name=poolAssets,proto3" json:"poolAssets" yaml:"pool_assets"` // sum of all non-normalized pool weights TotalWeight github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=totalWeight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"totalWeight" yaml:"total_weight"` } @@ -203,7 +254,7 @@ type Pool struct { func (m *Pool) Reset() { *m = Pool{} } func (*Pool) ProtoMessage() {} func (*Pool) Descriptor() ([]byte, []int) { - return fileDescriptor_7e991f749f68c2a4, []int{2} + return fileDescriptor_7e991f749f68c2a4, []int{3} } func (m *Pool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -235,6 +286,7 @@ var xxx_messageInfo_Pool proto.InternalMessageInfo func init() { proto.RegisterType((*SmoothWeightChangeParams)(nil), "osmosis.gamm.v1beta1.SmoothWeightChangeParams") proto.RegisterType((*PoolParams)(nil), "osmosis.gamm.v1beta1.PoolParams") + proto.RegisterType((*PoolAsset)(nil), "osmosis.gamm.v1beta1.PoolAsset") proto.RegisterType((*Pool)(nil), "osmosis.gamm.v1beta1.Pool") } @@ -243,56 +295,59 @@ func init() { } var fileDescriptor_7e991f749f68c2a4 = []byte{ - // 775 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0xcd, 0x4e, 0xdb, 0x4a, - 0x14, 0xc7, 0xe3, 0x24, 0xc0, 0x65, 0x90, 0xb8, 0x62, 0x2e, 0x0b, 0x13, 0x74, 0x63, 0xe4, 0x4a, - 0x15, 0xaa, 0x88, 0x2d, 0x68, 0xa5, 0x4a, 0x2c, 0x2a, 0x11, 0x68, 0x2b, 0x76, 0xd4, 0x54, 0x2a, - 0x2a, 0x0b, 0x6b, 0x92, 0x0c, 0x8e, 0x55, 0x3b, 0xe3, 0x7a, 0x26, 0x7c, 0xbc, 0x41, 0x97, 0xac, - 0x2a, 0x96, 0xbc, 0x42, 0xa5, 0xbe, 0x43, 0x59, 0xa2, 0xae, 0xaa, 0x2e, 0x4c, 0x05, 0xbb, 0x2e, - 0xf3, 0x04, 0xd5, 0xcc, 0x1c, 0x87, 0x34, 0x24, 0x12, 0x55, 0x57, 0xf1, 0xcc, 0x9c, 0xf3, 0x3b, - 0xff, 0xf3, 0x31, 0x13, 0xf4, 0x84, 0xf1, 0x98, 0xf1, 0x90, 0xbb, 0x01, 0x89, 0x63, 0x37, 0x61, - 0x2c, 0xaa, 0xc5, 0xac, 0x45, 0x23, 0xee, 0x36, 0x48, 0x44, 0x3a, 0x4d, 0x9a, 0xf6, 0x3f, 0x76, - 0x18, 0x8b, 0x9c, 0x24, 0x65, 0x82, 0xe1, 0x79, 0xf0, 0x72, 0xa4, 0x97, 0x73, 0xb8, 0xda, 0xa0, - 0x82, 0xac, 0x56, 0x16, 0x9a, 0x6a, 0xdb, 0x57, 0x36, 0xae, 0x5e, 0x68, 0x87, 0xca, 0x7c, 0xc0, - 0x02, 0xa6, 0xf7, 0xe5, 0x17, 0xec, 0x56, 0x03, 0xc6, 0x82, 0x88,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xcb, 0xeb, - 0xaa, 0xf1, 0xe3, 0xba, 0x6a, 0x9c, 0xde, 0x54, 0x0b, 0x97, 0x37, 0xd5, 0xc2, 0xb7, 0x9b, 0x6a, - 0xe1, 0xed, 0xb3, 0x81, 0xc0, 0x90, 0x68, 0x2d, 0x22, 0x0d, 0x9e, 0x2f, 0xdc, 0xc3, 0xa7, 0xee, - 0xf1, 0xf8, 0x7f, 0xad, 0xc6, 0xa4, 0x7a, 0x28, 0x1f, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x8d, - 0xd7, 0xef, 0xcf, 0xe1, 0x06, 0x00, 0x00, + // 821 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0xc7, 0xe3, 0x24, 0x6d, 0xe9, 0x14, 0x16, 0x75, 0xc8, 0xc1, 0xcd, 0x8a, 0xb8, 0x1a, 0x24, + 0xb4, 0x42, 0x1b, 0x5b, 0x5d, 0x90, 0x90, 0xf6, 0x00, 0xda, 0x6c, 0x0b, 0xea, 0xad, 0xb8, 0x48, + 0xad, 0xe8, 0xc1, 0x9a, 0x24, 0x53, 0xc7, 0xaa, 0xed, 0x31, 0x9e, 0x49, 0x7f, 0xfc, 0x07, 0x1c, + 0x7b, 0x42, 0x3d, 0xf6, 0xce, 0x09, 0x89, 0xff, 0x81, 0x1e, 0x2b, 0x4e, 0x88, 0x83, 0x8b, 0xda, + 0x1b, 0xc7, 0xfc, 0x05, 0x68, 0x66, 0x9e, 0xd3, 0x90, 0x26, 0xa2, 0xd5, 0x9e, 0x9a, 0x99, 0x79, + 0xef, 0xf3, 0xbe, 0xf3, 0xde, 0x77, 0x5c, 0xf4, 0x05, 0x17, 0x09, 0x17, 0x91, 0xf0, 0x42, 0x9a, + 0x24, 0x5e, 0xc6, 0x79, 0xdc, 0x4e, 0x78, 0x9f, 0xc5, 0xc2, 0xeb, 0xd2, 0x98, 0xa6, 0x3d, 0x96, + 0x8f, 0x7f, 0xec, 0x70, 0x1e, 0xbb, 0x59, 0xce, 0x25, 0xc7, 0x0d, 0xc8, 0x72, 0x55, 0x96, 0x7b, + 0xbc, 0xd1, 0x65, 0x92, 0x6e, 0x34, 0xd7, 0x7a, 0x7a, 0x3b, 0xd0, 0x31, 0x9e, 0x59, 0x98, 0x84, + 0x66, 0x23, 0xe4, 0x21, 0x37, 0xfb, 0xea, 0x17, 0xec, 0xb6, 0x42, 0xce, 0xc3, 0x98, 0x79, 0x7a, + 0xd5, 0x1d, 0x1e, 0x7a, 0xfd, 0x61, 0x4e, 0x65, 0xc4, 0x53, 0x38, 0x77, 0xa6, 0xcf, 0x65, 0x94, + 0x30, 0x21, 0x69, 0x92, 0x95, 0x00, 0x53, 0xc4, 0xa3, 0x43, 0x39, 0xf0, 0x40, 0x86, 0x5e, 0x4c, + 0x9d, 0x77, 0xa9, 0x60, 0xe3, 0xf3, 0x1e, 0x8f, 0xa0, 0x00, 0xf9, 0xbd, 0x86, 0xec, 0xdd, 0x84, + 0x73, 0x39, 0xd8, 0x63, 0x51, 0x38, 0x90, 0x6f, 0x07, 0x34, 0x0d, 0xd9, 0x0e, 0xcd, 0x69, 0x22, + 0xf0, 0x3e, 0x42, 0x42, 0xd2, 0x5c, 0x06, 0xaa, 0xaa, 0x6d, 0xad, 0x5b, 0x2f, 0x56, 0x5e, 0x35, + 0x5d, 0x23, 0xc9, 0x2d, 0x25, 0xb9, 0xdf, 0x97, 0x92, 0x3a, 0x1f, 0x5f, 0x15, 0x4e, 0x65, 0x54, + 0x38, 0xab, 0x67, 0x34, 0x89, 0x5f, 0x93, 0xfb, 0x5c, 0x72, 0x7e, 0xe3, 0x58, 0xfe, 0xb2, 0xde, + 0x50, 0xe1, 0x78, 0x80, 0xde, 0x2b, 0x6f, 0x6a, 0x57, 0x35, 0x77, 0xed, 0x01, 0x77, 0x13, 0x02, + 0x3a, 0x1b, 0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ce, 0x33, 0x72, 0xe7, 0xb3, 0xab, 0xc2, 0xb1, 0x46, + 0x85, 0x43, 0xe0, 0x46, 0x3a, 0x0e, 0xba, 0x19, 0xf4, 0x74, 0x64, 0x90, 0xe9, 0x50, 0xe2, 0xcf, + 0xad, 0x4d, 0x7e, 0xb1, 0xd0, 0xf2, 0x78, 0x4c, 0x78, 0x0b, 0x2d, 0x48, 0x7e, 0xc4, 0x52, 0x78, + 0x17, 0x6b, 0x2e, 0x3c, 0x77, 0xf5, 0xd2, 0xc6, 0x8a, 0xde, 0xf2, 0x28, 0xed, 0x34, 0x60, 0xa0, + 0xef, 0xc3, 0x40, 0x55, 0x16, 0xf1, 0x4d, 0x36, 0xde, 0x43, 0x8b, 0x46, 0x07, 0x74, 0xf2, 0xeb, + 0x27, 0x74, 0x72, 0x3b, 0x95, 0xa3, 0xc2, 0xf9, 0xc0, 0x60, 0x0d, 0x85, 0xf8, 0x80, 0x23, 0xbf, + 0xd6, 0x51, 0x5d, 0xa9, 0xc5, 0x2f, 0xd1, 0x12, 0xed, 0xf7, 0x73, 0x26, 0x04, 0x38, 0x01, 0x8f, + 0x0a, 0xe7, 0x99, 0x49, 0x82, 0x03, 0xe2, 0x97, 0x21, 0xf8, 0x19, 0xaa, 0x46, 0x7d, 0xad, 0xa5, + 0xee, 0x57, 0xa3, 0x3e, 0x66, 0x08, 0x65, 0x63, 0x57, 0x41, 0xfb, 0xd7, 0xe7, 0x5b, 0x18, 0x1a, + 0x3e, 0xf5, 0x70, 0xca, 0x0f, 0xa8, 0x71, 0x71, 0xd9, 0xe9, 0x09, 0x30, 0xfe, 0x0e, 0x35, 0x0e, + 0x87, 0x72, 0x98, 0x33, 0x13, 0x12, 0xf2, 0x63, 0x96, 0xa7, 0x3c, 0xb7, 0xeb, 0x5a, 0xb1, 0x73, + 0x8f, 0x9a, 0x15, 0x45, 0x7c, 0x6c, 0xb6, 0x95, 0x82, 0x6f, 0x61, 0x13, 0xef, 0xa3, 0x15, 0xc9, + 0x25, 0x8d, 0x77, 0x07, 0x34, 0x67, 0xc2, 0x5e, 0xf8, 0xbf, 0x31, 0x3d, 0x07, 0xcd, 0x1f, 0x95, + 0x63, 0x92, 0x34, 0x0e, 0x84, 0x4e, 0x26, 0xfe, 0x24, 0x0a, 0x1f, 0x98, 0x9e, 0x68, 0x1f, 0x08, + 0x7b, 0xf1, 0x71, 0xcf, 0xba, 0x09, 0x78, 0x6c, 0xf0, 0xfa, 0x02, 0x54, 0x13, 0xa0, 0x13, 0x06, + 0x87, 0x43, 0x90, 0x6d, 0x0c, 0x68, 0x2f, 0xe9, 0x06, 0x6c, 0x3d, 0xd9, 0x15, 0xff, 0xb9, 0x45, + 0xe9, 0x8d, 0x49, 0xf2, 0xeb, 0xd5, 0x9f, 0x2e, 0x9d, 0xca, 0xc5, 0xa5, 0x53, 0xf9, 0xe3, 0xb7, + 0xf6, 0x82, 0xd2, 0xb9, 0xdd, 0xd9, 0xbf, 0xba, 0x6d, 0x59, 0xd7, 0xb7, 0x2d, 0xeb, 0xef, 0xdb, + 0x96, 0x75, 0x7e, 0xd7, 0xaa, 0x5c, 0xdf, 0xb5, 0x2a, 0x7f, 0xde, 0xb5, 0x2a, 0x3f, 0x7c, 0x35, + 0x51, 0x18, 0x2e, 0xda, 0x8e, 0x69, 0x57, 0x94, 0x0b, 0xef, 0xf8, 0x4b, 0xef, 0x74, 0xfe, 0xbf, + 0xd0, 0xee, 0xa2, 0xfe, 0xac, 0x7f, 0xfe, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x95, 0xe6, + 0x20, 0x6e, 0x07, 0x00, 0x00, } func (m *SmoothWeightChangeParams) Marshal() (dAtA []byte, err error) { @@ -417,6 +472,49 @@ func (m *PoolParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PoolAsset) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PoolAsset) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PoolAsset) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Weight.Size() + i -= size + if _, err := m.Weight.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintBalancerPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBalancerPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *Pool) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -556,6 +654,19 @@ func (m *PoolParams) Size() (n int) { return n } +func (m *PoolAsset) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Token.Size() + n += 1 + l + sovBalancerPool(uint64(l)) + l = m.Weight.Size() + n += 1 + l + sovBalancerPool(uint64(l)) + return n +} + func (m *Pool) Size() (n int) { if m == nil { return 0 @@ -718,7 +829,7 @@ func (m *SmoothWeightChangeParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.InitialPoolWeights = append(m.InitialPoolWeights, types.PoolAsset{}) + m.InitialPoolWeights = append(m.InitialPoolWeights, PoolAsset{}) if err := m.InitialPoolWeights[len(m.InitialPoolWeights)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -752,7 +863,7 @@ func (m *SmoothWeightChangeParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TargetPoolWeights = append(m.TargetPoolWeights, types.PoolAsset{}) + m.TargetPoolWeights = append(m.TargetPoolWeights, PoolAsset{}) if err := m.TargetPoolWeights[len(m.TargetPoolWeights)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -932,6 +1043,123 @@ func (m *PoolParams) Unmarshal(dAtA []byte) error { } return nil } +func (m *PoolAsset) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBalancerPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PoolAsset: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PoolAsset: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBalancerPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBalancerPool + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBalancerPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBalancerPool + } + 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 ErrInvalidLengthBalancerPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBalancerPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Weight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBalancerPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBalancerPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Pool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1139,7 +1367,7 @@ func (m *Pool) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PoolAssets = append(m.PoolAssets, types.PoolAsset{}) + m.PoolAssets = append(m.PoolAssets, PoolAsset{}) if err := m.PoolAssets[len(m.PoolAssets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/gamm/pool-models/balancer/balancer_pool.go b/x/gamm/pool-models/balancer/balancer_pool.go index 53b9f339de0..115aa0bb119 100644 --- a/x/gamm/pool-models/balancer/balancer_pool.go +++ b/x/gamm/pool-models/balancer/balancer_pool.go @@ -21,7 +21,7 @@ var _ types.PoolI = &Pool{} // * 2 <= len(assets) <= 8 // * FutureGovernor is valid // * poolID doesn't already exist -func NewBalancerPool(poolId uint64, balancerPoolParams PoolParams, assets []types.PoolAsset, futureGovernor string, blockTime time.Time) (Pool, error) { +func NewBalancerPool(poolId uint64, balancerPoolParams PoolParams, assets []PoolAsset, futureGovernor string, blockTime time.Time) (Pool, error) { poolAddr := types.NewPoolAddress(poolId) // pool thats created up to ensuring the assets and params are valid. @@ -74,7 +74,7 @@ func (pa Pool) GetSwapFee(_ sdk.Context) sdk.Dec { } func (pa Pool) GetTotalLpBalances(_ sdk.Context) sdk.Coins { - return types.PoolAssetsCoins(pa.PoolAssets) + return PoolAssetsCoins(pa.PoolAssets) } func (pa Pool) GetExitFee(_ sdk.Context) sdk.Dec { @@ -106,14 +106,14 @@ func (pa *Pool) SubTotalShares(amt sdk.Int) { // If the same denom's PoolAsset exists, will return error. // The list of PoolAssets must be sorted. This is done to enable fast searching for a PoolAsset by denomination. // TODO: Unify story for validation of []PoolAsset, some is here, some is in CreatePool.ValidateBasic() -func (pa *Pool) setInitialPoolAssets(PoolAssets []types.PoolAsset) error { +func (pa *Pool) setInitialPoolAssets(PoolAssets []PoolAsset) error { exists := make(map[string]bool) for _, asset := range pa.PoolAssets { exists[asset.Token.Denom] = true } newTotalWeight := pa.TotalWeight - scaledPoolAssets := make([]types.PoolAsset, 0, len(PoolAssets)) + scaledPoolAssets := make([]PoolAsset, 0, len(PoolAssets)) // TODO: Refactor this into PoolAsset.validate() for _, asset := range PoolAssets { @@ -141,7 +141,7 @@ func (pa *Pool) setInitialPoolAssets(PoolAssets []types.PoolAsset) error { // Furthermore, consider changing the underlying data type to allow in-place modification if the // number of PoolAssets is expected to be large. pa.PoolAssets = append(pa.PoolAssets, scaledPoolAssets...) - types.SortPoolAssetsByDenom(pa.PoolAssets) + SortPoolAssetsByDenom(pa.PoolAssets) pa.TotalWeight = newTotalWeight @@ -149,13 +149,13 @@ func (pa *Pool) setInitialPoolAssets(PoolAssets []types.PoolAsset) error { } // setInitialPoolParams -func (pa *Pool) setInitialPoolParams(params PoolParams, sortedAssets []types.PoolAsset, curBlockTime time.Time) error { +func (pa *Pool) setInitialPoolParams(params PoolParams, sortedAssets []PoolAsset, curBlockTime time.Time) error { pa.PoolParams = params if params.SmoothWeightChangeParams != nil { // set initial assets - initialWeights := make([]types.PoolAsset, len(sortedAssets)) + initialWeights := make([]PoolAsset, len(sortedAssets)) for i, v := range sortedAssets { - initialWeights[i] = types.PoolAsset{ + initialWeights[i] = PoolAsset{ Weight: v.Weight, Token: sdk.Coin{Denom: v.Token.Denom, Amount: sdk.ZeroInt()}, } @@ -164,7 +164,7 @@ func (pa *Pool) setInitialPoolParams(params PoolParams, sortedAssets []types.Poo // sort target weights by denom targetPoolWeights := params.SmoothWeightChangeParams.TargetPoolWeights - types.SortPoolAssetsByDenom(targetPoolWeights) + SortPoolAssetsByDenom(targetPoolWeights) // scale target pool weights by GuaranteedWeightPrecision for i, v := range targetPoolWeights { @@ -172,7 +172,7 @@ func (pa *Pool) setInitialPoolParams(params PoolParams, sortedAssets []types.Poo if err != nil { return err } - pa.PoolParams.SmoothWeightChangeParams.TargetPoolWeights[i] = types.PoolAsset{ + pa.PoolParams.SmoothWeightChangeParams.TargetPoolWeights[i] = PoolAsset{ Weight: v.Weight.MulRaw(types.GuaranteedWeightPrecision), Token: v.Token, } @@ -191,19 +191,19 @@ func (pa *Pool) setInitialPoolParams(params PoolParams, sortedAssets []types.Poo // GetPoolAssets returns the denom's PoolAsset, If the PoolAsset doesn't exist, will return error. // As above, it will search the denom's PoolAsset by using binary search. // So, it is important to make sure that the PoolAssets are sorted. -func (pa Pool) GetPoolAsset(denom string) (types.PoolAsset, error) { +func (pa Pool) GetPoolAsset(denom string) (PoolAsset, error) { _, asset, err := pa.getPoolAssetAndIndex(denom) return asset, err } // Returns a pool asset, and its index. If err != nil, then the index will be valid. -func (pa Pool) getPoolAssetAndIndex(denom string) (int, types.PoolAsset, error) { +func (pa Pool) getPoolAssetAndIndex(denom string) (int, PoolAsset, error) { if denom == "" { - return -1, types.PoolAsset{}, fmt.Errorf("you tried to find the PoolAsset with empty denom") + return -1, PoolAsset{}, fmt.Errorf("you tried to find the PoolAsset with empty denom") } if len(pa.PoolAssets) == 0 { - return -1, types.PoolAsset{}, fmt.Errorf("can't find the PoolAsset (%s)", denom) + return -1, PoolAsset{}, fmt.Errorf("can't find the PoolAsset (%s)", denom) } i := sort.Search(len(pa.PoolAssets), func(i int) bool { @@ -214,20 +214,20 @@ func (pa Pool) getPoolAssetAndIndex(denom string) (int, types.PoolAsset, error) }) if i < 0 || i >= len(pa.PoolAssets) { - return -1, types.PoolAsset{}, fmt.Errorf("can't find the PoolAsset (%s)", denom) + return -1, PoolAsset{}, fmt.Errorf("can't find the PoolAsset (%s)", denom) } if pa.PoolAssets[i].Token.Denom != denom { - return -1, types.PoolAsset{}, fmt.Errorf("can't find the PoolAsset (%s)", denom) + return -1, PoolAsset{}, fmt.Errorf("can't find the PoolAsset (%s)", denom) } return i, pa.PoolAssets[i], nil } func (p Pool) parsePoolAssetsByDenoms(tokenADenom, tokenBDenom string) ( - Aasset types.PoolAsset, Basset types.PoolAsset, err error) { - Aasset, found1 := types.GetPoolAssetByDenom(p.PoolAssets, tokenADenom) - Basset, found2 := types.GetPoolAssetByDenom(p.PoolAssets, tokenBDenom) + Aasset PoolAsset, Basset PoolAsset, err error) { + Aasset, found1 := GetPoolAssetByDenom(p.PoolAssets, tokenADenom) + Basset, found2 := GetPoolAssetByDenom(p.PoolAssets, tokenBDenom) if !(found1 && found2) { return Aasset, Basset, errors.New("one of the provided pool denoms does not exist in pool") } @@ -235,7 +235,7 @@ func (p Pool) parsePoolAssetsByDenoms(tokenADenom, tokenBDenom string) ( } func (p Pool) parsePoolAssets(tokensA sdk.Coins, tokenBDenom string) ( - tokenA sdk.Coin, Aasset types.PoolAsset, Basset types.PoolAsset, err error) { + tokenA sdk.Coin, Aasset PoolAsset, Basset PoolAsset, err error) { if len(tokensA) != 1 { return tokenA, Aasset, Basset, errors.New("expected tokensB to be of length one") } @@ -244,7 +244,7 @@ func (p Pool) parsePoolAssets(tokensA sdk.Coins, tokenBDenom string) ( } func (p Pool) parsePoolAssetsCoins(tokensA sdk.Coins, tokensB sdk.Coins) ( - Aasset types.PoolAsset, Basset types.PoolAsset, err error) { + Aasset PoolAsset, Basset PoolAsset, err error) { if len(tokensB) != 1 { return Aasset, Basset, errors.New("expected tokensA to be of length one") } @@ -310,8 +310,8 @@ func (pa *Pool) addToPoolAssetBalances(coins sdk.Coins) error { return nil } -func (pa Pool) GetPoolAssets(denoms ...string) ([]types.PoolAsset, error) { - result := make([]types.PoolAsset, 0, len(denoms)) +func (pa Pool) GetPoolAssets(denoms ...string) ([]PoolAsset, error) { + result := make([]PoolAsset, 0, len(denoms)) for _, denom := range denoms { PoolAsset, err := pa.GetPoolAsset(denom) @@ -325,8 +325,8 @@ func (pa Pool) GetPoolAssets(denoms ...string) ([]types.PoolAsset, error) { return result, nil } -func (pa Pool) GetAllPoolAssets() []types.PoolAsset { - copyslice := make([]types.PoolAsset, len(pa.PoolAssets)) +func (pa Pool) GetAllPoolAssets() []PoolAsset { + copyslice := make([]PoolAsset, len(pa.PoolAssets)) copy(copyslice, pa.PoolAssets) return copyslice } @@ -342,7 +342,7 @@ func (pa Pool) GetAllPoolAssets() []types.PoolAsset { // TODO: (post-launch) If newWeights excludes an existing denomination, // remove the weight from the pool, and figure out something to do // with any remaining coin. -func (pa *Pool) updateAllWeights(newWeights []types.PoolAsset) { +func (pa *Pool) updateAllWeights(newWeights []PoolAsset) { if len(pa.PoolAssets) != len(newWeights) { panic("updateAllWeights called with invalid input, len(newWeights) != len(existingWeights)") } @@ -445,7 +445,7 @@ func (pa Pool) IsActive(curBlockTime time.Time) bool { return true } -func (params PoolParams) Validate(poolWeights []types.PoolAsset) error { +func (params PoolParams) Validate(poolWeights []PoolAsset) error { if params.ExitFee.IsNegative() { return types.ErrNegativeExitFee } @@ -476,8 +476,8 @@ func (params PoolParams) Validate(poolWeights []types.PoolAsset) error { } } // Ensure that all the target weight denoms are same as pool asset weights - sortedTargetPoolWeights := types.SortPoolAssetsOutOfPlaceByDenom(targetWeights) - sortedPoolWeights := types.SortPoolAssetsOutOfPlaceByDenom(poolWeights) + sortedTargetPoolWeights := SortPoolAssetsOutOfPlaceByDenom(targetWeights) + sortedPoolWeights := SortPoolAssetsOutOfPlaceByDenom(poolWeights) for i, v := range sortedPoolWeights { if sortedTargetPoolWeights[i].Token.Denom != v.Token.Denom { return types.ErrPoolParamsInvalidDenom @@ -551,8 +551,8 @@ func ValidateFutureGovernor(governor string) error { // It assumes that both pool assets have the same token denominations, // with the denominations in the same order. // Returned weights can (and probably will have some) be negative. -func subPoolAssetWeights(base []types.PoolAsset, other []types.PoolAsset) []types.PoolAsset { - weightDifference := make([]types.PoolAsset, len(base)) +func subPoolAssetWeights(base []PoolAsset, other []PoolAsset) []PoolAsset { + weightDifference := make([]PoolAsset, len(base)) // TODO: Consider deleting these panics for performance if len(base) != len(other) { panic("subPoolAssetWeights called with invalid input, len(base) != len(other)") @@ -564,7 +564,7 @@ func subPoolAssetWeights(base []types.PoolAsset, other []types.PoolAsset) []type i, asset.Token.Denom, other[i].Token.Denom)) } curWeightDiff := asset.Weight.Sub(other[i].Weight) - weightDifference[i] = types.PoolAsset{Token: asset.Token, Weight: curWeightDiff} + weightDifference[i] = PoolAsset{Token: asset.Token, Weight: curWeightDiff} } return weightDifference } @@ -573,8 +573,8 @@ func subPoolAssetWeights(base []types.PoolAsset, other []types.PoolAsset) []type // It assumes that both pool assets have the same token denominations, // with the denominations in the same order. // Returned weights can be negative. -func addPoolAssetWeights(base []types.PoolAsset, other []types.PoolAsset) []types.PoolAsset { - weightSum := make([]types.PoolAsset, len(base)) +func addPoolAssetWeights(base []PoolAsset, other []PoolAsset) []PoolAsset { + weightSum := make([]PoolAsset, len(base)) // TODO: Consider deleting these panics for performance if len(base) != len(other) { panic("addPoolAssetWeights called with invalid input, len(base) != len(other)") @@ -586,20 +586,20 @@ func addPoolAssetWeights(base []types.PoolAsset, other []types.PoolAsset) []type i, asset.Token.Denom, other[i].Token.Denom)) } curWeightSum := asset.Weight.Add(other[i].Weight) - weightSum[i] = types.PoolAsset{Token: asset.Token, Weight: curWeightSum} + weightSum[i] = PoolAsset{Token: asset.Token, Weight: curWeightSum} } return weightSum } // assumes 0 < d < 1 -func poolAssetsMulDec(base []types.PoolAsset, d sdk.Dec) []types.PoolAsset { - newWeights := make([]types.PoolAsset, len(base)) +func poolAssetsMulDec(base []PoolAsset, d sdk.Dec) []PoolAsset { + newWeights := make([]PoolAsset, len(base)) for i, asset := range base { // TODO: This can adversarially panic at the moment! (as can Pool.TotalWeight) // Ensure this won't be able to panic in the future PR where we bound // each assets weight, and add precision newWeight := d.MulInt(asset.Weight).RoundInt() - newWeights[i] = types.PoolAsset{Token: asset.Token, Weight: newWeight} + newWeights[i] = PoolAsset{Token: asset.Token, Weight: newWeight} } return newWeights } diff --git a/x/gamm/pool-models/balancer/balancer_pool_test.go b/x/gamm/pool-models/balancer/balancer_pool_test.go index 1d8c2f9046a..cf1f79b3789 100644 --- a/x/gamm/pool-models/balancer/balancer_pool_test.go +++ b/x/gamm/pool-models/balancer/balancer_pool_test.go @@ -22,7 +22,7 @@ var ( defaultFutureGovernor = "" defaultCurBlockTime = time.Unix(1618700000, 0) // - dummyPoolAssets = []types.PoolAsset{} + dummyPoolAssets = []PoolAsset{} wantErr = true noErr = false ) @@ -81,7 +81,7 @@ func TestBalancerPoolParams(t *testing.T) { func TestBalancerPoolUpdatePoolAssetBalance(t *testing.T) { var poolId uint64 = 10 - initialAssets := []types.PoolAsset{ + initialAssets := []PoolAsset{ { Weight: sdk.NewInt(100), Token: sdk.NewCoin("test1", sdk.NewInt(50000)), @@ -106,14 +106,14 @@ func TestBalancerPoolUpdatePoolAssetBalance(t *testing.T) { // TODO: This test actually just needs to be refactored to not be doing this, and just // create a different pool each time. - err = pacc.setInitialPoolAssets([]types.PoolAsset{{ + err = pacc.setInitialPoolAssets([]PoolAsset{{ Weight: sdk.NewInt(-1), Token: sdk.NewCoin("negativeWeight", sdk.NewInt(50000)), }}) require.Error(t, err) - err = pacc.setInitialPoolAssets([]types.PoolAsset{{ + err = pacc.setInitialPoolAssets([]PoolAsset{{ Weight: sdk.NewInt(0), Token: sdk.NewCoin("zeroWeight", sdk.NewInt(50000)), }}) @@ -143,12 +143,12 @@ func TestBalancerPoolAssetsWeightAndTokenBalance(t *testing.T) { // TODO: Add more cases // asset names should be i ascending order, starting from test1 tests := []struct { - assets []types.PoolAsset + assets []PoolAsset shouldErr bool }{ // weight 0 { - []types.PoolAsset{ + []PoolAsset{ { Weight: sdk.NewInt(0), Token: sdk.NewCoin("test1", sdk.NewInt(50000)), @@ -158,7 +158,7 @@ func TestBalancerPoolAssetsWeightAndTokenBalance(t *testing.T) { }, // negative weight { - []types.PoolAsset{ + []PoolAsset{ { Weight: sdk.NewInt(-1), Token: sdk.NewCoin("test1", sdk.NewInt(50000)), @@ -168,7 +168,7 @@ func TestBalancerPoolAssetsWeightAndTokenBalance(t *testing.T) { }, // 0 token amount { - []types.PoolAsset{ + []PoolAsset{ { Weight: sdk.NewInt(100), Token: sdk.NewCoin("test1", sdk.NewInt(0)), @@ -178,7 +178,7 @@ func TestBalancerPoolAssetsWeightAndTokenBalance(t *testing.T) { }, // negative token amount { - []types.PoolAsset{ + []PoolAsset{ { Weight: sdk.NewInt(100), Token: sdk.Coin{ @@ -191,7 +191,7 @@ func TestBalancerPoolAssetsWeightAndTokenBalance(t *testing.T) { }, // total weight 300 { - []types.PoolAsset{ + []PoolAsset{ { Weight: sdk.NewInt(200), Token: sdk.NewCoin("test2", sdk.NewInt(50000)), @@ -205,7 +205,7 @@ func TestBalancerPoolAssetsWeightAndTokenBalance(t *testing.T) { }, // two of the same token { - []types.PoolAsset{ + []PoolAsset{ { Weight: sdk.NewInt(200), Token: sdk.NewCoin("test2", sdk.NewInt(50000)), @@ -223,7 +223,7 @@ func TestBalancerPoolAssetsWeightAndTokenBalance(t *testing.T) { }, // total weight 7300 { - []types.PoolAsset{ + []PoolAsset{ { Weight: sdk.NewInt(200), Token: sdk.NewCoin("test2", sdk.NewInt(50000)), @@ -271,7 +271,7 @@ func TestGetBalancerPoolAssets(t *testing.T) { // and fails for things not in it. denomNotInPool := "xyzCoin" - assets := []types.PoolAsset{ + assets := []PoolAsset{ { Weight: sdk.NewInt(200), Token: sdk.NewCoin("test2", sdk.NewInt(50000)), @@ -318,7 +318,7 @@ func TestLBPParamsEmptyStartTime(t *testing.T) { // sets its start time to be the first start time it is called on defaultDuration := 100 * time.Second - initialPoolAssets := []types.PoolAsset{ + initialPoolAssets := []PoolAsset{ { Weight: sdk.NewInt(1), Token: sdk.NewCoin("asset1", sdk.NewInt(1000)), @@ -331,7 +331,7 @@ func TestLBPParamsEmptyStartTime(t *testing.T) { params := SmoothWeightChangeParams{ Duration: defaultDuration, - TargetPoolWeights: []types.PoolAsset{ + TargetPoolWeights: []PoolAsset{ { Weight: sdk.NewInt(1), Token: sdk.NewCoin("asset1", sdk.NewInt(0)), @@ -386,7 +386,7 @@ func TestBalancerPoolPokeTokenWeights(t *testing.T) { params: SmoothWeightChangeParams{ StartTime: defaultStartTime, Duration: defaultDuration, - InitialPoolWeights: []types.PoolAsset{ + InitialPoolWeights: []PoolAsset{ { Weight: sdk.NewInt(1), Token: sdk.NewCoin("asset1", sdk.NewInt(0)), @@ -396,7 +396,7 @@ func TestBalancerPoolPokeTokenWeights(t *testing.T) { Token: sdk.NewCoin("asset2", sdk.NewInt(0)), }, }, - TargetPoolWeights: []types.PoolAsset{ + TargetPoolWeights: []PoolAsset{ { Weight: sdk.NewInt(1), Token: sdk.NewCoin("asset1", sdk.NewInt(0)), @@ -434,7 +434,7 @@ func TestBalancerPoolPokeTokenWeights(t *testing.T) { params: SmoothWeightChangeParams{ StartTime: defaultStartTime, Duration: defaultDuration, - InitialPoolWeights: []types.PoolAsset{ + InitialPoolWeights: []PoolAsset{ { Weight: sdk.NewInt(2), Token: sdk.NewCoin("asset1", sdk.NewInt(0)), @@ -444,7 +444,7 @@ func TestBalancerPoolPokeTokenWeights(t *testing.T) { Token: sdk.NewCoin("asset2", sdk.NewInt(0)), }, }, - TargetPoolWeights: []types.PoolAsset{ + TargetPoolWeights: []PoolAsset{ { Weight: sdk.NewInt(4), Token: sdk.NewCoin("asset1", sdk.NewInt(0)), @@ -527,9 +527,9 @@ func TestBalancerPoolPokeTokenWeights(t *testing.T) { for poolNum, tc := range tests { paramsCopy := tc.params // First we create the initial pool assets we will use - initialPoolAssets := make([]types.PoolAsset, len(paramsCopy.InitialPoolWeights)) + initialPoolAssets := make([]PoolAsset, len(paramsCopy.InitialPoolWeights)) for i, asset := range paramsCopy.InitialPoolWeights { - assetCopy := types.PoolAsset{ + assetCopy := PoolAsset{ Weight: asset.Weight, Token: sdk.NewInt64Coin(asset.Token.Denom, 10000), } diff --git a/x/gamm/pool-models/balancer/marshal.go b/x/gamm/pool-models/balancer/marshal.go index 273ebee9202..e967ef1ffec 100644 --- a/x/gamm/pool-models/balancer/marshal.go +++ b/x/gamm/pool-models/balancer/marshal.go @@ -4,18 +4,16 @@ import ( "encoding/json" sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/osmosis-labs/osmosis/v7/x/gamm/types" ) type balancerPoolPretty struct { - Address sdk.AccAddress `json:"address" yaml:"address"` - Id uint64 `json:"id" yaml:"id"` - PoolParams PoolParams `json:"pool_params" yaml:"pool_params"` - FuturePoolGovernor string `json:"future_pool_governor" yaml:"future_pool_governor"` - TotalWeight sdk.Dec `json:"total_weight" yaml:"total_weight"` - TotalShares sdk.Coin `json:"total_shares" yaml:"total_shares"` - PoolAssets []types.PoolAsset `json:"pool_assets" yaml:"pool_assets"` + Address sdk.AccAddress `json:"address" yaml:"address"` + Id uint64 `json:"id" yaml:"id"` + PoolParams PoolParams `json:"pool_params" yaml:"pool_params"` + FuturePoolGovernor string `json:"future_pool_governor" yaml:"future_pool_governor"` + TotalWeight sdk.Dec `json:"total_weight" yaml:"total_weight"` + TotalShares sdk.Coin `json:"total_shares" yaml:"total_shares"` + PoolAssets []PoolAsset `json:"pool_assets" yaml:"pool_assets"` } func (pa Pool) String() string { diff --git a/x/gamm/pool-models/balancer/marshal_test.go b/x/gamm/pool-models/balancer/marshal_test.go index 19e424614a7..c079598207e 100644 --- a/x/gamm/pool-models/balancer/marshal_test.go +++ b/x/gamm/pool-models/balancer/marshal_test.go @@ -9,10 +9,9 @@ import ( "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/osmosis-labs/osmosis/v7/x/gamm/types" ) -var ymlAssetTest = []types.PoolAsset{ +var ymlAssetTest = []PoolAsset{ { Weight: sdk.NewInt(200), Token: sdk.NewCoin("test2", sdk.NewInt(50000)), @@ -26,7 +25,7 @@ var ymlAssetTest = []types.PoolAsset{ func TestPoolJson(t *testing.T) { var poolId uint64 = 10 - jsonAssetTest := []types.PoolAsset{ + jsonAssetTest := []PoolAsset{ { Weight: sdk.NewInt(200), Token: sdk.NewCoin("test2", sdk.NewInt(50000)), @@ -69,7 +68,7 @@ func TestPoolProtoMarshal(t *testing.T) { require.Equal(t, pool2.PoolParams.ExitFee, defaultExitFee) require.Equal(t, pool2.FuturePoolGovernor, "") require.Equal(t, pool2.TotalShares, sdk.Coin{Denom: "gamm/pool/10", Amount: sdk.ZeroInt()}) - require.Equal(t, pool2.PoolAssets, []types.PoolAsset{ + require.Equal(t, pool2.PoolAssets, []PoolAsset{ { Token: sdk.Coin{ Denom: "test1", diff --git a/x/gamm/pool-models/balancer/msgs.go b/x/gamm/pool-models/balancer/msgs.go index bb6b53cc8d7..b5921dd9cfd 100644 --- a/x/gamm/pool-models/balancer/msgs.go +++ b/x/gamm/pool-models/balancer/msgs.go @@ -22,7 +22,7 @@ func (msg MsgCreateBalancerPool) ValidateBasic() error { return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) } - err = types.ValidateUserSpecifiedPoolAssets(msg.PoolAssets) + err = ValidateUserSpecifiedPoolAssets(msg.PoolAssets) if err != nil { return err } diff --git a/x/gamm/pool-models/balancer/msgs_test.go b/x/gamm/pool-models/balancer/msgs_test.go index bfd3ebaf57b..c0d556994c9 100644 --- a/x/gamm/pool-models/balancer/msgs_test.go +++ b/x/gamm/pool-models/balancer/msgs_test.go @@ -19,7 +19,7 @@ func TestMsgCreateBalancerPool(t *testing.T) { invalidAddr := sdk.AccAddress("invalid") createMsg := func(after func(msg MsgCreateBalancerPool) MsgCreateBalancerPool) MsgCreateBalancerPool { - testPoolAsset := []types.PoolAsset{ + testPoolAsset := []PoolAsset{ { Weight: sdk.NewInt(100), Token: sdk.NewCoin("test", sdk.NewInt(100)), @@ -88,7 +88,7 @@ func TestMsgCreateBalancerPool(t *testing.T) { { name: "has no PoolAsset2", msg: createMsg(func(msg MsgCreateBalancerPool) MsgCreateBalancerPool { - msg.PoolAssets = []types.PoolAsset{} + msg.PoolAssets = []PoolAsset{} return msg }), expectPass: false, @@ -96,7 +96,7 @@ func TestMsgCreateBalancerPool(t *testing.T) { { name: "has one Pool Asset", msg: createMsg(func(msg MsgCreateBalancerPool) MsgCreateBalancerPool { - msg.PoolAssets = []types.PoolAsset{ + msg.PoolAssets = []PoolAsset{ msg.PoolAssets[0], } return msg diff --git a/x/gamm/types/pool_asset.go b/x/gamm/pool-models/balancer/pool_asset.go similarity index 90% rename from x/gamm/types/pool_asset.go rename to x/gamm/pool-models/balancer/pool_asset.go index 1742af906d9..046aa008a74 100644 --- a/x/gamm/types/pool_asset.go +++ b/x/gamm/pool-models/balancer/pool_asset.go @@ -1,4 +1,4 @@ -package types +package balancer import ( "fmt" @@ -7,6 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/osmosis-labs/osmosis/v7/x/gamm/types" "gopkg.in/yaml.v2" ) @@ -31,7 +32,7 @@ type poolAssetPretty struct { func (asset PoolAsset) prettify() poolAssetPretty { return poolAssetPretty{ - Weight: sdk.NewDecFromInt(asset.Weight).QuoInt64(GuaranteedWeightPrecision), + Weight: sdk.NewDecFromInt(asset.Weight).QuoInt64(types.GuaranteedWeightPrecision), Token: asset.Token, } } @@ -78,16 +79,16 @@ func SortPoolAssetsByDenom(assets []PoolAsset) { func ValidateUserSpecifiedPoolAssets(assets []PoolAsset) error { // The pool must be swapping between at least two assets if len(assets) < 2 { - return ErrTooFewPoolAssets + return types.ErrTooFewPoolAssets } // TODO: Add the limit of binding token to the pool params? if len(assets) > 8 { - return sdkerrors.Wrapf(ErrTooManyPoolAssets, "%d", len(assets)) + return sdkerrors.Wrapf(types.ErrTooManyPoolAssets, "%d", len(assets)) } for _, asset := range assets { - err := ValidateUserSpecifiedWeight(asset.Weight) + err := types.ValidateUserSpecifiedWeight(asset.Weight) if err != nil { return err } diff --git a/x/gamm/pool-models/balancer/tx.pb.go b/x/gamm/pool-models/balancer/tx.pb.go index 90bc8cea2b3..7824fc666f5 100644 --- a/x/gamm/pool-models/balancer/tx.pb.go +++ b/x/gamm/pool-models/balancer/tx.pb.go @@ -9,7 +9,6 @@ import ( _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" - types "github.com/osmosis-labs/osmosis/v7/x/gamm/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -31,10 +30,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // ===================== MsgCreatePool type MsgCreateBalancerPool struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` - PoolParams *PoolParams `protobuf:"bytes,2,opt,name=poolParams,proto3" json:"poolParams,omitempty" yaml:"pool_params"` - PoolAssets []types.PoolAsset `protobuf:"bytes,3,rep,name=poolAssets,proto3" json:"poolAssets"` - FuturePoolGovernor string `protobuf:"bytes,4,opt,name=future_pool_governor,json=futurePoolGovernor,proto3" json:"future_pool_governor,omitempty" yaml:"future_pool_governor"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + PoolParams *PoolParams `protobuf:"bytes,2,opt,name=poolParams,proto3" json:"poolParams,omitempty" yaml:"pool_params"` + PoolAssets []PoolAsset `protobuf:"bytes,3,rep,name=poolAssets,proto3" json:"poolAssets"` + FuturePoolGovernor string `protobuf:"bytes,4,opt,name=future_pool_governor,json=futurePoolGovernor,proto3" json:"future_pool_governor,omitempty" yaml:"future_pool_governor"` } func (m *MsgCreateBalancerPool) Reset() { *m = MsgCreateBalancerPool{} } @@ -84,7 +83,7 @@ func (m *MsgCreateBalancerPool) GetPoolParams() *PoolParams { return nil } -func (m *MsgCreateBalancerPool) GetPoolAssets() []types.PoolAsset { +func (m *MsgCreateBalancerPool) GetPoolAssets() []PoolAsset { if m != nil { return m.PoolAssets } @@ -152,33 +151,33 @@ func init() { } var fileDescriptor_26dfff9c7e076bd8 = []byte{ - // 412 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xc1, 0xea, 0xd3, 0x30, - 0x1c, 0xc7, 0xdb, 0x6d, 0x54, 0xcc, 0xf0, 0x60, 0x98, 0x52, 0x26, 0x36, 0xa5, 0x5e, 0xa6, 0xb2, - 0x86, 0x6d, 0x82, 0xe0, 0x41, 0xb0, 0x4e, 0x64, 0x87, 0xc1, 0xec, 0x69, 0x78, 0x19, 0xe9, 0x1a, - 0xeb, 0xa0, 0x6d, 0x4a, 0xd2, 0x95, 0x79, 0xf0, 0x1d, 0x7c, 0x1a, 0x9f, 0x61, 0xc7, 0x1d, 0x3d, - 0x15, 0xe9, 0xde, 0x60, 0x4f, 0x20, 0x4d, 0x5b, 0x99, 0xd0, 0x21, 0xff, 0x5b, 0xfa, 0xeb, 0xe7, - 0xfb, 0xf9, 0xe5, 0x97, 0x04, 0xbc, 0x60, 0x22, 0x62, 0x62, 0x27, 0x70, 0x40, 0xa2, 0x08, 0x27, - 0x8c, 0x85, 0xe3, 0x88, 0xf9, 0x34, 0x14, 0xd8, 0x23, 0x21, 0x89, 0xb7, 0x94, 0xe3, 0xf4, 0x60, - 0x27, 0x9c, 0xa5, 0x0c, 0x0e, 0x6a, 0xd6, 0x2e, 0x59, 0x3b, 0x9b, 0x78, 0x34, 0x25, 0x93, 0xe1, - 0x20, 0x60, 0x01, 0x93, 0x00, 0x2e, 0x57, 0x15, 0x3b, 0x7c, 0xf5, 0x7f, 0x6f, 0xb3, 0x58, 0x31, -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 0x3b, 0xe8, 0x2e, 0x45, 0x00, 0x33, 0x00, 0x5b, 0x6e, 0xe0, - 0x65, 0xfb, 0xa0, 0xad, 0x6d, 0x87, 0xb3, 0x3b, 0xc0, 0xcd, 0x1e, 0x9d, 0xf5, 0xb1, 0x30, 0xd4, - 0x53, 0x61, 0xa8, 0xbf, 0x0b, 0x43, 0xfd, 0x71, 0x36, 0x94, 0xd3, 0xd9, 0x50, 0x7e, 0x9d, 0x0d, - 0xe5, 0xf3, 0xdb, 0x60, 0x97, 0x7e, 0xdd, 0x7b, 0xf6, 0x96, 0x45, 0xb8, 0x16, 0x8f, 0x43, 0xe2, - 0x89, 0xe6, 0x03, 0x67, 0xaf, 0xf1, 0xe1, 0xf6, 0x5b, 0xf4, 0x34, 0xf9, 0xbc, 0x66, 0x7f, 0x02, - 0x00, 0x00, 0xff, 0xff, 0xff, 0xae, 0x1d, 0x7d, 0x0f, 0x03, 0x00, 0x00, + // 408 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xc1, 0x8a, 0xda, 0x40, + 0x18, 0xc7, 0x13, 0x95, 0x94, 0x8e, 0xf4, 0xd0, 0xc1, 0x96, 0x60, 0x69, 0x12, 0xd2, 0x8b, 0x6d, + 0x31, 0x83, 0x5a, 0x28, 0xf4, 0x50, 0x68, 0x6a, 0x29, 0x1e, 0x04, 0x37, 0x27, 0xd9, 0x8b, 0x4c, + 0xcc, 0x6c, 0x56, 0x48, 0x32, 0x61, 0x26, 0x06, 0xf7, 0xb0, 0xef, 0xb0, 0x4f, 0xb3, 0xcf, 0xe0, + 0xd1, 0xe3, 0x9e, 0xc2, 0x12, 0xdf, 0xc0, 0x27, 0x58, 0x32, 0x31, 0x8b, 0x87, 0xc8, 0xb2, 0xb7, + 0xc9, 0x7f, 0x7e, 0xdf, 0xff, 0xff, 0xcd, 0x97, 0x0f, 0x7c, 0xa3, 0x3c, 0x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x4c, 0xff, 0x54, 0x36, 0x52, 0x47, 0x99, 0x0e, 0x2c, 0xe5, 0x22, 0xe1, 0x7f, + 0x25, 0x8e, 0xc1, 0xe7, 0xda, 0xb9, 0x39, 0x84, 0xc7, 0x34, 0xe2, 0x04, 0x7e, 0x01, 0x6f, 0x84, + 0xcd, 0xca, 0x13, 0x03, 0x6c, 0xd9, 0x20, 0xcf, 0x74, 0xa5, 0x40, 0x26, 0x63, 0x47, 0x29, 0xae, + 0x26, 0xde, 0xf0, 0x16, 0x34, 0xa7, 0xdc, 0x87, 0x29, 0x80, 0x35, 0x7f, 0xe0, 0x7b, 0xfd, 0x43, + 0x6b, 0x63, 0xbb, 0xa3, 0x57, 0xc0, 0x55, 0x8f, 0xf6, 0x7c, 0x9b, 0x6b, 0xf2, 0x2e, 0xd7, 0xe4, + 0xc7, 0x5c, 0x93, 0xef, 0xf6, 0x9a, 0xb4, 0xdb, 0x6b, 0xd2, 0xc3, 0x5e, 0x93, 0x2e, 0x7f, 0xfb, + 0xab, 0xe4, 0x7a, 0xed, 0x5a, 0x4b, 0x1a, 0xa2, 0xa3, 0x71, 0x3f, 0xc0, 0x2e, 0xaf, 0x3e, 0x50, + 0xfa, 0x13, 0x6d, 0xce, 0xaf, 0x9a, 0xab, 0x88, 0xf5, 0x1a, 0x3d, 0x05, 0x00, 0x00, 0xff, 0xff, + 0x66, 0xb1, 0xa1, 0xc1, 0xee, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -534,7 +533,7 @@ func (m *MsgCreateBalancerPool) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PoolAssets = append(m.PoolAssets, types.PoolAsset{}) + m.PoolAssets = append(m.PoolAssets, PoolAsset{}) if err := m.PoolAssets[len(m.PoolAssets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/gamm/simulation/operations.go b/x/gamm/simulation/operations.go index b66177b041b..6dbbbb01a13 100644 --- a/x/gamm/simulation/operations.go +++ b/x/gamm/simulation/operations.go @@ -84,23 +84,23 @@ func genFuturePoolGovernor(r *rand.Rand, addr sdk.Address, tokenList []string) s } } -func genPoolAssets(r *rand.Rand, acct simtypes.Account, coins sdk.Coins) []types.PoolAsset { +func genPoolAssets(r *rand.Rand, acct simtypes.Account, coins sdk.Coins) []balancer.PoolAsset { // selecting random number between [2, Min(coins.Len, 6)] numCoins := 2 + r.Intn(Min(coins.Len(), 6)-1) denomIndices := r.Perm(coins.Len()) - assets := []types.PoolAsset{} + assets := []balancer.PoolAsset{} for _, denomIndex := range denomIndices[:numCoins] { denom := coins[denomIndex].Denom amt, _ := simtypes.RandPositiveInt(r, coins[denomIndex].Amount.QuoRaw(100)) reserveAmt := sdk.NewCoin(denom, amt) weight := sdk.NewInt(r.Int63n(9) + 1) - assets = append(assets, types.PoolAsset{Token: reserveAmt, Weight: weight}) + assets = append(assets, balancer.PoolAsset{Token: reserveAmt, Weight: weight}) } return assets } -func genBalancerPoolParams(r *rand.Rand, blockTime time.Time, assets []types.PoolAsset) balancer.PoolParams { +func genBalancerPoolParams(r *rand.Rand, blockTime time.Time, assets []balancer.PoolAsset) balancer.PoolParams { // swapFeeInt := int64(r.Intn(1e5)) // swapFee := sdk.NewDecWithPrec(swapFeeInt, 6) @@ -167,7 +167,7 @@ func SimulateMsgCreateBalancerPool(ak stakingTypes.AccountKeeper, bk stakingType FuturePoolGovernor: "", } - spentCoins := types.PoolAssetsCoins(poolAssets) + spentCoins := balancer.PoolAssetsCoins(poolAssets) txGen := simappparams.MakeTestEncodingConfig().TxConfig return osmo_simulation.GenAndDeliverTxWithRandFees( diff --git a/x/gamm/types/pool.pb.go b/x/gamm/types/pool.pb.go deleted file mode 100644 index 68a46da3696..00000000000 --- a/x/gamm/types/pool.pb.go +++ /dev/null @@ -1,377 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: osmosis/gamm/v1beta1/pool.proto - -package types - -import ( - fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type PoolAsset struct { - // Coins we are talking about, - // the denomination must be unique amongst all PoolAssets for this pool. - Token types.Coin `protobuf:"bytes,1,opt,name=token,proto3" json:"token" yaml:"token"` - // Weight that is not normalized. This weight must be less than 2^50 - Weight github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"weight" yaml:"weight"` -} - -func (m *PoolAsset) Reset() { *m = PoolAsset{} } -func (m *PoolAsset) String() string { return proto.CompactTextString(m) } -func (*PoolAsset) ProtoMessage() {} -func (*PoolAsset) Descriptor() ([]byte, []int) { - return fileDescriptor_e5ab9bc6d45f98ce, []int{0} -} -func (m *PoolAsset) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PoolAsset) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PoolAsset.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PoolAsset) XXX_Merge(src proto.Message) { - xxx_messageInfo_PoolAsset.Merge(m, src) -} -func (m *PoolAsset) XXX_Size() int { - return m.Size() -} -func (m *PoolAsset) XXX_DiscardUnknown() { - xxx_messageInfo_PoolAsset.DiscardUnknown(m) -} - -var xxx_messageInfo_PoolAsset proto.InternalMessageInfo - -func (m *PoolAsset) GetToken() types.Coin { - if m != nil { - return m.Token - } - return types.Coin{} -} - -func init() { - proto.RegisterType((*PoolAsset)(nil), "osmosis.gamm.v1beta1.PoolAsset") -} - -func init() { proto.RegisterFile("osmosis/gamm/v1beta1/pool.proto", fileDescriptor_e5ab9bc6d45f98ce) } - -var fileDescriptor_e5ab9bc6d45f98ce = []byte{ - // 286 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcf, 0x2f, 0xce, 0xcd, - 0x2f, 0xce, 0x2c, 0xd6, 0x4f, 0x4f, 0xcc, 0xcd, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, - 0xd4, 0x2f, 0xc8, 0xcf, 0xcf, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, 0x2a, 0xd0, - 0x03, 0x29, 0xd0, 0x83, 0x2a, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd0, 0x07, 0xb1, - 0x20, 0x6a, 0xa5, 0xe4, 0x92, 0xc1, 0x8a, 0xf5, 0x93, 0x12, 0x8b, 0x53, 0xe1, 0x66, 0x25, 0xe7, - 0x67, 0xe6, 0x41, 0xe4, 0x95, 0x56, 0x33, 0x72, 0x71, 0x06, 0xe4, 0xe7, 0xe7, 0x38, 0x16, 0x17, - 0xa7, 0x96, 0x08, 0xb9, 0x72, 0xb1, 0x96, 0xe4, 0x67, 0xa7, 0xe6, 0x49, 0x30, 0x2a, 0x30, 0x6a, - 0x70, 0x1b, 0x49, 0xea, 0x41, 0x74, 0xeb, 0x81, 0x74, 0xc3, 0x2c, 0xd2, 0x73, 0xce, 0xcf, 0xcc, - 0x73, 0x12, 0x39, 0x71, 0x4f, 0x9e, 0xe1, 0xd3, 0x3d, 0x79, 0x9e, 0xca, 0xc4, 0xdc, 0x1c, 0x2b, - 0x25, 0xb0, 0x2e, 0xa5, 0x20, 0x88, 0x6e, 0xa1, 0x70, 0x2e, 0xb6, 0xf2, 0xd4, 0xcc, 0xf4, 0x8c, - 0x12, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x4e, 0x27, 0x7b, 0x90, 0xe2, 0x5b, 0xf7, 0xe4, 0xd5, 0xd2, - 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xa1, 0xee, 0x82, 0x50, 0xba, 0xc5, - 0x29, 0xd9, 0xfa, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x7a, 0x9e, 0x79, 0x25, 0x9f, 0xee, 0xc9, 0xf3, - 0x42, 0x8c, 0x85, 0x98, 0xa2, 0x14, 0x04, 0x35, 0xce, 0xc9, 0xf3, 0xc4, 0x23, 0x39, 0xc6, 0x0b, - 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, - 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xf4, 0x91, 0x8c, 0x86, 0x06, 0x8f, 0x6e, 0x4e, 0x62, 0x52, 0x31, - 0x8c, 0xa3, 0x5f, 0x66, 0xae, 0x5f, 0x01, 0x09, 0x51, 0xb0, 0x3d, 0x49, 0x6c, 0x60, 0xff, 0x1b, - 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x64, 0x99, 0x81, 0xef, 0x6e, 0x01, 0x00, 0x00, -} - -func (m *PoolAsset) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PoolAsset) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PoolAsset) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Weight.Size() - i -= size - if _, err := m.Weight.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintPool(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPool(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintPool(dAtA []byte, offset int, v uint64) int { - offset -= sovPool(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *PoolAsset) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Token.Size() - n += 1 + l + sovPool(uint64(l)) - l = m.Weight.Size() - n += 1 + l + sovPool(uint64(l)) - return n -} - -func sovPool(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozPool(x uint64) (n int) { - return sovPool(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *PoolAsset) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PoolAsset: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PoolAsset: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPool - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPool - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPool - } - 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 ErrInvalidLengthPool - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPool - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Weight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPool(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPool - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipPool(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPool - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPool - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPool - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthPool - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupPool - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthPool - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthPool = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPool = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupPool = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/gamm/types/query.pb.go b/x/gamm/types/query.pb.go index 0f15565e7c4..b4c0ee9317b 100644 --- a/x/gamm/types/query.pb.go +++ b/x/gamm/types/query.pb.go @@ -481,108 +481,18 @@ func (m *QueryTotalSharesResponse) GetTotalShares() types1.Coin { return types1.Coin{} } -//=============================== PoolAssets -type QueryPoolAssetsRequest struct { - PoolId uint64 `protobuf:"varint,1,opt,name=poolId,proto3" json:"poolId,omitempty" yaml:"pool_id"` -} - -func (m *QueryPoolAssetsRequest) Reset() { *m = QueryPoolAssetsRequest{} } -func (m *QueryPoolAssetsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryPoolAssetsRequest) ProtoMessage() {} -func (*QueryPoolAssetsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d9a717df9ca609ef, []int{10} -} -func (m *QueryPoolAssetsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryPoolAssetsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryPoolAssetsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryPoolAssetsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPoolAssetsRequest.Merge(m, src) -} -func (m *QueryPoolAssetsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryPoolAssetsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPoolAssetsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryPoolAssetsRequest proto.InternalMessageInfo - -func (m *QueryPoolAssetsRequest) GetPoolId() uint64 { - if m != nil { - return m.PoolId - } - return 0 -} - -type QueryPoolAssetsResponse struct { - PoolAssets []PoolAsset `protobuf:"bytes,1,rep,name=poolAssets,proto3" json:"poolAssets"` -} - -func (m *QueryPoolAssetsResponse) Reset() { *m = QueryPoolAssetsResponse{} } -func (m *QueryPoolAssetsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryPoolAssetsResponse) ProtoMessage() {} -func (*QueryPoolAssetsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d9a717df9ca609ef, []int{11} -} -func (m *QueryPoolAssetsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryPoolAssetsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryPoolAssetsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryPoolAssetsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPoolAssetsResponse.Merge(m, src) -} -func (m *QueryPoolAssetsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryPoolAssetsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPoolAssetsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryPoolAssetsResponse proto.InternalMessageInfo - -func (m *QueryPoolAssetsResponse) GetPoolAssets() []PoolAsset { - if m != nil { - return m.PoolAssets - } - return nil -} - //=============================== SpotPrice type QuerySpotPriceRequest struct { PoolId uint64 `protobuf:"varint,1,opt,name=poolId,proto3" json:"poolId,omitempty" yaml:"pool_id"` TokenInDenom string `protobuf:"bytes,2,opt,name=tokenInDenom,proto3" json:"tokenInDenom,omitempty" yaml:"token_in_denom"` TokenOutDenom string `protobuf:"bytes,3,opt,name=tokenOutDenom,proto3" json:"tokenOutDenom,omitempty" yaml:"token_out_denom"` - WithSwapFee bool `protobuf:"varint,4,opt,name=withSwapFee,proto3" json:"withSwapFee,omitempty" yaml:"with_swap_fee"` } func (m *QuerySpotPriceRequest) Reset() { *m = QuerySpotPriceRequest{} } func (m *QuerySpotPriceRequest) String() string { return proto.CompactTextString(m) } func (*QuerySpotPriceRequest) ProtoMessage() {} func (*QuerySpotPriceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d9a717df9ca609ef, []int{12} + return fileDescriptor_d9a717df9ca609ef, []int{10} } func (m *QuerySpotPriceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -632,13 +542,6 @@ func (m *QuerySpotPriceRequest) GetTokenOutDenom() string { return "" } -func (m *QuerySpotPriceRequest) GetWithSwapFee() bool { - if m != nil { - return m.WithSwapFee - } - return false -} - type QuerySpotPriceResponse struct { // String of the Dec. Ex) 10.203uatom SpotPrice string `protobuf:"bytes,1,opt,name=spotPrice,proto3" json:"spotPrice,omitempty" yaml:"spot_price"` @@ -648,7 +551,7 @@ func (m *QuerySpotPriceResponse) Reset() { *m = QuerySpotPriceResponse{} func (m *QuerySpotPriceResponse) String() string { return proto.CompactTextString(m) } func (*QuerySpotPriceResponse) ProtoMessage() {} func (*QuerySpotPriceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d9a717df9ca609ef, []int{13} + return fileDescriptor_d9a717df9ca609ef, []int{11} } func (m *QuerySpotPriceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -696,7 +599,7 @@ func (m *QuerySwapExactAmountInRequest) Reset() { *m = QuerySwapExactAmo func (m *QuerySwapExactAmountInRequest) String() string { return proto.CompactTextString(m) } func (*QuerySwapExactAmountInRequest) ProtoMessage() {} func (*QuerySwapExactAmountInRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d9a717df9ca609ef, []int{14} + return fileDescriptor_d9a717df9ca609ef, []int{12} } func (m *QuerySwapExactAmountInRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -761,7 +664,7 @@ func (m *QuerySwapExactAmountInResponse) Reset() { *m = QuerySwapExactAm func (m *QuerySwapExactAmountInResponse) String() string { return proto.CompactTextString(m) } func (*QuerySwapExactAmountInResponse) ProtoMessage() {} func (*QuerySwapExactAmountInResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d9a717df9ca609ef, []int{15} + return fileDescriptor_d9a717df9ca609ef, []int{13} } func (m *QuerySwapExactAmountInResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -802,7 +705,7 @@ func (m *QuerySwapExactAmountOutRequest) Reset() { *m = QuerySwapExactAm func (m *QuerySwapExactAmountOutRequest) String() string { return proto.CompactTextString(m) } func (*QuerySwapExactAmountOutRequest) ProtoMessage() {} func (*QuerySwapExactAmountOutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d9a717df9ca609ef, []int{16} + return fileDescriptor_d9a717df9ca609ef, []int{14} } func (m *QuerySwapExactAmountOutRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -867,7 +770,7 @@ func (m *QuerySwapExactAmountOutResponse) Reset() { *m = QuerySwapExactA func (m *QuerySwapExactAmountOutResponse) String() string { return proto.CompactTextString(m) } func (*QuerySwapExactAmountOutResponse) ProtoMessage() {} func (*QuerySwapExactAmountOutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d9a717df9ca609ef, []int{17} + return fileDescriptor_d9a717df9ca609ef, []int{15} } func (m *QuerySwapExactAmountOutResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -903,7 +806,7 @@ func (m *QueryTotalLiquidityRequest) Reset() { *m = QueryTotalLiquidityR func (m *QueryTotalLiquidityRequest) String() string { return proto.CompactTextString(m) } func (*QueryTotalLiquidityRequest) ProtoMessage() {} func (*QueryTotalLiquidityRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d9a717df9ca609ef, []int{18} + return fileDescriptor_d9a717df9ca609ef, []int{16} } func (m *QueryTotalLiquidityRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -940,7 +843,7 @@ func (m *QueryTotalLiquidityResponse) Reset() { *m = QueryTotalLiquidity func (m *QueryTotalLiquidityResponse) String() string { return proto.CompactTextString(m) } func (*QueryTotalLiquidityResponse) ProtoMessage() {} func (*QueryTotalLiquidityResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d9a717df9ca609ef, []int{19} + return fileDescriptor_d9a717df9ca609ef, []int{17} } func (m *QueryTotalLiquidityResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -987,8 +890,6 @@ func init() { proto.RegisterType((*QueryPoolParamsResponse)(nil), "osmosis.gamm.v1beta1.QueryPoolParamsResponse") proto.RegisterType((*QueryTotalSharesRequest)(nil), "osmosis.gamm.v1beta1.QueryTotalSharesRequest") proto.RegisterType((*QueryTotalSharesResponse)(nil), "osmosis.gamm.v1beta1.QueryTotalSharesResponse") - proto.RegisterType((*QueryPoolAssetsRequest)(nil), "osmosis.gamm.v1beta1.QueryPoolAssetsRequest") - proto.RegisterType((*QueryPoolAssetsResponse)(nil), "osmosis.gamm.v1beta1.QueryPoolAssetsResponse") proto.RegisterType((*QuerySpotPriceRequest)(nil), "osmosis.gamm.v1beta1.QuerySpotPriceRequest") proto.RegisterType((*QuerySpotPriceResponse)(nil), "osmosis.gamm.v1beta1.QuerySpotPriceResponse") proto.RegisterType((*QuerySwapExactAmountInRequest)(nil), "osmosis.gamm.v1beta1.QuerySwapExactAmountInRequest") @@ -1002,90 +903,85 @@ func init() { func init() { proto.RegisterFile("osmosis/gamm/v1beta1/query.proto", fileDescriptor_d9a717df9ca609ef) } var fileDescriptor_d9a717df9ca609ef = []byte{ - // 1326 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, - 0x17, 0xcf, 0xa6, 0x69, 0xbe, 0xf5, 0xa4, 0xed, 0xb7, 0x9d, 0x3a, 0xa9, 0xb3, 0x6d, 0xbd, 0x61, - 0x80, 0x24, 0xb4, 0xf1, 0x6e, 0xd3, 0x50, 0x21, 0x2a, 0x5a, 0xa8, 0x49, 0xda, 0x5a, 0x02, 0x1a, - 0xb6, 0x08, 0x10, 0x1c, 0xcc, 0x3a, 0x9e, 0xba, 0xab, 0xda, 0x3b, 0x1b, 0xcf, 0x6c, 0x53, 0x0b, - 0x55, 0xa0, 0x4a, 0xdc, 0x38, 0x80, 0xca, 0x0d, 0xc4, 0x09, 0x09, 0x89, 0x33, 0x7f, 0x44, 0x85, - 0x38, 0x54, 0xe2, 0x82, 0x38, 0x2c, 0xa8, 0xe5, 0x2f, 0xf0, 0x1d, 0x09, 0xed, 0xec, 0xdb, 0xf5, - 0xae, 0xe3, 0xdf, 0x12, 0xa7, 0xd6, 0xf3, 0x3e, 0xef, 0xcd, 0xe7, 0x7d, 0x3e, 0xb3, 0x33, 0x2f, - 0x68, 0x89, 0xf1, 0x06, 0xe3, 0x36, 0x37, 0x6a, 0x56, 0xa3, 0x61, 0xdc, 0x5b, 0xaf, 0x50, 0x61, - 0xad, 0x1b, 0xbb, 0x1e, 0x6d, 0xb6, 0x74, 0xb7, 0xc9, 0x04, 0xc3, 0x59, 0x40, 0xe8, 0x01, 0x42, - 0x07, 0x84, 0x9a, 0xad, 0xb1, 0x1a, 0x93, 0x00, 0x23, 0xf8, 0x5f, 0x88, 0x55, 0xcf, 0xf4, 0xac, - 0x26, 0xee, 0x43, 0x58, 0xeb, 0x19, 0x76, 0x19, 0xab, 0x03, 0x20, 0xbf, 0x23, 0x11, 0x46, 0xc5, - 0xe2, 0x34, 0x8e, 0xef, 0x30, 0xdb, 0x81, 0xf8, 0xd9, 0x64, 0x5c, 0x92, 0xec, 0x54, 0xb1, 0x6a, - 0xb6, 0x63, 0x09, 0x9b, 0x45, 0xd8, 0xd3, 0x35, 0xc6, 0x6a, 0x75, 0x6a, 0x58, 0xae, 0x6d, 0x58, - 0x8e, 0xc3, 0x84, 0x0c, 0x72, 0x88, 0x2e, 0x42, 0x54, 0xfe, 0xaa, 0x78, 0xb7, 0x0d, 0xcb, 0x69, - 0x45, 0xa1, 0x70, 0x93, 0x72, 0xd8, 0x5d, 0xf8, 0x23, 0x0c, 0x91, 0x2b, 0xe8, 0xd8, 0xbb, 0xc1, - 0xae, 0xdb, 0x8c, 0xd5, 0x4d, 0xba, 0xeb, 0x51, 0x2e, 0xf0, 0x59, 0x34, 0x1b, 0x74, 0x50, 0xaa, - 0xe6, 0x94, 0x25, 0x65, 0x75, 0xa6, 0x88, 0xdb, 0xbe, 0x76, 0xb4, 0x65, 0x35, 0xea, 0x97, 0x48, - 0xb0, 0x5e, 0xb6, 0xab, 0xc4, 0x04, 0x04, 0xb9, 0x81, 0x8e, 0x27, 0xf2, 0xb9, 0xcb, 0x1c, 0x4e, - 0xf1, 0x06, 0x9a, 0x09, 0xc2, 0x32, 0x7d, 0xee, 0x42, 0x56, 0x0f, 0x99, 0xe9, 0x11, 0x33, 0xfd, - 0xaa, 0xd3, 0x2a, 0x66, 0x7e, 0xf9, 0xb9, 0x70, 0x30, 0xc8, 0x2a, 0x99, 0x12, 0x4c, 0x3e, 0x4e, - 0x54, 0xe2, 0x11, 0x95, 0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 0xd2, 0xfa, 0x8a, 0x00, 0xde, 0x38, - 0xf0, 0x2d, 0x96, 0x9c, 0x94, 0x35, 0x37, 0xc6, 0xb6, 0x66, 0xa1, 0xeb, 0xcb, 0x8f, 0x9c, 0x49, - 0x97, 0x27, 0xa7, 0x91, 0xda, 0xb9, 0x9e, 0xdf, 0xb2, 0x77, 0x3d, 0xbb, 0x6a, 0x8b, 0x56, 0xf4, - 0xba, 0x7d, 0xa7, 0xa0, 0x53, 0x3d, 0xc3, 0xc0, 0xf6, 0x01, 0xca, 0xd4, 0xa3, 0x45, 0xb8, 0x04, - 0x07, 0x5c, 0xdf, 0x9b, 0x20, 0x28, 0x68, 0x14, 0x67, 0x92, 0x9f, 0xfe, 0xd4, 0x56, 0x47, 0x68, - 0x2c, 0x28, 0xc2, 0xcd, 0xce, 0x8e, 0x17, 0xda, 0x87, 0xd1, 0x41, 0x49, 0x0f, 0x7f, 0x86, 0xe4, - 0xbb, 0xcf, 0x71, 0x9f, 0xcf, 0x68, 0xdf, 0xbc, 0xa2, 0xae, 0x0e, 0x07, 0x86, 0x4d, 0x92, 0xe7, - 0x1f, 0xfe, 0xf6, 0xf7, 0xa3, 0xe9, 0x33, 0xf8, 0x94, 0xd1, 0x77, 0x84, 0xe4, 0xf8, 0x4b, 0x05, - 0x1d, 0x8a, 0x66, 0x00, 0x7c, 0x76, 0x40, 0xed, 0xae, 0x01, 0x42, 0x3d, 0x37, 0x12, 0x16, 0xa8, - 0xac, 0x48, 0x2a, 0xcf, 0x61, 0xad, 0x37, 0x95, 0x78, 0xac, 0xc0, 0x3f, 0x28, 0xe8, 0x68, 0xda, - 0x33, 0x7c, 0x7e, 0xc0, 0x46, 0x3d, 0xdd, 0x57, 0xd7, 0xc7, 0xc8, 0x00, 0x82, 0x05, 0x49, 0x70, - 0x05, 0xbf, 0xd8, 0x9b, 0x60, 0xf8, 0x62, 0xc7, 0x06, 0xe2, 0x2f, 0x14, 0x34, 0x13, 0x74, 0x88, - 0x97, 0x87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 0x5a, 0x67, 0x52, 0x50, 0x2f, 0x8e, 0x99, 0x05, 0x1d, - 0x6d, 0xc9, 0x8e, 0x5e, 0xc7, 0x97, 0x27, 0xef, 0x88, 0x79, 0xa2, 0x58, 0x7a, 0xfc, 0x34, 0xaf, - 0x3c, 0x79, 0x9a, 0x57, 0xfe, 0x7a, 0x9a, 0x57, 0xbe, 0x7a, 0x96, 0x9f, 0x7a, 0xf2, 0x2c, 0x3f, - 0xf5, 0xfb, 0xb3, 0xfc, 0xd4, 0x47, 0x46, 0xe2, 0x0d, 0x83, 0x2d, 0x0a, 0x75, 0xab, 0xc2, 0xe3, - 0xfd, 0xee, 0xbd, 0x62, 0xdc, 0x0f, 0x37, 0x95, 0x0f, 0x5a, 0x65, 0x56, 0xfe, 0xe1, 0xb5, 0xf1, - 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xae, 0x6a, 0x1e, 0x71, 0x09, 0x11, 0x00, 0x00, + // 1248 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x97, 0xc1, 0x6f, 0x1b, 0xc5, + 0x17, 0xc7, 0xb3, 0xa9, 0x93, 0x5f, 0x3d, 0xf9, 0x35, 0x24, 0xd3, 0x24, 0x75, 0x36, 0x8d, 0x37, + 0x0c, 0x90, 0x84, 0x34, 0xde, 0x6d, 0x1a, 0x2a, 0x04, 0xa2, 0x85, 0x9a, 0xa4, 0xad, 0x11, 0x90, + 0xb0, 0x41, 0x80, 0xe0, 0x60, 0xad, 0xe3, 0xc5, 0x59, 0xc5, 0xde, 0xd9, 0x78, 0x66, 0x9b, 0x58, + 0xa8, 0x42, 0xaa, 0xc4, 0x8d, 0x03, 0xa8, 0xdc, 0x40, 0x9c, 0x90, 0x90, 0x38, 0xf3, 0x47, 0x54, + 0x88, 0x43, 0x10, 0x07, 0x10, 0x07, 0x83, 0x12, 0xfe, 0x02, 0xdf, 0x91, 0xd0, 0xce, 0xbc, 0x5d, + 0xaf, 0x1d, 0xc7, 0x76, 0x22, 0x71, 0x4a, 0x76, 0xde, 0xf7, 0xbd, 0xf9, 0xbc, 0xf7, 0x76, 0xe7, + 0x8d, 0xd1, 0x1c, 0x65, 0x15, 0xca, 0x1c, 0x66, 0x94, 0xac, 0x4a, 0xc5, 0x78, 0xb0, 0x52, 0xb0, + 0xb9, 0xb5, 0x62, 0xec, 0xf9, 0x76, 0xb5, 0xa6, 0x7b, 0x55, 0xca, 0x29, 0x9e, 0x00, 0x85, 0x1e, + 0x28, 0x74, 0x50, 0xa8, 0x13, 0x25, 0x5a, 0xa2, 0x42, 0x60, 0x04, 0xff, 0x49, 0xad, 0x3a, 0xdb, + 0x31, 0x1a, 0x3f, 0x00, 0x73, 0x7a, 0x5b, 0xd8, 0x8d, 0x82, 0xc5, 0xec, 0xc8, 0xba, 0x4d, 0x1d, + 0x17, 0xec, 0x4b, 0x71, 0xbb, 0x60, 0x88, 0x54, 0x9e, 0x55, 0x72, 0x5c, 0x8b, 0x3b, 0x34, 0xd4, + 0x5e, 0x2d, 0x51, 0x5a, 0x2a, 0xdb, 0x86, 0xe5, 0x39, 0x86, 0xe5, 0xba, 0x94, 0x0b, 0x23, 0x03, + 0xeb, 0x34, 0x58, 0xc5, 0x53, 0xc1, 0xff, 0xd8, 0xb0, 0xdc, 0x5a, 0x68, 0x92, 0x9b, 0xe4, 0x25, + 0xbc, 0x7c, 0x90, 0x26, 0x72, 0x1b, 0x8d, 0xbd, 0x13, 0xec, 0xba, 0x49, 0x69, 0xd9, 0xb4, 0xf7, + 0x7c, 0x9b, 0x71, 0xbc, 0x84, 0x86, 0x3d, 0x4a, 0xcb, 0xb9, 0x62, 0x4a, 0x99, 0x53, 0x16, 0x13, + 0x59, 0xdc, 0xa8, 0x6b, 0xa3, 0x35, 0xab, 0x52, 0x7e, 0x99, 0x04, 0xeb, 0x79, 0xa7, 0x48, 0x4c, + 0x50, 0x90, 0xfb, 0x68, 0x3c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x56, 0x0e, 0x8f, 0xd2, 0xca, 0x5f, 0x47, 0x69, 0xe5, 0x8b, 0xe3, 0xf4, 0xc0, + 0xe1, 0x71, 0x7a, 0xe0, 0xf7, 0xe3, 0xf4, 0xc0, 0x87, 0x46, 0x6c, 0x44, 0xc0, 0x16, 0x99, 0xb2, + 0x55, 0x60, 0xd1, 0x7e, 0x0f, 0x5e, 0x34, 0x0e, 0xe4, 0xa6, 0x62, 0x5e, 0x14, 0x86, 0xc5, 0xcf, + 0x80, 0xd5, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x8c, 0xef, 0x1d, 0x76, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1107,7 +1003,6 @@ type QueryClient interface { Pool(ctx context.Context, in *QueryPoolRequest, opts ...grpc.CallOption) (*QueryPoolResponse, error) PoolParams(ctx context.Context, in *QueryPoolParamsRequest, opts ...grpc.CallOption) (*QueryPoolParamsResponse, error) TotalShares(ctx context.Context, in *QueryTotalSharesRequest, opts ...grpc.CallOption) (*QueryTotalSharesResponse, error) - PoolAssets(ctx context.Context, in *QueryPoolAssetsRequest, opts ...grpc.CallOption) (*QueryPoolAssetsResponse, error) SpotPrice(ctx context.Context, in *QuerySpotPriceRequest, opts ...grpc.CallOption) (*QuerySpotPriceResponse, error) // Estimate the swap. EstimateSwapExactAmountIn(ctx context.Context, in *QuerySwapExactAmountInRequest, opts ...grpc.CallOption) (*QuerySwapExactAmountInResponse, error) @@ -1176,15 +1071,6 @@ func (c *queryClient) TotalShares(ctx context.Context, in *QueryTotalSharesReque return out, nil } -func (c *queryClient) PoolAssets(ctx context.Context, in *QueryPoolAssetsRequest, opts ...grpc.CallOption) (*QueryPoolAssetsResponse, error) { - out := new(QueryPoolAssetsResponse) - err := c.cc.Invoke(ctx, "/osmosis.gamm.v1beta1.Query/PoolAssets", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) SpotPrice(ctx context.Context, in *QuerySpotPriceRequest, opts ...grpc.CallOption) (*QuerySpotPriceResponse, error) { out := new(QuerySpotPriceResponse) err := c.cc.Invoke(ctx, "/osmosis.gamm.v1beta1.Query/SpotPrice", in, out, opts...) @@ -1221,7 +1107,6 @@ type QueryServer interface { Pool(context.Context, *QueryPoolRequest) (*QueryPoolResponse, error) PoolParams(context.Context, *QueryPoolParamsRequest) (*QueryPoolParamsResponse, error) TotalShares(context.Context, *QueryTotalSharesRequest) (*QueryTotalSharesResponse, error) - PoolAssets(context.Context, *QueryPoolAssetsRequest) (*QueryPoolAssetsResponse, error) SpotPrice(context.Context, *QuerySpotPriceRequest) (*QuerySpotPriceResponse, error) // Estimate the swap. EstimateSwapExactAmountIn(context.Context, *QuerySwapExactAmountInRequest) (*QuerySwapExactAmountInResponse, error) @@ -1250,9 +1135,6 @@ func (*UnimplementedQueryServer) PoolParams(ctx context.Context, req *QueryPoolP func (*UnimplementedQueryServer) TotalShares(ctx context.Context, req *QueryTotalSharesRequest) (*QueryTotalSharesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TotalShares not implemented") } -func (*UnimplementedQueryServer) PoolAssets(ctx context.Context, req *QueryPoolAssetsRequest) (*QueryPoolAssetsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PoolAssets not implemented") -} func (*UnimplementedQueryServer) SpotPrice(ctx context.Context, req *QuerySpotPriceRequest) (*QuerySpotPriceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SpotPrice not implemented") } @@ -1375,24 +1257,6 @@ func _Query_TotalShares_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } -func _Query_PoolAssets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryPoolAssetsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).PoolAssets(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.gamm.v1beta1.Query/PoolAssets", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).PoolAssets(ctx, req.(*QueryPoolAssetsRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_SpotPrice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QuerySpotPriceRequest) if err := dec(in); err != nil { @@ -1475,10 +1339,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "TotalShares", Handler: _Query_TotalShares_Handler, }, - { - MethodName: "PoolAssets", - Handler: _Query_PoolAssets_Handler, - }, { MethodName: "SpotPrice", Handler: _Query_SpotPrice_Handler, @@ -1818,71 +1678,6 @@ func (m *QueryTotalSharesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *QueryPoolAssetsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryPoolAssetsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryPoolAssetsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.PoolId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.PoolId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryPoolAssetsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryPoolAssetsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryPoolAssetsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PoolAssets) > 0 { - for iNdEx := len(m.PoolAssets) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PoolAssets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func (m *QuerySpotPriceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1903,16 +1698,6 @@ func (m *QuerySpotPriceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.WithSwapFee { - i-- - if m.WithSwapFee { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } if len(m.TokenOutDenom) > 0 { i -= len(m.TokenOutDenom) copy(dAtA[i:], m.TokenOutDenom) @@ -2340,33 +2125,6 @@ func (m *QueryTotalSharesResponse) Size() (n int) { return n } -func (m *QueryPoolAssetsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PoolId != 0 { - n += 1 + sovQuery(uint64(m.PoolId)) - } - return n -} - -func (m *QueryPoolAssetsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.PoolAssets) > 0 { - for _, e := range m.PoolAssets { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - func (m *QuerySpotPriceRequest) Size() (n int) { if m == nil { return 0 @@ -2384,9 +2142,6 @@ func (m *QuerySpotPriceRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - if m.WithSwapFee { - n += 2 - } return n } @@ -3294,159 +3049,6 @@ func (m *QueryTotalSharesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryPoolAssetsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryPoolAssetsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPoolAssetsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) - } - m.PoolId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PoolId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryPoolAssetsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryPoolAssetsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPoolAssetsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolAssets", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PoolAssets = append(m.PoolAssets, PoolAsset{}) - if err := m.PoolAssets[len(m.PoolAssets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QuerySpotPriceRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3559,26 +3161,6 @@ func (m *QuerySpotPriceRequest) Unmarshal(dAtA []byte) error { } m.TokenOutDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field WithSwapFee", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.WithSwapFee = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/gamm/types/query.pb.gw.go b/x/gamm/types/query.pb.gw.go index a33763ce2aa..a6f0b4b23f6 100644 --- a/x/gamm/types/query.pb.gw.go +++ b/x/gamm/types/query.pb.gw.go @@ -265,60 +265,6 @@ func local_request_Query_TotalShares_0(ctx context.Context, marshaler runtime.Ma } -func request_Query_PoolAssets_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPoolAssetsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["poolId"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "poolId") - } - - protoReq.PoolId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "poolId", err) - } - - msg, err := client.PoolAssets(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_PoolAssets_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPoolAssetsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["poolId"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "poolId") - } - - protoReq.PoolId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "poolId", err) - } - - msg, err := server.PoolAssets(ctx, &protoReq) - return msg, metadata, err - -} - var ( filter_Query_SpotPrice_0 = &utilities.DoubleArray{Encoding: map[string]int{"poolId": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) @@ -661,26 +607,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_PoolAssets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_PoolAssets_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_PoolAssets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_SpotPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -902,26 +828,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_PoolAssets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_PoolAssets_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_PoolAssets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_SpotPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -998,8 +904,6 @@ var ( pattern_Query_TotalShares_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"osmosis", "gamm", "v1beta1", "pools", "poolId", "total_shares"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_PoolAssets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"osmosis", "gamm", "v1beta1", "pools", "poolId", "tokens"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_SpotPrice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"osmosis", "gamm", "v1beta1", "pools", "poolId", "prices"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_EstimateSwapExactAmountIn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 2, 5}, []string{"osmosis", "gamm", "v1beta1", "poolId", "estimate", "swap_exact_amount_in"}, "", runtime.AssumeColonVerbOpt(true))) @@ -1020,8 +924,6 @@ var ( forward_Query_TotalShares_0 = runtime.ForwardResponseMessage - forward_Query_PoolAssets_0 = runtime.ForwardResponseMessage - forward_Query_SpotPrice_0 = runtime.ForwardResponseMessage forward_Query_EstimateSwapExactAmountIn_0 = runtime.ForwardResponseMessage diff --git a/x/gamm/types/tx.pb.go b/x/gamm/types/tx.pb.go index a46e8c10509..79ba0b422b3 100644 --- a/x/gamm/types/tx.pb.go +++ b/x/gamm/types/tx.pb.go @@ -31,6 +31,7 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // ===================== MsgJoinPool +// This is really MsgJoinPoolNoSwap type MsgJoinPool struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` PoolId uint64 `protobuf:"varint,2,opt,name=poolId,proto3" json:"poolId,omitempty" yaml:"pool_id"` @@ -529,10 +530,13 @@ func (m *MsgSwapExactAmountOutResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSwapExactAmountOutResponse proto.InternalMessageInfo // ===================== MsgJoinSwapExternAmountIn +// TODO: Rename to MsgJoinSwapExactAmountIn type MsgJoinSwapExternAmountIn struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` - PoolId uint64 `protobuf:"varint,2,opt,name=poolId,proto3" json:"poolId,omitempty" yaml:"pool_id"` - TokenIn types.Coin `protobuf:"bytes,3,opt,name=tokenIn,proto3" json:"tokenIn" yaml:"token_in"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + PoolId uint64 `protobuf:"varint,2,opt,name=poolId,proto3" json:"poolId,omitempty" yaml:"pool_id"` + TokenIn types.Coin `protobuf:"bytes,3,opt,name=tokenIn,proto3" json:"tokenIn" yaml:"token_in"` + // reserved 3; + // reserved "token_in"; ShareOutMinAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=shareOutMinAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"shareOutMinAmount" yaml:"share_out_min_amount"` } diff --git a/x/pool-incentives/keeper/keeper_test.go b/x/pool-incentives/keeper/keeper_test.go index f1bff7078b6..895d27e6848 100644 --- a/x/pool-incentives/keeper/keeper_test.go +++ b/x/pool-incentives/keeper/keeper_test.go @@ -62,7 +62,7 @@ func (suite *KeeperTestSuite) prepareBalancerPoolWithPoolParams(PoolParams balan } } - poolId, err := suite.app.GAMMKeeper.CreateBalancerPool(suite.ctx, acc1, PoolParams, []gammtypes.PoolAsset{ + poolId, err := suite.app.GAMMKeeper.CreateBalancerPool(suite.ctx, acc1, PoolParams, []balancer.PoolAsset{ { Weight: sdk.NewInt(100), Token: sdk.NewCoin("foo", sdk.NewInt(5000000)), diff --git a/x/superfluid/keeper/gov/gov_test.go b/x/superfluid/keeper/gov/gov_test.go index d0a0dd77c41..6fa7608ebbb 100644 --- a/x/superfluid/keeper/gov/gov_test.go +++ b/x/superfluid/keeper/gov/gov_test.go @@ -5,7 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer" - gammtypes "github.com/osmosis-labs/osmosis/v7/x/gamm/types" minttypes "github.com/osmosis-labs/osmosis/v7/x/mint/types" "github.com/osmosis-labs/osmosis/v7/x/superfluid/keeper/gov" @@ -15,10 +14,10 @@ import ( func (suite *KeeperTestSuite) createGammPool(denoms []string) uint64 { coins := suite.app.GAMMKeeper.GetParams(suite.ctx).PoolCreationFee - poolAssets := []gammtypes.PoolAsset{} + poolAssets := []balancer.PoolAsset{} for _, denom := range denoms { coins = coins.Add(sdk.NewInt64Coin(denom, 1000000000000000000)) - poolAssets = append(poolAssets, gammtypes.PoolAsset{ + poolAssets = append(poolAssets, balancer.PoolAsset{ Weight: sdk.NewInt(100), Token: sdk.NewCoin(denom, sdk.NewInt(1000000000000000000)), }) diff --git a/x/superfluid/keeper/keeper_test.go b/x/superfluid/keeper/keeper_test.go index 22ff8b97659..06b551968e4 100644 --- a/x/superfluid/keeper/keeper_test.go +++ b/x/superfluid/keeper/keeper_test.go @@ -97,10 +97,10 @@ func CreateRandomAccounts(numAccts int) []sdk.AccAddress { func (suite *KeeperTestSuite) createGammPool(denoms []string) uint64 { coins := suite.App.GAMMKeeper.GetParams(suite.Ctx).PoolCreationFee - poolAssets := []gammtypes.PoolAsset{} + poolAssets := []balancer.PoolAsset{} for _, denom := range denoms { coins = coins.Add(sdk.NewInt64Coin(denom, 1000000000000000000)) - poolAssets = append(poolAssets, gammtypes.PoolAsset{ + poolAssets = append(poolAssets, balancer.PoolAsset{ Weight: sdk.NewInt(100), Token: sdk.NewCoin(denom, sdk.NewInt(1000000000000000000)), }) diff --git a/x/txfees/keeper/keeper_test.go b/x/txfees/keeper/keeper_test.go index 6643b41fdc2..12f9771e52e 100644 --- a/x/txfees/keeper/keeper_test.go +++ b/x/txfees/keeper/keeper_test.go @@ -14,8 +14,7 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/osmosis-labs/osmosis/v7/app" - balancertypes "github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer" - gammtypes "github.com/osmosis-labs/osmosis/v7/x/gamm/types" + "github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer" "github.com/osmosis-labs/osmosis/v7/x/txfees/types" ) @@ -83,7 +82,7 @@ func (suite *KeeperTestSuite) ExecuteUpgradeFeeTokenProposal(feeToken string, po func (suite *KeeperTestSuite) PreparePoolWithAssets(asset1, asset2 sdk.Coin) uint64 { return suite.preparePool( - []gammtypes.PoolAsset{ + []balancer.PoolAsset{ { Weight: sdk.NewInt(1), Token: asset1, @@ -96,11 +95,11 @@ func (suite *KeeperTestSuite) PreparePoolWithAssets(asset1, asset2 sdk.Coin) uin ) } -func (suite *KeeperTestSuite) preparePool(assets []gammtypes.PoolAsset) uint64 { +func (suite *KeeperTestSuite) preparePool(assets []balancer.PoolAsset) uint64 { suite.Require().Len(assets, 2) poolId, err := suite.app.GAMMKeeper.CreateBalancerPool(suite.ctx, acc1, - balancertypes.PoolParams{ + balancer.PoolParams{ SwapFee: sdk.NewDec(0), ExitFee: sdk.NewDec(0), }, assets, "") From c805c1397320faca498e20c15862f64125e35501 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Tue, 22 Mar 2022 22:25:52 -0500 Subject: [PATCH 5/6] Move constants for balancer pool weight verification --- x/gamm/pool-models/balancer/balancer_pool.go | 19 +++++++++++++++---- .../balancer/balancer_pool_test.go | 17 ++++++++--------- x/gamm/pool-models/balancer/constants.go | 10 ++++++++++ x/gamm/pool-models/balancer/pool_asset.go | 4 ++-- x/gamm/types/pool.go | 17 ----------------- 5 files changed, 35 insertions(+), 32 deletions(-) create mode 100644 x/gamm/pool-models/balancer/constants.go diff --git a/x/gamm/pool-models/balancer/balancer_pool.go b/x/gamm/pool-models/balancer/balancer_pool.go index 115aa0bb119..ff1a34b75f9 100644 --- a/x/gamm/pool-models/balancer/balancer_pool.go +++ b/x/gamm/pool-models/balancer/balancer_pool.go @@ -132,7 +132,7 @@ func (pa *Pool) setInitialPoolAssets(PoolAssets []PoolAsset) error { exists[asset.Token.Denom] = true // Scale weight from the user provided weight to the correct internal weight - asset.Weight = asset.Weight.MulRaw(types.GuaranteedWeightPrecision) + asset.Weight = asset.Weight.MulRaw(GuaranteedWeightPrecision) scaledPoolAssets = append(scaledPoolAssets, asset) newTotalWeight = newTotalWeight.Add(asset.Weight) } @@ -148,6 +148,17 @@ func (pa *Pool) setInitialPoolAssets(PoolAssets []PoolAsset) error { return nil } +func ValidateUserSpecifiedWeight(weight sdk.Int) error { + if !weight.IsPositive() { + return sdkerrors.Wrap(types.ErrNotPositiveWeight, weight.String()) + } + + if weight.GTE(MaxUserSpecifiedWeight) { + return sdkerrors.Wrap(types.ErrWeightTooLarge, weight.String()) + } + return nil +} + // setInitialPoolParams func (pa *Pool) setInitialPoolParams(params PoolParams, sortedAssets []PoolAsset, curBlockTime time.Time) error { pa.PoolParams = params @@ -168,12 +179,12 @@ func (pa *Pool) setInitialPoolParams(params PoolParams, sortedAssets []PoolAsset // scale target pool weights by GuaranteedWeightPrecision for i, v := range targetPoolWeights { - err := types.ValidateUserSpecifiedWeight(v.Weight) + err := ValidateUserSpecifiedWeight(v.Weight) if err != nil { return err } pa.PoolParams.SmoothWeightChangeParams.TargetPoolWeights[i] = PoolAsset{ - Weight: v.Weight.MulRaw(types.GuaranteedWeightPrecision), + Weight: v.Weight.MulRaw(GuaranteedWeightPrecision), Token: v.Token, } } @@ -470,7 +481,7 @@ func (params PoolParams) Validate(poolWeights []PoolAsset) error { } // Validate all user specified weights for _, v := range targetWeights { - err := types.ValidateUserSpecifiedWeight(v.Weight) + err := ValidateUserSpecifiedWeight(v.Weight) if err != nil { return err } diff --git a/x/gamm/pool-models/balancer/balancer_pool_test.go b/x/gamm/pool-models/balancer/balancer_pool_test.go index cf1f79b3789..ba9701a9023 100644 --- a/x/gamm/pool-models/balancer/balancer_pool_test.go +++ b/x/gamm/pool-models/balancer/balancer_pool_test.go @@ -8,7 +8,6 @@ import ( "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/osmosis-labs/osmosis/v7/x/gamm/types" ) var ( @@ -29,7 +28,7 @@ var ( // Expected is un-scaled func testTotalWeight(t *testing.T, expected sdk.Int, pool Pool) { - scaledExpected := expected.MulRaw(types.GuaranteedWeightPrecision) + scaledExpected := expected.MulRaw(GuaranteedWeightPrecision) require.Equal(t, scaledExpected.String(), pool.GetTotalWeight().String()) @@ -361,7 +360,7 @@ func TestBalancerPoolPokeTokenWeights(t *testing.T) { defaultStartTime := time.Unix(1618703511, 0) defaultStartTimeUnix := defaultStartTime.Unix() defaultDuration := 100 * time.Second - floatGuaranteedPrecison := float64(types.GuaranteedWeightPrecision) + floatGuaranteedPrecison := float64(GuaranteedWeightPrecision) // testCases don't need to be ordered by time. but the blockTime should be // less than the end time of the SmoothWeightChange. Testing past the end time @@ -412,16 +411,16 @@ func TestBalancerPoolPokeTokenWeights(t *testing.T) { // Halfway through at 50 seconds elapsed blockTime: time.Unix(defaultStartTimeUnix+50, 0), expectedWeights: []sdk.Int{ - sdk.NewInt(1 * types.GuaranteedWeightPrecision), + sdk.NewInt(1 * GuaranteedWeightPrecision), // Halfway between 1 & 2 - sdk.NewInt(3 * types.GuaranteedWeightPrecision / 2), + sdk.NewInt(3 * GuaranteedWeightPrecision / 2), }, }, { // Quarter way through at 25 seconds elapsed blockTime: time.Unix(defaultStartTimeUnix+25, 0), expectedWeights: []sdk.Int{ - sdk.NewInt(1 * types.GuaranteedWeightPrecision), + sdk.NewInt(1 * GuaranteedWeightPrecision), // Quarter way between 1 & 2 = 1.25 sdk.NewInt(int64(1.25 * floatGuaranteedPrecison)), }, @@ -461,9 +460,9 @@ func TestBalancerPoolPokeTokenWeights(t *testing.T) { blockTime: time.Unix(defaultStartTimeUnix+50, 0), expectedWeights: []sdk.Int{ // Halfway between 2 & 4 - sdk.NewInt(6 * types.GuaranteedWeightPrecision / 2), + sdk.NewInt(6 * GuaranteedWeightPrecision / 2), // Halfway between 1 & 2 - sdk.NewInt(3 * types.GuaranteedWeightPrecision / 2), + sdk.NewInt(3 * GuaranteedWeightPrecision / 2), }, }, { @@ -489,7 +488,7 @@ func TestBalancerPoolPokeTokenWeights(t *testing.T) { initialWeights := make([]sdk.Int, len(params.InitialPoolWeights)) finalWeights := make([]sdk.Int, len(params.TargetPoolWeights)) for i, v := range params.InitialPoolWeights { - initialWeights[i] = v.Weight.MulRaw(types.GuaranteedWeightPrecision) + initialWeights[i] = v.Weight.MulRaw(GuaranteedWeightPrecision) } for i, v := range params.TargetPoolWeights { // Doesn't need to be scaled, due to this being done already in param initialization, diff --git a/x/gamm/pool-models/balancer/constants.go b/x/gamm/pool-models/balancer/constants.go new file mode 100644 index 00000000000..5f9b691d656 --- /dev/null +++ b/x/gamm/pool-models/balancer/constants.go @@ -0,0 +1,10 @@ +package balancer + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var ( + MaxUserSpecifiedWeight sdk.Int = sdk.NewIntFromUint64(1 << 20) + GuaranteedWeightPrecision int64 = 1 << 30 +) diff --git a/x/gamm/pool-models/balancer/pool_asset.go b/x/gamm/pool-models/balancer/pool_asset.go index 046aa008a74..40ebc3b99f9 100644 --- a/x/gamm/pool-models/balancer/pool_asset.go +++ b/x/gamm/pool-models/balancer/pool_asset.go @@ -32,7 +32,7 @@ type poolAssetPretty struct { func (asset PoolAsset) prettify() poolAssetPretty { return poolAssetPretty{ - Weight: sdk.NewDecFromInt(asset.Weight).QuoInt64(types.GuaranteedWeightPrecision), + Weight: sdk.NewDecFromInt(asset.Weight).QuoInt64(GuaranteedWeightPrecision), Token: asset.Token, } } @@ -88,7 +88,7 @@ func ValidateUserSpecifiedPoolAssets(assets []PoolAsset) error { } for _, asset := range assets { - err := types.ValidateUserSpecifiedWeight(asset.Weight) + err := ValidateUserSpecifiedWeight(asset.Weight) if err != nil { return err } diff --git a/x/gamm/types/pool.go b/x/gamm/types/pool.go index 58daf98d534..c8d6caa985d 100644 --- a/x/gamm/types/pool.go +++ b/x/gamm/types/pool.go @@ -4,7 +4,6 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" proto "github.com/gogo/protobuf/proto" "github.com/osmosis-labs/osmosis/v7/v043_temp/address" ) @@ -46,23 +45,7 @@ type PoolI interface { ExitPool(ctx sdk.Context, numShares sdk.Int, exitFee sdk.Dec) (exitedCoins sdk.Coins, err error) } -var ( - MaxUserSpecifiedWeight sdk.Int = sdk.NewIntFromUint64(1 << 20) - GuaranteedWeightPrecision int64 = 1 << 30 -) - func NewPoolAddress(poolId uint64) sdk.AccAddress { key := append([]byte("pool"), sdk.Uint64ToBigEndian(poolId)...) return address.Module(ModuleName, key) } - -func ValidateUserSpecifiedWeight(weight sdk.Int) error { - if !weight.IsPositive() { - return sdkerrors.Wrap(ErrNotPositiveWeight, weight.String()) - } - - if weight.GTE(MaxUserSpecifiedWeight) { - return sdkerrors.Wrap(ErrWeightTooLarge, weight.String()) - } - return nil -} From 4c1f96312705d214649787aa82e1c83fc60bffa1 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Wed, 23 Mar 2022 10:27:30 -0500 Subject: [PATCH 6/6] Add godocs that Bez pointed out! --- osmomath/math.go | 6 ++++++ .../gamm/pool-models/balancer/balancerPool.proto | 9 --------- x/gamm/pool-models/balancer/balancer_pool.go | 3 +++ x/gamm/pool-models/balancer/constants.go | 14 ++++++++++++-- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/osmomath/math.go b/osmomath/math.go index e868747ee83..ed0c2801c8a 100644 --- a/osmomath/math.go +++ b/osmomath/math.go @@ -16,6 +16,12 @@ var one_half sdk.Dec = sdk.MustNewDecFromStr("0.5") var one sdk.Dec = sdk.OneDec() var two sdk.Dec = sdk.MustNewDecFromStr("2") +// Returns the internal "power precision". +// All fractional exponentiation in osmosis is expected to be accurate up to +// powPrecision. +// *technically* the error term can be greater than this powPrecision, +// but for small bases this bound applies. See comments in the PowApprox function +// for more detail. func GetPowPrecision() sdk.Dec { return powPrecision.Clone() } diff --git a/proto/osmosis/gamm/pool-models/balancer/balancerPool.proto b/proto/osmosis/gamm/pool-models/balancer/balancerPool.proto index 96951585feb..f1a92e3f00a 100644 --- a/proto/osmosis/gamm/pool-models/balancer/balancerPool.proto +++ b/proto/osmosis/gamm/pool-models/balancer/balancerPool.proto @@ -102,15 +102,6 @@ message PoolAsset { (gogoproto.moretags) = "yaml:\"weight\"", (gogoproto.nullable) = false ]; - - // Weight that is normalized s.t. the sum of all pool assets' weights - // equals 1. If the user provides this value, it is ignored. This should only - // ever be set by the state machine. This is left as a TODO for a future PR. - // string normalizedWeight = 3 [ - // (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - // (gogoproto.moretags) = "yaml:\"normalized_weight\"", - // (gogoproto.nullable) = true - // ]; } message Pool { diff --git a/x/gamm/pool-models/balancer/balancer_pool.go b/x/gamm/pool-models/balancer/balancer_pool.go index ff1a34b75f9..3111b6b9136 100644 --- a/x/gamm/pool-models/balancer/balancer_pool.go +++ b/x/gamm/pool-models/balancer/balancer_pool.go @@ -148,6 +148,9 @@ func (pa *Pool) setInitialPoolAssets(PoolAssets []PoolAsset) error { return nil } +// ValidateUserSpecifiedWeight ensures that a weight that is provided from user-input anywhere +// for creating a pool obeys the expected guarantees. +// Namely, that the weight is in the range [1, MaxUserSpecifiedWeight) func ValidateUserSpecifiedWeight(weight sdk.Int) error { if !weight.IsPositive() { return sdkerrors.Wrap(types.ErrNotPositiveWeight, weight.String()) diff --git a/x/gamm/pool-models/balancer/constants.go b/x/gamm/pool-models/balancer/constants.go index 5f9b691d656..ed733539c92 100644 --- a/x/gamm/pool-models/balancer/constants.go +++ b/x/gamm/pool-models/balancer/constants.go @@ -5,6 +5,16 @@ import ( ) var ( - MaxUserSpecifiedWeight sdk.Int = sdk.NewIntFromUint64(1 << 20) - GuaranteedWeightPrecision int64 = 1 << 30 + // Pool creators can specify a weight in [1, MaxUserSpecifiedWeight) + // for every token in the balancer pool. + // + // The weight used in the balancer equation is then creator-specified-weight * GuaranteedWeightPrecision. + // This is done so that LBP's / smooth weight changes can actually happen smoothly, + // without complex precision loss / edge effects. + MaxUserSpecifiedWeight sdk.Int = sdk.NewIntFromUint64(1 << 20) + // Scaling factor for every weight. The pool weight is: + // weight_in_MsgCreateBalancerPool * GuaranteedWeightPrecision + // + // This is done so that smooth weight changes have enough precision to actually be smooth. + GuaranteedWeightPrecision int64 = 1 << 30 )