
Morpho · Reads onchain state
Reads a Morpho Blue market's current borrow rate as a per-second rate and an APY. The interest rate model's borrowRateView is evaluated on the market's live state at 18 decimals, and the action compounds it over a year into borrowApy. Reach for it to compare markets before borrowing, to gate a borrow on a maximum rate, or to weigh the cost against what borrowed funds will earn elsewhere.
Morpho: Find Borrow Rate Delta



1·Take
This step declares current_market as a caller-supplied parameter, the market whose borrow rate you want measured first.
2·Take
A second parameter, target_market, is declared here so the caller names the market to compare against.
3·Get borrow rate
Reading the borrow rate uses [the value in slot "0.0"], meaning current_market, and returns its per-second rate and APY.
4·Use
This composes the Morpho: Get Borrow APR plug to turn the raw rate figures into an APR for the current market.
5·Set
The result of that composition, [the value in slot "3.0"], is stored as current_apr for later comparison.
6·Get borrow rate
Borrow rate is read again, this time for [the value in slot "1.0"], which is target_market, giving its per-second rate and APY.
7·Use
The same Get Borrow APR plug runs again to convert the target market's rate into an APR.
8·Set
That output, [the value in slot "6.0"], is saved as target_apr.
9·Use
Composing the Morpho: Find Value Delta plug compares the two stored APRs to compute their difference and direction.
10·Set
From the delta result, [the value in slot "8.0"] is stored as current_apr_is_higher, a flag for which market's APR is greater.
11·Set
The magnitude of the difference, [the value in slot "8.1"], is saved as apr_delta.
12·Bubble
Bubbling <={9.0} surfaces current_apr_is_higher as an output of this plug.
13·Bubble
Finally, <={10.0} surfaces apr_delta as an output so callers can read the size of the gap.
On other protocols · 4