Indexing a Factory Contract using Unmarshal Parser
In this tutorial, I will demonstrate how you can index a Factory styled Contract with Unmarshal’s Parser.
For the purposes of this tutorial I will demonstrate how you can index Quickswap and all gather all of their children’s data. We find their factory contract deployed at
1. Index the factory like you would for any other contract
2. Once the ABI is loaded in select all events and function you want to index. Make sure to pick
PairCreated event. (This is what’s emitted when a new Pair is created and holds the new contract’s addresss)
3. Once at the Add Child Parser page, Click on Add Child Parser
4. This should open a brand new form to enter the new “Child” parser’s data in.
5. In our case
PairCreated is the event emitted when a pair is created and
pair holds the address of the field. So we select the same
6. Enter the address of any random pair. (Note: Every pair will be indexed, not just the one supplied. This column is used merely as a reference and to fetch ABI)
7. Pick the events you want indexed. (At this time we can only track events for all deployed child contracts. There are future plans to support functions as well)
8. You can add any price plugins if you need. (Stay Tuned for a step-by step guide on this!)
9. Enter additional details about your child parser. This part is concerned with where you’d like to store your data (Schema) and how far back the data should go (Start Block). When you’re done, click on Add Child Parser.
10. Review yours Child parser’s details and change anything incorrect.
11. Fill in the rest of your Factory’s details and deploy your parser!
12. Both your Parser’s should be up and running now!
There are a multitude of applications where tracking the price of a token is essential. Consider one of the most popular use cases for the factory pattern in Web3: A Dex. With the price plugin, the Parser allows you to track historical prices for all tokens involved. Stay tuned for our case study into Uniswap and how you can index it with Price details.
Unmarshal is a Multi-chain Web 3.0 data network aiming to deliver granular, reliable & real-time data to dApps, DeFi protocols, NFTs, Metaverse and GameFi solutions. Unmarshal provides the easiest way to query Blockchain data from Ethereum, Polygon, BNB Chain, Avalanche, Fantom, Celo, Solana, Klaytn, Kadena, Arbitrum, and XDC Network. Unmarshal network consists of data indexers and transforming tools to power Web 3.0 applications on any chain while providing a latent view of transformed data.