Skip to content

decentdao/decent-subgraph

Repository files navigation

Fractal Subgraph

Development

  • Clone repo git clone https://github.com/decent-dao/fractal-subgraph
  • Install dependencies npm install
  • Generate types and entities (this will generate types and entities based on the schema and handlers defined in the subgraph.yaml file) npm run codegen -f subgraph.<network>.yaml

Adding network support

  • Make sure that network is supported from Subgraph Studio. Note - the chain might be not listed, but still supported. Check graphprotocol Discord.
  • Create subgraph.<network>.yaml in the repository root. Copy-paste content from one of existing configuration files. Adjust contract addresses, network and startBlock fields.
  • Create new Subgraph Studio instance from the Studio
  • Update package.json with deploy:<network> script.
  • Deploy newly created Subgraph instance (see next section).
  • Open the PR to merge your changes with all the created/updated configuration into main branch.

Deployment

Subgraph Docs

  • Authorize for deployment. You can get <DEPLOY KEY> from the Subgraph Studio.
    npx graph auth --studio <DEPLOY KEY>
  • Generate static build.
    npm run codegen:sepolia
    npm run build:sepolia
  • Do the Deployment. It will prompt you for version.
    npm run deploy:sepolia

Architecture

There're 3 main parts of this repository:

  • GraphQL Schema: used to define schema of entitines that are stored in Subgraph.
  • Subgraph Config: central place of configuration of The Graph service. Used to define handlers and data source (aka smart contracts to read events from). Also, defines which handlers to call in regard of events
  • Handlers: actual code, where you define handlers and how they react to events (creating/updating/deleting entities)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •