EatTheBlocks Forum

Profitable-flashloans #15: breaking changes with @uniswap/sdk

I was unable to run the code as described in
[https://github.com/jklepatch/eattheblocks/tree/master/profitable-flashloans/15-poll-uniswap-prices](http://Chapter 15)

After reviewing Uniswap’s documentation, just saw there seems to be breaking changes with version 3, so here is an update of the changes to be done in our code:

Before:

        Token.fetchData(
            ChainId.MAINNET,
            tokenAddress
        )

Now:

        new Token(
            ChainId.MAINNET,
            tokenAddress,
            18
        )

Before:

   const daiWeth = await Pair.fetchData(
       dai,
       weth
   );

Now:

   const daiWeth = await Fetcher.fetchPairData(
       dai,
       weth
   );

Also had issues with the lastest version, but using the one just before did work:

npm i @uniswap/sdk@3.0.2

Just for you to know!

1 Like

Thanks for sharing @ sjuanati !

Thanks @sjuanati and @jklepatch
When I try to run this it gives the below error:


Please help guys!

You need to uniswall Uniswap SDK and reinstall the exact version specified in package.json on Github. To install specific version, append @ + version after the name of the package: npm install packageName@version.

Hello, I use this code and then get this error:

Warning: 0x6b175474e89094c44da98b954eedeac495271d0f is not checksummed.
(node:15264) UnhandledPromiseRejectionWarning: ReferenceError: Fetcher is not defined
at init (C:\Users\user\bot\run-arbitrage.js:31:23)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use node --trace-warnings ... to show where the warning was created)
(node:15264) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:15264) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Please help me. Thank you.