Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: complete interface & use inheritdoc #763

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
163d3e1
feat: complete interface & use inheritdoc
sakulstra Dec 9, 2022
cbd8a14
Added missing functions on IReserveInterestRateStrategy and inheritdo…
eboadom Dec 11, 2022
6db9764
fix: added missing overrides, docs for constructor and added ADDRESSE…
sendra Dec 13, 2022
df4baac
fix: sepparated interest rate strategy interface into default and rat…
sendra Dec 13, 2022
9fb81c5
fix: added visibility to false rule
sendra Dec 13, 2022
cafa9f7
Update contracts/misc/AaveProtocolDataProvider.sol
sendra Dec 13, 2022
a0de696
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
d2db42a
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
4ce4a31
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
929e5da
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
396f8dd
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
3dd6753
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
2bfeee2
fix: minor fixes
sendra Dec 13, 2022
42937fc
fix: merged conflicts
sendra Dec 13, 2022
69e3df5
fix: fixed natspec. Fixed import order
sendra Dec 13, 2022
f1775c0
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
6f07e6b
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
fe7ea21
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
db16ed8
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
4c67dbe
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
a9bc6c7
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
f5c6095
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
557c8cb
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
488f774
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
7584a85
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
740c0d7
Update contracts/interfaces/IDefaultInterestRateStrategy.sol
sendra Dec 13, 2022
01aac16
Apply suggestions from code review
sendra Dec 13, 2022
fd2ec63
Apply suggestions from code review
sendra Dec 13, 2022
13ec16d
fix: fixed correct import order
sendra Dec 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions contracts/interfaces/IDefaultInterestRateStrategy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;

import {IReserveInterestRateStrategy} from './IReserveInterestRateStrategy.sol';
import {IPoolAddressesProvider} from './IPoolAddressesProvider.sol';

/**
* @title IDefaultInterestRateStrategy
* @author Aave
* @notice Default Interface for the calculation of the interest rates
sendra marked this conversation as resolved.
Show resolved Hide resolved
*/
interface IDefaultInterestRateStrategy is IReserveInterestRateStrategy {
/**
miguelmtzinf marked this conversation as resolved.
Show resolved Hide resolved
* @dev This constant represents the usage ratio at which the pool aims to obtain most competitive borrow rates.
* Expressed in ray
*/
function OPTIMAL_USAGE_RATIO() external view returns (uint256);

/**
* @dev This constant represents the optimal stable debt to total debt ratio of the reserve.
* Expressed in ray
*/
function OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO() external view returns (uint256);

/**
* @dev This constant represents the excess usage ratio above the optimal. It's always equal to
* 1-optimal usage ratio. Added as a constant here for gas optimizations.
* Expressed in ray
*/
function MAX_EXCESS_USAGE_RATIO() external view returns (uint256);

/**
* @dev This constant represents the excess stable debt ratio above the optimal. It's always equal to
* 1-optimal stable to total debt ratio. Added as a constant here for gas optimizations.
* Expressed in ray
*/
function MAX_EXCESS_STABLE_TO_TOTAL_DEBT_RATIO() external view returns (uint256);

/**
* @dev Returns the address for the PoolAddressesProvider contract.
*/
function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider);

/**
* @notice Returns the variable rate slope below optimal usage ratio
* @dev Its the variable rate when usage ratio > 0 and <= OPTIMAL_USAGE_RATIO
sendra marked this conversation as resolved.
Show resolved Hide resolved
* @return The variable rate slope
sendra marked this conversation as resolved.
Show resolved Hide resolved
*/
function getVariableRateSlope1() external view returns (uint256);

/**
* @notice Returns the variable rate slope above optimal usage ratio
* @dev Its the variable rate when usage ratio > OPTIMAL_USAGE_RATIO
sendra marked this conversation as resolved.
Show resolved Hide resolved
* @return The variable rate slope
sendra marked this conversation as resolved.
Show resolved Hide resolved
*/
function getVariableRateSlope2() external view returns (uint256);

/**
* @notice Returns the stable rate slope below optimal usage ratio
* @dev Its the stable rate when usage ratio > 0 and <= OPTIMAL_USAGE_RATIO
sendra marked this conversation as resolved.
Show resolved Hide resolved
* @return The stable rate slope
sendra marked this conversation as resolved.
Show resolved Hide resolved
*/
function getStableRateSlope1() external view returns (uint256);

/**
* @notice Returns the stable rate slope above optimal usage ratio
* @dev Its the variable rate when usage ratio > OPTIMAL_USAGE_RATIO
sendra marked this conversation as resolved.
Show resolved Hide resolved
* @return The stable rate slope
sendra marked this conversation as resolved.
Show resolved Hide resolved
*/
function getStableRateSlope2() external view returns (uint256);

/**
* @notice Returns the stable rate excess offset
* @dev An additional premium applied to the stable when stable debt > OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO
sendra marked this conversation as resolved.
Show resolved Hide resolved
* @return The stable rate excess offset
sendra marked this conversation as resolved.
Show resolved Hide resolved
*/
function getStableRateExcessOffset() external view returns (uint256);

/**
* @notice Returns the base stable borrow rate
* @return The base stable borrow rate
sendra marked this conversation as resolved.
Show resolved Hide resolved
*/
function getBaseStableBorrowRate() external view returns (uint256);

/**
* @notice Returns the base variable borrow rate
* @return The base variable borrow rate, expressed in ray
*/
function getBaseVariableBorrowRate() external view returns (uint256);

/**
* @notice Returns the maximum variable borrow rate
* @return The maximum variable borrow rate, expressed in ray
*/
function getMaxVariableBorrowRate() external view returns (uint256);
}
185 changes: 182 additions & 3 deletions contracts/interfaces/IPoolDataProvider.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,123 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;

import { IPoolAddressesProvider } from './IPoolAddressesProvider.sol';

interface IPoolDataProvider {
sendra marked this conversation as resolved.
Show resolved Hide resolved
struct TokenData {
string symbol;
address tokenAddress;
}

/**
* @notice Returns the address for the PoolAddressesProvider contract.
* @return The address for the PoolAddressesProvider contract
*/
function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider);

/**
* @notice Returns the list of the existing reserves in the pool.
* @dev Handling MKR and ETH in a different way since they do not have standard `symbol` functions.
* @return The list of reserves, pairs of symbols and addresses
*/
function getAllReservesTokens() external view returns (TokenData[] memory);

/**
* @notice Returns the list of the existing ATokens in the pool.
* @return The list of ATokens, pairs of symbols and addresses
*/
function getAllATokens() external view returns (TokenData[] memory);

/**
* @notice Returns the configuration data of the reserve
* @dev Not returning borrow and supply caps for compatibility, nor pause flag
* @param asset The address of the underlying asset of the reserve
* @return decimals The number of decimals of the reserve
* @return ltv The ltv of the reserve
* @return liquidationThreshold The liquidationThreshold of the reserve
* @return liquidationBonus The liquidationBonus of the reserve
* @return reserveFactor The reserveFactor of the reserve
* @return usageAsCollateralEnabled True if the usage as collateral is enabled, false otherwise
* @return borrowingEnabled True if borrowing is enabled, false otherwise
* @return stableBorrowRateEnabled True if stable rate borrowing is enabled, false otherwise
* @return isActive True if it is active, false otherwise
* @return isFrozen True if it is frozen, false otherwise
*/
function getReserveConfigurationData(address asset)
external
view
returns (
uint256 decimals,
uint256 ltv,
uint256 liquidationThreshold,
uint256 liquidationBonus,
uint256 reserveFactor,
bool usageAsCollateralEnabled,
bool borrowingEnabled,
bool stableBorrowRateEnabled,
bool isActive,
bool isFrozen
);

/**
* Returns the efficiency mode category of the reserve
sendra marked this conversation as resolved.
Show resolved Hide resolved
* @param asset The address of the underlying asset of the reserve
* @return The eMode id of the reserve
*/
function getReserveEModeCategory(address asset) external view returns (uint256);

/**
* @notice Returns the caps parameters of the reserve
* @param asset The address of the underlying asset of the reserve
* @return borrowCap The borrow cap of the reserve
* @return supplyCap The supply cap of the reserve
**/
function getReserveCaps(address asset)
external
view
returns (uint256 borrowCap, uint256 supplyCap);

/**
* @notice Returns if the pool is paused
* @param asset The address of the underlying asset of the reserve
* @return isPaused True if the pool is paused, false otherwise
*/
function getPaused(address asset) external view returns (bool isPaused);

/**
* @notice Returns the siloed borrowing flag
* @param asset The address of the underlying asset of the reserve
* @return True if the asset is siloed for borrowing
*/
function getSiloedBorrowing(address asset) external view returns (bool);

/**
* @notice Returns the protocol fee on the liquidation bonus
* @param asset The address of the underlying asset of the reserve
* @return The protocol fee on liquidation
*/
function getLiquidationProtocolFee(address asset) external view returns (uint256);

/**
* @notice Returns the unbacked mint cap of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The unbacked mint cap of the reserve
*/
function getUnbackedMintCap(address asset) external view returns (uint256);

/**
* @notice Returns the debt ceiling of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The debt ceiling of the reserve
*/
function getDebtCeiling(address asset) external view returns (uint256);

/**
* @notice Returns the debt ceiling decimals
* @return The debt ceiling decimals
*/
function getDebtCeilingDecimals() external pure returns (uint256);

/**
* @notice Returns the reserve data
* @param asset The address of the underlying asset of the reserve
Expand All @@ -17,7 +133,7 @@ interface IPoolDataProvider {
* @return liquidityIndex The liquidity index of the reserve
* @return variableBorrowIndex The variable borrow index of the reserve
* @return lastUpdateTimestamp The timestamp of the last update of the reserve
**/
*/
function getReserveData(address asset)
external
view
Expand All @@ -40,13 +156,76 @@ interface IPoolDataProvider {
* @notice Returns the total supply of aTokens for a given asset
* @param asset The address of the underlying asset of the reserve
* @return The total supply of the aToken
**/
*/
function getATokenTotalSupply(address asset) external view returns (uint256);

/**
* @notice Returns the total debt for a given asset
* @param asset The address of the underlying asset of the reserve
* @return The total debt for asset
**/
*/
function getTotalDebt(address asset) external view returns (uint256);

/**
* @notice Returns the user data in a reserve
* @param asset The address of the underlying asset of the reserve
* @param user The address of the user
* @return currentATokenBalance The current AToken balance of the user
* @return currentStableDebt The current stable debt of the user
* @return currentVariableDebt The current variable debt of the user
* @return principalStableDebt The principal stable debt of the user
* @return scaledVariableDebt The scaled variable debt of the user
* @return stableBorrowRate The stable borrow rate of the user
* @return liquidityRate The liquidity rate of the reserve
* @return stableRateLastUpdated The timestamp of the last update of the user stable rate
* @return usageAsCollateralEnabled True if the user is using the asset as collateral, false
* otherwise
*/
function getUserReserveData(address asset, address user)
external
view
returns (
uint256 currentATokenBalance,
uint256 currentStableDebt,
uint256 currentVariableDebt,
uint256 principalStableDebt,
uint256 scaledVariableDebt,
uint256 stableBorrowRate,
uint256 liquidityRate,
uint40 stableRateLastUpdated,
bool usageAsCollateralEnabled
);

/**
* @notice Returns the token addresses of the reserve
* @param asset The address of the underlying asset of the reserve
* @return aTokenAddress The AToken address of the reserve
* @return stableDebtTokenAddress The StableDebtToken address of the reserve
* @return variableDebtTokenAddress The VariableDebtToken address of the reserve
*/
function getReserveTokensAddresses(address asset)
external
view
returns (
address aTokenAddress,
address stableDebtTokenAddress,
address variableDebtTokenAddress
);

/**
* @notice Returns the address of the Interest Rate strategy
* @param asset The address of the underlying asset of the reserve
* @return irStrategyAddress The address of the Interest Rate strategy
*/
function getInterestRateStrategyAddress(address asset)
external
view
returns (address irStrategyAddress);

/**
* @notice Returns whether the reserve has FlashLoans enabled or disabled
* @param asset The address of the underlying asset of the reserve
* @return True if FlashLoans are enabled, false otherwise
*/
function getFlashLoanEnabled(address asset) external view returns (bool);
}
14 changes: 1 addition & 13 deletions contracts/interfaces/IReserveInterestRateStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,13 @@ import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
* @notice Interface for the calculation of the interest rates
*/
interface IReserveInterestRateStrategy {
/**
* @notice Returns the base variable borrow rate
* @return The base variable borrow rate, expressed in ray
**/
function getBaseVariableBorrowRate() external view returns (uint256);

/**
* @notice Returns the maximum variable borrow rate
* @return The maximum variable borrow rate, expressed in ray
**/
function getMaxVariableBorrowRate() external view returns (uint256);

/**
* @notice Calculates the interest rates depending on the reserve's state and configurations
* @param params The parameters needed to calculate interest rates
* @return liquidityRate The liquidity rate expressed in rays
* @return stableBorrowRate The stable borrow rate expressed in rays
* @return variableBorrowRate The variable borrow rate expressed in rays
**/
*/
function calculateInterestRates(DataTypes.CalculateInterestRatesParams memory params)
external
view
Expand Down
Loading