Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix test
Signed-off-by: Georgi Zlatarev <[email protected]>
  • Loading branch information
ghzlatarev committed May 26, 2022
commit b34836e2dab63b4b58d9c83b670f8ebabeb96058
4 changes: 2 additions & 2 deletions xtokens/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ pub mod module {
/// Not supported MultiLocation
NotSupportedMultiLocation,
/// MinXcmFee not registered for certain reserve location
MinXcmFeeNotRegistered,
MinXcmFeeNotDefined,
}

#[pallet::hooks]
Expand Down Expand Up @@ -540,7 +540,7 @@ pub mod module {
ensure!(non_fee_reserve == dest.chain_part(), Error::<T>::InvalidAsset);

let reserve_location = non_fee_reserve.clone().ok_or(Error::<T>::AssetHasNoReserve)?;
let min_xcm_fee = T::MinXcmFee::get(&reserve_location).ok_or(Error::<T>::MinXcmFeeNotRegistered)?;
let min_xcm_fee = T::MinXcmFee::get(&reserve_location).ok_or(Error::<T>::MinXcmFeeNotDefined)?;

// min xcm fee should less than user fee
let fee_to_dest: MultiAsset = (fee.id.clone(), min_xcm_fee).into();
Expand Down
6 changes: 3 additions & 3 deletions xtokens/src/mock/para.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,11 @@ match_types! {
}

parameter_type_with_key! {
pub ParachainMinFee: |location: MultiLocation| -> u128 {
pub ParachainMinFee: |location: MultiLocation| -> Option<u128> {
#[allow(clippy::match_ref_pats)] // false positive
match (location.parents, location.first_interior()) {
(1, Some(Parachain(2))) => 40,
_ => u128::MAX,
(1, Some(Parachain(2))) => Some(40),
_ => None,
}
};
}
Expand Down
6 changes: 3 additions & 3 deletions xtokens/src/mock/para_relative_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,11 @@ match_types! {
}

parameter_type_with_key! {
pub ParachainMinFee: |location: MultiLocation| -> u128 {
pub ParachainMinFee: |location: MultiLocation| -> Option<u128> {
#[allow(clippy::match_ref_pats)] // false positive
match (location.parents, location.first_interior()) {
(1, Some(Parachain(2))) => 40,
_ => u128::MAX,
(1, Some(Parachain(2))) => Some(40),
_ => None,
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion xtokens/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ fn transfer_asset_with_relay_fee_failed() {
),
40,
),
Error::<para::Runtime>::FeeNotEnough
Error::<para::Runtime>::MinXcmFeeNotDefined
);
});
}
Expand Down