This project implements a Substreams-powered subgraph for tracking ERC4626 token rates and APR calculations.
The Vision SPS project uses Substreams to index ERC4626 tokens, also known as tokenized vaults, on the Ethereum blockchain. Specifically, it tracks:
- Token metadata: decimals, symbol, and underlying asset address
- Vault metrics: total assets and total supply
- Conversion rates: the rate at which shares of the vault convert to underlying assets
- APR calculations: based on changes in conversion rates over time
This indexing focuses on yield-bearing tokens and automated yield strategies, providing insights into the performance and efficiency of various DeFi protocols that implement the ERC4626 standard. The project processes historical data to retrieve and store these metrics, offering a comprehensive view of ERC4626 token behavior and returns over time.
- Rust (latest stable version)
- Node.js (v14 or later) and Yarn
- Substreams CLI (latest version)
- The Graph CLI (latest version)
src/lib.rs
: Contains the main Substreams logic for processing ERC4626 token datasubstreams.yaml
: Substreams configuration filepackage.json
: Node.js package configuration and scriptsschema.graphql
: GraphQL schema for the subgraphsubgraph.yaml
: Subgraph manifest file
- Install Rust: https://www.rust-lang.org/tools/install
- Install Node.js and Yarn: https://nodejs.org/ and https://yarnpkg.com/
- Install Substreams CLI: Follow instructions at https://substreams.streamingfast.io/getting-started/installing-the-cli
- Install The Graph CLI:
yarn global add @graphprotocol/graph-cli
-
Build the Substreams module:
yarn substreams:prepare
-
Generate subgraph files:
yarn codegen
-
Build the subgraph:
yarn subgraph:build
-
Deploy the subgraph (replace
<SUBGRAPH_NAME>
with your subgraph name):yarn deploy <SUBGRAPH_NAME>
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch:
git checkout -b feat/my-new-feature
- Commit your changes:
git commit -m 'feat: add some feature'
- Push to the branch:
git push origin feat/my-new-feature
- Submit a pull request
This project is licensed under the MIT License.