From 1e0969ee45475fdb544e7aeffc36af71cec075d0 Mon Sep 17 00:00:00 2001 From: ApolloGie Date: Thu, 27 Jun 2024 22:09:58 +0000 Subject: [PATCH] fix: bump astroport pairtype --- Cargo.lock | 1 + test-helpers/Cargo.toml | 2 ++ test-helpers/src/astroport.rs | 16 ++++++++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) 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/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..1bd994b 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), + }; + + 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, @@ -311,3 +318,4 @@ pub fn instantiate_test_astroport_contract<'a, R: Runner<'a>>( .data .address) } +