From 51507914d7ba806675b625cb40a57aa99133226b Mon Sep 17 00:00:00 2001 From: Kaloyan Gangov Date: Wed, 31 Jul 2024 11:06:19 +0300 Subject: [PATCH] lints and removes unnecessary testcase --- contracts/pool_stable/src/tests/config.rs | 7 +- contracts/pool_stable/src/tests/swap.rs | 93 +---------------------- 2 files changed, 3 insertions(+), 97 deletions(-) diff --git a/contracts/pool_stable/src/tests/config.rs b/contracts/pool_stable/src/tests/config.rs index e8487a0f..8d0883d4 100644 --- a/contracts/pool_stable/src/tests/config.rs +++ b/contracts/pool_stable/src/tests/config.rs @@ -1,11 +1,8 @@ extern crate std; -use soroban_sdk::{testutils::Address as _, Address, Env, IntoVal}; +use soroban_sdk::{testutils::Address as _, Address, Env}; use super::setup::{deploy_stable_liquidity_pool_contract, deploy_token_contract}; -use crate::{ - storage::{Config, PairType}, - token_contract, -}; +use crate::storage::{Config, PairType}; #[test] fn update_config() { diff --git a/contracts/pool_stable/src/tests/swap.rs b/contracts/pool_stable/src/tests/swap.rs index 920a84d9..dd3d4471 100644 --- a/contracts/pool_stable/src/tests/swap.rs +++ b/contracts/pool_stable/src/tests/swap.rs @@ -625,6 +625,7 @@ fn simple_swap_with_two_tokens_both_with_7_decimals() { &None, &Some(spread), &None::, + &None, ); // // let share_token_address = pool.query_share_token_address(); @@ -651,95 +652,3 @@ fn simple_swap_with_two_tokens_both_with_7_decimals() { // assert_eq!(token1.balance(&user), 99); // assert_eq!(token2.balance(&user), 101); } - -#[test] -fn simple_swap_with_tokens_with_6_8_decimals() { - let env = Env::default(); - env.mock_all_auths(); - env.budget().reset_unlimited(); - - let admin = Address::generate(&env); - let manager = Address::generate(&env); - let factory = Address::generate(&env); - let user = Address::generate(&env); - - let mut token1 = token_contract::Client::new( - &env, - &env.register_contract_wasm(None, token_contract::WASM), - ); - - token1.initialize( - &admin, - &6, - &"name1".into_val(&env), - &"symbol1".into_val(&env), - ); - - let mut token2 = token_contract::Client::new( - &env, - &env.register_contract_wasm(None, token_contract::WASM), - ); - - token2.initialize( - &admin, - &8, - &"name2".into_val(&env), - &"symbol2".into_val(&env), - ); - - if token2.address < token1.address { - std::mem::swap(&mut token1, &mut token2); - } - - let swap_fees = 0i64; - let pool = deploy_stable_liquidity_pool_contract( - &env, - None, - (&token1.address, &token2.address), - swap_fees, - None, - None, - None, - manager, - factory, - None, - ); - - token1.mint(&user, &1_100); - token2.mint(&user, &1_100); - pool.provide_liquidity(&user, &1_000, &1_000, &None, &None::, &None); - - let spread = 100i64; // 1% maximum spread allowed - pool.swap( - &user, - &token1.address, - &1, - &None, - &Some(spread), - &None::, - ); - - let share_token_address = pool.query_share_token_address(); - let result = pool.query_pool_info(); - - assert_eq!( - result, - PoolResponse { - asset_a: Asset { - address: token1.address.clone(), - amount: 1_001i128, - }, - asset_b: Asset { - address: token2.address.clone(), - amount: 999i128, - }, - asset_lp_share: Asset { - address: share_token_address.clone(), - amount: 1_000i128, - }, - stake_address: pool.query_stake_contract_address(), - } - ); - assert_eq!(token1.balance(&user), 99); - assert_eq!(token2.balance(&user), 101); -}