Skip to content

Commit

Permalink
[E2E] Create stableswap and cl pools (backport #4175) (#4606)
Browse files Browse the repository at this point in the history
Co-authored-by: Roman <[email protected]>
  • Loading branch information
mergify[bot] and p0mvn authored Mar 13, 2023
1 parent de93d16 commit cde469e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 15 deletions.
11 changes: 11 additions & 0 deletions tests/e2e/configurer/chain/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ func (n *NodeConfig) CreateBalancerPool(poolFile, from string) uint64 {
return poolID
}

func (n *NodeConfig) CreateStableswapPool(poolFile, from string) uint64 {
n.LogActionF("creating stableswap pool from file %s", poolFile)
cmd := []string{"osmosisd", "tx", "gamm", "create-pool", fmt.Sprintf("--pool-file=/osmosis/%s", poolFile), "--pool-type=stableswap", fmt.Sprintf("--from=%s", from)}
_, _, err := n.containerManager.ExecTxCmd(n.t, n.chainId, n.Name, cmd)
require.NoError(n.t, err)

poolID := n.QueryNumPools()
n.LogActionF("successfully created stableswap pool with ID %d", poolID)
return poolID
}

func (n *NodeConfig) CreateConcentratedPool(from, denom1, denom2 string, tickSpacing uint64, exponentAtPriceOne int64, swapFee string) uint64 {
n.LogActionF("creating concentrated pool")

Expand Down
16 changes: 9 additions & 7 deletions tests/e2e/configurer/config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ var (
InitialMinExpeditedDeposit = MinExpeditedDepositValue / 4
// The first id of a pool create via CLI before starting an
// upgrade.
// Note: that we create a pool with id 1 via genesis
// in the initialization package. As a result, the first
// pre-upgrade should have id 2.
// This value gets mutated during the pre-upgrade pool
// creation in case more pools are added to genesis
// in the future
PreUpgradePoolId uint64 = 2
PreUpgradePoolId uint64

PreUpgradeStableSwapPoolId uint64

StrideMigrateWallet = "stride-migration"

LockupWallet = "lockup-wallet"

LockupWalletSuperfluid = "lockup-wallet-superfluid"

StableswapWallet = "stableswap-wallet"
)
24 changes: 16 additions & 8 deletions tests/e2e/configurer/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ func (uc *UpgradeConfigurer) ConfigureChain(chainConfig *chain.Config) error {
}

func (uc *UpgradeConfigurer) CreatePreUpgradeState() error {
const lockupWallet = "lockup-wallet"
const lockupWalletSuperfluid = "lockup-wallet-superfluid"

chainA := uc.chainConfigs[0]
chainANode, err := chainA.GetDefaultNode()
if err != nil {
Expand All @@ -128,14 +125,25 @@ func (uc *UpgradeConfigurer) CreatePreUpgradeState() error {
config.PreUpgradePoolId = chainANode.CreateBalancerPool("pool1A.json", initialization.ValidatorWalletName)
poolShareDenom := fmt.Sprintf("gamm/pool/%d", config.PreUpgradePoolId)
chainBNode.CreateBalancerPool("pool1B.json", initialization.ValidatorWalletName)
config.PreUpgradeStableSwapPoolId = chainANode.CreateStableswapPool("stablePool.json", initialization.ValidatorWalletName)
chainBNode.CreateStableswapPool("stablePool.json", initialization.ValidatorWalletName)

// enable superfluid assets on chainA
chainA.EnableSuperfluidAsset(poolShareDenom)

// setup wallets and send gamm tokens to these wallets (only chainA)
lockupWalletAddrA, lockupWalletSuperfluidAddrA := chainANode.CreateWallet(lockupWallet), chainANode.CreateWallet(lockupWalletSuperfluid)
chainANode.BankSend("10000000000000000000"+poolShareDenom, chainA.NodeConfigs[0].PublicAddress, lockupWalletAddrA)
chainANode.BankSend("10000000000000000000"+poolShareDenom, chainA.NodeConfigs[0].PublicAddress, lockupWalletSuperfluidAddrA)
// Setup wallets and send tokens to wallets (only chainA)
config.LockupWallet = chainANode.CreateWalletAndFund(config.LockupWallet, []string{
"10000000000000000000" + poolShareDenom,
})
config.LockupWalletSuperfluid = chainANode.CreateWalletAndFund(config.LockupWalletSuperfluid, []string{
"10000000000000000000" + poolShareDenom,
})
config.StableswapWallet = chainANode.CreateWalletAndFund(config.LockupWalletSuperfluid, []string{
"100000stake",
})

// test swap exact amount in for stable swap pool (only chainA)A
chainANode.SwapExactAmountIn("2000stake", "1", fmt.Sprintf("%d", config.PreUpgradeStableSwapPoolId), "uosmo", config.StableswapWallet)

// Upload the rate limiting contract to both chains (as they both will be updated)
uc.t.Logf("Uploading rate limiting contract to both chains")
Expand All @@ -149,7 +157,7 @@ func (uc *UpgradeConfigurer) CreatePreUpgradeState() error {
}

// test lock and add to existing lock for both regular and superfluid lockups (only chainA)
chainA.LockAndAddToExistingLock(sdk.NewInt(1000000000000000000), poolShareDenom, lockupWalletAddrA, lockupWalletSuperfluidAddrA)
chainA.LockAndAddToExistingLock(sdk.NewInt(1000000000000000000), poolShareDenom, config.LockupWallet, config.LockupWalletSuperfluid)

// LP to pools 833, 817, 810
// initialize lp wallets
Expand Down
7 changes: 7 additions & 0 deletions tests/e2e/scripts/stablePool.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"initial-deposit": "1000000stake,1000uosmo",
"swap-fee": "0.005",
"exit-fee": "0",
"future-governor": "",
"scaling-factors": "1000,1"
}

0 comments on commit cde469e

Please sign in to comment.