Skip to content

Commit

Permalink
fix: ITs
Browse files Browse the repository at this point in the history
  • Loading branch information
wischli committed Aug 12, 2024
1 parent a0dcafd commit c8a3dc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 30 deletions.
2 changes: 2 additions & 0 deletions runtime/integration-tests/src/cases/lp/investments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ mod with_pool_currency {

env.state_mut(|evm| {
utils::cancel(evm, Keyring::TrancheInvestor(1), names::POOL_C_T_1_USDC);

lp_utils::process_gateway_message::<T>(lp_utils::verify_gateway_message_success::<T>);
});

env.pass(Blocks::ByNumber(1));
Expand Down
35 changes: 5 additions & 30 deletions runtime/integration-tests/src/cases/lp/pool_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// GNU General Public License for more details.

use cfg_primitives::{AccountId, Balance, PoolId, SECONDS_PER_YEAR};
use cfg_traits::{PoolMetadata, TimeAsSecs, TrancheTokenPrice};
use cfg_traits::{PoolMetadata, TrancheTokenPrice};
use cfg_types::{
domain_address::{Domain, DomainAddress},
permissions::PoolRole,
Expand Down Expand Up @@ -147,20 +147,16 @@ fn add_pool<T: Runtime>() {

utils::process_gateway_message::<T>(utils::verify_gateway_message_success::<T>);

let creation_time = <pallet_timestamp::Pallet<T> as TimeAsSecs>::now();

// Compare the pool.created_at field that is returned
let evm_pool_time = Decoder::<Uint>::decode(
assert!(Decoder::<bool>::decode(
&evm.view(
Keyring::Alice,
names::POOL_MANAGER,
"pools",
"isPoolActive",
Some(&[Token::Uint(Uint::from(POOL))]),
)
.unwrap()
.value,
);
assert_eq!(evm_pool_time, Uint::from(creation_time));
.value
));
});

env.state_mut(|evm| {
Expand Down Expand Up @@ -564,27 +560,6 @@ fn update_tranche_token_price<T: Runtime>() {
super::setup_tranches(evm);
});

// Neither price nor computed exists yet
env.state(|evm| {
let (price_evm, computed_evm) = Decoder::<(u128, u64)>::decode(
&evm.view(
Keyring::Alice,
names::POOL_MANAGER,
"getTranchePrice",
Some(&[
Token::Uint(Uint::from(POOL_A)),
Token::FixedBytes(pool_a_tranche_1_id::<T>().to_vec()),
Token::Address(evm.deployed(names::USDC).address()),
]),
)
.unwrap()
.value,
);

assert_eq!(price_evm, 0);
assert_eq!(computed_evm, 0);
});

let (price, last_updated) = env.state_mut(|_evm| {
let price =
<pallet_pool_system::Pallet<T> as TrancheTokenPrice<AccountId, CurrencyId>>::get_price(
Expand Down

0 comments on commit c8a3dc7

Please sign in to comment.