Skip to main content

Subgraph and yDaemon

If you need to fetch large amounts of historical yearn data there are 2 services built for that:

  • The subgraph is a GraphQL interface to raw historical data
  • yDaemon is a RESTful API that hydrates subgraph responses with more data, like APY calculations

yDaemon

Subgraph

Subgraph Entities

  • Account

    • id: Address of the account
  • ActiveAccount

    • id: { daily/hourly }-{ Address of the account }-{ Days/hours since Unix epoch }
  • Deposit

    • id: { Transaction hash }-{ Log index }
    • hash: Transaction hash of the transaction that emitted this event
    • logIndex: Event log index. For transactions that don't emit event, create arbitrary index starting from 0
    • protocol: The protocol this transaction belongs to
    • to: Market that tokens are deposited into
    • from: Address that deposited tokens
    • blockNumber: Block number of this event
    • timestamp: Timestamp of this event
    • asset: Token deposited
    • amount: Amount of token deposited in native units
    • amountUSD: Amount of token deposited in USD
    • vault: The vault involving this transaction
  • FinancialsDailySnapshot

    • id: ID is # of days since Unix epoch time
    • protocol: Protocol this snapshot is associated with
    • totalValueLockedUSD: Current TVL (Total Value Locked) of the entire protocol
    • protocolControlledValueUSD: Current PCV (Protocol Controlled Value). Only relevant for protocols with PCV.
    • dailySupplySideRevenueUSD: Revenue claimed by suppliers to the protocol. LPs on DEXs (e.g. 0.25% of the swap fee in Sushiswap). Depositors on Lending Protocols. NFT sellers on OpenSea.
    • cumulativeSupplySideRevenueUSD: Revenue claimed by suppliers to the protocol. LPs on DEXs (e.g. 0.25% of the swap fee in Sushiswap). Depositors on Lending Protocols. NFT sellers on OpenSea.
    • dailyProtocolSideRevenueUSD: Gross revenue for the protocol (revenue claimed by protocol). Examples: AMM protocol fee (Sushi’s 0.05%). OpenSea 10% sell fee.
    • cumulativeProtocolSideRevenueUSD: Gross revenue for the protocol (revenue claimed by protocol). Examples: AMM protocol fee (Sushi’s 0.05%). OpenSea 10% sell fee.
    • dailyTotalRevenueUSD: All revenue generated by the protocol. e.g. 0.30% of swap fee in Sushiswap, all yield generated by Yearn.
    • cumulativeTotalRevenueUSD: All revenue generated by the protocol. e.g. 0.30% of swap fee in Sushiswap, all yield generated by Yearn.
    • blockNumber: Block number of this snapshot
    • timestamp: Timestamp of this snapshot
  • RewardToken

    • id: { Reward token type }-{ Smart contract address of the reward token }
    • token: Reference to the actual token
    • type: The type of the reward token
  • Token

    • id: Smart contract address of the token
    • name: Name of the token, mirrored from the smart contract
    • symbol: Symbol of the token, mirrored from the smart contract
    • decimals: The number of decimal places this token uses, default to 18
    • lastPriceUSD: Optional field to track the price of a token, mostly for caching purposes
    • lastPriceBlockNumber: Optional field to track the block number of the last token price
  • UsageMetricsDailySnapshot

    • id: ID is # of days since Unix epoch time
    • protocol: Protocol this snapshot is associated