@@ -5,13 +5,53 @@ import "./config/BaseTest.t.sol";
5
5
6
6
import { PoolLens } from "../PoolLens.sol " ;
7
7
import "../compound/ComptrollerInterface.sol " ;
8
+ import { JumpRateModel } from "../compound/JumpRateModel.sol " ;
8
9
9
10
contract PoolLensTest is BaseTest {
10
11
function testPolygonFPL () public debuggingOnly fork (POLYGON_MAINNET) {
11
12
PoolLens fpl = PoolLens (0xD7225110D8F419b0E8Ad0A536977965E62fB5769 );
12
13
fpl.getPoolAssetsWithData (IonicComptroller (0xB08A309eFBFFa41f36A06b2D0C9a4629749b17a2 ));
13
14
}
14
15
16
+ function testModeFPL () public debuggingOnly fork (MODE_MAINNET) {
17
+ IonicComptroller pool = IonicComptroller (0xFB3323E24743Caf4ADD0fDCCFB268565c0685556 );
18
+ // PoolLens fpl = PoolLens(0x611a68618412c2e15A36e3e59C0b979746d87AB8);
19
+ // PoolLens.PoolAsset[] memory datas = fpl.getPoolAssetsWithData(pool);
20
+ //
21
+ // emit log_named_uint("ionicFee", datas[0].ionicFee);
22
+ // emit log_named_uint("adminFee", datas[0].adminFee);
23
+
24
+ ICErc20[] memory markets = pool.getAllMarkets ();
25
+
26
+ for (uint256 i = 0 ; i < markets.length ; i++ ) {
27
+ uint256 totalUnderlyingSupplied = markets[i].getTotalUnderlyingSupplied ();
28
+ uint256 totalBorrows = markets[i].totalBorrows ();
29
+ uint256 totalReserves = markets[i].totalReserves ();
30
+ uint256 cash = markets[i].getCash ();
31
+
32
+ emit log ("" );
33
+ emit log (markets[i].symbol ());
34
+ emit log_named_uint ("totalUnderlyingSupplied " , totalUnderlyingSupplied);
35
+ emit log_named_uint ("totalBorrows " , totalBorrows);
36
+ emit log_named_uint ("totalReserves " , totalReserves);
37
+ emit log_named_uint ("cash " , cash);
38
+ emit log_named_uint ("reserves + fees " , cash + totalBorrows - totalUnderlyingSupplied);
39
+
40
+ JumpRateModel irm = JumpRateModel (markets[i].interestRateModel ());
41
+
42
+ emit log_named_uint ("blocksPerYear " , irm.blocksPerYear ());
43
+
44
+ emit log_named_uint (
45
+ "borrow rate per year " ,
46
+ irm.blocksPerYear () * irm.getBorrowRate (cash, totalBorrows, totalReserves)
47
+ );
48
+ emit log_named_uint (
49
+ "supply rate per year " ,
50
+ irm.blocksPerYear () * irm.getSupplyRate (cash, totalBorrows, totalReserves, 0.1e18 )
51
+ );
52
+ }
53
+ }
54
+
15
55
function testWhitelistsFPL () public debuggingOnly fork (BSC_CHAPEL) {
16
56
PoolLens fpl = PoolLens (0x604805B587C939042120D2e22398f299547A130c );
17
57
fpl.getSupplyCapsDataForPool (IonicComptroller (0x307BEc9d1368A459E9168fa6296C1e69025ab30f ));
0 commit comments