Skip to content

Instantly share code, notes, and snippets.

@patcito
Last active March 24, 2026 14:14
Show Gist options
  • Select an option

  • Save patcito/e6a455a352aec69b754e32edf13bae2e to your computer and use it in GitHub Desktop.

Select an option

Save patcito/e6a455a352aec69b754e32edf13bae2e to your computer and use it in GitHub Desktop.
Lending Dashboard API - Series & New Fields

Lending Dashboard API Changes

Endpoint: GET /mm/lend

New: chains[].series

Each chain now includes a series object with daily historical data (last 30 days):

{
  "chains": [{
    "chainId": 146,
    "series": {
      "totalDeposited": [
        { "timestamp": 1711324800, "value": 123456.78 }
      ],
      "totalBorrowed": [
        { "timestamp": 1711324800, "value": 45678.90 }
      ],
      "totalEarnings": [
        { "timestamp": 1711324800, "value": 1234.56 }
      ],
      "supplyApy": [
        { "timestamp": 1711324800, "value": 2100000000000000 }
      ],
      "borrowApy": [
        { "timestamp": 1711324800, "value": 21000000000000000 }
      ],
      "utilization": [
        { "timestamp": 1711324800, "value": 500000000000000000 }
      ]
    }
  }]
}

Series fields

Field Description Units Aggregation
totalDeposited Total supplied across all assets USD (raw WAD, divide by 1e18) SUM per day
totalBorrowed Total borrowed across all assets USD (raw WAD, divide by 1e18) SUM per day
totalEarnings Cumulative FT rewards distributed to suppliers USD (already converted at $0.10/FT) Cumulative running total
supplyApy Average supply APY across assets WAD (divide by 1e18 for decimal, multiply by 100 for %) AVG per day
borrowApy Average borrow APY across assets WAD (divide by 1e18 for decimal, multiply by 100 for %) AVG per day
utilization Average utilization across assets WAD (divide by 1e18 for decimal, multiply by 100 for %) AVG per day

Notes

  • timestamp is Unix seconds
  • totalDeposited and totalBorrowed are in WAD format (1e18 = $1.00 USD)
  • totalEarnings is in plain USD (no WAD scaling) — cumulative FT rewards at $0.10/FT
  • totalEarnings will be empty until the first epoch is settled on-chain (lending just launched)
  • supplyApy and borrowApy are in WAD format — to get percentage: value / 1e18 * 100
  • series is omitted if no historical data exists

Other recent changes

  • chains[].assets[].userMetrics.totalWithdrawable / totalWithdrawableUsd — max user can withdraw per asset
  • chains[].assets[].userMetrics.*Raw fields — raw big int strings for wallet balance, supplied, borrowed, available, withdrawable
  • chains[].assets[].globalMetrics.utilizationPct — now returns 0-100% instead of 0-1 decimal
  • chains[].circuitBreakerParams.isPaused — when true, CB limits don't apply
  • Health factor returns 6.5535 (infinity sentinel) when user has positions but no borrows
  • Borrow capacity (totalAvailable) respects both marginHfSafeBps and marginMinEquityUSDWad from on-chain config
  • New assets: stS, ftUSD, WETH, WBTC on Sonic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment