The Graph is an indexing protocol that makes it easier to query networks like Ethereum and Optimism. With The Graph, anyone can build and publish open-source APIs, known as subgraphs, which organize blockchain data to make it more easily accessible.
When any decentralized application (dapp) adds data to the blockchain, the smart contract emits one or more events while processing the transaction. Indexers on The Graph Network index subgraphs that track the events emitted by the smart contract and organize them neatly, enabling dapps to access and rapidly display only the information relevant to their users.
Subgraphs identify smart contracts, the events in those contracts to pay attention to, and how to map event data to the data that will be indexed via The Graph’s decentralized network.
At Exactly Protocol, our subgraph allows us to perform advanced queries and operations like aggregation, search, relationships, and non-trivial filtering. It enables us to index and return every event emitted by our smart contract on the blockchain. This includes details of all the different operations, such as borrows and deposits, as well as the Interest Rate Model that determines the protocol’s earnings and debts.