mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
feat: added new rates fields
This commit is contained in:
parent
3f9ab86592
commit
f0fe26e904
|
@ -17,6 +17,7 @@ import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
|
||||||
import {IChainlinkAggregator} from '../interfaces/IChainlinkAggregator.sol';
|
import {IChainlinkAggregator} from '../interfaces/IChainlinkAggregator.sol';
|
||||||
import {DefaultReserveInterestRateStrategy} from '../protocol/lendingpool/DefaultReserveInterestRateStrategy.sol';
|
import {DefaultReserveInterestRateStrategy} from '../protocol/lendingpool/DefaultReserveInterestRateStrategy.sol';
|
||||||
import {IERC20DetailedBytes} from './interfaces/IERC20DetailedBytes.sol';
|
import {IERC20DetailedBytes} from './interfaces/IERC20DetailedBytes.sol';
|
||||||
|
import {ILendingRateOracle} from '../interfaces/ILendingRateOracle.sol';
|
||||||
|
|
||||||
contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
|
contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
|
||||||
using WadRayMath for uint256;
|
using WadRayMath for uint256;
|
||||||
|
@ -36,24 +37,23 @@ contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
|
||||||
marketReferenceCurrencyPriceInUsdProxyAggregator = _marketReferenceCurrencyPriceInUsdProxyAggregator;
|
marketReferenceCurrencyPriceInUsdProxyAggregator = _marketReferenceCurrencyPriceInUsdProxyAggregator;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getInterestRateStrategySlopes(DefaultReserveInterestRateStrategy interestRateStrategy)
|
function getInterestRateStrategySlopes(DefaultReserveInterestRateStrategy interestRateStrategy, ILendingPoolAddressesProvider provider, address reserve)
|
||||||
internal
|
internal
|
||||||
view
|
view
|
||||||
returns (
|
returns(InterestRates memory)
|
||||||
uint256,
|
|
||||||
uint256,
|
|
||||||
uint256,
|
|
||||||
uint256,
|
|
||||||
uint256
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return (
|
InterestRates memory interestRates;
|
||||||
interestRateStrategy.variableRateSlope1(),
|
interestRates.variableRateSlope1 = interestRateStrategy.variableRateSlope1();
|
||||||
interestRateStrategy.variableRateSlope2(),
|
interestRates.variableRateSlope2 = interestRateStrategy.variableRateSlope2();
|
||||||
interestRateStrategy.stableRateSlope1(),
|
interestRates.stableRateSlope1 = interestRateStrategy.stableRateSlope1();
|
||||||
interestRateStrategy.stableRateSlope2(),
|
interestRates.stableRateSlope2 = interestRateStrategy.stableRateSlope2();
|
||||||
interestRateStrategy.OPTIMAL_UTILIZATION_RATE()
|
interestRates.baseVariableBorrowRate = interestRateStrategy.baseVariableBorrowRate();
|
||||||
);
|
interestRates.optimalUsageRatio = interestRateStrategy.OPTIMAL_UTILIZATION_RATE();
|
||||||
|
|
||||||
|
interestRates.baseStableBorrowRate = ILendingRateOracle(provider.getLendingRateOracle())
|
||||||
|
.getMarketBorrowRate(reserve);
|
||||||
|
|
||||||
|
return interestRates;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getReservesList(ILendingPoolAddressesProvider provider)
|
function getReservesList(ILendingPoolAddressesProvider provider)
|
||||||
|
@ -133,15 +133,18 @@ contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
|
||||||
reserveData.stableBorrowRateEnabled
|
reserveData.stableBorrowRateEnabled
|
||||||
) = baseData.configuration.getFlagsMemory();
|
) = baseData.configuration.getFlagsMemory();
|
||||||
reserveData.usageAsCollateralEnabled = reserveData.baseLTVasCollateral != 0;
|
reserveData.usageAsCollateralEnabled = reserveData.baseLTVasCollateral != 0;
|
||||||
(
|
|
||||||
reserveData.variableRateSlope1,
|
InterestRates memory interestRates = getInterestRateStrategySlopes(
|
||||||
reserveData.variableRateSlope2,
|
DefaultReserveInterestRateStrategy(reserveData.interestRateStrategyAddress), provider, reserveData.underlyingAsset
|
||||||
reserveData.stableRateSlope1,
|
|
||||||
reserveData.stableRateSlope2,
|
|
||||||
reserveData.optimalUsageRatio
|
|
||||||
) = getInterestRateStrategySlopes(
|
|
||||||
DefaultReserveInterestRateStrategy(reserveData.interestRateStrategyAddress)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
reserveData.variableRateSlope1 = interestRates.variableRateSlope1;
|
||||||
|
reserveData.variableRateSlope2 = interestRates.variableRateSlope2;
|
||||||
|
reserveData.stableRateSlope1 = interestRates.stableRateSlope1;
|
||||||
|
reserveData.stableRateSlope2 = interestRates.stableRateSlope2;
|
||||||
|
reserveData.baseStableBorrowRate = interestRates.baseStableBorrowRate;
|
||||||
|
reserveData.baseVariableBorrowRate = interestRates.baseVariableBorrowRate;
|
||||||
|
reserveData.optimalUsageRatio = interestRates.optimalUsageRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseCurrencyInfo memory baseCurrencyInfo;
|
BaseCurrencyInfo memory baseCurrencyInfo;
|
||||||
|
|
|
@ -5,6 +5,16 @@ pragma experimental ABIEncoderV2;
|
||||||
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
|
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
|
||||||
|
|
||||||
interface IUiPoolDataProviderV3 {
|
interface IUiPoolDataProviderV3 {
|
||||||
|
struct InterestRates {
|
||||||
|
uint256 variableRateSlope1;
|
||||||
|
uint256 variableRateSlope2;
|
||||||
|
uint256 stableRateSlope1;
|
||||||
|
uint256 stableRateSlope2;
|
||||||
|
uint256 baseStableBorrowRate;
|
||||||
|
uint256 baseVariableBorrowRate;
|
||||||
|
uint256 optimalUsageRatio;
|
||||||
|
}
|
||||||
|
|
||||||
struct AggregatedReserveData {
|
struct AggregatedReserveData {
|
||||||
address underlyingAsset;
|
address underlyingAsset;
|
||||||
string name;
|
string name;
|
||||||
|
@ -42,6 +52,8 @@ interface IUiPoolDataProviderV3 {
|
||||||
uint256 variableRateSlope2;
|
uint256 variableRateSlope2;
|
||||||
uint256 stableRateSlope1;
|
uint256 stableRateSlope1;
|
||||||
uint256 stableRateSlope2;
|
uint256 stableRateSlope2;
|
||||||
|
uint256 baseStableBorrowRate;
|
||||||
|
uint256 baseVariableBorrowRate;
|
||||||
uint256 optimalUsageRatio;
|
uint256 optimalUsageRatio;
|
||||||
// v3
|
// v3
|
||||||
bool isPaused;
|
bool isPaused;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user