Skip to content

Commit 5a59b21

Browse files
committed
Move max asset check inside do_transfer_multiassets
1 parent ebc863c commit 5a59b21

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

xtokens/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ pub mod module {
387387
) -> DispatchResult {
388388
let who = ensure_signed(origin)?;
389389
let assets: MultiAssets = (*assets).try_into().map_err(|()| Error::<T>::BadVersion)?;
390-
ensure!(assets.len() <= MAX_ASSETS_FOR_TRANSFER, Error::<T>::TooManyAssets);
391390
let dest: MultiLocation = (*dest).try_into().map_err(|()| Error::<T>::BadVersion)?;
392391

393392
// We first grab the fee
@@ -558,6 +557,9 @@ pub mod module {
558557
dest_weight: Weight,
559558
deposit_event: bool,
560559
) -> DispatchResult {
560+
ensure!(assets.len() <= MAX_ASSETS_FOR_TRANSFER, Error::<T>::TooManyAssets);
561+
562+
// We check that all assets are valid and share the same reserve
561563
for i in 0..assets.clone().len() {
562564
let asset = assets.get(i).ok_or(Error::<T>::Empty)?;
563565
if !asset.is_fungible(None) {

0 commit comments

Comments
 (0)