{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://api.liquity.org/schemas/protocol-stats.json",
  "title": "ProtocolStats",
  "description": "Comprehensive Liquity V2 (BOLD) protocol statistics snapshot including totals, per-branch metrics, yield opportunities, and token prices.",
  "type": "object",
  "properties": {
    "total_bold_supply": {
      "type": "string",
      "description": "Total BOLD stablecoin supply as a decimal numeric string.",
      "example": "50000000.123456789"
    },
    "total_debt_pending": {
      "type": "string",
      "description": "Total pending debt across all collateral branches as a decimal numeric string."
    },
    "total_coll_value": {
      "type": "string",
      "description": "Total collateral value in USD across all branches as a decimal numeric string."
    },
    "total_sp_deposits": {
      "type": "string",
      "description": "Total stability pool deposits as a decimal numeric string."
    },
    "total_value_locked": {
      "type": "string",
      "description": "Total value locked in the protocol as a decimal numeric string."
    },
    "max_sp_apy": {
      "type": "string",
      "description": "Maximum stability pool APY across all collateral branches as a decimal numeric string."
    },
    "branch": {
      "type": "object",
      "description": "Per-collateral branch statistics. Keys are asset names (e.g., WETH, wstETH, rETH).",
      "additionalProperties": {
        "$ref": "#/$defs/BranchStats"
      }
    },
    "boldYield": {
      "type": "array",
      "description": "List of BOLD yield opportunities across DeFi protocols.",
      "items": {
        "$ref": "#/$defs/YieldVenue"
      }
    },
    "sBOLD": {
      "$ref": "#/$defs/YieldVenue",
      "description": "sBOLD vault yield metrics."
    },
    "yBOLD": {
      "$ref": "#/$defs/YieldVenue",
      "description": "yBOLD vault yield metrics."
    },
    "prices": {
      "type": "object",
      "description": "Current token prices keyed by symbol.",
      "additionalProperties": {
        "type": "string",
        "description": "Token price as a decimal numeric string."
      }
    }
  },
  "$defs": {
    "BranchStats": {
      "type": "object",
      "title": "BranchStats",
      "description": "Per-collateral branch statistics for a Liquity V2 deployment.",
      "properties": {
        "coll_active": { "type": "string", "description": "Active collateral amount as numeric string." },
        "coll_default": { "type": "string", "description": "Defaulted collateral amount as numeric string." },
        "coll_price": { "type": "string", "description": "Current collateral price as numeric string." },
        "debt_recorded": { "type": "string", "description": "Recorded debt amount as numeric string." },
        "debt_default": { "type": "string", "description": "Defaulted debt amount as numeric string." },
        "sp_deposits": { "type": "string", "description": "Stability pool deposit amount as numeric string." },
        "interest_accrual_1y": { "type": "string", "description": "Annualized interest accrual as numeric string." },
        "interest_pending": { "type": "string", "description": "Pending interest amount as numeric string." },
        "batch_management_fees_pending": { "type": "string", "description": "Pending batch management fees as numeric string." },
        "coll": { "type": "string", "description": "Total collateral as numeric string." },
        "coll_value": { "type": "string", "description": "Total collateral value in USD as numeric string." },
        "debt_pending": { "type": "string", "description": "Pending debt as numeric string." },
        "debt_active": { "type": "string", "description": "Active debt as numeric string." },
        "debt": { "type": "string", "description": "Total debt as numeric string." },
        "value_locked": { "type": "string", "description": "Total value locked as numeric string." },
        "interest_rate_avg": { "type": "string", "description": "Average interest rate as numeric string." },
        "sp_apy": { "type": "string", "description": "Stability pool APY as numeric string." },
        "apy_avg": { "type": "string", "description": "Average APY as numeric string." },
        "sp_apy_avg_1d": { "type": "string", "description": "1-day average stability pool APY as numeric string." },
        "sp_apy_avg_7d": { "type": "string", "description": "7-day average stability pool APY as numeric string." }
      }
    },
    "YieldVenue": {
      "type": "object",
      "title": "YieldVenue",
      "description": "A yield opportunity for BOLD in a DeFi protocol.",
      "properties": {
        "protocol": { "type": "string", "description": "Name of the DeFi protocol.", "example": "Euler" },
        "asset": { "type": "string", "description": "Asset or vault identifier.", "example": "BOLD Vault" },
        "link": { "type": "string", "format": "uri", "description": "URL to the yield opportunity." },
        "weekly_apr": { "type": "number", "description": "Weekly annualized percentage rate as decimal.", "example": 0.103 },
        "total_apr": { "type": "string", "description": "Total APR range as formatted string.", "example": "21.5% - 103.1%" },
        "tvl": { "type": "number", "description": "Total value locked in USD.", "example": 148921.61 }
      },
      "required": ["protocol", "asset", "link", "weekly_apr", "total_apr", "tvl"]
    }
  }
}
