Skip to content

Commit

Permalink
LP: Unitary testing for all pending extrinsics (#1916)
Browse files Browse the repository at this point in the history
* allow and disallow currency tests

* schedule_upgrade cancel_upgrade and update_tranche_token_metadata
  • Loading branch information
lemunozm authored Jul 22, 2024
1 parent 00ad8bf commit 59f0d5d
Show file tree
Hide file tree
Showing 3 changed files with 487 additions and 533 deletions.
13 changes: 4 additions & 9 deletions pallets/liquidity-pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,11 +769,6 @@ pub mod pallet {
) -> DispatchResult {
let who = ensure_signed(origin.clone())?;

ensure!(
T::PoolInspect::tranche_exists(pool_id, tranche_id),
Error::<T>::TrancheNotFound
);

let investment_id = Self::derive_invest_id(pool_id, tranche_id)?;
let metadata = T::AssetRegistry::metadata(&investment_id.into())
.ok_or(Error::<T>::TrancheMetadataNotFound)?;
Expand Down Expand Up @@ -923,6 +918,10 @@ pub mod pallet {
pub fn validate_investment_currency(
currency_id: T::CurrencyId,
) -> Result<(u128, EVMChainId), DispatchError> {
let currency = Self::try_get_general_index(currency_id)?;

let (chain_id, ..) = Self::try_get_wrapped_token(&currency_id)?;

// Ensure the currency is enabled as pool_currency
let metadata =
T::AssetRegistry::metadata(&currency_id).ok_or(Error::<T>::AssetNotFound)?;
Expand All @@ -931,10 +930,6 @@ pub mod pallet {
Error::<T>::AssetMetadataNotPoolCurrency
);

let currency = Self::try_get_general_index(currency_id)?;

let (chain_id, ..) = Self::try_get_wrapped_token(&currency_id)?;

Ok((currency, chain_id))
}

Expand Down
Loading

0 comments on commit 59f0d5d

Please sign in to comment.