-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lost assets (no share price decrease) #5
Conversation
b2acf97
to
db71fbe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that bad debt is not taken into account in the vault share pricing (using convertToAssets
as we do now to price ERC-4626 shares).
Which means that a vault with a lot of bad debt would have its shares overpriced, and a share holder could borrow almost "against nothing" if a morpho market uses those shares as collateral. (Other way to see this : someone who borrows against those shares wouldn't be liquidated if the vault occurred bad debt. And so bad debt would also occur on the market with shares as collateral)
So we should use new custom oracles to price MetaMorpho shares
… into feat/no-share-price-decrease-2
So to me there is no need to change the oracle at all. Although this should be noted somewhere in the docs: with the normal vault you just had to have a look at the potential future bad debt of a vault (=risk), and with this one you have to look at the current hole plus the potential future bad debt. |
The point is here:
Bad debt, if significant (as defined by the oracle), should be atomically taken into account otherwise lenders can be atomically drained |
So it would be an oracle returning zero if the relative bad debt exceeds a certain threshold and the normal price otherwise right? EDIT: for opening new positions, that makes sense, for liquidating no, because it means you can seize the collateral and repay nothing |
I guess it's a very relevant example of the benefit of separating the price used to open positions and the one used to close |
I would agree if we could say what would be the price used to close positions in that case. If not then there is still only one price. If we can have an oracle to close positions, then wouldn't it be a good candidate as an oracle to open positions ? |
This creates a difference in behavior between the two MM versions that has to be accounted for when using MM as a developer. I'm not sure what is gained to counterbalance that. edit: tried it here: #18 |
Co-authored-by: MathisGD <74971347+MathisGD@users.noreply.github.com> Signed-off-by: Adrien Husson <adhusson@gmail.com>
Co-authored-by: MathisGD <74971347+MathisGD@users.noreply.github.com> Signed-off-by: Adrien Husson <adhusson@gmail.com>
…on-bad-debt check lost asset increase after bad debt
restore NotEnoughLiquidity error on overwithdraw
Version of Metamorpho which does not realise bad debt.
The way it works is the following:
_accrueFees()
), compute the new totalAssets on morpho (sum of the assets on each cap>0 market) (now called "realTotalAssets").lostAssets
.Important notes:
_deposit
and_withdraw
, lastTotalAssets is updated "optimistically" meaning that it can think the vault thinks it has one more assets than in reality, which can turn into lostAsset after. (see Add missing tests #23)About the verification:
LostAssetsNoLink
assumes that Morpho is view (in order not to change the ghost variable sumBalances).LostAssetsLink
links the concrete implementation of Morpho (necessary to prove "lostAssets <= totalAssets")Other notes:
TODO: