diff --git a/src/utils/routerTradeAdapter.ts b/src/utils/routerTradeAdapter.ts index 23ffff11..1414c9a3 100644 --- a/src/utils/routerTradeAdapter.ts +++ b/src/utils/routerTradeAdapter.ts @@ -1,17 +1,15 @@ import { MixedRouteSDK, Trade as RouterTrade } from '@uniswap/router-sdk' import { - ChainId, Currency, CurrencyAmount, Ether, - NativeCurrency as SdkNativeCurrency, Token, TradeType, } from '@uniswap/sdk-core' import { Pair, Route as V2Route } from '@uniswap/v2-sdk' import { Pool, Route as V3Route, FeeAmount } from '@uniswap/v3-sdk' import { BigNumber } from 'ethers' -import { ETH_ADDRESS, E_ETH_ADDRESS, WRAPPED_NATIVE_CURRENCY } from './constants' +import { ETH_ADDRESS, E_ETH_ADDRESS } from './constants' export type TokenInRoute = { address: string @@ -168,7 +166,7 @@ export class RouterTradeAdapter { private static toCurrency(isNative: boolean, token: TokenInRoute): Currency { if (isNative) { - return new NativeCurrency(token.chainId, parseInt(token.decimals)) + return Ether.onChain(token.chainId) } return this.toToken(token) } @@ -216,25 +214,3 @@ export class RouterTradeAdapter { return route.every((pool) => pool.type === type) } } - -export class NativeCurrency extends SdkNativeCurrency { - constructor(chainId: ChainId, decimals: number, symbol?: string, name?: string) { - if (chainId === ChainId.MAINNET) { - return Ether.onChain(chainId) - } - super(chainId, decimals, symbol, name) - } - - equals(currency: Currency): boolean { - return currency.isNative && currency.chainId === this.chainId - } - - get wrapped(): Token { - const wrapped = WRAPPED_NATIVE_CURRENCY[this.chainId as ChainId] - if (!wrapped) { - throw new Error('unsupported chain') - } - - return wrapped - } -} diff --git a/test/forge/interop.json b/test/forge/interop.json index d4c1e555..0bc773c9 100644 --- a/test/forge/interop.json +++ b/test/forge/interop.json @@ -247,4 +247,4 @@ "calldata": "0x24856bc30000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000030b000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000003eb3459f0ce6ae000b00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f46b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000000000000000000", "value": "1000000000000000000" } -} +} \ No newline at end of file