Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
markuspluna committed Nov 9, 2023
1 parent 4c69d10 commit 09197aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 26 deletions.
2 changes: 1 addition & 1 deletion test-suites/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
27 changes: 2 additions & 25 deletions test-suites/tests/test_wasm_happy_path.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 09197aa

Please sign in to comment.