From bd83d2d48bb4a78a771e3f504a878fbb460bb59f Mon Sep 17 00:00:00 2001 From: vuong Date: Thu, 19 May 2022 13:40:55 +0700 Subject: [PATCH] add TestSetStableSwapScalingFactors but still comment out because stableswap still disable --- x/gamm/keeper/pool.go | 2 +- x/gamm/keeper/pool_service_test.go | 34 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/x/gamm/keeper/pool.go b/x/gamm/keeper/pool.go index 2451f5c6160..02b5c49115a 100644 --- a/x/gamm/keeper/pool.go +++ b/x/gamm/keeper/pool.go @@ -227,7 +227,7 @@ func (k Keeper) GetNextPoolNumberAndIncrement(ctx sdk.Context) uint64 { } // set ScalingFactors in stable stableswap pools -func (k *Keeper) setStableSwapScalingFactors(ctx sdk.Context, scalingFactors []uint64, poolId uint64, scalingFactorGovernor string) error { +func (k *Keeper) SetStableSwapScalingFactors(ctx sdk.Context, scalingFactors []uint64, poolId uint64, scalingFactorGovernor string) error { poolI, err := k.GetPoolAndPoke(ctx, poolId) if err != nil { return err diff --git a/x/gamm/keeper/pool_service_test.go b/x/gamm/keeper/pool_service_test.go index 4fd15a73140..43dec4a3cf6 100644 --- a/x/gamm/keeper/pool_service_test.go +++ b/x/gamm/keeper/pool_service_test.go @@ -573,3 +573,37 @@ func (suite *KeeperTestSuite) TestJoinSwapExactAmountInConsistency() { }) } } + +// func (suite *KeeperTestSuite) TestSetStableSwapScalingFactors() { +// stableSwapPoolParams := stableswap.PoolParams{ +// SwapFee: defaultSwapFee, +// ExitFee: defaultExitFee, +// } + +// testPoolAsset := sdk.Coins{ +// sdk.NewCoin("foo", sdk.NewInt(10000)), +// sdk.NewCoin("bar", sdk.NewInt(10000)), +// } + +// suite.FundAcc(suite.TestAccs[0], defaultAcctFunds) + +// testScalingFactors := []uint64{1, 1} + +// msg := stableswap.NewMsgCreateStableswapPool( +// suite.TestAccs[0], stableSwapPoolParams, testPoolAsset, defaultFutureGovernor) +// poolID, err := suite.App.GAMMKeeper.CreatePool(suite.Ctx, msg) +// suite.Require().NoError(err) + +// err = suite.App.GAMMKeeper.SetStableSwapScalingFactors(suite.Ctx, testScalingFactors, poolID, "") +// suite.Require().NoError(err) + +// poolI, err := suite.App.GAMMKeeper.GetPoolAndPoke(suite.Ctx, poolID) +// suite.Require().NoError(err) + +// poolScalingFactors := poolI.(*stableswap.Pool).GetScalingFactors() + +// suite.Require().Equal( +// poolScalingFactors, +// testScalingFactors, +// ) +// }