Contracts on Ethereum have events that can be written into your contracts. When there is a state change, these events fire off in the contracts. The Graph provides a framework for listening to those events, allowing you to map, rewrite, and transform that data into really sensible entities and databases representing the current state of your contracts.
Our subgraph references the Moloch v3 which is a combination of multiple contacts. The core DAO for governance, the Gnosis Safe for the treasury, the loot ERC-20 and the shares ERC-20 so we can know when tokens are minted, transferred or burned. We can track who the holders are and what the balances are.
We have deployed a factory contract for deploying DAO contracts on Moloch v3 and our subgraph listens to this factory to create templates for each DAO launched. We then listen to each DAO contract for the events they fire off. That data is combined into the subgraph entities that are easy to query. and give us the data needed for our interfaces.
Our subgraph schema is composed of the following entities:
The DAOhaus subgraph should be stable and will not change often. If your application is integrating with other contracts those contracts may already have subgraphs you are bringing into your app. If you are writing new contracts you may want to create your own subgraphs to query within your app and enhance the data that you are getting.