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.0, the market identifier the rest of the plug reads against.

  2. 2·Get total supplied and borrowed

    Reading that named market's totals returns its supplied and borrowed figures, both assets and shares on each side.

  3. 3·Calculate

    Taking the supplied assets at slot 1.0.0 and subtracting the borrowed assets at slot 1.0.2 yields the difference between what is supplied and what is borrowed.

  4. 4·Set

    Assigning that difference to available_liquidity names the result for the surfacing step.

  5. 5·Bubble

    Bubbling available_liquidity surfaces the computed figure as the output of this plug.

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 · 5