From 09197aa5b3ce8bab81992053c05938788970ede1 Mon Sep 17 00:00:00 2001 From: markuspluna <59978114+markuspluna@users.noreply.github.com> Date: Wed, 8 Nov 2023 19:51:57 -0500 Subject: [PATCH] fixed tests --- test-suites/src/setup.rs | 2 +- test-suites/tests/test_wasm_happy_path.rs | 27 ++--------------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/test-suites/src/setup.rs b/test-suites/src/setup.rs index 4954958a..842e513d 100644 --- a/test-suites/src/setup.rs +++ b/test-suites/src/setup.rs @@ -64,7 +64,7 @@ pub fn create_fixture_with_data<'a>(wasm: bool) -> TestFixture<'a> { fixture.tokens[TokenIndex::USDC].mint(&frodo, &(12_5010_000_0000_0000 * SCALAR_7)); fixture.tokens[TokenIndex::USDC].approve(&frodo, &fixture.lp.address, &i128::MAX, &99999); fixture.lp.join_pool( - &(500_000_00000 * SCALAR_7), + &(500_000_0000 * SCALAR_7), &vec![ &fixture.env, 500_0010_000_0000_0000 * SCALAR_7, diff --git a/test-suites/tests/test_wasm_happy_path.rs b/test-suites/tests/test_wasm_happy_path.rs index cadcab0b..e0a6b250 100644 --- a/test-suites/tests/test_wasm_happy_path.rs +++ b/test-suites/tests/test_wasm_happy_path.rs @@ -1,6 +1,5 @@ #![cfg(test)] -use backstop::{BackstopDataKey, PoolBalance, PoolUserKey, UserBalance}; use fixed_point_math::FixedPoint; use pool::Request; use soroban_sdk::{testutils::Address as _, vec, Address}; @@ -428,35 +427,13 @@ fn test_wasm_happy_path() { // Frodo claims a year worth of backstop emissions let mut backstop_blnd_balance = fixture.tokens[TokenIndex::BLND].balance(&fixture.backstop.address); - fixture.env.as_contract(&fixture.backstop.address, || { - let key = BackstopDataKey::UserBalance(PoolUserKey { - pool: fixture.pools[0].pool.address.clone(), - user: frodo.clone(), - }); - let shares: UserBalance = fixture.env.storage().persistent().get(&key).unwrap(); - println!("shares: {:?}", shares.shares); - let key = BackstopDataKey::PoolBalance(fixture.pools[0].pool.address.clone()); - let shares: PoolBalance = fixture.env.storage().persistent().get(&key).unwrap(); - println!("shares: {:?}", shares.shares); - }); let claim_amount = fixture.backstop.claim( &frodo, &vec![&fixture.env, pool_fixture.pool.address.clone()], &frodo, ); - fixture.env.as_contract(&fixture.backstop.address, || { - let key = BackstopDataKey::UserBalance(PoolUserKey { - pool: fixture.pools[0].pool.address.clone(), - user: frodo.clone(), - }); - let shares: UserBalance = fixture.env.storage().persistent().get(&key).unwrap(); - println!("shares: {:?}", shares.shares); - let key = BackstopDataKey::PoolBalance(fixture.pools[0].pool.address.clone()); - let shares: PoolBalance = fixture.env.storage().persistent().get(&key).unwrap(); - println!("shares: {:?}", shares.shares); - }); - assert_eq!(claim_amount, 22014720_0000000); - backstop_blnd_balance -= 22014720_0000000; + assert_eq!(claim_amount, 22014719_9998450); //actual amount is 22014720_0000000 but get's rounded down + backstop_blnd_balance -= 22014719_9998450; assert_eq!( fixture.tokens[TokenIndex::BLND].balance(&fixture.backstop.address), backstop_blnd_balance