diff --git a/connect/src/routes/portico/automatic.ts b/connect/src/routes/portico/automatic.ts index 5ba3b7d32..b8bf35404 100644 --- a/connect/src/routes/portico/automatic.ts +++ b/connect/src/routes/portico/automatic.ts @@ -201,6 +201,9 @@ export class AutomaticPorticoRoute try { const swapAmounts = await this.fetchSwapQuote(request, params); + // destination token may have a different number of decimals than the source token + // so we need to scale the amounts to the token with the most decimals + // before comparing them const maxDecimals = Math.max(request.source.decimals, request.destination.decimals); const scaledAmount = amount.units(amount.scale(params.normalizedParams.amount, maxDecimals)); const scaledMinAmountFinish = amount.units(