1

Let's say I'm quering mempool, that is, pending transactions. How can I then filter out those that are the result of swaps made via Uniswap of certain liquidity pools? Let's say there're 10 liquidity pools I want to watch.

Will I have to check the field to in each transaction? And then compare it with the list of the smart contract addresses of those 10 liquidity pools?

If so, will there be any caveats?

1 Answer 1

1

There are two ways a swap can be made.

An EOA sends a transaction to a Uniswap router, in which case you query all txs that has the router address in the tx.to field. You just watch the router addresses for txs, decode the input parameters to know what is swapped and where.

An EOA transmits a transaction to a contract which is not Uniswap router, which runs a function that will internally interact with a Uniswap router/pair to perform a transaction. In this case, you won't be able to detect this in the mempool, unless you're already familiar with this contract and you know that it will perform a swap.

3
  • what's EOA?.... Commented Jun 25, 2022 at 11:51
  • My question is about Uniswap itself. Therefore the 2nd way won't apply, will it? Commented Jun 25, 2022 at 12:38
  • Many trade on uniswap through a 3rd party contract, such as 1inch or a private contract by arbitrage bots. I believe most of transactions are done that way, depends on what you need, you may have to take this into account.
    – Kof
    Commented Jun 26, 2022 at 5:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.