Fix bug in nabla minimum output calculation#1226
Open
gianfra-t wants to merge 1 commit into
Open
Conversation
❌ Deploy Preview for vortex-sandbox failed. Why did it fail? →
|
✅ Deploy Preview for vortexfi ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes minimum-output calculation for Nabla EVM swaps in cases where an offramp quote’s outputAmountRaw is increased by a partner subsidy, ensuring the on-chain minimum is derived from the AMM-deliverable amount instead of the subsidy-inflated amount.
Changes:
- Preserve AMM-only output amounts on offramp quotes by storing
ammOutputAmountRaw/Decimalbefore subsidy is merged. - Update Base Nabla swap transaction builder to compute minimum outputs from
ammOutputAmountRawwhen present (fallback tooutputAmountRaw). - Extend
QuoteContext.nablaSwapEvmtypes to include the optional AMM-only output fields.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/api/src/api/services/transactions/onramp/common/transactions.ts | Uses AMM-only output (when available) as the base for min-output calculations for the Nabla swap on Base. |
| apps/api/src/api/services/quote/engines/merge-subsidy/offramp-evm.ts | Captures AMM-only output values before merging subsidy into outputAmount*. |
| apps/api/src/api/services/quote/core/types.ts | Adds optional AMM-only output fields to the nablaSwapEvm context type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+267
to
268
| const minOutputBaseRaw = quote.metadata.nablaSwapEvm.ammOutputAmountRaw ?? quote.metadata.nablaSwapEvm.outputAmountRaw; | ||
| const outputAmountRaw = Big(quote.metadata.nablaSwapEvm.outputAmountRaw); |
Contributor
Author
There was a problem hiding this comment.
I wouldn't remove this just yet, to avoid breaking the interface downstrea.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.