
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
The plug opens by declaring current_market, a parameter the caller fills in at execution time.
2·Take
Next it declares target_market, a second caller-supplied parameter.
3·Get borrow rate
Reading the current_market value in slot 0.0, this step fetches that Morpho Blue market's borrow rate as a per-second rate and an APY.
4·Use
Here it composes the Morpho: Get Borrow APR plug to convert that reading into an APR.
5·Set
The APR result in slot 3.0 is stored to the variable current_apr for later reference.
6·Get borrow rate
Turning to the target_market value in slot 1.0, it reads that market's borrow rate the same way.
7·Use
Again it composes Morpho: Get Borrow APR to derive an APR from that second reading.
8·Set
This target APR from slot 6.0 is assigned to the variable target_apr.
9·Use
Using the Morpho: Find Value Delta plug, it compares current_apr against target_apr.
10·Set
From slot 8.0 it saves current_apr_is_higher, the flag indicating which market's APR is greater.
11·Set
From slot 8.1 it saves apr_delta, the difference between the two APRs.
12·Bubble
Surfacing the value in slot 9.0, it bubbles current_apr_is_higher as an output.
13·Bubble
Finally it bubbles the value in slot 10.0 as the output apr_delta.
On other protocols · 3