Get total supplied and borrowed

Get total supplied and borrowed on Morpho

Ethereum
Ethereum
Base
Base

Reads onchain state

Ready to run on Base

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.

Plug lets you combine onchain actions like this one into a single transaction, without writing a smart contract. Use in App opens a new plug with this action already in it.

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

More plugs on Base

Borrow on Base · 7 plugs

Posts · 2

More on Morpho · 16

On other protocols · 6