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( ...@@ -171,7 +171,7 @@ export function useBestV3TradeExactOut(
state: isSyncing ? V3TradeState.SYNCING : V3TradeState.VALID, state: isSyncing ? V3TradeState.SYNCING : V3TradeState.VALID,
trade: Trade.createUncheckedTrade({ trade: Trade.createUncheckedTrade({
route: bestRoute, route: bestRoute,
tradeType: TradeType.EXACT_INPUT, tradeType: TradeType.EXACT_OUTPUT,
inputAmount: inputAmount:
currencyIn instanceof Token currencyIn instanceof Token
? new TokenAmount(currencyIn, amountIn.toString()) ? new TokenAmount(currencyIn, amountIn.toString())
......
...@@ -18,8 +18,7 @@ export function isTradeBetter( ...@@ -18,8 +18,7 @@ export function isTradeBetter(
!currencyEquals(tradeA.inputAmount.currency, tradeB.inputAmount.currency) || !currencyEquals(tradeA.inputAmount.currency, tradeB.inputAmount.currency) ||
!currencyEquals(tradeB.outputAmount.currency, tradeB.outputAmount.currency) !currencyEquals(tradeB.outputAmount.currency, tradeB.outputAmount.currency)
) { ) {
console.error('Comparing incomparable trades', tradeA, tradeB) throw new Error('Comparing incomparable trades')
return false
} }
if (minimumDelta.equalTo(ZERO_PERCENT)) { 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