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

Descend to user origin & Burn fee from the user #168

Closed
wants to merge 6 commits into from

Conversation

yrong
Copy link

@yrong yrong commented Aug 1, 2024

No description provided.

Comment on lines +390 to +395
let (ticket, fee, fee_to_burn) =
validate_send::<Config::XcmSender>(dest, msg, self.origin_ref())?;
self.take_fee(fee, reason.clone())?;
if let Some(fee_to_burn) = fee_to_burn {
self.burn_fee(fee_to_burn, reason)?;
}
Copy link
Author

@yrong yrong Aug 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make validate_send return an extra fees(optional) for burning.

Comment on lines +499 to 510
let sender = if let Some(origin) = source { Some(origin.clone().interior) } else { None }
.ok_or(NotApplicable)?;

let mut message = Xcm(if let Some(ref payment) = maybe_payment {
let fees = payment
.clone()
.reanchored(&bridge, &UniversalLocation::get())
.map_err(|_| Unroutable)?;
vec![
DescendOrigin(sender),
ReceiveTeleportedAsset(fees.clone().into()),
BuyExecution { fees, weight_limit: Unlimited },
Copy link
Author

@yrong yrong Aug 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In custom exporter we add DescendOrigin into the outer Xcm of the export message.

@@ -461,7 +461,7 @@ impl<Bridges: ExporterFor, Router: SendXcm, UniversalLocation: Get<InteriorLocat
fn validate(
dest: &mut Option<Location>,
msg: &mut Option<Xcm<()>>,
_source: Option<&Location>,
source: Option<&Location>,
Copy link
Author

@yrong yrong Aug 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the source location(optional) to SendXcm trait so that we can DescendOrigin to the souce location(i.e. user) later.

#169 as prerequisite which is a breaking change.

@yrong yrong added the xcm label Aug 22, 2024
@yrong yrong closed this Aug 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant