mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
refactoring interfaces and config folders to fit current guideline
This commit is contained in:
parent
cdc7e4effc
commit
2d0325a3d2
|
@ -1,10 +1,12 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import '@openzeppelin/contracts/access/Ownable.sol';
|
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
|
||||||
import '../libraries/openzeppelin-upgradeability/InitializableAdminUpgradeabilityProxy.sol';
|
import {
|
||||||
|
InitializableAdminUpgradeabilityProxy
|
||||||
|
} from '../libraries/openzeppelin-upgradeability/InitializableAdminUpgradeabilityProxy.sol';
|
||||||
|
|
||||||
import '../interfaces/ILendingPoolAddressesProvider.sol';
|
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title LendingPoolAddressesProvider contract
|
* @title LendingPoolAddressesProvider contract
|
||||||
|
@ -52,7 +54,7 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider
|
||||||
* @param pool the new lending pool implementation
|
* @param pool the new lending pool implementation
|
||||||
**/
|
**/
|
||||||
function setLendingPoolImpl(address pool) external override onlyOwner {
|
function setLendingPoolImpl(address pool) external override onlyOwner {
|
||||||
updateImplInternal(LENDING_POOL, pool);
|
_updateImplementation(LENDING_POOL, pool);
|
||||||
emit LendingPoolUpdated(pool);
|
emit LendingPoolUpdated(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +71,7 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider
|
||||||
* @param configurator the new lending pool configurator implementation
|
* @param configurator the new lending pool configurator implementation
|
||||||
**/
|
**/
|
||||||
function setLendingPoolConfiguratorImpl(address configurator) external override onlyOwner {
|
function setLendingPoolConfiguratorImpl(address configurator) external override onlyOwner {
|
||||||
updateImplInternal(LENDING_POOL_CONFIGURATOR, configurator);
|
_updateImplementation(LENDING_POOL_CONFIGURATOR, configurator);
|
||||||
emit LendingPoolConfiguratorUpdated(configurator);
|
emit LendingPoolConfiguratorUpdated(configurator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +132,7 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider
|
||||||
* @param id the id of the contract to be updated
|
* @param id the id of the contract to be updated
|
||||||
* @param newAddress the address of the new implementation
|
* @param newAddress the address of the new implementation
|
||||||
**/
|
**/
|
||||||
function updateImplInternal(bytes32 id, address newAddress) internal {
|
function _updateImplementation(bytes32 id, address newAddress) internal {
|
||||||
address payable proxyAddress = payable(_addresses[id]);
|
address payable proxyAddress = payable(_addresses[id]);
|
||||||
|
|
||||||
InitializableAdminUpgradeabilityProxy proxy = InitializableAdminUpgradeabilityProxy(
|
InitializableAdminUpgradeabilityProxy proxy = InitializableAdminUpgradeabilityProxy(
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import '@openzeppelin/contracts/access/Ownable.sol';
|
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
|
||||||
import '../interfaces/ILendingPoolAddressesProviderRegistry.sol';
|
import {
|
||||||
|
ILendingPoolAddressesProviderRegistry
|
||||||
|
} from '../interfaces/ILendingPoolAddressesProviderRegistry.sol';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title LendingPoolAddressesProviderRegistry contract
|
* @title LendingPoolAddressesProviderRegistry contract
|
||||||
|
@ -15,21 +17,21 @@ contract LendingPoolAddressesProviderRegistry is Ownable, ILendingPoolAddressesP
|
||||||
event AddressesProviderRegistered(address indexed newAddress);
|
event AddressesProviderRegistered(address indexed newAddress);
|
||||||
event AddressesProviderUnregistered(address indexed newAddress);
|
event AddressesProviderUnregistered(address indexed newAddress);
|
||||||
|
|
||||||
mapping(address => uint256) addressesProviders;
|
mapping(address => uint256) internal _addressesProviders;
|
||||||
address[] addressesProvidersList;
|
address[] internal _addressesProvidersList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev returns if an addressesProvider is registered or not
|
* @dev returns if an addressesProvider is registered or not
|
||||||
* @param _provider the addresses provider
|
* @param provider the addresses provider
|
||||||
* @return true if the addressesProvider is registered, false otherwise
|
* @return true if the addressesProvider is registered, false otherwise
|
||||||
**/
|
**/
|
||||||
function isAddressesProviderRegistered(address _provider)
|
function isAddressesProviderRegistered(address provider)
|
||||||
external
|
external
|
||||||
override
|
override
|
||||||
view
|
view
|
||||||
returns (uint256)
|
returns (uint256)
|
||||||
{
|
{
|
||||||
return addressesProviders[_provider];
|
return _addressesProviders[provider];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,13 +39,13 @@ contract LendingPoolAddressesProviderRegistry is Ownable, ILendingPoolAddressesP
|
||||||
* @return the list of addressesProviders
|
* @return the list of addressesProviders
|
||||||
**/
|
**/
|
||||||
function getAddressesProvidersList() external override view returns (address[] memory) {
|
function getAddressesProvidersList() external override view returns (address[] memory) {
|
||||||
uint256 maxLength = addressesProvidersList.length;
|
uint256 maxLength = _addressesProvidersList.length;
|
||||||
|
|
||||||
address[] memory activeProviders = new address[](maxLength);
|
address[] memory activeProviders = new address[](maxLength);
|
||||||
|
|
||||||
for (uint256 i = 0; i < addressesProvidersList.length; i++) {
|
for (uint256 i = 0; i < _addressesProvidersList.length; i++) {
|
||||||
if (addressesProviders[addressesProvidersList[i]] > 0) {
|
if (_addressesProviders[_addressesProvidersList[i]] > 0) {
|
||||||
activeProviders[i] = addressesProvidersList[i];
|
activeProviders[i] = _addressesProvidersList[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,35 +54,35 @@ contract LendingPoolAddressesProviderRegistry is Ownable, ILendingPoolAddressesP
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev adds a lending pool to the list of registered lending pools
|
* @dev adds a lending pool to the list of registered lending pools
|
||||||
* @param _provider the pool address to be registered
|
* @param provider the pool address to be registered
|
||||||
**/
|
**/
|
||||||
function registerAddressesProvider(address _provider, uint256 _id) public override onlyOwner {
|
function registerAddressesProvider(address provider, uint256 id) external override onlyOwner {
|
||||||
addressesProviders[_provider] = _id;
|
_addressesProviders[provider] = id;
|
||||||
addToAddressesProvidersListInternal(_provider);
|
_addToAddressesProvidersList(provider);
|
||||||
emit AddressesProviderRegistered(_provider);
|
emit AddressesProviderRegistered(provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev removes a lending pool from the list of registered lending pools
|
* @dev removes a lending pool from the list of registered lending pools
|
||||||
* @param _provider the pool address to be unregistered
|
* @param provider the pool address to be unregistered
|
||||||
**/
|
**/
|
||||||
function unregisterAddressesProvider(address _provider) public override onlyOwner {
|
function unregisterAddressesProvider(address provider) external override onlyOwner {
|
||||||
require(addressesProviders[_provider] > 0, 'Provider is not registered');
|
require(_addressesProviders[provider] > 0, 'Provider is not registered');
|
||||||
addressesProviders[_provider] = 0;
|
_addressesProviders[provider] = 0;
|
||||||
emit AddressesProviderUnregistered(_provider);
|
emit AddressesProviderUnregistered(provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev adds to the list of the addresses providers, if it wasn't already added before
|
* @dev adds to the list of the addresses providers, if it wasn't already added before
|
||||||
* @param _provider the pool address to be added
|
* @param provider the pool address to be added
|
||||||
**/
|
**/
|
||||||
function addToAddressesProvidersListInternal(address _provider) internal {
|
function _addToAddressesProvidersList(address provider) internal {
|
||||||
for (uint256 i = 0; i < addressesProvidersList.length; i++) {
|
for (uint256 i = 0; i < _addressesProvidersList.length; i++) {
|
||||||
if (addressesProvidersList[i] == _provider) {
|
if (_addressesProvidersList[i] == provider) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addressesProvidersList.push(_provider);
|
_addressesProvidersList.push(provider);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,12 @@ interface IExchangeAdapter {
|
||||||
uint256 toAmount
|
uint256 toAmount
|
||||||
);
|
);
|
||||||
|
|
||||||
function approveExchange(IERC20[] calldata _tokens) external;
|
function approveExchange(IERC20[] calldata tokens) external;
|
||||||
|
|
||||||
function exchange(
|
function exchange(
|
||||||
address _from,
|
address from,
|
||||||
address _to,
|
address to,
|
||||||
uint256 _amount,
|
uint256 amount,
|
||||||
uint256 _maxSlippage
|
uint256 maxSlippage
|
||||||
) external returns (uint256);
|
) external returns (uint256);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,112 +9,112 @@ interface ILendingPool {
|
||||||
/**
|
/**
|
||||||
* @dev deposits The underlying asset into the reserve. A corresponding amount of the overlying asset (aTokens)
|
* @dev deposits The underlying asset into the reserve. A corresponding amount of the overlying asset (aTokens)
|
||||||
* is minted.
|
* is minted.
|
||||||
* @param _reserve the address of the reserve
|
* @param reserve the address of the reserve
|
||||||
* @param _amount the amount to be deposited
|
* @param amount the amount to be deposited
|
||||||
* @param _referralCode integrators are assigned a referral code and can potentially receive rewards.
|
* @param referralCode integrators are assigned a referral code and can potentially receive rewards.
|
||||||
**/
|
**/
|
||||||
function deposit(
|
function deposit(
|
||||||
address _reserve,
|
address reserve,
|
||||||
uint256 _amount,
|
uint256 amount,
|
||||||
uint16 _referralCode
|
uint16 referralCode
|
||||||
) external;
|
) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev withdraws the assets of _user.
|
* @dev withdraws the assets of user.
|
||||||
* @param _reserve the address of the reserve
|
* @param reserve the address of the reserve
|
||||||
* @param _amount the underlying amount to be redeemed
|
* @param amount the underlying amount to be redeemed
|
||||||
**/
|
**/
|
||||||
function withdraw(address _reserve, uint256 _amount) external;
|
function withdraw(address reserve, uint256 amount) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Allows users to borrow a specific amount of the reserve currency, provided that the borrower
|
* @dev Allows users to borrow a specific amount of the reserve currency, provided that the borrower
|
||||||
* already deposited enough collateral.
|
* already deposited enough collateral.
|
||||||
* @param _reserve the address of the reserve
|
* @param reserve the address of the reserve
|
||||||
* @param _amount the amount to be borrowed
|
* @param amount the amount to be borrowed
|
||||||
* @param _interestRateMode the interest rate mode at which the user wants to borrow. Can be 0 (STABLE) or 1 (VARIABLE)
|
* @param interestRateMode the interest rate mode at which the user wants to borrow. Can be 0 (STABLE) or 1 (VARIABLE)
|
||||||
**/
|
**/
|
||||||
function borrow(
|
function borrow(
|
||||||
address _reserve,
|
address reserve,
|
||||||
uint256 _amount,
|
uint256 amount,
|
||||||
uint256 _interestRateMode,
|
uint256 interestRateMode,
|
||||||
uint16 _referralCode
|
uint16 referralCode
|
||||||
) external;
|
) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice repays a borrow on the specific reserve, for the specified amount (or for the whole amount, if uint256(-1) is specified).
|
* @notice repays a borrow on the specific reserve, for the specified amount (or for the whole amount, if uint256(-1) is specified).
|
||||||
* @dev the target user is defined by _onBehalfOf. If there is no repayment on behalf of another account,
|
* @dev the target user is defined by onBehalfOf. If there is no repayment on behalf of another account,
|
||||||
* _onBehalfOf must be equal to msg.sender.
|
* onBehalfOf must be equal to msg.sender.
|
||||||
* @param _reserve the address of the reserve on which the user borrowed
|
* @param reserve the address of the reserve on which the user borrowed
|
||||||
* @param _amount the amount to repay, or uint256(-1) if the user wants to repay everything
|
* @param amount the amount to repay, or uint256(-1) if the user wants to repay everything
|
||||||
* @param _onBehalfOf the address for which msg.sender is repaying.
|
* @param onBehalfOf the address for which msg.sender is repaying.
|
||||||
**/
|
**/
|
||||||
function repay(
|
function repay(
|
||||||
address _reserve,
|
address reserve,
|
||||||
uint256 _amount,
|
uint256 amount,
|
||||||
uint256 _rateMode,
|
uint256 rateMode,
|
||||||
address _onBehalfOf
|
address onBehalfOf
|
||||||
) external;
|
) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev borrowers can user this function to swap between stable and variable borrow rate modes.
|
* @dev borrowers can user this function to swap between stable and variable borrow rate modes.
|
||||||
* @param _reserve the address of the reserve on which the user borrowed
|
* @param reserve the address of the reserve on which the user borrowed
|
||||||
* @param _rateMode the rate mode that the user wants to swap
|
* @param rateMode the rate mode that the user wants to swap
|
||||||
**/
|
**/
|
||||||
function swapBorrowRateMode(address _reserve, uint256 _rateMode) external;
|
function swapBorrowRateMode(address reserve, uint256 rateMode) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev rebalances the stable interest rate of a user if current liquidity rate > user stable rate.
|
* @dev rebalances the stable interest rate of a user if current liquidity rate > user stable rate.
|
||||||
* this is regulated by Aave to ensure that the protocol is not abused, and the user is paying a fair
|
* this is regulated by Aave to ensure that the protocol is not abused, and the user is paying a fair
|
||||||
* rate. Anyone can call this function.
|
* rate. Anyone can call this function.
|
||||||
* @param _reserve the address of the reserve
|
* @param reserve the address of the reserve
|
||||||
* @param _user the address of the user to be rebalanced
|
* @param user the address of the user to be rebalanced
|
||||||
**/
|
**/
|
||||||
function rebalanceStableBorrowRate(address _reserve, address _user) external;
|
function rebalanceStableBorrowRate(address reserve, address user) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev allows depositors to enable or disable a specific deposit as collateral.
|
* @dev allows depositors to enable or disable a specific deposit as collateral.
|
||||||
* @param _reserve the address of the reserve
|
* @param reserve the address of the reserve
|
||||||
* @param _useAsCollateral true if the user wants to user the deposit as collateral, false otherwise.
|
* @param useAsCollateral true if the user wants to user the deposit as collateral, false otherwise.
|
||||||
**/
|
**/
|
||||||
function setUserUseReserveAsCollateral(address _reserve, bool _useAsCollateral) external;
|
function setUserUseReserveAsCollateral(address reserve, bool useAsCollateral) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev users can invoke this function to liquidate an undercollateralized position.
|
* @dev users can invoke this function to liquidate an undercollateralized position.
|
||||||
* @param _reserve the address of the collateral to liquidated
|
* @param reserve the address of the collateral to liquidated
|
||||||
* @param _reserve the address of the principal reserve
|
* @param reserve the address of the principal reserve
|
||||||
* @param _user the address of the borrower
|
* @param user the address of the borrower
|
||||||
* @param _purchaseAmount the amount of principal that the liquidator wants to repay
|
* @param purchaseAmount the amount of principal that the liquidator wants to repay
|
||||||
* @param _receiveAToken true if the liquidators wants to receive the aTokens, false if
|
* @param receiveAToken true if the liquidators wants to receive the aTokens, false if
|
||||||
* he wants to receive the underlying asset directly
|
* he wants to receive the underlying asset directly
|
||||||
**/
|
**/
|
||||||
function liquidationCall(
|
function liquidationCall(
|
||||||
address _collateral,
|
address collateral,
|
||||||
address _reserve,
|
address reserve,
|
||||||
address _user,
|
address user,
|
||||||
uint256 _purchaseAmount,
|
uint256 purchaseAmount,
|
||||||
bool _receiveAToken
|
bool receiveAToken
|
||||||
) external;
|
) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev allows smartcontracts to access the liquidity of the pool within one transaction,
|
* @dev allows smartcontracts to access the liquidity of the pool within one transaction,
|
||||||
* as long as the amount taken plus a fee is returned. NOTE There are security concerns for developers of flashloan receiver contracts
|
* as long as the amount taken plus a fee is returned. NOTE There are security concerns for developers of flashloan receiver contracts
|
||||||
* that must be kept into consideration. For further details please visit https://developers.aave.com
|
* that must be kept into consideration. For further details please visit https://developers.aave.com
|
||||||
* @param _receiver The address of the contract receiving the funds. The receiver should implement the IFlashLoanReceiver interface.
|
* @param receiver The address of the contract receiving the funds. The receiver should implement the IFlashLoanReceiver interface.
|
||||||
* @param _reserve the address of the principal reserve
|
* @param reserve the address of the principal reserve
|
||||||
* @param _amount the amount requested for this flashloan
|
* @param amount the amount requested for this flashloan
|
||||||
**/
|
**/
|
||||||
function flashLoan(
|
function flashLoan(
|
||||||
address _receiver,
|
address receiver,
|
||||||
address _reserve,
|
address reserve,
|
||||||
uint256 _amount,
|
uint256 amount,
|
||||||
bytes calldata _params
|
bytes calldata params
|
||||||
) external;
|
) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev accessory functions to fetch data from the core contract
|
* @dev accessory functions to fetch data from the core contract
|
||||||
**/
|
**/
|
||||||
|
|
||||||
function getReserveConfigurationData(address _reserve)
|
function getReserveConfigurationData(address reserve)
|
||||||
external
|
external
|
||||||
view
|
view
|
||||||
returns (
|
returns (
|
||||||
|
@ -130,7 +130,7 @@ interface ILendingPool {
|
||||||
bool isFreezed
|
bool isFreezed
|
||||||
);
|
);
|
||||||
|
|
||||||
function getReserveTokensAddresses(address _reserve)
|
function getReserveTokensAddresses(address reserve)
|
||||||
external
|
external
|
||||||
view
|
view
|
||||||
returns (
|
returns (
|
||||||
|
@ -139,7 +139,7 @@ interface ILendingPool {
|
||||||
address variableDebtTokenAddress
|
address variableDebtTokenAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
function getReserveData(address _reserve)
|
function getReserveData(address reserve)
|
||||||
external
|
external
|
||||||
view
|
view
|
||||||
returns (
|
returns (
|
||||||
|
@ -155,7 +155,7 @@ interface ILendingPool {
|
||||||
uint40 lastUpdateTimestamp
|
uint40 lastUpdateTimestamp
|
||||||
);
|
);
|
||||||
|
|
||||||
function getUserAccountData(address _user)
|
function getUserAccountData(address user)
|
||||||
external
|
external
|
||||||
view
|
view
|
||||||
returns (
|
returns (
|
||||||
|
@ -167,7 +167,7 @@ interface ILendingPool {
|
||||||
uint256 healthFactor
|
uint256 healthFactor
|
||||||
);
|
);
|
||||||
|
|
||||||
function getUserReserveData(address _reserve, address _user)
|
function getUserReserveData(address reserve, address user)
|
||||||
external
|
external
|
||||||
view
|
view
|
||||||
returns (
|
returns (
|
||||||
|
@ -185,42 +185,42 @@ interface ILendingPool {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev initializes a reserve
|
* @dev initializes a reserve
|
||||||
* @param _reserve the address of the reserve
|
* @param reserve the address of the reserve
|
||||||
* @param _aTokenAddress the address of the overlying aToken contract
|
* @param aTokenAddress the address of the overlying aToken contract
|
||||||
* @param _interestRateStrategyAddress the address of the interest rate strategy contract
|
* @param interestRateStrategyAddress the address of the interest rate strategy contract
|
||||||
**/
|
**/
|
||||||
function initReserve(
|
function initReserve(
|
||||||
address _reserve,
|
address reserve,
|
||||||
address _aTokenAddress,
|
address aTokenAddress,
|
||||||
address _stableDebtAddress,
|
address stableDebtAddress,
|
||||||
address _variableDebtAddress,
|
address variableDebtAddress,
|
||||||
address _interestRateStrategyAddress
|
address interestRateStrategyAddress
|
||||||
) external;
|
) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev updates the address of the interest rate strategy contract
|
* @dev updates the address of the interest rate strategy contract
|
||||||
* @param _reserve the address of the reserve
|
* @param reserve the address of the reserve
|
||||||
* @param _rateStrategyAddress the address of the interest rate strategy contract
|
* @param rateStrategyAddress the address of the interest rate strategy contract
|
||||||
**/
|
**/
|
||||||
|
|
||||||
function setReserveInterestRateStrategyAddress(address _reserve, address _rateStrategyAddress)
|
function setReserveInterestRateStrategyAddress(address reserve, address rateStrategyAddress)
|
||||||
external;
|
external;
|
||||||
|
|
||||||
function setConfiguration(address _reserve, uint256 _configuration) external;
|
function setConfiguration(address reserve, uint256 configuration) external;
|
||||||
|
|
||||||
function getConfiguration(address _reserve)
|
function getConfiguration(address reserve)
|
||||||
external
|
external
|
||||||
view
|
view
|
||||||
returns (ReserveConfiguration.Map memory);
|
returns (ReserveConfiguration.Map memory);
|
||||||
|
|
||||||
function getReserveNormalizedIncome(address _reserve) external view returns (uint256);
|
function getReserveNormalizedIncome(address reserve) external view returns (uint256);
|
||||||
|
|
||||||
function getReserveNormalizedVariableDebt(address _reserve) external view returns (uint256);
|
function getReserveNormalizedVariableDebt(address reserve) external view returns (uint256);
|
||||||
|
|
||||||
function balanceDecreaseAllowed(
|
function balanceDecreaseAllowed(
|
||||||
address _reserve,
|
address reserve,
|
||||||
address _user,
|
address user,
|
||||||
uint256 _amount
|
uint256 amount
|
||||||
) external view returns (bool);
|
) external view returns (bool);
|
||||||
|
|
||||||
function getReserves() external view returns (address[] memory);
|
function getReserves() external view returns (address[] memory);
|
||||||
|
|
|
@ -9,9 +9,9 @@ pragma solidity ^0.6.8;
|
||||||
interface ILendingPoolAddressesProviderRegistry {
|
interface ILendingPoolAddressesProviderRegistry {
|
||||||
function getAddressesProvidersList() external view returns (address[] memory);
|
function getAddressesProvidersList() external view returns (address[] memory);
|
||||||
|
|
||||||
function isAddressesProviderRegistered(address _provider) external view returns (uint256);
|
function isAddressesProviderRegistered(address provider) external view returns (uint256);
|
||||||
|
|
||||||
function registerAddressesProvider(address _provider, uint256 _id) external;
|
function registerAddressesProvider(address provider, uint256 id) external;
|
||||||
|
|
||||||
function unregisterAddressesProvider(address _provider) external;
|
function unregisterAddressesProvider(address provider) external;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,10 @@ interface ILendingRateOracle {
|
||||||
/**
|
/**
|
||||||
@dev returns the market borrow rate in ray
|
@dev returns the market borrow rate in ray
|
||||||
**/
|
**/
|
||||||
function getMarketBorrowRate(address _asset) external view returns (uint256);
|
function getMarketBorrowRate(address asset) external view returns (uint256);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@dev sets the market borrow rate. Rate value must be in ray
|
@dev sets the market borrow rate. Rate value must be in ray
|
||||||
**/
|
**/
|
||||||
function setMarketBorrowRate(address _asset, uint256 _rate) external;
|
function setMarketBorrowRate(address asset, uint256 rate) external;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,10 @@ interface IPriceOracle {
|
||||||
/***********
|
/***********
|
||||||
@dev returns the asset price in ETH
|
@dev returns the asset price in ETH
|
||||||
*/
|
*/
|
||||||
function getAssetPrice(address _asset) external view returns (uint256);
|
function getAssetPrice(address asset) external view returns (uint256);
|
||||||
|
|
||||||
/***********
|
/***********
|
||||||
@dev sets the asset price, in wei
|
@dev sets the asset price, in wei
|
||||||
*/
|
*/
|
||||||
function setAssetPrice(address _asset, uint256 _price) external;
|
function setAssetPrice(address asset, uint256 price) external;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ pragma solidity ^0.6.8;
|
||||||
interface IPriceOracleGetter {
|
interface IPriceOracleGetter {
|
||||||
/**
|
/**
|
||||||
* @dev returns the asset price in ETH
|
* @dev returns the asset price in ETH
|
||||||
* @param _asset the address of the asset
|
* @param asset the address of the asset
|
||||||
* @return the ETH price of the asset
|
* @return the ETH price of the asset
|
||||||
**/
|
**/
|
||||||
function getAssetPrice(address _asset) external view returns (uint256);
|
function getAssetPrice(address asset) external view returns (uint256);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,11 @@ interface IReserveInterestRateStrategy {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function calculateInterestRates(
|
function calculateInterestRates(
|
||||||
address _reserve,
|
address reserve,
|
||||||
uint256 _utilizationRate,
|
uint256 utilizationRate,
|
||||||
uint256 _totalBorrowsStable,
|
uint256 totalBorrowsStable,
|
||||||
uint256 _totalBorrowsVariable,
|
uint256 totalBorrowsVariable,
|
||||||
uint256 _averageStableBorrowRate
|
uint256 averageStableBorrowRate
|
||||||
)
|
)
|
||||||
external
|
external
|
||||||
view
|
view
|
||||||
|
|
|
@ -8,105 +8,105 @@ interface IAToken is IERC20 {
|
||||||
* @dev redirects the interest generated to a target address.
|
* @dev redirects the interest generated to a target address.
|
||||||
* when the interest is redirected, the user balance is added to
|
* when the interest is redirected, the user balance is added to
|
||||||
* the recepient redirected balance.
|
* the recepient redirected balance.
|
||||||
* @param _to the address to which the interest will be redirected
|
* @param to the address to which the interest will be redirected
|
||||||
**/
|
**/
|
||||||
function redirectInterestStream(address _to) external;
|
function redirectInterestStream(address to) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev redirects the interest generated by _from to a target address.
|
* @dev redirects the interest generated by from to a target address.
|
||||||
* when the interest is redirected, the user balance is added to
|
* when the interest is redirected, the user balance is added to
|
||||||
* the recepient redirected balance. The caller needs to have allowance on
|
* the recepient redirected balance. The caller needs to have allowance on
|
||||||
* the interest redirection to be able to execute the function.
|
* the interest redirection to be able to execute the function.
|
||||||
* @param _from the address of the user whom interest is being redirected
|
* @param from the address of the user whom interest is being redirected
|
||||||
* @param _to the address to which the interest will be redirected
|
* @param to the address to which the interest will be redirected
|
||||||
**/
|
**/
|
||||||
function redirectInterestStreamOf(address _from, address _to) external;
|
function redirectInterestStreamOf(address from, address to) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev gives allowance to an address to execute the interest redirection
|
* @dev gives allowance to an address to execute the interest redirection
|
||||||
* on behalf of the caller.
|
* on behalf of the caller.
|
||||||
* @param _to the address to which the interest will be redirected. Pass address(0) to reset
|
* @param to the address to which the interest will be redirected. Pass address(0) to reset
|
||||||
* the allowance.
|
* the allowance.
|
||||||
**/
|
**/
|
||||||
function allowInterestRedirectionTo(address _to) external;
|
function allowInterestRedirectionTo(address to) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev burns the aTokens and sends the equivalent amount of underlying to the target.
|
* @dev burns the aTokens and sends the equivalent amount of underlying to the target.
|
||||||
* only lending pools can call this function
|
* only lending pools can call this function
|
||||||
* @param _amount the amount being burned
|
* @param amount the amount being burned
|
||||||
**/
|
**/
|
||||||
function burn(
|
function burn(
|
||||||
address _user,
|
address user,
|
||||||
address _underlyingTarget,
|
address underlyingTarget,
|
||||||
uint256 _amount
|
uint256 amount
|
||||||
) external;
|
) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev mints aTokens to _user
|
* @dev mints aTokens to user
|
||||||
* only lending pools can call this function
|
* only lending pools can call this function
|
||||||
* @param _user the address receiving the minted tokens
|
* @param user the address receiving the minted tokens
|
||||||
* @param _amount the amount of tokens to mint
|
* @param amount the amount of tokens to mint
|
||||||
*/
|
*/
|
||||||
function mint(address _user, uint256 _amount) external;
|
function mint(address user, uint256 amount) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev transfers tokens in the event of a borrow being liquidated, in case the liquidators reclaims the aToken
|
* @dev transfers tokens in the event of a borrow being liquidated, in case the liquidators reclaims the aToken
|
||||||
* only lending pools can call this function
|
* only lending pools can call this function
|
||||||
* @param _from the address from which transfer the aTokens
|
* @param from the address from which transfer the aTokens
|
||||||
* @param _to the destination address
|
* @param to the destination address
|
||||||
* @param _value the amount to transfer
|
* @param value the amount to transfer
|
||||||
**/
|
**/
|
||||||
function transferOnLiquidation(
|
function transferOnLiquidation(
|
||||||
address _from,
|
address from,
|
||||||
address _to,
|
address to,
|
||||||
uint256 _value
|
uint256 value
|
||||||
) external;
|
) external;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev returns the principal balance of the user. The principal balance is the last
|
* @dev returns the principal balance of the user. The principal balance is the last
|
||||||
* updated stored balance, which does not consider the perpetually accruing interest.
|
* updated stored balance, which does not consider the perpetually accruing interest.
|
||||||
* @param _user the address of the user
|
* @param user the address of the user
|
||||||
* @return the principal balance of the user
|
* @return the principal balance of the user
|
||||||
**/
|
**/
|
||||||
function principalBalanceOf(address _user) external view returns (uint256);
|
function principalBalanceOf(address user) external view returns (uint256);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Used to validate transfers before actually executing them.
|
* @dev Used to validate transfers before actually executing them.
|
||||||
* @param _user address of the user to check
|
* @param user address of the user to check
|
||||||
* @param _amount the amount to check
|
* @param amount the amount to check
|
||||||
* @return true if the _user can transfer _amount, false otherwise
|
* @return true if the user can transfer amount, false otherwise
|
||||||
**/
|
**/
|
||||||
function isTransferAllowed(address _user, uint256 _amount) external view returns (bool);
|
function isTransferAllowed(address user, uint256 amount) external view returns (bool);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev returns the last index of the user, used to calculate the balance of the user
|
* @dev returns the last index of the user, used to calculate the balance of the user
|
||||||
* @param _user address of the user
|
* @param user address of the user
|
||||||
* @return the last user index
|
* @return the last user index
|
||||||
**/
|
**/
|
||||||
function getUserIndex(address _user) external view returns (uint256);
|
function getUserIndex(address user) external view returns (uint256);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev returns the address to which the interest is redirected
|
* @dev returns the address to which the interest is redirected
|
||||||
* @param _user address of the user
|
* @param user address of the user
|
||||||
* @return 0 if there is no redirection, an address otherwise
|
* @return 0 if there is no redirection, an address otherwise
|
||||||
**/
|
**/
|
||||||
function getInterestRedirectionAddress(address _user) external view returns (address);
|
function getInterestRedirectionAddress(address user) external view returns (address);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev returns the redirected balance of the user. The redirected balance is the balance
|
* @dev returns the redirected balance of the user. The redirected balance is the balance
|
||||||
* redirected by other accounts to the user, that is accrueing interest for him.
|
* redirected by other accounts to the user, that is accrueing interest for him.
|
||||||
* @param _user address of the user
|
* @param user address of the user
|
||||||
* @return the total redirected balance
|
* @return the total redirected balance
|
||||||
**/
|
**/
|
||||||
function getRedirectedBalance(address _user) external view returns (uint256);
|
function getRedirectedBalance(address user) external view returns (uint256);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev transfers the underlying asset to the target. Used by the lendingpool to transfer
|
* @dev transfers the underlying asset to the target. Used by the lendingpool to transfer
|
||||||
* assets in borrow(), redeem() and flashLoan()
|
* assets in borrow(), redeem() and flashLoan()
|
||||||
* @param _target the target of the transfer
|
* @param target the target of the transfer
|
||||||
* @param _amount the amount to transfer
|
* @param amount the amount to transfer
|
||||||
* @return the amount transferred
|
* @return the amount transferred
|
||||||
**/
|
**/
|
||||||
|
|
||||||
function transferUnderlyingTo(address _target, uint256 _amount) external returns (uint256);
|
function transferUnderlyingTo(address target, uint256 amount) external returns (uint256);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user