Skip to content

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://blue-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 {
  marketByUniqueKey(
    uniqueKey: "0xe7e9694b754c4d4f7e21faf7223f6fa71abaeb10296a4c43a54a7977149687d2"
    chainId: 1
  ) {
    reallocatableLiquidityAssets
    state {
      liquidityAssets
    }
    publicAllocatorSharedLiquidity {
      assets
      vault {
        address
        name
      }
      allocationMarket {
        uniqueKey
      }
    }
  }
}

Market's Available liquidity

Available liquidity of a market taking account for the public Allocator.

query MarketByUniqueKey($uniqueKey: String!, $chainId: Int) {
  marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
    reallocatableLiquidityAssets
    state {
      liquidityAssets
    }
    publicAllocatorSharedLiquidity {
      assets
      vault {
        address
        name
      }
      allocationMarket {
        uniqueKey
        reallocatableLiquidityAssets
      }
    }
  }
}

with the following variables:

{
  "uniqueKey": "0xb8fc70e82bc5bb53e773626fcc6a23f7eefa036918d7ef216ecfb1950a94a85e",
  "chainId": 1
}

Market's Available liquidity is liquidityAssets (the market liquidity) + the sum of reallocatableLiquidityAssets (what can be reallocated from other markets).

Reallocations that occurred for a Morpho Vault

query {
  publicAllocatorReallocates(
    where: { vaultAddress_in: ["0xBEEf050ecd6a16c4e7bfFbB52Ebba7846C4b8cD4"] }
  ) {
    items {
      timestamp
      assets
      type
      vault {
        address
      }
      market {
        uniqueKey
      }
    }
  }
}

Config of the Public Allocator for a Morpho Vault

query {
  vaultByAddress(
    address: "0x38989BBA00BDF8181F4082995b3DEAe96163aC5D"
    chainId: 1
  ) {
    address
    publicAllocatorConfig {
      fee
      flowCaps {
        market {
          uniqueKey
        }
        maxIn
        maxOut
      }
    }
  }
}