Skip to content

Commit

Permalink
Merge branch 'swap-endpoint' into fix/swap-fees-calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
gsteenkamp89 committed Jan 15, 2025
2 parents 82fadc3 + b6d634f commit 4a4ee23
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions api/_dexes/cross-swap-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export async function getCrossSwapQuotesForOutputA2B(
type: crossSwap.type,
};
// 2.1. Get origin swap quote for any input token -> bridgeable input token
const originSwapQuote = await profiler.measureAsync(
const indicativeOriginSwapQuote = await profiler.measureAsync(
originStrategy.fetchFn(
{
...originSwap,
Expand All @@ -342,23 +342,20 @@ export async function getCrossSwapQuotesForOutputA2B(
);
// 2.2. Re-fetch origin swap quote with updated input amount and EXACT_INPUT type.
// This prevents leftover tokens in the SwapAndBridge contract.
let adjOriginSwapQuote = await profiler.measureAsync(
let originSwapQuote = await profiler.measureAsync(
originStrategy.fetchFn(
{
...originSwap,
amount: addMarkupToAmount(
originSwapQuote.maximumAmountIn,
indicativeOriginSwapQuote.maximumAmountIn,
indicativeQuoteBuffer
).toString(),
},
TradeType.EXACT_INPUT
),
"getOriginSwapQuote"
);
assertMinOutputAmount(
adjOriginSwapQuote.minAmountOut,
bridgeQuote.inputAmount
);
assertMinOutputAmount(originSwapQuote.minAmountOut, bridgeQuote.inputAmount);

return {
crossSwap,
Expand Down

0 comments on commit 4a4ee23

Please sign in to comment.