This repository was archived by the owner on Dec 18, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ abstract contract IndexesLens is LensStorage {
179179 {
180180 marketParameters = morpho.marketParameters (_poolToken);
181181
182- if (! _updated || block . number == _lastPoolIndexes.lastUpdateBlockNumber ) {
182+ if (! _updated) {
183183 return (
184184 morpho.p2pSupplyIndex (_poolToken),
185185 morpho.p2pBorrowIndex (_poolToken),
Original file line number Diff line number Diff line change @@ -74,10 +74,9 @@ contract TestLens is TestSetup {
7474 uint256 amount = 10_000 ether ;
7575 uint256 toBorrow = amount / 2 ;
7676
77- borrower1.approve (dai, amount );
77+ borrower1.approve (dai, type ( uint256 ).max );
7878 indexes.index1 = ICToken (cDai).exchangeRateCurrent ();
7979 borrower1.supply (cDai, amount);
80- uint256 p2pBorrowIndex = morpho.p2pBorrowIndex (cDai);
8180 borrower1.borrow (cDai, toBorrow);
8281
8382 indexes.index2 = ICToken (cDai).exchangeRateCurrent ();
@@ -94,6 +93,9 @@ contract TestLens is TestSetup {
9493
9594 uint256 total;
9695
96+ // To update p2p indexes on Morpho (they can change inside of a block because the poolSupplyIndex can change due to rounding errors).
97+ borrower1.supply (cDai, 1 );
98+ uint256 p2pBorrowIndex = morpho.p2pBorrowIndex (cDai);
9799 {
98100 uint256 onPool = amount.div (indexes.index1);
99101 uint256 matchedInP2P = toBorrow.div (morpho.p2pSupplyIndex (cDai));
You can’t perform that action at this time.
0 commit comments