0

I have a simple code that aimed to listen to Uniswap Router V3 protocol events

import { ethers } from "ethers";
import { ALCHEMY_HTTP } from "./const";

async function main() {
  const provider = new ethers.providers.JsonRpcProvider(ALCHEMY_HTTP);

  const filter = {
    address: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
  };
  provider.on(filter, (event: any) => {
    console.log(event);
  });
}

main();

I don't receive any events. If I change the address to for example Metamask Router or DAI contract I receive corresponded events.

I'm sure that the contract address for Uniswap Router version 3 is correct. The contract addresses are as below link: https://docs.uniswap.org/protocol/reference/deployments

And also as I check the etherscan, it has a lot of transactions and events. https://etherscan.io/address/0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45

Is there any difference between smart contracts in listening to events?!

Why I don't receive events only for Uniswap V3 Router?

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92

1 Answers1

1

As I understand it, you don't see events because they simply don't exist. If you open the smartcontract in etherscan and go to the tab of the events, it will be empty. The DAI smartcontract, on the other hand, has a lot of events.

Uniswap SwapRouter02 Contract

I also suggest you look at how Uniswap Router smartcontract works - Uniswap Swap Router. I think it can be useful, because if you look there you can also find the answer why there are no events.

Pobepto
  • 430
  • 2
  • 8