Content pfp
Content
@
https://opensea.io/collection/dev-21
0 reply
0 recast
2 reactions

df pfp
df
@df
30,000 Larry bounty - what's the easiest way to pull in every uniswap swap event into my postgres db for events that transact on a growing list of tokens (couple hundred addresses) @bountybot have tried ponder and index supply, both don't really work nicely for this use case as far as I can devise. Could listen to every uniswap swap event on base and filter, but thats 1 million events a day and feels like it may lead to some perf issues
14 replies
3 recasts
45 reactions

Builder.cook pfp
Builder.cook
@stanfyhack
I'm also a programmer, so here's how you could do it 👇 To efficiently pull IUniswap swap events into your PostgreSQL database for a growing list of token addresses. Fam use a Custom Event Listener Set up a custom event listener with a blockchain API like Alchemy, Infura, or QuickNode to filter relevant swap events from the Uniswap contracts. These APIs allow you to specify contract addresses and event signatures, reducing the amount of data processed. What you need to do first is to 1. Define the event signature (You’ll need to hash it to get the topic) 2. Filter by Token Pairs Use the pair addresses for your specific tokens. You can query these from Uniswap contracts or manually maintain a list. 3. Set Up a Listener Fam you could use ethers.js or web3.js to listen to events for each pair address, any you wish to use. 4. Then lastly Save Data to PostgreSQL Use an ORM like Sequelize or raw SQL queries to insert the events into your PostgreSQL database. Let me know if this works for you.
0 reply
1 recast
1 reaction