From 692aca874a2398b61318cb65060842fb2058f998 Mon Sep 17 00:00:00 2001 From: markuspluna <59978114+markuspluna@users.noreply.github.com> Date: Tue, 19 Dec 2023 18:24:09 -0600 Subject: [PATCH] test fixes --- test-suites/src/pool.rs | 2 +- test-suites/tests/test_liquidation.rs | 54 ++++++++++++++------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/test-suites/src/pool.rs b/test-suites/src/pool.rs index f290593c..ed029dde 100644 --- a/test-suites/src/pool.rs +++ b/test-suites/src/pool.rs @@ -15,7 +15,7 @@ pub fn default_reserve_metadata() -> ReserveConfig { r_one: 0_0500000, r_two: 0_5000000, r_three: 1_5000000, - reactivity: 0, // 10e-5 0_000_002_000 + reactivity: 0_000_002_000, // 10e-5 index: 0, } } diff --git a/test-suites/tests/test_liquidation.rs b/test-suites/tests/test_liquidation.rs index a4cb1fd0..f1eaf455 100644 --- a/test-suites/tests/test_liquidation.rs +++ b/test-suites/tests/test_liquidation.rs @@ -19,31 +19,35 @@ fn test_liquidations() { let pool_fixture = &fixture.pools[0]; // Disable rate modifiers - // let mut usdc_config: ReserveConfig = fixture.read_reserve_config(0, TokenIndex::STABLE); - // usdc_config.reactivity = 0; - // pool_fixture - // .pool - // .queue_set_reserve(&fixture.tokens[TokenIndex::STABLE].address, &usdc_config); - // let mut xlm_config: ReserveConfig = fixture.read_reserve_config(0, TokenIndex::XLM); - // xlm_config.reactivity = 0; - // pool_fixture - // .pool - // .queue_set_reserve(&fixture.tokens[TokenIndex::XLM].address, &xlm_config); - // let mut weth_config: ReserveConfig = fixture.read_reserve_config(0, TokenIndex::WETH); - // weth_config.reactivity = 0; - // pool_fixture - // .pool - // .queue_set_reserve(&fixture.tokens[TokenIndex::WETH].address, &weth_config); - // fixture.jump(60 * 60 * 24 * 7); - // pool_fixture - // .pool - // .set_reserve(&fixture.tokens[TokenIndex::STABLE].address); - // pool_fixture - // .pool - // .set_reserve(&fixture.tokens[TokenIndex::XLM].address); - // pool_fixture - // .pool - // .set_reserve(&fixture.tokens[TokenIndex::WETH].address); + let mut usdc_config: ReserveConfig = fixture.read_reserve_config(0, TokenIndex::STABLE); + usdc_config.reactivity = 0; + + let mut xlm_config: ReserveConfig = fixture.read_reserve_config(0, TokenIndex::XLM); + xlm_config.reactivity = 0; + let mut weth_config: ReserveConfig = fixture.read_reserve_config(0, TokenIndex::WETH); + weth_config.reactivity = 0; + + fixture.env.as_contract(&fixture.pools[0].pool.address, || { + let key = PoolDataKey::ResConfig(fixture.tokens[TokenIndex::STABLE].address.clone()); + fixture + .env + .storage() + .persistent() + .set::(&key, &usdc_config); + let key = PoolDataKey::ResConfig(fixture.tokens[TokenIndex::XLM].address.clone()); + fixture + .env + .storage() + .persistent() + .set::(&key, &xlm_config); + let key = PoolDataKey::ResConfig(fixture.tokens[TokenIndex::WETH].address.clone()); + fixture + .env + .storage() + .persistent() + .set::(&key, &weth_config); + }); + // Create a user let samwise = Address::generate(&fixture.env); //sam will be supplying XLM and borrowing STABLE