fix a bug in v3 trade routing returning the wrong trade type for output trade
This commit is contained in:
parent
1f41587ba9
commit
e9a432b58e
@ -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(
|
|||||||
!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)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user