From 01d7836eb1103875e754a0d90d1a1af4ea8bea27 Mon Sep 17 00:00:00 2001 From: ApolloGie Date: Thu, 27 Jun 2024 22:09:58 +0000 Subject: [PATCH] fix: bump astroport pairtype --- .github/workflows/test.yml | 23 ++++++++++------------- Cargo.lock | 1 + cw-dex-astroport/tests/astroport_tests.rs | 13 ++++++++++++- test-helpers/Cargo.toml | 2 ++ test-helpers/src/astroport.rs | 15 +++++++++++---- 5 files changed, 36 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ddf68c3..8a66c05 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,6 @@ on: env: RUSTFLAGS: -D warnings - TEST_RUNNER: osmosis-test-tube jobs: test: @@ -15,16 +14,13 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 - - name: Set up Go 1.21.6 - uses: actions/setup-go@v5 - with: - go-version: "1.21.6" - - - name: Install cargo make - uses: davidB/rust-cargo-make@v1 - - name: Install stable toolchain - run: cargo make install-stable + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.79.0 + target: wasm32-unknown-unknown + override: true - name: Run unit tests uses: actions-rs/cargo@v1 @@ -54,7 +50,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --locked --test osmosis_tests --all-features + args: --locked --test osmosis_tests env: RUST_BACKTRACE: 1 @@ -62,7 +58,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --locked --test astroport_tests --all-features + args: --locked --test astroport_tests -- --test-threads=1 env: RUST_BACKTRACE: 1 @@ -70,6 +66,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --locked --test osmosis_proptests --all-features + args: --locked --test osmosis_proptests -- --test-threads=1 env: RUST_BACKTRACE: 1 + diff --git a/Cargo.lock b/Cargo.lock index 86e8978..df304df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1033,6 +1033,7 @@ dependencies = [ "apollo-cw-asset", "apollo-utils", "astroport 2.9.0", + "astroport 5.1.0", "astroport-test-contract", "cosmwasm-std", "cw-dex-test-contract", diff --git a/cw-dex-astroport/tests/astroport_tests.rs b/cw-dex-astroport/tests/astroport_tests.rs index be6ebae..af678e8 100644 --- a/cw-dex-astroport/tests/astroport_tests.rs +++ b/cw-dex-astroport/tests/astroport_tests.rs @@ -12,6 +12,7 @@ mod tests { use cw_dex_test_helpers::{cw20_balance_query, cw20_transfer, query_asset_balance}; use cw_it::astroport::utils::AstroportContracts; use cw_it::helpers::Unwrap; + use cw_it::multi_test::modules::TokenFactory; use cw_it::multi_test::MultiTestRunner; use cw_it::test_tube::cosmrs::proto::cosmwasm::wasm::v1::MsgExecuteContractResponse; use cw_it::test_tube::{ @@ -26,9 +27,18 @@ mod tests { #[cfg(feature = "osmosis-test-tube")] use cw_it::osmosis_test_tube::OsmosisTestApp; + const TOKEN_FACTORY: &TokenFactory = + &TokenFactory::new("factory", 32, 16, 59 + 16, DENOM_CREATION_FEE); pub fn get_test_runner<'a>() -> OwnedTestRunner<'a> { match option_env!("TEST_RUNNER").unwrap_or("multi-test") { - "multi-test" => OwnedTestRunner::MultiTest(MultiTestRunner::new("osmo")), + "multi-test" => { + let mut stargate_keeper = StargateKeeper::new(); + TOKEN_FACTORY.register_msgs(&mut stargate_keeper); + OwnedTestRunner::MultiTest(MultiTestRunner::new_with_stargate( + "osmo", + stargate_keeper, + )) + } #[cfg(feature = "osmosis-test-tube")] "osmosis-test-tube" => OwnedTestRunner::OsmosisTestApp(OsmosisTestApp::new()), _ => panic!("Unsupported test runner type"), @@ -660,3 +670,4 @@ mod tests { ); } } + diff --git a/test-helpers/Cargo.toml b/test-helpers/Cargo.toml index e6de23e..50f5241 100644 --- a/test-helpers/Cargo.toml +++ b/test-helpers/Cargo.toml @@ -37,5 +37,7 @@ cw-dex-test-contract = { workspace = true } astroport-test-contract = { workspace = true, optional = true } cw-it = { workspace = true } astroport = { workspace = true } +astroport_v5 = { workspace = true } cw20 = { workspace = true } cw20-base = { workspace = true } + diff --git a/test-helpers/src/astroport.rs b/test-helpers/src/astroport.rs index 70b8716..73851f9 100644 --- a/test-helpers/src/astroport.rs +++ b/test-helpers/src/astroport.rs @@ -3,6 +3,7 @@ use apollo_utils::assets::separate_natives_and_cw20s; use astroport::asset::{Asset as AstroAsset, AssetInfo as AstroAssetInfo}; use astroport::factory::PairType; use astroport::pair::{ExecuteMsg as PairExecuteMsg, StablePoolParams}; +use astroport_v5::factory::PairType as AstroportV5PairType; use cosmwasm_std::{to_json_binary, Addr, Coin, Decimal, Uint128}; use cw20::{Cw20ExecuteMsg, MinterResponse}; use cw20_base::msg::InstantiateMsg as Cw20InstantiateMsg; @@ -211,10 +212,16 @@ pub fn setup_pool_and_test_contract<'a>( }, _ => None, }; - let (pair_addr, lp_token_addr) = create_astroport_pair( + let astroport_v5_pair_type = match &pool_type { + PairType::Xyk {} => AstroportV5PairType::Xyk {}, + PairType::Stable {} => AstroportV5PairType::Stable {}, + PairType::Custom(t) => AstroportV5PairType::Custom(t.to_string()), + }; + + let (pair_addr, lp_token_addr, lp_token_denom) = create_astroport_pair( runner, &astroport_contracts.factory.address, - pool_type, + astroport_v5_pair_type, [astro_asset_infos[0].clone(), astro_asset_infos[1].clone()], init_params, admin, @@ -274,13 +281,13 @@ pub fn setup_pool_and_test_contract<'a>( AssetInfo::cw20(Addr::unchecked( astroport_contracts.astro_token.address.clone(), )), - lp_token_addr.clone(), + lp_token_denom.clone(), &accs[0], )?; Ok(( accs, - lp_token_addr, + lp_token_denom, pair_addr, contract_addr, asset_list,