Get Metrics
Vaults List
Endpoint: blue-api.morpho.org/graphql
query {
vaults {
items {
address
symbol
name
whitelisted
asset {
id
address
decimals
}
chain {
id
network
}
}
}
}
Total Deposits & Liquidity
query {
vaults(first: 100, orderBy: TotalAssetsUsd, orderDirection: Desc) {
items {
address
state {
totalAssets
totalAssetsUsd
totalSupply
}
}
}
}
APY (Native + Rewards)
Current state
query {
vaults(first: 100, orderBy: TotalAssetsUsd, orderDirection: Desc) {
items {
address
state {
apy
netApy
netApyWithoutRewards
dailyApy
dailyNetApy
weeklyApy
weeklyNetApy
monthlyApy
monthlyNetApy
rewards {
asset {
address
}
supplyApr
yearlySupplyTokens
}
}
}
}
}
Historical state
query VaultApys($options: TimeseriesOptions) {
vaults(first: 10, orderBy: TotalAssetsUsd, orderDirection: Desc) {
items {
address
historicalState {
apy(options: $options) {
x
y
}
netApy(options: $options) {
x
y
}
}
}
}
}
with those variables
{
"options": {
"startTimestamp": 1740000000,
"endTimestamp": 1742564817,
"interval": "DAY"
}
}
Markets Allocation
query {
vaults(first: 100, orderBy: TotalAssetsUsd, orderDirection: Desc) {
items {
address
state {
allocation {
market {
uniqueKey
loanAsset {
name
}
collateralAsset {
name
}
oracleAddress
irmAddress
lltv
}
supplyCap
supplyAssets
supplyAssetsUsd
}
}
}
}
}
Price of a vault token
query {
vaults(first: 100, orderBy: TotalAssetsUsd, orderDirection: Desc) {
items {
address
state {
sharePrice
sharePriceUsd
}
}
}
}
Vault Configuration
query {
vaults(first: 100, orderBy: TotalAssetsUsd, orderDirection: Desc) {
items {
address
name
whitelisted
metadata {
description
forumLink
image
curators {
image
name
url
}
}
allocators {
address
}
state {
owner
curator
guardian
timelock
}
}
}
}
Depositors
query {
vaultPositions(
first: 10
orderBy: Shares
orderDirection: Desc
where: {
vaultAddress_in: [
"0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB"
"0x73e65DBD630f90604062f6E02fAb9138e713edD9"
]
}
) {
items {
vault {
address
}
user {
address
}
state {
shares
assets
assetsUsd
}
}
}
}
Transaction history
query {
transactions(
first: 10
orderBy: Timestamp
orderDirection: Desc
where: { vaultAddress_in: ["0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB"] }
) {
items {
blockNumber
hash
type
user {
address
}
}
}
}
Vault Queues
query {
vaults(first: 100, orderBy: TotalAssetsUsd, orderDirection: Desc) {
items {
address
state {
totalAssets
lastTotalAssets
allocation {
supplyQueueIndex
withdrawQueueIndex
market {
uniqueKey
}
}
}
}
}
}
Vaults Warnings
a. Warnings type
are:
unrecognized_deposit_asset
,unrecognized_vault_curator
,not_whitelisted
b. Warning level
is either:
- YELLOW,
- RED.
query {
vaults {
items {
name
warnings {
type
level
}
}
}
}
User all Vaults Position
query GetAllUserPositions($chainId: Int!, $userAddress: String!) {
vaultPositions(
where: {
chainId_in: [$chainId]
shares_gte: 0
userAddress_in: [$userAddress]
}
) {
items {
id
assets
vault {
id
address
}
}
}
}
Onchain & API combination - Vaults
In this tutorial, we'll explore how to compute the APY and rewards for Morpho Vaults. We'll cover both the calculation of the vault's APY based on allocated assets across markets and the computation of rewards.
First one has to get the Rate (of Native APY or Reward APR) on the markets belonging to the vault and apply the weight method to get the final values.
Native APY Computation
To compute the Annual Percentage Yield (APY) of Morpho Vaults, one has to follow a weighted approach based on the liquidity allocated in each market within the vault's withdraw queue.
1. Retrieve Liquidity: Identify the liquidity allocated in each market in the vault's withdrawal queue.
2. Get APYs: Retrieve the APY of each market thanks to this tutorial.
3. Compute the Weighted APY:
where:
- APYMarketX refers to the APY of market X.
- assetsAllocatedInMarketA is the amount of assets the vault has allocated in market X.
- totalAssetsAllocated is the sum of all assets allocated across markets.
Rewards Computation
Get Reward Emission
Retrieve the reward emission rate. Refer to the dedicated rewards section or the Morpho API section related to rewards.
Calculate Reward Value
emissionRatePerYear
is the annual rate of reward emission. Potentially, there are supply, borrow, and collateral emission rates. In the case of Morpho Vaults, only the supply emission rate matters.priceRewardTokenUSD
is the price of the reward token in USD.rewardTokenDecimals
is the decimal places of the reward token.marketTotalAssets
is the total supply of assets in the market.assetPriceUSD
is the price of the asset in USD.assetDecimals
is the decimal of the asset.