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 | ||||
| pragma solidity ^0.6.8; | ||||
| 
 | ||||
| import '@openzeppelin/contracts/access/Ownable.sol'; | ||||
| import '../libraries/openzeppelin-upgradeability/InitializableAdminUpgradeabilityProxy.sol'; | ||||
| import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol'; | ||||
| import { | ||||
|   InitializableAdminUpgradeabilityProxy | ||||
| } from '../libraries/openzeppelin-upgradeability/InitializableAdminUpgradeabilityProxy.sol'; | ||||
| 
 | ||||
| import '../interfaces/ILendingPoolAddressesProvider.sol'; | ||||
| import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol'; | ||||
| 
 | ||||
| /** | ||||
|  * @title LendingPoolAddressesProvider contract | ||||
|  | @ -52,7 +54,7 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider | |||
|    * @param pool the new lending pool implementation | ||||
|    **/ | ||||
|   function setLendingPoolImpl(address pool) external override onlyOwner { | ||||
|     updateImplInternal(LENDING_POOL, pool); | ||||
|     _updateImplementation(LENDING_POOL, pool); | ||||
|     emit LendingPoolUpdated(pool); | ||||
|   } | ||||
| 
 | ||||
|  | @ -69,7 +71,7 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider | |||
|    * @param configurator the new lending pool configurator implementation | ||||
|    **/ | ||||
|   function setLendingPoolConfiguratorImpl(address configurator) external override onlyOwner { | ||||
|     updateImplInternal(LENDING_POOL_CONFIGURATOR, configurator); | ||||
|     _updateImplementation(LENDING_POOL_CONFIGURATOR, configurator); | ||||
|     emit LendingPoolConfiguratorUpdated(configurator); | ||||
|   } | ||||
| 
 | ||||
|  | @ -130,7 +132,7 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider | |||
|    * @param id the id of the contract to be updated | ||||
|    * @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]); | ||||
| 
 | ||||
|     InitializableAdminUpgradeabilityProxy proxy = InitializableAdminUpgradeabilityProxy( | ||||
|  |  | |||
|  | @ -1,8 +1,10 @@ | |||
| // SPDX-License-Identifier: agpl-3.0 | ||||
| pragma solidity ^0.6.8; | ||||
| 
 | ||||
| import '@openzeppelin/contracts/access/Ownable.sol'; | ||||
| import '../interfaces/ILendingPoolAddressesProviderRegistry.sol'; | ||||
| import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol'; | ||||
| import { | ||||
|   ILendingPoolAddressesProviderRegistry | ||||
| } from '../interfaces/ILendingPoolAddressesProviderRegistry.sol'; | ||||
| 
 | ||||
| /** | ||||
|  * @title LendingPoolAddressesProviderRegistry contract | ||||
|  | @ -15,21 +17,21 @@ contract LendingPoolAddressesProviderRegistry is Ownable, ILendingPoolAddressesP | |||
|   event AddressesProviderRegistered(address indexed newAddress); | ||||
|   event AddressesProviderUnregistered(address indexed newAddress); | ||||
| 
 | ||||
|   mapping(address => uint256) addressesProviders; | ||||
|   address[] addressesProvidersList; | ||||
|   mapping(address => uint256) internal _addressesProviders; | ||||
|   address[] internal _addressesProvidersList; | ||||
| 
 | ||||
|   /** | ||||
|    * @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 | ||||
|    **/ | ||||
|   function isAddressesProviderRegistered(address _provider) | ||||
|   function isAddressesProviderRegistered(address provider) | ||||
|     external | ||||
|     override | ||||
|     view | ||||
|     returns (uint256) | ||||
|   { | ||||
|     return addressesProviders[_provider]; | ||||
|     return _addressesProviders[provider]; | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|  | @ -37,13 +39,13 @@ contract LendingPoolAddressesProviderRegistry is Ownable, ILendingPoolAddressesP | |||
|    * @return the list of addressesProviders | ||||
|    **/ | ||||
|   function getAddressesProvidersList() external override view returns (address[] memory) { | ||||
|     uint256 maxLength = addressesProvidersList.length; | ||||
|     uint256 maxLength = _addressesProvidersList.length; | ||||
| 
 | ||||
|     address[] memory activeProviders = new address[](maxLength); | ||||
| 
 | ||||
|     for (uint256 i = 0; i < addressesProvidersList.length; i++) { | ||||
|       if (addressesProviders[addressesProvidersList[i]] > 0) { | ||||
|         activeProviders[i] = addressesProvidersList[i]; | ||||
|     for (uint256 i = 0; i < _addressesProvidersList.length; i++) { | ||||
|       if (_addressesProviders[_addressesProvidersList[i]] > 0) { | ||||
|         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 | ||||
|    * @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 { | ||||
|     addressesProviders[_provider] = _id; | ||||
|     addToAddressesProvidersListInternal(_provider); | ||||
|     emit AddressesProviderRegistered(_provider); | ||||
|   function registerAddressesProvider(address provider, uint256 id) external override onlyOwner { | ||||
|     _addressesProviders[provider] = id; | ||||
|     _addToAddressesProvidersList(provider); | ||||
|     emit AddressesProviderRegistered(provider); | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * @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 { | ||||
|     require(addressesProviders[_provider] > 0, 'Provider is not registered'); | ||||
|     addressesProviders[_provider] = 0; | ||||
|     emit AddressesProviderUnregistered(_provider); | ||||
|   function unregisterAddressesProvider(address provider) external override onlyOwner { | ||||
|     require(_addressesProviders[provider] > 0, 'Provider is not registered'); | ||||
|     _addressesProviders[provider] = 0; | ||||
|     emit AddressesProviderUnregistered(provider); | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * @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 { | ||||
|     for (uint256 i = 0; i < addressesProvidersList.length; i++) { | ||||
|       if (addressesProvidersList[i] == _provider) { | ||||
|   function _addToAddressesProvidersList(address provider) internal { | ||||
|     for (uint256 i = 0; i < _addressesProvidersList.length; i++) { | ||||
|       if (_addressesProvidersList[i] == provider) { | ||||
|         return; | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     addressesProvidersList.push(_provider); | ||||
|     _addressesProvidersList.push(provider); | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -12,12 +12,12 @@ interface IExchangeAdapter { | |||
|     uint256 toAmount | ||||
|   ); | ||||
| 
 | ||||
|   function approveExchange(IERC20[] calldata _tokens) external; | ||||
|   function approveExchange(IERC20[] calldata tokens) external; | ||||
| 
 | ||||
|   function exchange( | ||||
|     address _from, | ||||
|     address _to, | ||||
|     uint256 _amount, | ||||
|     uint256 _maxSlippage | ||||
|     address from, | ||||
|     address to, | ||||
|     uint256 amount, | ||||
|     uint256 maxSlippage | ||||
|   ) 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) | ||||
|    * is minted. | ||||
|    * @param _reserve the address of the reserve | ||||
|    * @param _amount the amount to be deposited | ||||
|    * @param _referralCode integrators are assigned a referral code and can potentially receive rewards. | ||||
|    * @param reserve the address of the reserve | ||||
|    * @param amount the amount to be deposited | ||||
|    * @param referralCode integrators are assigned a referral code and can potentially receive rewards. | ||||
|    **/ | ||||
|   function deposit( | ||||
|     address _reserve, | ||||
|     uint256 _amount, | ||||
|     uint16 _referralCode | ||||
|     address reserve, | ||||
|     uint256 amount, | ||||
|     uint16 referralCode | ||||
|   ) external; | ||||
| 
 | ||||
|   /** | ||||
|    * @dev withdraws the assets of _user. | ||||
|    * @param _reserve the address of the reserve | ||||
|    * @param _amount the underlying amount to be redeemed | ||||
|    * @dev withdraws the assets of user. | ||||
|    * @param reserve the address of the reserve | ||||
|    * @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 | ||||
|    * already deposited enough collateral. | ||||
|    * @param _reserve the address of the reserve | ||||
|    * @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 reserve the address of the reserve | ||||
|    * @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) | ||||
|    **/ | ||||
|   function borrow( | ||||
|     address _reserve, | ||||
|     uint256 _amount, | ||||
|     uint256 _interestRateMode, | ||||
|     uint16 _referralCode | ||||
|     address reserve, | ||||
|     uint256 amount, | ||||
|     uint256 interestRateMode, | ||||
|     uint16 referralCode | ||||
|   ) external; | ||||
| 
 | ||||
|   /** | ||||
|    * @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, | ||||
|    * _onBehalfOf must be equal to msg.sender. | ||||
|    * @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 _onBehalfOf the address for which msg.sender is repaying. | ||||
|    * @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. | ||||
|    * @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 onBehalfOf the address for which msg.sender is repaying. | ||||
|    **/ | ||||
|   function repay( | ||||
|     address _reserve, | ||||
|     uint256 _amount, | ||||
|     uint256 _rateMode, | ||||
|     address _onBehalfOf | ||||
|     address reserve, | ||||
|     uint256 amount, | ||||
|     uint256 rateMode, | ||||
|     address onBehalfOf | ||||
|   ) external; | ||||
| 
 | ||||
|   /** | ||||
|    * @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 _rateMode the rate mode that the user wants to swap | ||||
|    * @param reserve the address of the reserve on which the user borrowed | ||||
|    * @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. | ||||
|    * 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. | ||||
|    * @param _reserve the address of the reserve | ||||
|    * @param _user the address of the user to be rebalanced | ||||
|    * @param reserve the address of the reserve | ||||
|    * @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. | ||||
|    * @param _reserve the address of the reserve | ||||
|    * @param _useAsCollateral true if the user wants to user the deposit as collateral, false otherwise. | ||||
|    * @param reserve the address of the reserve | ||||
|    * @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. | ||||
|    * @param _reserve the address of the collateral to liquidated | ||||
|    * @param _reserve the address of the principal reserve | ||||
|    * @param _user the address of the borrower | ||||
|    * @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 reserve the address of the collateral to liquidated | ||||
|    * @param reserve the address of the principal reserve | ||||
|    * @param user the address of the borrower | ||||
|    * @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 | ||||
|    * he wants to receive the underlying asset directly | ||||
|    **/ | ||||
|   function liquidationCall( | ||||
|     address _collateral, | ||||
|     address _reserve, | ||||
|     address _user, | ||||
|     uint256 _purchaseAmount, | ||||
|     bool _receiveAToken | ||||
|     address collateral, | ||||
|     address reserve, | ||||
|     address user, | ||||
|     uint256 purchaseAmount, | ||||
|     bool receiveAToken | ||||
|   ) external; | ||||
| 
 | ||||
|   /** | ||||
|    * @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 | ||||
|    * 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 _reserve the address of the principal reserve | ||||
|    * @param _amount the amount requested for this flashloan | ||||
|    * @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 amount the amount requested for this flashloan | ||||
|    **/ | ||||
|   function flashLoan( | ||||
|     address _receiver, | ||||
|     address _reserve, | ||||
|     uint256 _amount, | ||||
|     bytes calldata _params | ||||
|     address receiver, | ||||
|     address reserve, | ||||
|     uint256 amount, | ||||
|     bytes calldata params | ||||
|   ) external; | ||||
| 
 | ||||
|   /** | ||||
|    * @dev accessory functions to fetch data from the core contract | ||||
|    **/ | ||||
| 
 | ||||
|   function getReserveConfigurationData(address _reserve) | ||||
|   function getReserveConfigurationData(address reserve) | ||||
|     external | ||||
|     view | ||||
|     returns ( | ||||
|  | @ -130,7 +130,7 @@ interface ILendingPool { | |||
|       bool isFreezed | ||||
|     ); | ||||
| 
 | ||||
|   function getReserveTokensAddresses(address _reserve) | ||||
|   function getReserveTokensAddresses(address reserve) | ||||
|     external | ||||
|     view | ||||
|     returns ( | ||||
|  | @ -139,7 +139,7 @@ interface ILendingPool { | |||
|       address variableDebtTokenAddress | ||||
|     ); | ||||
| 
 | ||||
|   function getReserveData(address _reserve) | ||||
|   function getReserveData(address reserve) | ||||
|     external | ||||
|     view | ||||
|     returns ( | ||||
|  | @ -155,7 +155,7 @@ interface ILendingPool { | |||
|       uint40 lastUpdateTimestamp | ||||
|     ); | ||||
| 
 | ||||
|   function getUserAccountData(address _user) | ||||
|   function getUserAccountData(address user) | ||||
|     external | ||||
|     view | ||||
|     returns ( | ||||
|  | @ -167,7 +167,7 @@ interface ILendingPool { | |||
|       uint256 healthFactor | ||||
|     ); | ||||
| 
 | ||||
|   function getUserReserveData(address _reserve, address _user) | ||||
|   function getUserReserveData(address reserve, address user) | ||||
|     external | ||||
|     view | ||||
|     returns ( | ||||
|  | @ -185,42 +185,42 @@ interface ILendingPool { | |||
| 
 | ||||
|   /** | ||||
|    * @dev initializes a reserve | ||||
|    * @param _reserve the address of the reserve | ||||
|    * @param _aTokenAddress the address of the overlying aToken contract | ||||
|    * @param _interestRateStrategyAddress the address of the interest rate strategy contract | ||||
|    * @param reserve the address of the reserve | ||||
|    * @param aTokenAddress the address of the overlying aToken contract | ||||
|    * @param interestRateStrategyAddress the address of the interest rate strategy contract | ||||
|    **/ | ||||
|   function initReserve( | ||||
|     address _reserve, | ||||
|     address _aTokenAddress, | ||||
|     address _stableDebtAddress, | ||||
|     address _variableDebtAddress, | ||||
|     address _interestRateStrategyAddress | ||||
|     address reserve, | ||||
|     address aTokenAddress, | ||||
|     address stableDebtAddress, | ||||
|     address variableDebtAddress, | ||||
|     address interestRateStrategyAddress | ||||
|   ) external; | ||||
| 
 | ||||
|   /** | ||||
|    * @dev updates the address of the interest rate strategy contract | ||||
|    * @param _reserve the address of the reserve | ||||
|    * @param _rateStrategyAddress the address of the interest rate strategy contract | ||||
|    * @param reserve the address of the reserve | ||||
|    * @param rateStrategyAddress the address of the interest rate strategy contract | ||||
|    **/ | ||||
| 
 | ||||
|   function setReserveInterestRateStrategyAddress(address _reserve, address _rateStrategyAddress) | ||||
|   function setReserveInterestRateStrategyAddress(address reserve, address rateStrategyAddress) | ||||
|     external; | ||||
| 
 | ||||
|   function setConfiguration(address _reserve, uint256 _configuration) external; | ||||
|   function setConfiguration(address reserve, uint256 configuration) external; | ||||
| 
 | ||||
|   function getConfiguration(address _reserve) | ||||
|   function getConfiguration(address reserve) | ||||
|     external | ||||
|     view | ||||
|     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( | ||||
|     address _reserve, | ||||
|     address _user, | ||||
|     uint256 _amount | ||||
|     address reserve, | ||||
|     address user, | ||||
|     uint256 amount | ||||
|   ) external view returns (bool); | ||||
| 
 | ||||
|   function getReserves() external view returns (address[] memory); | ||||
|  |  | |||
|  | @ -9,9 +9,9 @@ pragma solidity ^0.6.8; | |||
| interface ILendingPoolAddressesProviderRegistry { | ||||
|   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 | ||||
|     **/ | ||||
|   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 | ||||
|     **/ | ||||
|   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 | ||||
|      */ | ||||
|   function getAssetPrice(address _asset) external view returns (uint256); | ||||
|   function getAssetPrice(address asset) external view returns (uint256); | ||||
| 
 | ||||
|   /*********** | ||||
|     @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 { | ||||
|   /** | ||||
|    * @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 | ||||
|    **/ | ||||
|   function getAssetPrice(address _asset) external view returns (uint256); | ||||
|   function getAssetPrice(address asset) external view returns (uint256); | ||||
| } | ||||
|  |  | |||
|  | @ -19,11 +19,11 @@ interface IReserveInterestRateStrategy { | |||
|    * | ||||
|    */ | ||||
|   function calculateInterestRates( | ||||
|     address _reserve, | ||||
|     uint256 _utilizationRate, | ||||
|     uint256 _totalBorrowsStable, | ||||
|     uint256 _totalBorrowsVariable, | ||||
|     uint256 _averageStableBorrowRate | ||||
|     address reserve, | ||||
|     uint256 utilizationRate, | ||||
|     uint256 totalBorrowsStable, | ||||
|     uint256 totalBorrowsVariable, | ||||
|     uint256 averageStableBorrowRate | ||||
|   ) | ||||
|     external | ||||
|     view | ||||
|  |  | |||
|  | @ -8,105 +8,105 @@ interface IAToken is IERC20 { | |||
|    * @dev redirects the interest generated to a target address. | ||||
|    * when the interest is redirected, the user balance is added to | ||||
|    * 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 | ||||
|    * the recepient redirected balance. The caller needs to have allowance on | ||||
|    * the interest redirection to be able to execute the function. | ||||
|    * @param _from the address of the user whom interest is being redirected | ||||
|    * @param _to the address to which the interest will be redirected | ||||
|    * @param from the address of the user whom interest is being 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 | ||||
|    * 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. | ||||
|    **/ | ||||
|   function allowInterestRedirectionTo(address _to) external; | ||||
|   function allowInterestRedirectionTo(address to) external; | ||||
| 
 | ||||
|   /** | ||||
|    * @dev burns the aTokens and sends the equivalent amount of underlying to the target. | ||||
|    * only lending pools can call this function | ||||
|    * @param _amount the amount being burned | ||||
|    * @param amount the amount being burned | ||||
|    **/ | ||||
|   function burn( | ||||
|     address _user, | ||||
|     address _underlyingTarget, | ||||
|     uint256 _amount | ||||
|     address user, | ||||
|     address underlyingTarget, | ||||
|     uint256 amount | ||||
|   ) external; | ||||
| 
 | ||||
|   /** | ||||
|    * @dev mints aTokens to _user | ||||
|    * @dev mints aTokens to user | ||||
|    * only lending pools can call this function | ||||
|    * @param _user the address receiving the minted tokens | ||||
|    * @param _amount the amount of tokens to mint | ||||
|    * @param user the address receiving the minted tokens | ||||
|    * @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 | ||||
|    *      only lending pools can call this function | ||||
|    * @param _from the address from which transfer the aTokens | ||||
|    * @param _to the destination address | ||||
|    * @param _value the amount to transfer | ||||
|    * @param from the address from which transfer the aTokens | ||||
|    * @param to the destination address | ||||
|    * @param value the amount to transfer | ||||
|    **/ | ||||
|   function transferOnLiquidation( | ||||
|     address _from, | ||||
|     address _to, | ||||
|     uint256 _value | ||||
|     address from, | ||||
|     address to, | ||||
|     uint256 value | ||||
|   ) external; | ||||
| 
 | ||||
|   /** | ||||
|    * @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. | ||||
|    * @param _user the address of the user | ||||
|    * @param user the address 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. | ||||
|    * @param _user address of the user to check | ||||
|    * @param _amount the amount to check | ||||
|    * @return true if the _user can transfer _amount, false otherwise | ||||
|    * @param user address of the user to check | ||||
|    * @param amount the amount to check | ||||
|    * @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 | ||||
|    * @param _user address of the user | ||||
|    * @param user address of the user | ||||
|    * @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 | ||||
|    * @param _user address of the user | ||||
|    * @param user address of the user | ||||
|    * @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 | ||||
|    * 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 | ||||
|    **/ | ||||
|   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 | ||||
|    * assets in borrow(), redeem() and flashLoan() | ||||
|    * @param _target the target of the transfer | ||||
|    * @param _amount the amount to transfer | ||||
|    * @param target the target of the transfer | ||||
|    * @param amount the amount to transfer | ||||
|    * @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
	 andyk
						andyk