Git Product home page Git Product logo

compoundv2-substreams's Introduction

CompoundV2 Substreams

Archive Note

The repo has migrated to https://github.com/messari/substreams.


Ongoing effort to index Compound V2 using substreams.

Architecture

graph TD;
  map_accrue_interest[map: map_accrue_interest]
  sf.ethereum.type.v1.Block[source: sf.ethereum.type.v1.Block] --> map_accrue_interest
  map_mint[map: map_mint]
  sf.ethereum.type.v1.Block[source: sf.ethereum.type.v1.Block] --> map_mint
  store_token --> map_mint
  store_price --> map_mint
  map_market_listed[map: map_market_listed]
  sf.ethereum.type.v1.Block[source: sf.ethereum.type.v1.Block] --> map_market_listed
  map_market_totals[map: map_market_totals]
  map_accrue_interest --> map_market_totals
  store_token --> map_market_totals
  store_price --> map_market_totals
  map_market_revenue_delta[map: map_market_revenue_delta]
  map_accrue_interest --> map_market_revenue_delta
  store_market_reserve_factor --> map_market_revenue_delta
  store_price --> map_market_revenue_delta
  store_token --> map_market_revenue_delta
  store_token[store: store_token]
  map_market_listed --> store_token
  store_market_reserve_factor[store: store_market_reserve_factor]
  sf.ethereum.type.v1.Block[source: sf.ethereum.type.v1.Block] --> store_market_reserve_factor
  store_market_count[store: store_market_count]
  map_market_listed --> store_market_count
  store_mint_count[store: store_mint_count]
  map_mint --> store_mint_count
  store_oracle[store: store_oracle]
  sf.ethereum.type.v1.Block[source: sf.ethereum.type.v1.Block] --> store_oracle
  store_price[store: store_price]
  map_accrue_interest --> store_price
  store_oracle --> store_price
  store_token --> store_price
  store_market_listed[store: store_market_listed]
  map_market_listed --> store_market_listed
  store_mint[store: store_mint]
  map_mint --> store_mint
  store_market_totals[store: store_market_totals]
  map_market_totals --> store_market_totals
  store_protocol_totals[store: store_protocol_totals]
  map_market_totals --> store_protocol_totals
  store_market_listed --> store_protocol_totals
  store_market_totals --> store_protocol_totals
  store_revenue[store: store_revenue]
  map_market_revenue_delta --> store_revenue

Quick Start

Install

Run go install ./cmd/substreams under substreams repo develop branch to get the latest substreams cli.

Run brew install bufbuild/buf/buf to install buf.

Build

Generate src/pb

make codegen

Build

make build

Run

sftoken
substreams run -e api-dev.streamingfast.io:443 substreams.yaml map_market_listed,store_market --start-block 7710778 --stop-block +10

Implemented Schema

LendingProtocol

  • oracle
  • totalPoolCount
  • totalValueLockedUSD
  • totalBorrowBalanceUSD
  • cumulativeTotalRevenueUSD
  • cumulativeProtocolSideRevenueUSD
  • cumulativeSupplySideRevenueUSD

Market

  • inputToken
  • outputToken
  • reserveFactor
  • totalValueLockedUSD
  • totalBorrowBalanceUSD
  • cumulativeTotalRevenueUSD
  • cumulativeProtocolSideRevenueUSD
  • cumulativeSupplySideRevenueUSD

Token

  • address
  • name
  • symbol
  • decimals
  • lastPriceUSD

UsageMetricsDailySnapshot

  • dailyDepositCount

MarketDailySnapshot

  • dailyTotalRevenueUSD
  • dailyProtocolSideRevenueUSD
  • dailySupplySideRevenueUSD

FinancialsDailySnapshot

  • dailyTotalRevenueUSD
  • dailyProtocolSideRevenueUSD
  • dailySupplySideRevenueUSD

Troubleshooting

Running store_* module could produce the below error. Just ignore it and retry.

Error: rpc error: code = Unknown desc = error building pipeline: synchronizing stores: from worker: calling back scheduler: squashing: merging partials: initializing next partial store "store_transfers": storage file 0012289000-0012288000.partial: not found

compoundv2-substreams's People

Contributors

0xbe1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.