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

sdk: quote destination amount truncation fix #560

Merged

Conversation

kev1n-peters
Copy link
Contributor

@kev1n-peters kev1n-peters commented Nov 27, 2024

Fixes an issue where calling quote with an amount that has more fractional digits than the destination chain supports throws an error. We need to truncate and scale the destination amount to destination chain decimals (min(srcDecimals, dstDecimals, 8). If the transfer amount has dust, the contract will revert:

revert TransferAmountHasDust(amount, amount - newAmount);
. The SDK will strip off any dust instead of letting the transaction revert. This may result in the actual transfer amount being slightly different than the input amount, but that is a tradeoff we're making here to avoid adding additional complexity for Connect to handle (e.g. amount can't contain dust).

Fixes an issue where calling quote with an amount that has
more fractional digits than the destination chain supports
throws an error. We need to truncate and scale the destination
amount to destination chain decimals.
@nik-suri nik-suri merged commit 2ce277c into wormhole-foundation:main Dec 2, 2024
9 checks passed
kev1n-peters added a commit to wormholelabs-xyz/wormhole-connect that referenced this pull request Dec 3, 2024
Fixes an issue that prevents users from transferring ntt amounts
with more fractional digits than the destination chain supports.
Mostly affected transfers from an EVM chain to Solana when the
max button was pressed and included a lot of dust.

bump ntt sdk for this fix: wormhole-foundation/native-token-transfers#560
kev1n-peters added a commit to wormhole-foundation/wormhole-connect that referenced this pull request Dec 3, 2024
Fixes an issue that prevents users from transferring ntt amounts
with more fractional digits than the destination chain supports.
Mostly affected transfers from an EVM chain to Solana when the
max button was pressed and included a lot of dust.

bump ntt sdk for this fix: wormhole-foundation/native-token-transfers#560
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.

4 participants