-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: polygon-prototype-staging
Are you sure you want to change the base?
Account for minimum balance when off-ramping from AssetHub. #349
Conversation
✅ Deploy Preview for pendulum-pay ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
… into account-for-min-balance-assethub
… into account-for-min-balance-assethub
@gianfra-t you didn't add any reviewers, is this ready? |
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. |
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. |
const { hash } = await tx.signAndSend(walletAccount.address, { signer: walletAccount.signer as Signer }); | ||
setOfframpSigningPhase?.('finished'); | ||
|
||
await xcmSentEventPromise; |
There was a problem hiding this comment.
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.
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 thetransfer
operation is attempted by thexcm_executor
, which would leave the balance bellow this specified minimum, thexcm
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 display1.52
.