I have a list of token addresses that I would like to poll for when the Add Liquidity ETH method is called. I know that you can access contract events by using:

web3 = Web3(my_provider)
contract = web3.eth.contract(address=token_address, abi=token_abi) 

However, two things seem unclear to me...

  1. Some tokens aren't verified contracts and therefor do not have an ABI listed. And even if they are and do have an ABI listed. It seems that it is inconsistent whether or not that method is listed in there. So how is it possible to get the contract when the ABI is not listed?
  2. If you assume what the ABI is by using the standard ERC20 ABI as listed in an answer here: https://ethereum.stackexchange.com/a/29929. Wouldn't you still run in to the same issue as above where the contract will not show you the Add Liquidity ETH method.

To provide an example if we look at APAD. You can see liquidity was added about a week ago as shown in the screenshot here: enter image description here

In APAD's case, their method is called addLiquidity and it can be seen in their source code and ABI. So I understand that this differs a little bit from other contracts that call it addLiquidityETH or whatever else.

What is the best way to detect when this event happens? Am I on the right track with trying to do this by using contract.events? If so how would I check for when that event happens?


With some help from the answer below I am getting further along. I am able to detect transfers that are being made by doing the following:

token_contract = web3.eth.contract(address=created_pair.get_token_address(weth_contract), 
check_liquidity_filter = token_contract.events.Transfer.createFilter(fromBlock='latest')

asyncio.run(await log_liquidity(check_liquidity_filter, 2))

And here is my log_liquidity method:

async def log_liquidity(event_filter, poll_interval):
    while True:
        print("checking for liquidity")
        for res in event_filter.get_new_entries():
        await asyncio.sleep(poll_interval)

In my most recent example I pulled the token data for this pairing:

token0: https://etherscan.io/address/0x694aeb98D02bf69a20a1bA754F07acfA2F4D8f9E

token1: https://etherscan.io/address/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

pair: https://etherscan.io/address/0x2297cfc74CcD5880d835d1009Bd6328D3D9E62e3

Token1 being WETH and Token0 being the new Token in question.

I eventually picked up the following event that happened:

    "args": {
        "from": "0x2297cfc74CcD5880d835d1009Bd6328D3D9E62e3", 
        "to": "0x970075Ffb8feCaA79135c385dB8461dFF488c96B",
        "value": 26448300574725940621084517}, "event": "Transfer",
        "logIndex": 13, 
        "transactionIndex": 13, 
        "transactionHash": "0xefb43d7c033a6b6fe1aeda8812c1a4a1c2b0a7db2bb54cbffc56b3a06405c210", 
        "address": "0x694aeb98D02bf69a20a1bA754F07acfA2F4D8f9E", 
        "blockHash": "0x2c33968dd4f2fcd70214a019903ea00ea61cbfbff896b12d913dd29c6580f9ad", 
        "blockNumber": 14420431

This does not seem to line up with the initial liquidity being added from the transaction here:


  1. It does not seem to be the correct block number.
  2. The To address in the pair seems to be the pairing address, but this is supposed to be the from address?

1 Answer 1


0x60806040 represents the constructor, and Add Liquidity represents a function from APAD that adds Liquidity by calling UniswapV2's function

function addLiquidity(uint256 tokens) external payable onlyOwner() liquidityAdd {
    _mint(address(this), tokens);
    _approve(address(this), address(_router), tokens);

    _router.addLiquidityETH{value: msg.value}(

To track all liquidity deposits, you can just filter this event:

Transfer (address from, address to, uint256 value)

where address to is the liquidity pool.

And the same way, for all liquidity withdrawals, you can filter to address from where from is the liquidity pool.

  • Thank you for your response. This is beginning to become a bit clearer to me. However, how would I be able to filter on the even of the token if I do not have the ABI? Commented Mar 19, 2022 at 19:26
  • Sorry, event* not even... Commented Mar 19, 2022 at 19:33
  • 1
    If it follows the ERC20 standard and it does, you should be able to get this event. all ERC20 should emit this event Transfer(address indexed _from, address indexed _to, uint256 _value) based on EIP20 eips.ethereum.org/EIPS/eip-20
    – Adam Boudj
    Commented Mar 19, 2022 at 19:52
  • Thanks again for responding. i took what you mentioned and tried to implement what I thought you meant. However, some things are still a little unclear to me. I updated my questions with an Edit. Could you please take a look and tell me where I am going wrong? Thank you! Commented Mar 20, 2022 at 12:59

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.