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

This commit is contained in:
Moody Salem 2021-04-30 22:43:29 -05:00
parent 1f41587ba9
commit e9a432b58e
No known key found for this signature in database
GPG Key ID: 8CB5CD10385138DB
2 changed files with 2 additions and 3 deletions

@ -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)) {