From a3be0c5aa9db99e822688804df479f6c3a9e7880 Mon Sep 17 00:00:00 2001 From: JanKuczma Date: Tue, 3 Sep 2024 10:18:34 +0200 Subject: [PATCH] fix test --- amm/contracts/router_v2/lib.rs | 2 +- amm/drink-tests/src/router_v2_tests.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/amm/contracts/router_v2/lib.rs b/amm/contracts/router_v2/lib.rs index 431c2a1f..4898d3ba 100755 --- a/amm/contracts/router_v2/lib.rs +++ b/amm/contracts/router_v2/lib.rs @@ -152,7 +152,7 @@ pub mod router_v2 { if let Some(pool) = self.cached_stable_pools.get(pool_id) { return Ok(Pool::StablePool(pool)); } - if let Some(pair) = self.get_pair(pair.0, pair.1).ok() { + if let Ok(pair) = self.get_pair(pair.0, pair.1) { ensure!(pair.pool_id() == pool_id, RouterV2Error::PoolNotFound); return Ok(Pool::Pair(pair)); } diff --git a/amm/drink-tests/src/router_v2_tests.rs b/amm/drink-tests/src/router_v2_tests.rs index 0d1946c0..0f89325c 100644 --- a/amm/drink-tests/src/router_v2_tests.rs +++ b/amm/drink-tests/src/router_v2_tests.rs @@ -131,7 +131,7 @@ fn test_simple_swap(mut session: Session) { bob(), BOB, ); - let _ice_wood_pair: pair_contract::Instance = + let ice_wood_pair: pair_contract::Instance = factory::get_pair(&mut session, factory.into(), ice.into(), wood.into()); _ = router_v2::add_pair_liquidity( @@ -146,7 +146,7 @@ fn test_simple_swap(mut session: Session) { bob(), BOB, ); - let _ice_usdt_pair: pair_contract::Instance = + let ice_usdt_pair: pair_contract::Instance = factory::get_pair(&mut session, factory.into(), ice.into(), usdt); // increase gas limit (swaps with more than 3 tokens require more gas) @@ -167,15 +167,15 @@ fn test_simple_swap(mut session: Session) { vec![ Step { token_in: wood.into(), - pool_id: None, + pool_id: ice_wood_pair.into(), }, Step { token_in: ice.into(), - pool_id: None, + pool_id: ice_usdt_pair.into(), }, Step { token_in: usdt.into(), - pool_id: Some(usdt_usdc_pool), + pool_id: usdt_usdc_pool.into(), }, ], usdc.into(),