The workshop was recorded on July 28th 2021 and led by Hadrien Croubois, Smart Contract Engineer at OpenZeppelin and Nader Dabit, Developer Relation Engineer, Edge & Node
The workshop covers the following:
You can watch the video, view the slides, and learn how to use OpenZeppelin’s Subgraphs to index your smart contracts app.
DeFi applications depend on efficient indexing so trade and exchange data is up-to-date. Writing proprietary code for syncing and indexing is expensive, inefficient, and error prone. The Graph’s standardized and trusted Subgraphs have become the fastest, cheapest, and most reliable way to index and serve Defi applications.
Subgraphs enable developers to build discoverable APIs by pulling data indexed from Ethereum and other blockchains. The Graph learns what and how to index data based on subgraph descriptions, known as the subgraph manifest. The subgraph description defines the smart contracts of interest for a subgraph, the events in those contracts to pay attention to, and how to map event data to data that The Graph will store in its database.
Information is not about the individual pieces of data, it’s about the links between them. Like Wikipedia’s linking system, Subgraphs allow you to link specific bits of information to others, creating a powerful system of linked records that can be used for a multitude of applications.
Creating dense Subgraphs is one of the most important aspects of indexing on-chain information. This is generally done by linking data types within a Subgraph pulling metadata from an object. Indexing using heavily linked data types means there is more information to work with for analysis and debugging improving outcomes for developers.
A few guidelines for creating dense subgraphs:
OpenZeppelin Contracts supports subgraphs in the following modules:
AccessControl
ERC20
ERC721
ERC1155
ERC1967upgrade
Ownable
Pausable
Timelock
We plan to add support for the following modules:
ERC20votes
ERC777
Install from npm for local development:
npm install @openzeppelin/contracts
npm install @openzeppelin/subgraphs
For each module the library provides:
The subgraph can be assembled manually or using the graph-compile
tool as part of the @amxx/graphprotocol-utils
package. Simply describe your application using a config.json file then generate your custom schema and manifest with all modules enabled. To get started building modular subgraphs with OpenZeppelin Contracts, head over to our official documentation page and visit the Github repository.
To see the slides from the webinar click here.
Learn more about OpenZeppelin Contracts and sign up for a free Defender account.
See the documentation:
OpenZeppelin Defender Documentation
OpenZeppelin Subgraphs Documentation