For the complete documentation index, see llms.txt. This page is also available as Markdown.

Using the Subgraph

Using the Vaults Subgraph

The MORE Vaults subgraph exposes on‑chain vault activity and performance via GraphQL. It tracks the factory, all vaults, deposits/withdrawals, user share balances (with cost basis and PnL), and daily/weekly performance snapshots.

Endpoints

Quickstart queries

  • Latest vaults with performance

{
  vaults(first: 5, orderBy: totalAssetsUSD, orderDirection: desc) {
    id
    name
    symbol
    totalAssets
    totalAssetsUSD
    apyPriceTrailing
    apyDailyReturnTrailing
    apyWeeklyReturnTrailing
  }
}
  • A wallet’s balance and PnL in a vault

  • Daily performance for a vault (recent 7 days)

Schema and behaviors

  • Vaults and factory

    • VaultFactory tracks the factory and derived vaults.

    • Vault stores totalAssets, totalSupply, totalAssetsUSD, creation timestamp, and return/apy fields:

      • Returns: return1Days, return7Days, return30Days, return90Days, return180Days, return365Days, returnInception.

      • APYs: price‑based apyPriceTrailing, naive daily apyDailyReturnTrailing (+ 1/7/30/90/180/365 windows), and weekly apyWeeklyReturnTrailing (+ 1/4/13/26/52 weeks).

  • Events and user state

    • DepositEvent and WithdrawEvent mirror vault actions.

    • UserVaultBalance maintains shares, USD value, weighted average cost basis, and realized/unrealized PnL.

    • UserVaultTransaction records every user‑level action including P2P share transfers.

  • Snapshots and pricing

    • VaultDailySnapshot is created once per UTC day per vault; includes share/asset USD prices, dailyReturn, APR (= dailyReturn × 365), and projected APY (= (1+dailyReturn)^365 − 1).

    • VaultWeeklySnapshot aggregates weekly totals and weeklyReturn.

    • Price entities: VaultPriceOracle (current oracle) and VaultAssetPrice (last asset USD price with 8‑decimals), used to compute USD values.

  • Update cadence

    • On each deposit/withdraw: updates vault totals, USD values, user balances, cost basis, PnL, creates events and transactions, and refreshes daily/weekly snapshots and APYs for that block’s UTC day.

    • On P2P share Transfer: adjusts sender/receiver balances, cost basis (receiver), and unrealized PnL; does not change vault totals.

    • Once per UTC day per vault: first block that lands in a new day bucket creates/updates VaultDailySnapshot and recomputes trailing APYs; weekly buckets are maintained similarly.

  • GraphQL tips

    • All list fields support where, orderBy, orderDirection, first/skip, and block for historical queries.

    • IDs: snapshots use vaultAddress-<dayTimestamp|weekTimestamp>.

Last updated