@@ -110,12 +110,7 @@ contract PoolLens is Initializable {
110
110
*/
111
111
function getPublicPoolsWithData ()
112
112
external
113
- returns (
114
- uint256 [] memory ,
115
- PoolDirectory.Pool[] memory ,
116
- IonicPoolData[] memory ,
117
- bool [] memory
118
- )
113
+ returns (uint256 [] memory , PoolDirectory.Pool[] memory , IonicPoolData[] memory , bool [] memory )
119
114
{
120
115
(uint256 [] memory indexes , PoolDirectory.Pool[] memory publicPools ) = directory.getPublicPools ();
121
116
(IonicPoolData[] memory data , bool [] memory errored ) = getPoolsData (publicPools);
@@ -127,15 +122,9 @@ contract PoolLens is Initializable {
127
122
* @dev This function is not designed to be called in a transaction: it is too gas-intensive.
128
123
* Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.
129
124
*/
130
- function getPublicPoolsByVerificationWithData (bool whitelistedAdmin )
131
- external
132
- returns (
133
- uint256 [] memory ,
134
- PoolDirectory.Pool[] memory ,
135
- IonicPoolData[] memory ,
136
- bool [] memory
137
- )
138
- {
125
+ function getPublicPoolsByVerificationWithData (
126
+ bool whitelistedAdmin
127
+ ) external returns (uint256 [] memory , PoolDirectory.Pool[] memory , IonicPoolData[] memory , bool [] memory ) {
139
128
(uint256 [] memory indexes , PoolDirectory.Pool[] memory publicPools ) = directory.getPublicPoolsByVerification (
140
129
whitelistedAdmin
141
130
);
@@ -148,15 +137,9 @@ contract PoolLens is Initializable {
148
137
* @dev This function is not designed to be called in a transaction: it is too gas-intensive.
149
138
* Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.
150
139
*/
151
- function getPoolsByAccountWithData (address account )
152
- external
153
- returns (
154
- uint256 [] memory ,
155
- PoolDirectory.Pool[] memory ,
156
- IonicPoolData[] memory ,
157
- bool [] memory
158
- )
159
- {
140
+ function getPoolsByAccountWithData (
141
+ address account
142
+ ) external returns (uint256 [] memory , PoolDirectory.Pool[] memory , IonicPoolData[] memory , bool [] memory ) {
160
143
(uint256 [] memory indexes , PoolDirectory.Pool[] memory accountPools ) = directory.getPoolsByAccount (account);
161
144
(IonicPoolData[] memory data , bool [] memory errored ) = getPoolsData (accountPools);
162
145
return (indexes, accountPools, data, errored);
@@ -167,15 +150,9 @@ contract PoolLens is Initializable {
167
150
* @dev This function is not designed to be called in a transaction: it is too gas-intensive.
168
151
* Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.
169
152
*/
170
- function getPoolsOIonicrWithData (address user )
171
- external
172
- returns (
173
- uint256 [] memory ,
174
- PoolDirectory.Pool[] memory ,
175
- IonicPoolData[] memory ,
176
- bool [] memory
177
- )
178
- {
153
+ function getPoolsOIonicrWithData (
154
+ address user
155
+ ) external returns (uint256 [] memory , PoolDirectory.Pool[] memory , IonicPoolData[] memory , bool [] memory ) {
179
156
(uint256 [] memory indexes , PoolDirectory.Pool[] memory userPools ) = directory.getPoolsOfUser (user);
180
157
(IonicPoolData[] memory data , bool [] memory errored ) = getPoolsData (userPools);
181
158
return (indexes, userPools, data, errored);
@@ -210,16 +187,9 @@ contract PoolLens is Initializable {
210
187
/**
211
188
* @notice Returns total supply balance (in ETH), total borrow balance (in ETH), underlying token addresses, and underlying token symbols of a Ionic pool.
212
189
*/
213
- function getPoolSummary (IonicComptroller comptroller )
214
- external
215
- returns (
216
- uint256 ,
217
- uint256 ,
218
- address [] memory ,
219
- string [] memory ,
220
- bool
221
- )
222
- {
190
+ function getPoolSummary (
191
+ IonicComptroller comptroller
192
+ ) external returns (uint256 , uint256 , address [] memory , string [] memory , bool ) {
223
193
uint256 totalBorrow = 0 ;
224
194
uint256 totalSupply = 0 ;
225
195
ICErc20[] memory cTokens = comptroller.getAllMarkets ();
@@ -359,7 +329,10 @@ contract PoolLens is Initializable {
359
329
return (detailedAssets);
360
330
}
361
331
362
- function getBorrowCapsPerCollateral (ICErc20 borrowedAsset , IonicComptroller comptroller )
332
+ function getBorrowCapsPerCollateral (
333
+ ICErc20 borrowedAsset ,
334
+ IonicComptroller comptroller
335
+ )
363
336
internal
364
337
view
365
338
returns (
@@ -448,7 +421,7 @@ contract PoolLens is Initializable {
448
421
uint256 [] memory supplyCapsPerAsset = new uint256 [](poolMarkets.length );
449
422
for (uint256 i = 0 ; i < poolMarkets.length ; i++ ) {
450
423
assets[i] = address (poolMarkets[i]);
451
- supplyCapsPerAsset[i] = comptroller.supplyCaps (assets[i]);
424
+ supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps (assets[i]);
452
425
}
453
426
454
427
return (assets, supplyCapsPerAsset);
@@ -458,23 +431,17 @@ contract PoolLens is Initializable {
458
431
* @notice returns the total supply cap for each asset in the pool and the total non-whitelist supplied assets
459
432
* @dev This function is not designed to be called in a transaction: it is too gas-intensive.
460
433
*/
461
- function getSupplyCapsDataForPool (IonicComptroller comptroller )
462
- public
463
- view
464
- returns (
465
- address [] memory ,
466
- uint256 [] memory ,
467
- uint256 [] memory
468
- )
469
- {
434
+ function getSupplyCapsDataForPool (
435
+ IonicComptroller comptroller
436
+ ) public view returns (address [] memory , uint256 [] memory , uint256 [] memory ) {
470
437
ICErc20[] memory poolMarkets = comptroller.getAllMarkets ();
471
438
472
439
address [] memory assets = new address [](poolMarkets.length );
473
440
uint256 [] memory supplyCapsPerAsset = new uint256 [](poolMarkets.length );
474
441
uint256 [] memory nonWhitelistedTotalSupply = new uint256 [](poolMarkets.length );
475
442
for (uint256 i = 0 ; i < poolMarkets.length ; i++ ) {
476
443
assets[i] = address (poolMarkets[i]);
477
- supplyCapsPerAsset[i] = comptroller.supplyCaps (assets[i]);
444
+ supplyCapsPerAsset[i] = comptroller.effectiveSupplyCaps (assets[i]);
478
445
uint256 assetTotalSupplied = poolMarkets[i].getTotalUnderlyingSupplied ();
479
446
uint256 whitelistedSuppliersSupply = comptroller.getWhitelistedSuppliersSupply (assets[i]);
480
447
if (whitelistedSuppliersSupply >= assetTotalSupplied) nonWhitelistedTotalSupply[i] = 0 ;
@@ -488,7 +455,9 @@ contract PoolLens is Initializable {
488
455
* @notice returns the total borrow cap and the per collateral borrowing cap/blacklist for the asset
489
456
* @dev This function is not designed to be called in a transaction: it is too gas-intensive.
490
457
*/
491
- function getBorrowCapsForAsset (ICErc20 asset )
458
+ function getBorrowCapsForAsset (
459
+ ICErc20 asset
460
+ )
492
461
public
493
462
view
494
463
returns (
@@ -500,14 +469,16 @@ contract PoolLens is Initializable {
500
469
{
501
470
IonicComptroller comptroller = IonicComptroller (asset.comptroller ());
502
471
(collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral (asset, comptroller);
503
- totalBorrowCap = comptroller.borrowCaps (address (asset));
472
+ totalBorrowCap = comptroller.effectiveBorrowCaps (address (asset));
504
473
}
505
474
506
475
/**
507
476
* @notice returns the total borrow cap, the per collateral borrowing cap/blacklist for the asset and the total non-whitelist borrows
508
477
* @dev This function is not designed to be called in a transaction: it is too gas-intensive.
509
478
*/
510
- function getBorrowCapsDataForAsset (ICErc20 asset )
479
+ function getBorrowCapsDataForAsset (
480
+ ICErc20 asset
481
+ )
511
482
public
512
483
view
513
484
returns (
@@ -520,7 +491,7 @@ contract PoolLens is Initializable {
520
491
{
521
492
IonicComptroller comptroller = IonicComptroller (asset.comptroller ());
522
493
(collateral, borrowCapsPerCollateral, collateralBlacklisted) = getBorrowCapsPerCollateral (asset, comptroller);
523
- totalBorrowCap = comptroller.borrowCaps (address (asset));
494
+ totalBorrowCap = comptroller.effectiveBorrowCaps (address (asset));
524
495
uint256 totalBorrows = asset.totalBorrowsCurrent ();
525
496
uint256 whitelistedBorrowersBorrows = comptroller.getWhitelistedBorrowersBorrows (address (asset));
526
497
if (whitelistedBorrowersBorrows >= totalBorrows) nonWhitelistedTotalBorrows = 0 ;
@@ -532,11 +503,9 @@ contract PoolLens is Initializable {
532
503
* Note that the whitelist does not have to be enforced.
533
504
* @dev This function is not designed to be called in a transaction: it is too gas-intensive.
534
505
*/
535
- function getWhitelistedPoolsByAccount (address account )
536
- public
537
- view
538
- returns (uint256 [] memory , PoolDirectory.Pool[] memory )
539
- {
506
+ function getWhitelistedPoolsByAccount (
507
+ address account
508
+ ) public view returns (uint256 [] memory , PoolDirectory.Pool[] memory ) {
540
509
(, PoolDirectory.Pool[] memory pools ) = directory.getActivePools ();
541
510
uint256 arrayLength = 0 ;
542
511
@@ -569,15 +538,9 @@ contract PoolLens is Initializable {
569
538
* @dev This function is not designed to be called in a transaction: it is too gas-intensive.
570
539
* Ideally, we can add the `view` modifier, but many cToken functions potentially modify the state.
571
540
*/
572
- function getWhitelistedPoolsByAccountWithData (address account )
573
- external
574
- returns (
575
- uint256 [] memory ,
576
- PoolDirectory.Pool[] memory ,
577
- IonicPoolData[] memory ,
578
- bool [] memory
579
- )
580
- {
541
+ function getWhitelistedPoolsByAccountWithData (
542
+ address account
543
+ ) external returns (uint256 [] memory , PoolDirectory.Pool[] memory , IonicPoolData[] memory , bool [] memory ) {
581
544
(uint256 [] memory indexes , PoolDirectory.Pool[] memory accountPools ) = getWhitelistedPoolsByAccount (account);
582
545
(IonicPoolData[] memory data , bool [] memory errored ) = getPoolsData (accountPools);
583
546
return (indexes, accountPools, data, errored);
0 commit comments