-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat(VaultUtils): add accruedInterest util #256
Conversation
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.
If vault is empty, accruedInterest
is almost zero
toAssets( | ||
totalSupply, | ||
{ totalAssets: 0n, totalSupply: 0n, decimalsOffset }, | ||
"Down", |
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.
"Down", |
Optional: this is the default behavior and it sematnically corresponds to what's expected: the canonical assets value of all shares
@@ -293,6 +294,13 @@ export class AccrualVault extends Vault implements IAccrualVault { | |||
return MathLib.wMulDown(this.apy, MathLib.WAD - this.fee); | |||
} | |||
|
|||
/** | |||
* Total interest paid by borrowers, increased with unrealized bad debt. |
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.
* Total interest paid by borrowers, increased with unrealized bad debt. | |
* Total interest paid by borrowers to this vault plus unrealized bad debt. | |
* In the case of MetaMorphoV1.1 vaults, also contains realized bad debt. |
Or we pass totalAssets - lostAssets
to accruedInterest
Formula is wrong |
First part of INTER-1822
This PR implements the util to compute accruedInterests on a vault, given it's current state