How to you fetch all transactions (swap, mint, burn) of a Liquidity Pool? I searched up and down found this. However, it's making a REST call to Polygon API. Is there a way to do this strictly using web3.py?
For CRONOS chain, I can write this:
cronos_mainnet_rpc = "https://evm.cronos.org" w3 = Web3(Web3.HTTPProvider(cronos_mainnet_rpc)) latest_block = w3.eth.getBlock('latest') latest_block_number = latest_block['number'] for block_number in range(latest_block_number): this_block = w3.eth.getBlock(block_number) for trx_hash in this_block.transactions: try: trx = w3.eth.getTransaction(trx_hash) print(trx) except: print("oops")
- When I look at fields from trx, I cannot find the fields I'm familiar with that identifies for example a swap transaction:
See this post for details.
- Specifically I am searching for swap transactions in SINGLE/USDC pool on VVS: https://vvs.finance/info/farm/0x0fbab8a90cac61b481530aad3a64fe17b322c25d I cannot filter "trx" by pool contract address "0x0fbab8a90cac61b481530aad3a64fe17b322c25d"
Futher checking the LP contract I cannot find any function that's relevant https://cronos.org/explorer/address/0x0fBAB8A90CAC61b481530AAd3a64fE17B322C25d/transactions
This article is close to what I need but does not cover fetching historical swap transactions.