Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XCM executor: refund unused swapped fees #7945

Closed

Conversation

mrshiposha
Copy link
Contributor

This PR changes the XCM executor to refund the unused swapped fees into the corresponding fees source (jit withdraw, holding register, or fees register).

@mrshiposha mrshiposha requested a review from a team as a code owner March 17, 2025 18:18
@mrshiposha mrshiposha changed the title fix: deposit fee change XCM executor: refund unused swapped fees Mar 17, 2025
Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

Could you add a test?

@acatangiu acatangiu added the T6-XCM This PR/Issue is related to XCM. label Mar 18, 2025
Comment on lines +606 to +613
let (needed, change) = Self::get_fungible_needed_and_change(
swapped_asset,
&asset_needed_for_fees.id,
&asset_to_pay_for_fees.id,
)
.ok_or(XcmError::FeesNotMet)?;

self.deposit_fee_asset(change, fees_source)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the scenario where there is leftover of the source asset after swapping to target asset?

I see that we are quoting the price just before doing the swap so it should be exact swap with no change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ooph. Apparently, I got confused. Also, I was actually focused on another thing — simplifying the WeightTrader, where I wanted to use the AssetExchanger (I wanted this to allow general implementation of xcmPaymentApi.queryWeightToAssetFee, see the end of this comment).

I'm closing this PR.

@mrshiposha mrshiposha closed this Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T6-XCM This PR/Issue is related to XCM.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants