diff --git a/src/entities/protocols/uniswap.ts b/src/entities/protocols/uniswap.ts index f31a20e..83db7bf 100644 --- a/src/entities/protocols/uniswap.ts +++ b/src/entities/protocols/uniswap.ts @@ -16,11 +16,12 @@ import { partitionMixedRouteByProtocol, } from '@uniswap/router-sdk' import { Permit2Permit } from '../../utils/inputTokens' -import { Currency, TradeType, CurrencyAmount, Percent } from '@uniswap/sdk-core' +import { Currency, TradeType, CurrencyAmount, Percent, Fraction } from '@uniswap/sdk-core' import { Command, RouterTradeType, TradeConfig } from '../Command' import { SENDER_AS_RECIPIENT, ROUTER_AS_RECIPIENT, CONTRACT_BALANCE, ETH_ADDRESS } from '../../utils/constants' import { encodeFeeBips } from '../../utils/numbers' import { BigNumber, BigNumberish } from 'ethers' +import JSBI from 'jsbi' export type FlatFeeOptions = { amount: BigNumberish @@ -177,11 +178,16 @@ function addV2Swap( tradeType ) + const ZERO = JSBI.BigInt(0); + console.log(typeof ZERO, ZERO instanceof JSBI) + console.log(new Fraction(ZERO) instanceof Fraction) + + console.log( 'ur-sdk', options.slippageTolerance.toFixed(), options.slippageTolerance.isPercent, - options.slippageTolerance + options.slippageTolerance.lessThan(new Fraction(ZERO)) ) if (tradeType == TradeType.EXACT_INPUT) { diff --git a/yarn.lock b/yarn.lock index 76a6047..8e80e7f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5728,9 +5728,9 @@ js-yaml@^3.13.1: esprima "^4.0.0" jsbi@^3.1.4: - version "3.2.5" - resolved "https://registry.npmjs.org/jsbi/-/jsbi-3.2.5.tgz" - integrity sha512-aBE4n43IPvjaddScbvWRA2YlTzKEynHzu7MqOyTipdHucf/VxS63ViCjxYRg86M8Rxwbt/GfzHl1kKERkt45fQ== + version "3.1.4" + resolved "https://registry.yarnpkg.com/jsbi/-/jsbi-3.1.4.tgz#9654dd02207a66a4911b4e4bb74265bc2cbc9dd0" + integrity sha512-52QRRFSsi9impURE8ZUbzAMCLjPm4THO7H2fcuIvaaeFTbSysvkodbQQXIVsNgq/ypDbq6dJiuGKL0vZ/i9hUg== jsbn@~0.1.0: version "0.1.1"