What this does
This plug converts a Morpho borrow share balance into a loan-asset amount using the protocol's virtual-offset rounding. It asks the caller for borrow_shares, total_borrow_assets, and total_borrow_shares at execution time. It runs whenever those three figures are supplied, adding 1 to total assets and 1000000 to total shares before multiplying borrow_shares by virtual assets, dividing by virtual shares, and rounding up. Computing this by hand or against stale market totals yields a borrow-asset figure that misstates the debt owed.
Actions · 7







Related plugs · 8