-
Notifications
You must be signed in to change notification settings - Fork 60
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
refactor(interests): expose accrued interests and fee #138
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.
EDIT: actually, just expose extsload with arrays, just like UniV4, and this topic can be closed.
Maybe we can do that and write some helpers in the doc help developers?
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.
I'm also ok with this solution
I'm for adding a getter like this. It seems like the one of uniswap is not appropriate because it only allows to retrieve contiguous storage (and |
Done in #147! I gave my POV there, but TLDR: I may prefer this solution even though it complexifies Blue, because I believe it has a way higher business value for integrators (including MetaMorpho vaults). |
…ue into refactor/accrue-interests
The base branch was changed.
No it's more like 4 x 100 gas |
#171 seems to better do the job |
Well merge conflicts are not really nice. I'll redo the PR |
accrueInterests
public ? #129The goal of this PR is to let integrators be able to query the amount of hypothetically accrued interests (and corresponding fee shares) upon interaction. In solidity, it would look like:
Changes are significant and we lose minimalism, so I am ok to leave the protocol without this "hypothetical interests" getter. Integrators have the possibility to query independently query the variables necessary for this calculation, but it would cost them more than with the corresponding getter built into the protocol, because of the cost of CALLs.
The difference of gas cost between a built-in getter and a reproduced calculation would approximately be:
totalBorrow
+lastUpdate
) if only interested in the borrow side (don't need to calculate the fee)totalSupply
+totalBorrow
+lastUpdate
+fee
+totalSupplyShares
) if interested in the supply sideTo address this issue, we could expose a getter for all information related to a state. It could save 4 CALLs in the worst case, which approximately represents 20k gas.
EDIT: actually, just expose
extsload
with arrays, just like UniV4, and this topic can be closed.