Get total supplied and borrowed
Get total supplied and borrowed

Morpho · Reads onchain state

Reads a Morpho Blue market's totals: assets and shares supplied and borrowed. The market state returns total supply assets and shares, total borrow assets and shares in the loan token's units, the last accrual timestamp, and the fee at 18 decimals. Reach for it to compute utilization and judge rate direction, to check available liquidity as supply minus borrow before a borrow or withdrawal, or to size against a market's depth.

Morpho: Get Market Liquidity

plug
morpho
math
5actions
  1. 1·Take

    The caller supplies morpho_market at slot 0, naming the Morpho Blue market whose liquidity is being measured.

  2. 2·Get total supplied and borrowed

    Reading the totals of that supplied market returns its supplied and borrowed assets and shares.

  3. 3·Calculate

    Subtracting the borrowed assets in slot 1.0.2 from the supplied assets in slot 1.0.0 yields the difference between what has been supplied and what has been borrowed.

  4. 4·Set

    That difference is assigned to available_liquidity so the final step can reference it under a stable name.

  5. 5·Bubble

    Surfacing available_liquidity exposes the computed liquidity figure as this plug's output.

Take
Get total supplied and borrowed in
Calculate
Set to
Bubble
  • Morpho: Check Refinancing Constraints

    plug
    morpho
    evm
  • Morpho Pendle Expiry Deleveraging

    pendle
    time
    boolean
  • Morpho: Get Market Liquidity

    plug
    morpho
    math

On other protocols · 4