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

Do we still need the external accrueInterest #399

Closed
MathisGD opened this issue Aug 21, 2023 · 6 comments · Fixed by #405
Closed

Do we still need the external accrueInterest #399

MathisGD opened this issue Aug 21, 2023 · 6 comments · Fixed by #405
Assignees

Comments

@MathisGD
Copy link
Contributor

With #171 merged, do we still need this external function ?

https://github.com/morpho-labs/morpho-blue/blob/453c185ec94587143240ea234977509bdcc20d9f/src/Morpho.sol#L436-L441

@Rubilmax
Copy link
Contributor

Rubilmax commented Aug 21, 2023

#171 is to be used inside view contexts, while external accrueInterest avoids having to do the calculation twice in a non-view context (e.g. an ERC4626 on top when checking for maxWithdraw)

So I'm for keeping both

@MathisGD
Copy link
Contributor Author

MathisGD commented Aug 21, 2023

isn't maxWithdraw view ?

Edit: yes https://eips.ethereum.org/EIPS/eip-4626#maxwithdraw

Edit1: I agree that there might be some use-cases, but it might be a little bit niche

@Rubilmax
Copy link
Contributor

Rubilmax commented Aug 21, 2023

isn't maxWithdraw view ?

Yes, but you could want, upon withdraw, to override the default ERC4626's behavior by first accruing interest (optimistically), then calculate maxWithdraw with actual values (that are up-to-date)

It's a niche example I agree, can't we think of another similar which motivates keeping both?
It'll never be strictly necessary to have both, but I find it quite ok to have them both

@MathisGD
Copy link
Contributor Author

Yes, but you could want, upon withdraw, to override the default ERC4626's behavior by first accruing interest (optimistically), then calculate maxWithdraw with actual values (that are up-to-date)

in practice you would maxWithdraw the shares but ok you could

@MathisGD
Copy link
Contributor Author

@QGarchery is highlighting me that this function can be useful to make a contract to help feeReceiver withdrawMax (but literally useful to one person so I don't think it's worth it)

@MerlinEgalite
Copy link
Contributor

Discussed with @PaulFrambot, we're having a hard time to find a usecase for this function. So I think we should remove it.

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 a pull request may close this issue.

3 participants