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
Ethereum network: Open a support ticket on Discord for access to the Ethereum subgraph URL.
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
query($user: Bytes!, $vault: String!) {
userVaultBalances(where: { user: $user, vault: $vault }) {
sharesBalance
shareBalanceUSD
weightedAverageCostBasis
realizedPnLUSD
unrealizedPnLUSD
lastUpdatedTimestamp
}
}
Daily performance for a vault (recent 7 days)
query($vault: String!) {
vaultDailySnapshots(
first: 7
orderBy: dayTimestamp
orderDirection: desc
where: { vault: $vault }
) {
dayTimestamp
sharePrice
dailyReturn
apr
apyDailyProjected
}
}
Schema and behaviors
Vaults and factory
VaultFactory
tracks the factory and derivedvaults
.Vault
storestotalAssets
,totalSupply
,totalAssetsUSD
, creation timestamp, and return/apy fields:Returns:
return1Days
,return7Days
,return30Days
,return90Days
,return180Days
,return365Days
,returnInception
.APYs: price‑based
apyPriceTrailing
, naive dailyapyDailyReturnTrailing
(+ 1/7/30/90/180/365 windows), and weeklyapyWeeklyReturnTrailing
(+ 1/4/13/26/52 weeks).
Events and user state
DepositEvent
andWithdrawEvent
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 andweeklyReturn
.Price entities:
VaultPriceOracle
(current oracle) andVaultAssetPrice
(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
, andblock
for historical queries.IDs: snapshots use
vaultAddress-<dayTimestamp|weekTimestamp>
.
Last updated