Skip to content

Fix bug in nabla minimum output calculation#1226

Open
gianfra-t wants to merge 1 commit into
stagingfrom
fix-nabla-min-output
Open

Fix bug in nabla minimum output calculation#1226
gianfra-t wants to merge 1 commit into
stagingfrom
fix-nabla-min-output

Conversation

@gianfra-t

Copy link
Copy Markdown
Contributor

No description provided.

@netlify

netlify Bot commented Jun 16, 2026

Copy link
Copy Markdown

Deploy Preview for vortex-sandbox failed. Why did it fail? →

Name Link
🔨 Latest commit ccd7bc7
🔍 Latest deploy log https://app.netlify.com/projects/vortex-sandbox/deploys/6a3166e59048a900076010c1

@netlify

netlify Bot commented Jun 16, 2026

Copy link
Copy Markdown

Deploy Preview for vortexfi ready!

Name Link
🔨 Latest commit ccd7bc7
🔍 Latest deploy log https://app.netlify.com/projects/vortexfi/deploys/6a3166e57fbc4d0008c9789b
😎 Deploy Preview https://deploy-preview-1226--vortexfi.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 project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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/Decimal before subsidy is merged.
  • Update Base Nabla swap transaction builder to compute minimum outputs from ammOutputAmountRaw when present (fallback to outputAmountRaw).
  • Extend QuoteContext.nablaSwapEvm types 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);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wouldn't remove this just yet, to avoid breaking the interface downstrea.

@ebma ebma changed the title Ffix bug in nabla minimum output calculation Fix bug in nabla minimum output calculation Jun 16, 2026
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.

2 participants