
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



1·Take
The caller hands in morpho_market at execution time, declared here as a named parameter that the read in the next step draws the market identifier from.
2·Get total supplied and borrowed
Reading the Morpho Blue market at that identifier returns its totals, giving the assets and shares supplied and borrowed on both sides.
3·Calculate
Taking the supplied assets figure in slot 1.0.0 and subtracting the borrowed assets figure in slot 1.0.2 leaves the amount supplied but not yet borrowed.
4·Set
That difference is stored in the variable available_liquidity so the surfacing step can reference it by name.
5·Bubble
Exposed as an output is available_liquidity, the leftover the plug just computed, made readable to callers.
On other protocols · 3