API
Public Allocator
How to query Public Allocator's Data thanks to the API?
Select the query you are interested in in the list below, and paste it into the GraphQL Playground: https://api.morpho.org/graphql
Basic Queries
Public Allocator address
query {
publicAllocators {
items {
address
creationBlockNumber
morphoBlue {
address
chain {
id
network
}
}
}
}
}Total reallocatable liquidity
Reallocations necessary to reach this number
query {
marketById(
marketId: "0xe7e9694b754c4d4f7e21faf7223f6fa71abaeb10296a4c43a54a7977149687d2"
chainId: 1
) {
reallocatableLiquidityAssets
state {
liquidityAssets
}
publicAllocatorSharedLiquidity {
assets
vault {
address
name
}
withdrawMarket {
marketId
}
}
}
}Market's Available liquidity
Available liquidity of a market taking account for the public Allocator.
query MarketById($marketId: String!, $chainId: Int!) {
marketById(marketId: $marketId, chainId: $chainId) {
reallocatableLiquidityAssets
state {
liquidityAssets
}
publicAllocatorSharedLiquidity {
assets
vault {
address
name
}
withdrawMarket {
marketId
}
}
}
}with the following variables:
{
"marketId": "0xb8fc70e82bc5bb53e773626fcc6a23f7eefa036918d7ef216ecfb1950a94a85e",
"chainId": 1
}Market's Available liquidity is liquidityAssets (the market liquidity) + reallocatableLiquidityAssets (what can be reallocated from other markets).
reallocatableLiquidityAssets being the sum of publicAllocatorSharedLiquidity.assets
Reallocations that occurred for a Morpho Vault
query {
publicAllocatorReallocates(
where: { vaultAddress_in: ["0xBEEf050ecd6a16c4e7bfFbB52Ebba7846C4b8cD4"] }
) {
items {
timestamp
assets
type
vault {
address
}
market {
marketId
}
}
}
}Config of the Public Allocator for a Morpho Vault
query {
vaultByAddress(
address: "0x38989BBA00BDF8181F4082995b3DEAe96163aC5D"
chainId: 1
) {
address
publicAllocatorConfig {
fee
flowCaps {
market {
marketId
}
maxIn
maxOut
}
}
}
}