Skip to content
This repository was archived by the owner on Dec 18, 2025. It is now read-only.

Commit e1c098d

Browse files
committed
fix: test
1 parent c93d91f commit e1c098d

1 file changed

Lines changed: 33 additions & 15 deletions

File tree

test-foundry/prod/aave-v2/TestLens.t.sol

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,59 @@ pragma solidity 0.8.13;
33

44
import "./setup/TestSetup.sol";
55

6-
contract TestBorrow is TestSetup {
6+
contract TestLens is TestSetup {
77
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
88
using WadRayMath for uint256;
99
using Math for uint256;
1010

11+
struct Vars {
12+
uint256 p2pSupplyIndex;
13+
uint256 p2pBorrowIndex;
14+
uint256 poolSupplyIndex;
15+
uint256 poolBorrowIndex;
16+
}
17+
1118
function testUpgradeLens() public {
1219
Lens lensImplV2 = new Lens(address(morpho));
1320

1421
address[] memory marketsCreated = lens.getAllMarkets();
22+
Vars[] memory expectedValues = new Vars[](marketsCreated.length);
23+
24+
vm.prank(proxyAdmin.owner());
25+
proxyAdmin.upgrade(lensProxy, address(lensImplV2));
1526

1627
for (uint256 i; i < marketsCreated.length; ++i) {
1728
address market = marketsCreated[i];
1829
if (market == aStEth) continue;
1930

2031
(
21-
uint256 p2pSupplyIndexBefore,
22-
uint256 p2pBorrowIndexBefore,
23-
uint256 poolSupplyIndexBefore,
24-
uint256 poolBorrowIndexBefore
32+
uint256 p2pSupplyIndex,
33+
uint256 p2pBorrowIndex,
34+
uint256 poolSupplyIndex,
35+
uint256 poolBorrowIndex
2536
) = lens.getIndexes(market);
2637

27-
vm.prank(proxyAdmin.owner());
28-
proxyAdmin.upgrade(lensProxy, address(lensImplV2));
38+
expectedValues[i].p2pSupplyIndex = p2pSupplyIndex;
39+
expectedValues[i].p2pBorrowIndex = p2pBorrowIndex;
40+
expectedValues[i].poolSupplyIndex = poolSupplyIndex;
41+
expectedValues[i].poolBorrowIndex = poolBorrowIndex;
42+
}
43+
44+
for (uint256 i; i < marketsCreated.length; ++i) {
45+
address market = marketsCreated[i];
46+
if (market == aStEth) continue;
2947

3048
(
31-
uint256 p2pSupplyIndexAfter,
32-
uint256 p2pBorrowIndexAfter,
33-
uint256 poolSupplyIndexAfter,
34-
uint256 poolBorrowIndexAfter
49+
uint256 p2pSupplyIndex,
50+
uint256 p2pBorrowIndex,
51+
uint256 poolSupplyIndex,
52+
uint256 poolBorrowIndex
3553
) = lens.getIndexes(market);
3654

37-
assertEq(p2pSupplyIndexAfter, p2pSupplyIndexBefore);
38-
assertEq(p2pBorrowIndexAfter, p2pBorrowIndexBefore);
39-
assertEq(poolSupplyIndexAfter, poolSupplyIndexBefore);
40-
assertEq(poolBorrowIndexAfter, poolBorrowIndexBefore);
55+
assertEq(expectedValues[i].p2pSupplyIndex, p2pSupplyIndex);
56+
assertEq(expectedValues[i].p2pBorrowIndex, p2pBorrowIndex);
57+
assertEq(expectedValues[i].poolSupplyIndex, poolSupplyIndex);
58+
assertEq(expectedValues[i].poolBorrowIndex, poolBorrowIndex);
4159
}
4260
}
4361
}

0 commit comments

Comments
 (0)