Commit e9a432b5 authored by Moody Salem's avatar Moody Salem

fix a bug in v3 trade routing returning the wrong trade type for output trade

parent 1f41587b
......@@ -171,7 +171,7 @@ export function useBestV3TradeExactOut(
state: isSyncing ? V3TradeState.SYNCING : V3TradeState.VALID,
trade: Trade.createUncheckedTrade({
route: bestRoute,
tradeType: TradeType.EXACT_INPUT,
tradeType: TradeType.EXACT_OUTPUT,
inputAmount:
currencyIn instanceof Token
? new TokenAmount(currencyIn, amountIn.toString())
......
......@@ -18,8 +18,7 @@ export function isTradeBetter(
!currencyEquals(tradeA.inputAmount.currency, tradeB.inputAmount.currency) ||
!currencyEquals(tradeB.outputAmount.currency, tradeB.outputAmount.currency)
) {
console.error('Comparing incomparable trades', tradeA, tradeB)
return false
throw new Error('Comparing incomparable trades')
}
if (minimumDelta.equalTo(ZERO_PERCENT)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment