@gearbox-protocol/periphery-v3 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
pragma solidity ^0.8.10;
|
|
5
5
|
pragma experimental ABIEncoderV2;
|
|
6
6
|
|
|
7
|
+
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
|
|
8
|
+
|
|
7
9
|
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
8
10
|
import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol";
|
|
9
11
|
|
|
@@ -177,11 +179,12 @@ contract DataCompressorV2_10 is IDataCompressorV2_10, ContractsRegisterTrait, Li
|
|
|
177
179
|
{
|
|
178
180
|
result.pool = creditManagerV2.pool();
|
|
179
181
|
PoolService pool = PoolService(result.pool);
|
|
180
|
-
// result.canBorrow =;
|
|
181
182
|
result.baseBorrowRate = pool.borrowAPY_RAY();
|
|
182
|
-
// TODO: add limit calculation
|
|
183
|
-
result.availableToBorrow = pool.creditManagersCanBorrow(_creditManager) ? pool.availableLiquidity() : 0;
|
|
184
183
|
|
|
184
|
+
(uint128 currentTotalDebt, uint128 totalDebtLimit) = creditFacade.totalDebt();
|
|
185
|
+
result.availableToBorrow = pool.creditManagersCanBorrow(_creditManager)
|
|
186
|
+
? Math.min(pool.availableLiquidity(), totalDebtLimit - currentTotalDebt)
|
|
187
|
+
: 0;
|
|
185
188
|
result.lirm = getLIRMData(address(pool.interestRateModel()));
|
|
186
189
|
}
|
|
187
190
|
|
|
@@ -244,8 +247,7 @@ contract DataCompressorV2_10 is IDataCompressorV2_10, ContractsRegisterTrait, Li
|
|
|
244
247
|
|
|
245
248
|
/// @dev Returns PoolData for a particular pool
|
|
246
249
|
/// @param _pool Pool address
|
|
247
|
-
|
|
248
|
-
// TODO: add interestRateModel address / data
|
|
250
|
+
|
|
249
251
|
function getPoolData(address _pool) public view registeredPoolOnly(_pool) returns (PoolData memory result) {
|
|
250
252
|
PoolService pool = PoolService(_pool);
|
|
251
253
|
|
package/package.json
CHANGED