Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

oumar-fall
Copy link
Contributor

@oumar-fall oumar-fall commented Jan 28, 2025

First part of INTER-1822

This PR implements the util to compute accruedInterests on a vault, given it's current state

@oumar-fall oumar-fall requested a review from Rubilmax January 28, 2025 09:30
@oumar-fall oumar-fall self-assigned this Jan 28, 2025
Copy link

linear bot commented Jan 28, 2025

Copy link
Collaborator

@Rubilmax Rubilmax left a 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",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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

@oumar-fall
Copy link
Contributor Author

Formula is wrong

@oumar-fall oumar-fall closed this Jan 28, 2025
@oumar-fall oumar-fall deleted the feat/add-vault-interest-utils branch January 28, 2025 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants