Add Credit Market AMO Strategy#2927
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2927 +/- ##
==========================================
+ Coverage 44.63% 45.37% +0.74%
==========================================
Files 110 112 +2
Lines 4920 4989 +69
Branches 1362 1381 +19
==========================================
+ Hits 2196 2264 +68
- Misses 2721 2722 +1
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
naddison36
left a comment
There was a problem hiding this comment.
A simple and clean implementation. Well done.
I think we need to decide if principal and accruedYield should be the true values or we just document that these aren't accurate as the netMinted amount will be less than the true principal amount once a burn has been done.
| } | ||
|
|
||
| /// @notice The principal, ie net OToken minted into the position. | ||
| function principal() external view returns (uint256) { |
There was a problem hiding this comment.
nit: is this view function adding value over the already public netMinted storage variable?
Also, netMinted may drift below the true principal once accrued interest is burned (redeemAndBurn lowers it by the amount withdrawn, floored at 0).
There was a problem hiding this comment.
I removed principal and another duplicate method. Re: the drift, I changed how the strategy behaves: it now burns through the yield/interest tokens first before it eats into the printed tokens.
So, if there's 100 OUSD minted and an interest of 10 OUSD is earned on top of it, when the strategist burns 50 OUSD, netMinted will be 60 OUSD (instead of 50 OUSD with the original implementation): f5d87df
| } | ||
|
|
||
| /// @notice Interest accrued on the position above the principal, in OToken units. | ||
| function accruedYield() external view returns (uint256) { |
There was a problem hiding this comment.
this won't be the true accrued yield after yielded oTokens are burned leaving netMinted not reflecting the true principal amount.
There was a problem hiding this comment.
Fixed by changing the behaviour to burn through yield first: f5d87df
Code Changes
Adds CreditMarketAMOStrategy, an AMO that mints an OToken and supplies it as the sole lender into a deposit-gated Morpho Vault V2 ("credit vault"). Borrowers post their own collateral and borrow the
OToken; the interest they pay grows the strategy's position and reaches OToken holders as rebase yield. The strategy only ever mints OToken in and burns OToken out — it never touches the Vault's backing
asset.
The contract is generic: the OToken, hard asset, and credit vault are set at deploy time, so one implementation serves OUSD or OETH. Wired up for OUSD first.
Key design decisions
only on-chain bound and must be sized below the protocol's real redeemable liquidity.