You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 18, 2025. It is now read-only.
When the Lens computes the virtual rate that you would get from entering a position, the p2p amount is not updated. This leads to a rare case where there is an error on the rate.
Here is a small recap on Aave-v2:
the function getNextUserBorrowRatePerYear is supposed to return the rate that you would get if you did only one loop of matching, resulting in a given matched amount. To do that it calls the function _getRatesPerYear with that matched amount. This should be the same as calling borrow, doing only one loop of matching and returning the rate as per the testNextRateShouldMatchRateAfterInteraction.
the function _getRatesPerYear takes into account the matched amount to compute the pool rates, because those depend on the utilization, so they depend on the amount supplied on pool and borrowed on pool.
the function _getRatesPerYear does not take into account the matched amount to compute the p2p rate when calling computeP2PBorrowRatePerYear. This is the reason of the bug. The p2p amount should be updated with the matched amount, because it is used to compute the share of the delta.