Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
foreign asset by reanchoring
Browse files Browse the repository at this point in the history
  • Loading branch information
metricaez committed Aug 28, 2023
1 parent ac306c0 commit 92e5940
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions pallets/proxy-teleport/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,13 @@ impl<T: Config> Pallet<T> {
id: AssetId::Concrete(MultiLocation::here()),
fun: Fungibility::Fungible(native_asset_amount),
};

let assets = MultiAssets::from(vec![native_asset]);
let assets = MultiAssets::from(vec![native_asset.clone()]);

// Native from foreign perspective
//TODO: Replace ID with parameter
let location_as_foreign =
MultiLocation { parents: 1, interior: Junctions::X1(Junction::Parachain(1836)) };

let native_as_foreign = MultiAsset {
id: AssetId::Concrete(location_as_foreign),
fun: Fungibility::Fungible(native_asset_amount),
};

let context = T::UniversalLocation::get();
let native_as_foreign = native_asset
.reanchored(&dest, context)
.map_err(|_| pallet_xcm::Error::<T>::CannotReanchor)?;
let foreing_assets = MultiAssets::from(vec![native_as_foreign]);

//Unbox proxy asset
Expand All @@ -143,15 +137,15 @@ impl<T: Config> Pallet<T> {
let (origin_location, assets) = value;

// Reanchor the proxy asset to the destination chain.
let context = T::UniversalLocation::get();

let fees = proxy_asset
.get(fee_asset_item as usize)
.ok_or(pallet_xcm::Error::<T>::Empty)?
.clone()
.reanchored(&dest, context)
.map_err(|_| pallet_xcm::Error::<T>::CannotReanchor)?;

// TODO: Define if Withdrawn proxy assets are deposited or trapped.
// TODO: Define if Withdrawn proxy assets are deposited or trapped.
// Check if there is no vulnerability through RefundSurplus
//let max_assets = (assets.len() as u32).checked_add(1).ok_or(Error::<T>::TooManyAssets)?;

Expand Down

0 comments on commit 92e5940

Please sign in to comment.