Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[E2E] Create stableswap and cl pools #4175

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3815303
Create stableswap pools and CL pools
phamminh0811 Jan 31, 2023
f34a8b4
Refactor code to make sure e2e test upgrading run well
phamminh0811 Jan 31, 2023
a51508e
Update tests/e2e/configurer/chain/commands.go
phamminh0811 Jan 31, 2023
f51ee8d
Remove CL pool and change stable token denom
phamminh0811 Feb 1, 2023
f387979
renome debug bin
phamminh0811 Feb 1, 2023
3d73423
Merge branch 'minh/create-stableswap-and-cl-pools' of https://github.…
phamminh0811 Feb 1, 2023
f157d7b
Remove rate limiter
phamminh0811 Feb 3, 2023
e1ca8cf
resolve compile osmosis amd64 for linux error
phamminh0811 Feb 3, 2023
3a9b011
Merge branch 'minh/create-stableswap-and-cl-pools' of https://github.…
phamminh0811 Feb 3, 2023
33bb4aa
resolve conflict
phamminh0811 Feb 3, 2023
ab120e7
Update stablepool
phamminh0811 Feb 6, 2023
e5658fa
update create function name
phamminh0811 Feb 6, 2023
ee984e4
rename create stableswap function
phamminh0811 Feb 6, 2023
08f0b2b
add rate_limiter.wasm
phamminh0811 Feb 7, 2023
653a1e4
Update whitespace error
phamminh0811 Feb 7, 2023
7676830
add some logic to execute a swap
phamminh0811 Feb 10, 2023
71a5904
update wasm file
phamminh0811 Feb 10, 2023
05e4b76
fix conflict main
phamminh0811 Feb 20, 2023
67cd658
Add stableswap pool test to e2e
phamminh0811 Feb 20, 2023
e1ab28e
Change TestStableSwapPostUpgrade to try swapping the pool created in …
phamminh0811 Feb 22, 2023
b6ad44e
merge stable pool migrate
phamminh0811 Feb 27, 2023
2ca5dd1
avoid hard code on e2e test
phamminh0811 Feb 27, 2023
5dfcc36
fix conflict
phamminh0811 Feb 28, 2023
47468ed
fix conflict
phamminh0811 Feb 28, 2023
a8fb39a
resolve conflict main
phamminh0811 Mar 9, 2023
eaec8fb
Delete go.work.sum
phamminh0811 Mar 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/e2e/configurer/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (uc *UpgradeConfigurer) CreatePreUpgradeState() error {

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

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

Expand Down
51 changes: 51 additions & 0 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,57 @@ func (s *IntegrationTestSuite) TestConcentratedLiquidity() {

}

func (s *IntegrationTestSuite) TestStableSwapPostUpgrade() {
if s.skipUpgrade {
s.T().Skip("Skipping StableSwapPostUpgrade test")
}

chainA := s.configurer.GetChainConfig(0)
chainANode, err := chainA.GetDefaultNode()
s.Require().NoError(err)

const (
poolFile = "stablePool.json"
walletName = "stable-swap-wallet"

denomA = "stake"
denomB = "uosmo"

minAmountOut = "1"

epochIdentifier = "day"
)

coinAIn, coinBIn := fmt.Sprintf("20000%s", denomA), fmt.Sprintf("1%s", denomB)

poolId := chainANode.CreateStableswapPool(poolFile, initialization.ValidatorWalletName)
phamminh0811 marked this conversation as resolved.
Show resolved Hide resolved
swapWalletAddr := chainANode.CreateWalletAndFund(walletName, []string{initialization.WalletFeeTokens.String()})

timeBeforeSwap := chainANode.QueryLatestBlockTime()
// Wait for the next height so that the requested twap
// start time (timeBeforeSwap) is not equal to the block time.
chainA.WaitForNumHeights(2)

s.T().Log("querying for the first TWAP to now before swap")
twapFromBeforeSwapToBeforeSwapOneAB, err := chainANode.QueryArithmeticTwapToNow(poolId, denomA, denomB, timeBeforeSwap)
s.Require().NoError(err)

chainANode.BankSend(coinAIn, chainA.NodeConfigs[0].PublicAddress, swapWalletAddr)
chainANode.BankSend(coinBIn, chainA.NodeConfigs[0].PublicAddress, swapWalletAddr)

s.T().Log("querying for the second TWAP to now before swap, must equal to first")
twapFromBeforeSwapToBeforeSwapTwoAB, err := chainANode.QueryArithmeticTwapToNow(poolId, denomA, denomB, timeBeforeSwap.Add(50*time.Millisecond))
s.Require().NoError(err)

// Since there were no swaps between the two queries, the TWAPs should be the same.
osmoassert.DecApproxEq(s.T(), twapFromBeforeSwapToBeforeSwapOneAB, twapFromBeforeSwapToBeforeSwapTwoAB, sdk.NewDecWithPrec(1, 3))
phamminh0811 marked this conversation as resolved.
Show resolved Hide resolved

s.T().Log("performing swaps")
chainANode.SwapExactAmountIn(coinAIn, minAmountOut, fmt.Sprintf("%d", poolId), denomB, swapWalletAddr)
chainANode.SwapExactAmountIn(coinBIn, minAmountOut, fmt.Sprintf("%d", poolId), denomA, swapWalletAddr)

}

// TestGeometricTwapMigration tests that the geometric twap record
// migration runs succesfully. It does so by attempting to execute
// the swap on the pool created pre-upgrade. When a pool is created
Expand Down