Skip to content

Commit

Permalink
update IT
Browse files Browse the repository at this point in the history
  • Loading branch information
lemunozm committed Jun 27, 2024
1 parent 55d661f commit 3557b4f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 41 deletions.
32 changes: 0 additions & 32 deletions runtime/integration-tests/src/cases/liquidity_pools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,38 +773,6 @@ mod add_allow_upgrade {
});
}

#[test_runtimes([development])]
fn update_token_price<T: Runtime + FudgeSupport>() {
let mut env = FudgeEnv::<T>::from_parachain_storage(
Genesis::default()
.add(genesis::balances::<T>(cfg(1_000)))
.add(genesis::tokens::<T>(vec![(
GLMR_CURRENCY_ID,
DEFAULT_BALANCE_GLMR,
)]))
.storage(),
);

setup_test(&mut env);

env.parachain_state_mut(|| {
let currency_id = AUSD_CURRENCY_ID;
let pool_id = POOL_ID;

enable_liquidity_pool_transferability::<T>(currency_id);

create_ausd_pool::<T>(pool_id);

assert_ok!(pallet_liquidity_pools::Pallet::<T>::update_token_price(
RawOrigin::Signed(Keyring::Bob.into()).into(),
pool_id,
default_tranche_id::<T>(pool_id),
currency_id,
Domain::EVM(MOONBEAM_EVM_CHAIN_ID),
));
});
}

#[test_runtimes([development])]
fn add_currency<T: Runtime + FudgeSupport>() {
let mut env = FudgeEnv::<T>::from_parachain_storage(
Expand Down
19 changes: 10 additions & 9 deletions runtime/integration-tests/src/cases/lp/pool_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

use cfg_primitives::{Balance, PoolId, SECONDS_PER_YEAR};
use cfg_primitives::{AccountId, Balance, PoolId, SECONDS_PER_YEAR};
use cfg_traits::{PoolMetadata, TimeAsSecs, TrancheTokenPrice};
use cfg_types::{
domain_address::{Domain, DomainAddress},
Expand Down Expand Up @@ -561,12 +561,13 @@ fn update_tranche_token_price<T: Runtime>() {
assert_eq!(computed_evm, 0);
});

let pre_price_cfg = env.state_mut(|_evm| {
let price = <pallet_pool_system::Pallet<T> as TrancheTokenPrice<
<T as frame_system::Config>::AccountId,
CurrencyId,
>>::get(POOL_A, pool_a_tranche_1_id::<T>())
.unwrap();
let (price, last_updated) = env.state_mut(|_evm| {
let price =
<pallet_pool_system::Pallet<T> as TrancheTokenPrice<AccountId, CurrencyId>>::get_price(
POOL_A,
pool_a_tranche_1_id::<T>(),
)
.unwrap();

assert_ok!(pallet_liquidity_pools::Pallet::<T>::update_token_price(
OriginFor::<T>::signed(Keyring::Alice.into()),
Expand Down Expand Up @@ -596,7 +597,7 @@ fn update_tranche_token_price<T: Runtime>() {
.value,
);

assert_eq!(pre_price_cfg.last_updated, computed_at_evm);
assert_eq!(price_evm, pre_price_cfg.price.into_inner());
assert_eq!(last_updated, computed_at_evm);
assert_eq!(price.into_inner(), price_evm);
});
}

0 comments on commit 3557b4f

Please sign in to comment.