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

Account for minimum balance when off-ramping from AssetHub. #349

Open
wants to merge 7 commits into
base: polygon-prototype-staging
Choose a base branch
from

Conversation

gianfra-t
Copy link
Contributor

@gianfra-t gianfra-t commented Jan 2, 2025

NOTE: Wait for the merge of 292 before merging.

Issue #346.

As described in the ticket, this happens because in AssetHub we have a minBalance for each asset. When the transfer operation is attempted by the xcm_executor, which would leave the balance bellow this specified minimum, the xcm transfer will fail.

Considerations

We are rounding the number to 2 decimals for ease of visualization. This means the user may see a slightly smaller balance as compared to what can be seen on chain, on the order of the minBalance property.

Example USDC

Balance: 1530000 (1.535 USDC).
Minimum Balance: 10000 (0.01 USDC)

Technically, the user could transfer: 1535000 - 10000 = 1525000 (1.525 USDC) but due to our rounding, the app will display 1.52.

Copy link

netlify bot commented Jan 2, 2025

Deploy Preview for pendulum-pay ready!

Name Link
🔨 Latest commit 129d362
🔍 Latest deploy log https://app.netlify.com/sites/pendulum-pay/deploys/677e93bdc5ca2d00086e10cd
😎 Deploy Preview https://deploy-preview-349--pendulum-pay.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@gianfra-t gianfra-t requested a review from a team January 2, 2025 20:02
@gianfra-t gianfra-t linked an issue Jan 2, 2025 that may be closed by this pull request
@gianfra-t gianfra-t removed the request for review from a team January 2, 2025 20:08
@gianfra-t gianfra-t changed the base branch from polygon-prototype-staging to 292-update-flow-to-start-off-ramping-from-evm-networks January 3, 2025 19:04
Base automatically changed from 292-update-flow-to-start-off-ramping-from-evm-networks to polygon-prototype-staging January 7, 2025 15:07
@ebma
Copy link
Member

ebma commented Jan 8, 2025

@gianfra-t you didn't add any reviewers, is this ready?

@gianfra-t
Copy link
Contributor Author

gianfra-t commented Jan 8, 2025

I was waiting for the evm PR since it was branched from it.

It is ready, but the events part is more like a suggestion only. As it may have downsides.

@ebma
Copy link
Member

ebma commented Jan 8, 2025

If there are any considerations that you are worried about, feel free to leave a note in the description so we can take it into account when reviewing.

@gianfra-t gianfra-t requested a review from a team January 8, 2025 15:02
const { hash } = await tx.signAndSend(walletAccount.address, { signer: walletAccount.signer as Signer });
setOfframpSigningPhase?.('finished');

await xcmSentEventPromise;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the core idea. We would now wait for an event that confirms that the XCM was sent.

Now, the issue is that we should also probably listen to the corresponding failed event to be complete, and this may be overkill for the application. @pendulum-chain/devs let me know what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle failed XCM transfers when off-ramping from AssetHub
2 participants