Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
yarn prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongeric committed Mar 19, 2024
1 parent 9ee7f74 commit 2b4ffea
Show file tree
Hide file tree
Showing 3 changed files with 206 additions and 94 deletions.
11 changes: 4 additions & 7 deletions src/utils/routerTradeAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ interface RouteResult {
outputAmount: CurrencyAmount<Currency>
}

export const isNativeCurrency = (address: string) =>
address.toLowerCase() === ETH_ADDRESS.toLowerCase()
export const isNativeCurrency = (address: string) => address.toLowerCase() === ETH_ADDRESS.toLowerCase()

// Helper class to convert routing-specific quote entities to RouterTrade entities
// the returned RouterTrade can then be used to build the UniswapTrade entity in this package
Expand All @@ -85,13 +84,11 @@ export class RouterTradeAdapter {
const tokenInData = route[0]?.[0]?.tokenIn
const tokenOutData = route[0]?.[route[0]?.length - 1]?.tokenOut
if (!tokenInData || !tokenOutData) throw new Error('Expected both tokenIn and tokenOut to be present')
if (tokenInData.chainId !== tokenOutData.chainId) throw new Error('Expected tokenIn and tokenOut to be have same chainId')
if (tokenInData.chainId !== tokenOutData.chainId)
throw new Error('Expected tokenIn and tokenOut to be have same chainId')

const parsedCurrencyIn = RouterTradeAdapter.toCurrency(isNativeCurrency(tokenIn), tokenInData)
const parsedCurrencyOut = RouterTradeAdapter.toCurrency(
isNativeCurrency(tokenOut),
tokenOutData
)
const parsedCurrencyOut = RouterTradeAdapter.toCurrency(isNativeCurrency(tokenOut), tokenOutData)

const typedRoutes: RouteResult[] = route.map((subRoute) => {
if (subRoute.length === 0) {
Expand Down
2 changes: 1 addition & 1 deletion test/forge/interop.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,4 @@
"calldata": "0x24856bc30000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000030b000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000003eb3459f0ce6ae000b00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f46b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000000000000000000",
"value": "1000000000000000000"
}
}
}
Loading

0 comments on commit 2b4ffea

Please sign in to comment.