diff --git a/buidler.config.ts b/buidler.config.ts index e90e16de..ae6ef7e3 100644 --- a/buidler.config.ts +++ b/buidler.config.ts @@ -14,8 +14,8 @@ usePlugin('@nomiclabs/buidler-etherscan'); //usePlugin('buidler-gas-reporter'); const SKIP_LOAD = process.env.SKIP_LOAD === 'true'; -const DEFAULT_BLOCK_GAS_LIMIT = 12500000; -const DEFAULT_GAS_PRICE = 1; +const DEFAULT_BLOCK_GAS_LIMIT = 10000000; +const DEFAULT_GAS_PRICE = 10; const HARDFORK = 'istanbul'; const INFURA_KEY = process.env.INFURA_KEY || ''; const ETHERSCAN_KEY = process.env.ETHERSCAN_KEY || ''; diff --git a/contracts/configuration/LendingPoolAddressesProvider.sol b/contracts/configuration/LendingPoolAddressesProvider.sol index 0cc67297..90fe8555 100644 --- a/contracts/configuration/LendingPoolAddressesProvider.sol +++ b/contracts/configuration/LendingPoolAddressesProvider.sol @@ -30,12 +30,41 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider bytes32 private constant LENDING_RATE_ORACLE = 'LENDING_RATE_ORACLE'; bytes32 private constant WALLET_BALANCE_PROVIDER = 'WALLET_BALANCE_PROVIDER'; + /** + * @dev Sets an address for an id, allowing to cover it or not with a proxy + * @param id The id + * @param newAddress The address to set, pass address(0) if a proxy is needed + * @param implementationAddress The address of the implementation if we want it covered by a proxy + * address(0) if we don't want a proxy covering + */ + function setAddress( + bytes32 id, + address newAddress, + address implementationAddress + ) external override onlyOwner { + if (implementationAddress != address(0)) { + _updateImpl(id, implementationAddress); + emit AddressSet(id, implementationAddress, true); + } else { + _addresses[id] = newAddress; + emit AddressSet(id, newAddress, false); + } + } + + /** + * @dev Returns an address by id + * @return The address + */ + function getAddress(bytes32 id) public override view returns (address) { + return _addresses[id]; + } + /** * @dev returns the address of the LendingPool proxy * @return the lending pool proxy address **/ function getLendingPool() external override view returns (address) { - return _addresses[LENDING_POOL]; + return getAddress(LENDING_POOL); } /** @@ -52,7 +81,7 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider * @return the lending pool configurator proxy address **/ function getLendingPoolConfigurator() external override view returns (address) { - return _addresses[LENDING_POOL_CONFIGURATOR]; + return getAddress(LENDING_POOL_CONFIGURATOR); } /** @@ -72,7 +101,7 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider **/ function getLendingPoolCollateralManager() external override view returns (address) { - return _addresses[LENDING_POOL_COLLATERAL_MANAGER]; + return getAddress(LENDING_POOL_COLLATERAL_MANAGER); } /** @@ -90,7 +119,7 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider **/ function getAaveAdmin() external override view returns (address) { - return _addresses[AAVE_ADMIN]; + return getAddress(AAVE_ADMIN); } function setAaveAdmin(address aaveAdmin) external override onlyOwner { @@ -99,7 +128,7 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider } function getPriceOracle() external override view returns (address) { - return _addresses[PRICE_ORACLE]; + return getAddress(PRICE_ORACLE); } function setPriceOracle(address priceOracle) external override onlyOwner { @@ -108,7 +137,7 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider } function getLendingRateOracle() external override view returns (address) { - return _addresses[LENDING_RATE_ORACLE]; + return getAddress(LENDING_RATE_ORACLE); } function setLendingRateOracle(address lendingRateOracle) external override onlyOwner { diff --git a/contracts/configuration/LendingPoolAddressesProviderRegistry.sol b/contracts/configuration/LendingPoolAddressesProviderRegistry.sol index ee0caf16..edc719ef 100644 --- a/contracts/configuration/LendingPoolAddressesProviderRegistry.sol +++ b/contracts/configuration/LendingPoolAddressesProviderRegistry.sol @@ -14,8 +14,8 @@ import {Errors} from '../libraries/helpers/Errors.sol'; **/ contract LendingPoolAddressesProviderRegistry is Ownable, ILendingPoolAddressesProviderRegistry { - mapping(address => uint256) addressesProviders; - address[] addressesProvidersList; + mapping(address => uint256) private _addressesProviders; + address[] private _addressesProvidersList; /** * @dev returns if an addressesProvider is registered or not @@ -28,7 +28,7 @@ contract LendingPoolAddressesProviderRegistry is Ownable, ILendingPoolAddressesP view returns (uint256) { - return addressesProviders[provider]; + return _addressesProviders[provider]; } /** @@ -36,13 +36,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]; } } @@ -54,7 +54,7 @@ contract LendingPoolAddressesProviderRegistry is Ownable, ILendingPoolAddressesP * @param provider the pool address to be registered **/ function registerAddressesProvider(address provider, uint256 id) external override onlyOwner { - addressesProviders[provider] = id; + _addressesProviders[provider] = id; _addToAddressesProvidersList(provider); emit AddressesProviderRegistered(provider); } @@ -64,8 +64,8 @@ contract LendingPoolAddressesProviderRegistry is Ownable, ILendingPoolAddressesP * @param provider the pool address to be unregistered **/ function unregisterAddressesProvider(address provider) external override onlyOwner { - require(addressesProviders[provider] > 0, Errors.PROVIDER_NOT_REGISTERED); - addressesProviders[provider] = 0; + require(_addressesProviders[provider] > 0, Errors.PROVIDER_NOT_REGISTERED); + _addressesProviders[provider] = 0; emit AddressesProviderUnregistered(provider); } @@ -74,12 +74,25 @@ contract LendingPoolAddressesProviderRegistry is Ownable, ILendingPoolAddressesP * @param provider the pool address to be added **/ function _addToAddressesProvidersList(address provider) internal { - for (uint256 i = 0; i < addressesProvidersList.length; i++) { - if (addressesProvidersList[i] == provider) { + for (uint256 i = 0; i < _addressesProvidersList.length; i++) { + if (_addressesProvidersList[i] == provider) { return; } } - addressesProvidersList.push(provider); + _addressesProvidersList.push(provider); + } + + /** + * @dev Returns the id on an `addressesProvider` or address(0) if not registered + * @return The id or address(0) + */ + function getAddressesProviderIdByAddress(address addressesProvider) + external + override + view + returns (uint256) + { + return _addressesProviders[addressesProvider]; } } diff --git a/contracts/interfaces/ILendingPool.sol b/contracts/interfaces/ILendingPool.sol index d19f7ba1..3fc461b6 100644 --- a/contracts/interfaces/ILendingPool.sol +++ b/contracts/interfaces/ILendingPool.sol @@ -327,6 +327,7 @@ interface ILendingPool { uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus, + uint256 reserveFactor, address interestRateStrategyAddress, bool usageAsCollateralEnabled, bool borrowingEnabled, @@ -349,8 +350,8 @@ interface ILendingPool { view returns ( uint256 availableLiquidity, - uint256 totalBorrowsStable, - uint256 totalBorrowsVariable, + uint256 totalStableDebt, + uint256 totalVariableDebt, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate, @@ -380,10 +381,9 @@ interface ILendingPool { uint256 currentStableDebt, uint256 currentVariableDebt, uint256 principalStableDebt, - uint256 principalVariableDebt, + uint256 scaledVariableDebt, uint256 stableBorrowRate, uint256 liquidityRate, - uint256 variableBorrowIndex, uint40 stableRateLastUpdated, bool usageAsCollateralEnabled ); @@ -428,7 +428,7 @@ interface ILendingPool { uint256 amount ) external view returns (bool); - function getReserves() external view returns (address[] memory); + function getReservesList() external view returns (address[] memory); /** * @dev Set the _pause state diff --git a/contracts/interfaces/ILendingPoolAddressesProvider.sol b/contracts/interfaces/ILendingPoolAddressesProvider.sol index 9f78edfe..53ed9873 100644 --- a/contracts/interfaces/ILendingPoolAddressesProvider.sol +++ b/contracts/interfaces/ILendingPoolAddressesProvider.sol @@ -7,7 +7,6 @@ pragma solidity ^0.6.8; */ interface ILendingPoolAddressesProvider { - //events event LendingPoolUpdated(address indexed newAddress); event AaveAdminUpdated(address indexed newAddress); event LendingPoolConfiguratorUpdated(address indexed newAddress); @@ -15,8 +14,16 @@ interface ILendingPoolAddressesProvider { event EthereumAddressUpdated(address indexed newAddress); event PriceOracleUpdated(address indexed newAddress); event LendingRateOracleUpdated(address indexed newAddress); - event ProxyCreated(bytes32 id, address indexed newAddress); + event AddressSet(bytes32 id, address indexed newAddress, bool hasProxy); + + function setAddress( + bytes32 id, + address newAddress, + address impl + ) external; + + function getAddress(bytes32 id) external view returns (address); function getLendingPool() external view returns (address); diff --git a/contracts/interfaces/ILendingPoolAddressesProviderRegistry.sol b/contracts/interfaces/ILendingPoolAddressesProviderRegistry.sol index ec26dd07..87c0c651 100644 --- a/contracts/interfaces/ILendingPoolAddressesProviderRegistry.sol +++ b/contracts/interfaces/ILendingPoolAddressesProviderRegistry.sol @@ -5,9 +5,7 @@ pragma solidity ^0.6.8; * @title ILendingPoolAddressesProvider interface * @notice provides the interface to fetch the LendingPoolCore address **/ - interface ILendingPoolAddressesProviderRegistry { - //events event AddressesProviderRegistered(address indexed newAddress); event AddressesProviderUnregistered(address indexed newAddress); @@ -15,6 +13,11 @@ interface ILendingPoolAddressesProviderRegistry { function isAddressesProviderRegistered(address provider) external view returns (uint256); + function getAddressesProviderIdByAddress(address addressesProvider) + external + view + returns (uint256); + function registerAddressesProvider(address provider, uint256 id) external; function unregisterAddressesProvider(address provider) external; diff --git a/contracts/interfaces/IReserveInterestRateStrategy.sol b/contracts/interfaces/IReserveInterestRateStrategy.sol index 48311e70..e04edbe5 100644 --- a/contracts/interfaces/IReserveInterestRateStrategy.sol +++ b/contracts/interfaces/IReserveInterestRateStrategy.sol @@ -10,9 +10,13 @@ interface IReserveInterestRateStrategy { /** * @dev returns the base variable borrow rate, in rays */ - function baseVariableBorrowRate() external view returns (uint256); + /** + * @dev returns the maximum variable borrow rate + */ + function getMaxVariableBorrowRate() external view returns (uint256); + /** * @dev calculates the liquidity, stable, and variable rates depending on the current utilization rate * and the base parameters @@ -21,9 +25,10 @@ interface IReserveInterestRateStrategy { function calculateInterestRates( address reserve, uint256 utilizationRate, - uint256 totalBorrowsStable, - uint256 totalBorrowsVariable, - uint256 averageStableBorrowRate + uint256 totalStableDebt, + uint256 totalVariableDebt, + uint256 averageStableBorrowRate, + uint256 reserveFactor ) external view diff --git a/contracts/lendingpool/DefaultReserveInterestRateStrategy.sol b/contracts/lendingpool/DefaultReserveInterestRateStrategy.sol index c2303254..1c6e4c0c 100644 --- a/contracts/lendingpool/DefaultReserveInterestRateStrategy.sol +++ b/contracts/lendingpool/DefaultReserveInterestRateStrategy.sol @@ -4,6 +4,7 @@ pragma solidity ^0.6.8; import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol'; import {IReserveInterestRateStrategy} from '../interfaces/IReserveInterestRateStrategy.sol'; import {WadRayMath} from '../libraries/math/WadRayMath.sol'; +import {PercentageMath} from '../libraries/math/PercentageMath.sol'; import {LendingPoolAddressesProvider} from '../configuration/LendingPoolAddressesProvider.sol'; import {ILendingRateOracle} from '../interfaces/ILendingRateOracle.sol'; @@ -17,7 +18,7 @@ import {ILendingRateOracle} from '../interfaces/ILendingRateOracle.sol'; contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy { using WadRayMath for uint256; using SafeMath for uint256; - + using PercentageMath for uint256; /** * @dev this constant represents the utilization rate at which the pool aims to obtain most competitive borrow rates * expressed in ray @@ -89,13 +90,26 @@ contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy { return _baseVariableBorrowRate; } + function getMaxVariableBorrowRate() external override view returns (uint256) { + return _baseVariableBorrowRate.add(_variableRateSlope1).add(_variableRateSlope2); + } + + struct CalcInterestRatesLocalVars { + uint256 totalBorrows; + uint256 currentVariableBorrowRate; + uint256 currentStableBorrowRate; + uint256 currentLiquidityRate; + uint256 utilizationRate; + } + /** * @dev calculates the interest rates depending on the available liquidity and the total borrowed. * @param reserve the address of the reserve * @param availableLiquidity the liquidity available in the reserve - * @param totalBorrowsStable the total borrowed from the reserve a stable rate - * @param totalBorrowsVariable the total borrowed from the reserve at a variable rate + * @param totalStableDebt the total borrowed from the reserve a stable rate + * @param totalVariableDebt the total borrowed from the reserve at a variable rate * @param averageStableBorrowRate the weighted average of all the stable rate borrows + * @param reserveFactor the reserve portion of the interest to redirect to the reserve treasury * @return currentLiquidityRate the liquidity rate * @return currentStableBorrowRate stable borrow rate * @return currentVariableBorrowRate variable borrow rate @@ -103,9 +117,10 @@ contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy { function calculateInterestRates( address reserve, uint256 availableLiquidity, - uint256 totalBorrowsStable, - uint256 totalBorrowsVariable, - uint256 averageStableBorrowRate + uint256 totalStableDebt, + uint256 totalVariableDebt, + uint256 averageStableBorrowRate, + uint256 reserveFactor ) external override @@ -116,16 +131,18 @@ contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy { uint256 ) { - uint256 totalBorrows = totalBorrowsStable.add(totalBorrowsVariable); - uint256 currentVariableBorrowRate = 0; - uint256 currentStableBorrowRate = 0; - uint256 currentLiquidityRate = 0; + CalcInterestRatesLocalVars memory vars; - uint256 utilizationRate = totalBorrows == 0 + vars.totalBorrows = totalStableDebt.add(totalVariableDebt); + vars.currentVariableBorrowRate = 0; + vars.currentStableBorrowRate = 0; + vars.currentLiquidityRate = 0; + + uint256 utilizationRate = vars.totalBorrows == 0 ? 0 - : totalBorrows.rayDiv(availableLiquidity.add(totalBorrows)); + : vars.totalBorrows.rayDiv(availableLiquidity.add(vars.totalBorrows)); - currentStableBorrowRate = ILendingRateOracle(addressesProvider.getLendingRateOracle()) + vars.currentStableBorrowRate = ILendingRateOracle(addressesProvider.getLendingRateOracle()) .getMarketBorrowRate(reserve); if (utilizationRate > OPTIMAL_UTILIZATION_RATE) { @@ -133,58 +150,60 @@ contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy { EXCESS_UTILIZATION_RATE ); - currentStableBorrowRate = currentStableBorrowRate.add(_stableRateSlope1).add( + vars.currentStableBorrowRate = vars.currentStableBorrowRate.add(_stableRateSlope1).add( _stableRateSlope2.rayMul(excessUtilizationRateRatio) ); - currentVariableBorrowRate = _baseVariableBorrowRate.add(_variableRateSlope1).add( + vars.currentVariableBorrowRate = _baseVariableBorrowRate.add(_variableRateSlope1).add( _variableRateSlope2.rayMul(excessUtilizationRateRatio) ); } else { - currentStableBorrowRate = currentStableBorrowRate.add( + vars.currentStableBorrowRate = vars.currentStableBorrowRate.add( _stableRateSlope1.rayMul(utilizationRate.rayDiv(OPTIMAL_UTILIZATION_RATE)) ); - currentVariableBorrowRate = _baseVariableBorrowRate.add( + vars.currentVariableBorrowRate = _baseVariableBorrowRate.add( utilizationRate.rayDiv(OPTIMAL_UTILIZATION_RATE).rayMul(_variableRateSlope1) ); } - currentLiquidityRate = _getOverallBorrowRate( - totalBorrowsStable, - totalBorrowsVariable, - currentVariableBorrowRate, + vars.currentLiquidityRate = _getOverallBorrowRate( + totalStableDebt, + totalVariableDebt, + vars + .currentVariableBorrowRate, averageStableBorrowRate ) - .rayMul(utilizationRate); + .rayMul(utilizationRate) + .percentMul(PercentageMath.PERCENTAGE_FACTOR.sub(reserveFactor)); - return (currentLiquidityRate, currentStableBorrowRate, currentVariableBorrowRate); + return ( + vars.currentLiquidityRate, + vars.currentStableBorrowRate, + vars.currentVariableBorrowRate + ); } /** * @dev calculates the overall borrow rate as the weighted average between the total variable borrows and total stable borrows. - * @param totalBorrowsStable the total borrowed from the reserve a stable rate - * @param totalBorrowsVariable the total borrowed from the reserve at a variable rate + * @param totalStableDebt the total borrowed from the reserve a stable rate + * @param totalVariableDebt the total borrowed from the reserve at a variable rate * @param currentVariableBorrowRate the current variable borrow rate * @param currentAverageStableBorrowRate the weighted average of all the stable rate borrows * @return the weighted averaged borrow rate **/ function _getOverallBorrowRate( - uint256 totalBorrowsStable, - uint256 totalBorrowsVariable, + uint256 totalStableDebt, + uint256 totalVariableDebt, uint256 currentVariableBorrowRate, uint256 currentAverageStableBorrowRate ) internal pure returns (uint256) { - uint256 totalBorrows = totalBorrowsStable.add(totalBorrowsVariable); + uint256 totalBorrows = totalStableDebt.add(totalVariableDebt); if (totalBorrows == 0) return 0; - uint256 weightedVariableRate = totalBorrowsVariable.wadToRay().rayMul( - currentVariableBorrowRate - ); + uint256 weightedVariableRate = totalVariableDebt.wadToRay().rayMul(currentVariableBorrowRate); - uint256 weightedStableRate = totalBorrowsStable.wadToRay().rayMul( - currentAverageStableBorrowRate - ); + uint256 weightedStableRate = totalStableDebt.wadToRay().rayMul(currentAverageStableBorrowRate); uint256 overallBorrowRate = weightedVariableRate.add(weightedStableRate).rayDiv( totalBorrows.wadToRay() diff --git a/contracts/lendingpool/LendingPool.sol b/contracts/lendingpool/LendingPool.sol index e6a3c059..526aa7f0 100644 --- a/contracts/lendingpool/LendingPool.sol +++ b/contracts/lendingpool/LendingPool.sol @@ -12,6 +12,7 @@ import {IAToken} from '../tokenization/interfaces/IAToken.sol'; import {Helpers} from '../libraries/helpers/Helpers.sol'; import {Errors} from '../libraries/helpers/Errors.sol'; import {WadRayMath} from '../libraries/math/WadRayMath.sol'; +import {PercentageMath} from '../libraries/math/PercentageMath.sol'; import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol'; import {GenericLogic} from '../libraries/logic/GenericLogic.sol'; import {ValidationLogic} from '../libraries/logic/ValidationLogic.sol'; @@ -19,48 +20,39 @@ import {ReserveConfiguration} from '../libraries/configuration/ReserveConfigurat import {UserConfiguration} from '../libraries/configuration/UserConfiguration.sol'; import {IStableDebtToken} from '../tokenization/interfaces/IStableDebtToken.sol'; import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol'; +import {DebtTokenBase} from '../tokenization/base/DebtTokenBase.sol'; import {IFlashLoanReceiver} from '../flashloan/interfaces/IFlashLoanReceiver.sol'; import {ISwapAdapter} from '../interfaces/ISwapAdapter.sol'; import {LendingPoolCollateralManager} from './LendingPoolCollateralManager.sol'; import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import {ILendingPool} from '../interfaces/ILendingPool.sol'; +import {LendingPoolStorage} from './LendingPoolStorage.sol'; +import {IReserveInterestRateStrategy} from '../interfaces/IReserveInterestRateStrategy.sol'; /** * @title LendingPool contract * @notice Implements the actions of the LendingPool, and exposes accessory methods to fetch the users and reserve data * @author Aave **/ - -contract LendingPool is VersionedInitializable, ILendingPool { +contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage { using SafeMath for uint256; using WadRayMath for uint256; - using ReserveLogic for ReserveLogic.ReserveData; - using ReserveConfiguration for ReserveConfiguration.Map; - using UserConfiguration for UserConfiguration.Map; + using PercentageMath for uint256; using SafeERC20 for IERC20; //main configuration parameters - uint256 public constant REBALANCE_DOWN_RATE_DELTA = (1e27) / 5; - uint256 public constant MAX_STABLE_RATE_BORROW_SIZE_PERCENT = 25; + uint256 public constant REBALANCE_UP_LIQUIDITY_RATE_THRESHOLD = 4000; + uint256 public constant REBALANCE_UP_USAGE_RATIO_THRESHOLD = 0.95 * 1e27; //usage ratio of 95% + uint256 public constant MAX_STABLE_RATE_BORROW_SIZE_PERCENT = 2500; uint256 public constant FLASHLOAN_PREMIUM_TOTAL = 9; - - ILendingPoolAddressesProvider internal _addressesProvider; - - mapping(address => ReserveLogic.ReserveData) internal _reserves; - mapping(address => UserConfiguration.Map) internal _usersConfig; - // debt token address => user who gives allowance => user who receives allowance => amount - mapping(address => mapping(address => mapping(address => uint256))) internal _borrowAllowance; - - address[] internal _reservesList; - - bool internal _flashLiquidationLocked; - bool internal _paused; + uint256 public constant MAX_NUMBER_RESERVES = 128; + uint256 public constant LENDINGPOOL_REVISION = 0x2; /** * @dev only lending pools configurator can use functions affected by this modifier **/ - function onlyLendingPoolConfigurator() internal view { + function _onlyLendingPoolConfigurator() internal view { require( _addressesProvider.getLendingPoolConfigurator() == msg.sender, Errors.CALLER_NOT_LENDING_POOL_CONFIGURATOR @@ -74,14 +66,10 @@ contract LendingPool is VersionedInitializable, ILendingPool { * * - The contract must not be paused. */ - function whenNotPaused() internal view { + function _whenNotPaused() internal view { require(!_paused, Errors.IS_PAUSED); } - uint256 public constant UINT_MAX_VALUE = uint256(-1); - - uint256 public constant LENDINGPOOL_REVISION = 0x2; - function getRevision() internal override pure returns (uint256) { return LENDINGPOOL_REVISION; } @@ -108,14 +96,14 @@ contract LendingPool is VersionedInitializable, ILendingPool { address onBehalfOf, uint16 referralCode ) external override { - whenNotPaused(); + _whenNotPaused(); ReserveLogic.ReserveData storage reserve = _reserves[asset]; ValidationLogic.validateDeposit(reserve, amount); address aToken = reserve.aTokenAddress; - reserve.updateCumulativeIndexesAndTimestamp(); + reserve.updateState(); reserve.updateInterestRates(asset, aToken, amount, 0); bool isFirstDeposit = IAToken(aToken).balanceOf(onBehalfOf) == 0; @@ -137,7 +125,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { * @param amount the underlying amount to be redeemed **/ function withdraw(address asset, uint256 amount) external override { - whenNotPaused(); + _whenNotPaused(); ReserveLogic.ReserveData storage reserve = _reserves[asset]; address aToken = reserve.aTokenAddress; @@ -147,22 +135,22 @@ contract LendingPool is VersionedInitializable, ILendingPool { uint256 amountToWithdraw = amount; //if amount is equal to uint(-1), the user wants to redeem everything - if (amount == UINT_MAX_VALUE) { + if (amount == type(uint256).max) { amountToWithdraw = userBalance; } ValidationLogic.validateWithdraw( asset, - aToken, amountToWithdraw, userBalance, _reserves, _usersConfig[msg.sender], _reservesList, + _reservesCount, _addressesProvider.getPriceOracle() ); - reserve.updateCumulativeIndexesAndTimestamp(); + reserve.updateState(); reserve.updateInterestRates(asset, aToken, 0, amountToWithdraw); @@ -175,6 +163,14 @@ contract LendingPool is VersionedInitializable, ILendingPool { emit Withdraw(asset, msg.sender, amount); } + /** + * @dev returns the borrow allowance of the user + * @param asset The underlying asset of the debt token + * @param fromUser The user to giving allowance + * @param toUser The user to give allowance to + * @param interestRateMode Type of debt: 1 for stable, 2 for variable + * @return the current allowance of toUser + **/ function getBorrowAllowance( address fromUser, address toUser, @@ -198,7 +194,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { uint256 interestRateMode, uint256 amount ) external override { - whenNotPaused(); + _whenNotPaused(); address debtToken = _reserves[asset].getDebtTokenAddress(interestRateMode); _borrowAllowance[debtToken][msg.sender][user] = amount; @@ -221,7 +217,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { uint16 referralCode, address onBehalfOf ) external override { - whenNotPaused(); + _whenNotPaused(); ReserveLogic.ReserveData storage reserve = _reserves[asset]; if (onBehalfOf != msg.sender) { @@ -261,17 +257,8 @@ contract LendingPool is VersionedInitializable, ILendingPool { uint256 rateMode, address onBehalfOf ) external override { - whenNotPaused(); - _executeRepay(asset, msg.sender, amount, rateMode, onBehalfOf); - } + _whenNotPaused(); - function _executeRepay( - address asset, - address user, - uint256 amount, - uint256 rateMode, - address onBehalfOf - ) internal { ReserveLogic.ReserveData storage reserve = _reserves[asset]; (uint256 stableDebt, uint256 variableDebt) = Helpers.getUserCurrentDebt(onBehalfOf, reserve); @@ -283,7 +270,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { ? stableDebt : variableDebt; - if (amount != UINT_MAX_VALUE && amount < paybackAmount) { + if (amount != type(uint256).max && amount < paybackAmount) { paybackAmount = amount; } @@ -296,13 +283,17 @@ contract LendingPool is VersionedInitializable, ILendingPool { variableDebt ); - reserve.updateCumulativeIndexesAndTimestamp(); + reserve.updateState(); //burns an equivalent amount of debt tokens if (interestRateMode == ReserveLogic.InterestRateMode.STABLE) { IStableDebtToken(reserve.stableDebtTokenAddress).burn(onBehalfOf, paybackAmount); } else { - IVariableDebtToken(reserve.variableDebtTokenAddress).burn(onBehalfOf, paybackAmount); + IVariableDebtToken(reserve.variableDebtTokenAddress).burn( + onBehalfOf, + paybackAmount, + reserve.variableBorrowIndex + ); } address aToken = reserve.aTokenAddress; @@ -312,9 +303,9 @@ contract LendingPool is VersionedInitializable, ILendingPool { _usersConfig[onBehalfOf].setBorrowing(reserve.id, false); } - IERC20(asset).safeTransferFrom(user, aToken, paybackAmount); + IERC20(asset).safeTransferFrom(msg.sender, aToken, paybackAmount); - emit Repay(asset, onBehalfOf, user, paybackAmount); + emit Repay(asset, onBehalfOf, msg.sender, paybackAmount); } /** @@ -323,7 +314,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { * @param rateMode the rate mode that the user wants to swap **/ function swapBorrowRateMode(address asset, uint256 rateMode) external override { - whenNotPaused(); + _whenNotPaused(); ReserveLogic.ReserveData storage reserve = _reserves[asset]; (uint256 stableDebt, uint256 variableDebt) = Helpers.getUserCurrentDebt(msg.sender, reserve); @@ -338,15 +329,23 @@ contract LendingPool is VersionedInitializable, ILendingPool { interestRateMode ); - reserve.updateCumulativeIndexesAndTimestamp(); + reserve.updateState(); if (interestRateMode == ReserveLogic.InterestRateMode.STABLE) { //burn stable rate tokens, mint variable rate tokens IStableDebtToken(reserve.stableDebtTokenAddress).burn(msg.sender, stableDebt); - IVariableDebtToken(reserve.variableDebtTokenAddress).mint(msg.sender, stableDebt); + IVariableDebtToken(reserve.variableDebtTokenAddress).mint( + msg.sender, + stableDebt, + reserve.variableBorrowIndex + ); } else { //do the opposite - IVariableDebtToken(reserve.variableDebtTokenAddress).burn(msg.sender, variableDebt); + IVariableDebtToken(reserve.variableDebtTokenAddress).burn( + msg.sender, + variableDebt, + reserve.variableBorrowIndex + ); IStableDebtToken(reserve.stableDebtTokenAddress).mint( msg.sender, variableDebt, @@ -367,44 +366,55 @@ contract LendingPool is VersionedInitializable, ILendingPool { * @param user the address of the user to be rebalanced **/ function rebalanceStableBorrowRate(address asset, address user) external override { - whenNotPaused(); + _whenNotPaused(); + ReserveLogic.ReserveData storage reserve = _reserves[asset]; - IStableDebtToken stableDebtToken = IStableDebtToken(reserve.stableDebtTokenAddress); + IERC20 stableDebtToken = IERC20(reserve.stableDebtTokenAddress); + IERC20 variableDebtToken = IERC20(reserve.variableDebtTokenAddress); + address aTokenAddress = reserve.aTokenAddress; - uint256 stableBorrowBalance = IERC20(address(stableDebtToken)).balanceOf(user); + uint256 stableBorrowBalance = IERC20(stableDebtToken).balanceOf(user); - // user must be borrowing on asset at a stable rate - require(stableBorrowBalance > 0, Errors.NOT_ENOUGH_STABLE_BORROW_BALANCE); + //if the utilization rate is below 95%, no rebalances are needed + uint256 totalBorrows = stableDebtToken + .totalSupply() + .add(variableDebtToken.totalSupply()) + .wadToRay(); + uint256 availableLiquidity = IERC20(asset).balanceOf(aTokenAddress).wadToRay(); + uint256 usageRatio = totalBorrows == 0 + ? 0 + : totalBorrows.rayDiv(availableLiquidity.add(totalBorrows)); - uint256 rebalanceDownRateThreshold = WadRayMath.ray().add(REBALANCE_DOWN_RATE_DELTA).rayMul( - reserve.currentStableBorrowRate - ); + //if the liquidity rate is below REBALANCE_UP_THRESHOLD of the max variable APR at 95% usage, + //then we allow rebalancing of the stable rate positions. - //1. user stable borrow rate is below the current liquidity rate. The loan needs to be rebalanced, - //as this situation can be abused (user putting back the borrowed liquidity in the same reserve to earn on it) - //2. user stable rate is above the market avg borrow rate of a certain delta, and utilization rate is low. - //In this case, the user is paying an interest that is too high, and needs to be rescaled down. - - uint256 userStableRate = stableDebtToken.getUserStableRate(user); + uint256 currentLiquidityRate = reserve.currentLiquidityRate; + uint256 maxVariableBorrowRate = IReserveInterestRateStrategy( + reserve + .interestRateStrategyAddress + ) + .getMaxVariableBorrowRate(); require( - userStableRate < reserve.currentLiquidityRate || userStableRate > rebalanceDownRateThreshold, + usageRatio >= REBALANCE_UP_USAGE_RATIO_THRESHOLD && + currentLiquidityRate <= + maxVariableBorrowRate.percentMul(REBALANCE_UP_LIQUIDITY_RATE_THRESHOLD), Errors.INTEREST_RATE_REBALANCE_CONDITIONS_NOT_MET ); - //burn old debt tokens, mint new ones + reserve.updateState(); - reserve.updateCumulativeIndexesAndTimestamp(); + IStableDebtToken(address(stableDebtToken)).burn(user, stableBorrowBalance); + IStableDebtToken(address(stableDebtToken)).mint( + user, + stableBorrowBalance, + reserve.currentStableBorrowRate + ); - stableDebtToken.burn(user, stableBorrowBalance); - stableDebtToken.mint(user, stableBorrowBalance, reserve.currentStableBorrowRate); - - reserve.updateInterestRates(asset, reserve.aTokenAddress, 0, 0); + reserve.updateInterestRates(asset, aTokenAddress, 0, 0); emit RebalanceStableBorrowRate(asset, user); - - return; } /** @@ -413,7 +423,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { * @param useAsCollateral true if the user wants to user the deposit as collateral, false otherwise. **/ function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external override { - whenNotPaused(); + _whenNotPaused(); ReserveLogic.ReserveData storage reserve = _reserves[asset]; ValidationLogic.validateSetUseReserveAsCollateral( @@ -422,6 +432,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { _reserves, _usersConfig[msg.sender], _reservesList, + _reservesCount, _addressesProvider.getPriceOracle() ); @@ -450,7 +461,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { uint256 purchaseAmount, bool receiveAToken ) external override { - whenNotPaused(); + _whenNotPaused(); address collateralManager = _addressesProvider.getLendingPoolCollateralManager(); //solium-disable-next-line @@ -474,19 +485,6 @@ contract LendingPool is VersionedInitializable, ILendingPool { } } - struct FlashLoanLocalVars { - uint256 premium; - uint256 amountPlusPremium; - uint256 amountPlusPremiumInETH; - uint256 receiverBalance; - uint256 receiverAllowance; - uint256 availableBalance; - uint256 assetPrice; - IFlashLoanReceiver receiver; - address aTokenAddress; - address oracle; - } - /** * @dev flashes the underlying collateral on an user to swap for the owed asset and repay * - Both the owner of the position and other liquidators can execute it @@ -507,7 +505,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { address receiver, bytes calldata params ) external override { - whenNotPaused(); + _whenNotPaused(); require(!_flashLiquidationLocked, Errors.REENTRANCY_NOT_ALLOWED); _flashLiquidationLocked = true; @@ -536,6 +534,14 @@ contract LendingPool is VersionedInitializable, ILendingPool { _flashLiquidationLocked = false; } + struct FlashLoanLocalVars { + uint256 premium; + uint256 amountPlusPremium; + IFlashLoanReceiver receiver; + address aTokenAddress; + address oracle; + } + /** * @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 @@ -555,7 +561,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { bytes calldata params, uint16 referralCode ) external override { - whenNotPaused(); + _whenNotPaused(); ReserveLogic.ReserveData storage reserve = _reserves[asset]; FlashLoanLocalVars memory vars; @@ -578,21 +584,22 @@ contract LendingPool is VersionedInitializable, ILendingPool { vars.amountPlusPremium = amount.add(vars.premium); if (debtMode == ReserveLogic.InterestRateMode.NONE) { - IERC20(asset).transferFrom(receiverAddress, vars.aTokenAddress, vars.amountPlusPremium); + IERC20(asset).safeTransferFrom(receiverAddress, vars.aTokenAddress, vars.amountPlusPremium); - reserve.updateCumulativeIndexesAndTimestamp(); + reserve.updateState(); reserve.cumulateToLiquidityIndex(IERC20(vars.aTokenAddress).totalSupply(), vars.premium); reserve.updateInterestRates(asset, vars.aTokenAddress, vars.premium, 0); emit FlashLoan(receiverAddress, asset, amount, vars.premium, referralCode); } else { - // If the transfer didn't succeed, the receiver either didn't return the funds, or didn't approve the transfer. + //if the user didn't choose to return the funds, the system checks if there + //is enough collateral and eventually open a position _executeBorrow( ExecuteBorrowParams( asset, msg.sender, msg.sender, - vars.amountPlusPremium.sub(vars.availableBalance), + vars.amountPlusPremium, mode, vars.aTokenAddress, referralCode, @@ -617,7 +624,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { uint256 amountToSwap, bytes calldata params ) external override { - whenNotPaused(); + _whenNotPaused(); address collateralManager = _addressesProvider.getLendingPoolCollateralManager(); //solium-disable-next-line @@ -653,6 +660,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus, + uint256 reserveFactor, address interestRateStrategyAddress, bool usageAsCollateralEnabled, bool borrowingEnabled, @@ -668,6 +676,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { reserve.configuration.getLtv(), reserve.configuration.getLiquidationThreshold(), reserve.configuration.getLiquidationBonus(), + reserve.configuration.getReserveFactor(), reserve.interestRateStrategyAddress, reserve.configuration.getLtv() != 0, reserve.configuration.getBorrowingEnabled(), @@ -702,8 +711,8 @@ contract LendingPool is VersionedInitializable, ILendingPool { view returns ( uint256 availableLiquidity, - uint256 totalBorrowsStable, - uint256 totalBorrowsVariable, + uint256 totalStableDebt, + uint256 totalVariableDebt, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate, @@ -714,6 +723,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { ) { ReserveLogic.ReserveData memory reserve = _reserves[asset]; + return ( IERC20(asset).balanceOf(reserve.aTokenAddress), IERC20(reserve.stableDebtTokenAddress).totalSupply(), @@ -752,6 +762,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { _reserves, _usersConfig[user], _reservesList, + _reservesCount, _addressesProvider.getPriceOracle() ); @@ -771,10 +782,9 @@ contract LendingPool is VersionedInitializable, ILendingPool { uint256 currentStableDebt, uint256 currentVariableDebt, uint256 principalStableDebt, - uint256 principalVariableDebt, + uint256 scaledVariableDebt, uint256 stableBorrowRate, uint256 liquidityRate, - uint256 variableBorrowIndex, uint40 stableRateLastUpdated, bool usageAsCollateralEnabled ) @@ -783,18 +793,14 @@ contract LendingPool is VersionedInitializable, ILendingPool { currentATokenBalance = IERC20(reserve.aTokenAddress).balanceOf(user); (currentStableDebt, currentVariableDebt) = Helpers.getUserCurrentDebt(user, reserve); - (principalStableDebt, principalVariableDebt) = Helpers.getUserPrincipalDebt(user, reserve); + principalStableDebt = IStableDebtToken(reserve.stableDebtTokenAddress).principalBalanceOf(user); + scaledVariableDebt = IVariableDebtToken(reserve.variableDebtTokenAddress).scaledBalanceOf(user); liquidityRate = reserve.currentLiquidityRate; stableBorrowRate = IStableDebtToken(reserve.stableDebtTokenAddress).getUserStableRate(user); stableRateLastUpdated = IStableDebtToken(reserve.stableDebtTokenAddress).getUserLastUpdated( user ); usageAsCollateralEnabled = _usersConfig[user].isUsingAsCollateral(reserve.id); - variableBorrowIndex = IVariableDebtToken(reserve.variableDebtTokenAddress).getUserIndex(user); - } - - function getReserves() external override view returns (address[] memory) { - return _reservesList; } receive() external payable { @@ -814,7 +820,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { address variableDebtAddress, address interestRateStrategyAddress ) external override { - onlyLendingPoolConfigurator(); + _onlyLendingPoolConfigurator(); _reserves[asset].init( aTokenAddress, stableDebtAddress, @@ -834,12 +840,12 @@ contract LendingPool is VersionedInitializable, ILendingPool { external override { - onlyLendingPoolConfigurator(); + _onlyLendingPoolConfigurator(); _reserves[asset].interestRateStrategyAddress = rateStrategyAddress; } function setConfiguration(address asset, uint256 configuration) external override { - onlyLendingPoolConfigurator(); + _onlyLendingPoolConfigurator(); _reserves[asset].configuration.data = configuration; } @@ -889,15 +895,16 @@ contract LendingPool is VersionedInitializable, ILendingPool { _reserves, userConfig, _reservesList, + _reservesCount, oracle ); - uint256 reserveIndex = reserve.id; - if (!userConfig.isBorrowing(reserveIndex)) { - userConfig.setBorrowing(reserveIndex, true); + uint256 reserveId = reserve.id; + if (!userConfig.isBorrowing(reserveId)) { + userConfig.setBorrowing(reserveId, true); } - reserve.updateCumulativeIndexesAndTimestamp(); + reserve.updateState(); //caching the current stable borrow rate uint256 currentStableRate = 0; @@ -913,7 +920,11 @@ contract LendingPool is VersionedInitializable, ILendingPool { currentStableRate ); } else { - IVariableDebtToken(reserve.variableDebtTokenAddress).mint(vars.onBehalfOf, vars.amount); + IVariableDebtToken(reserve.variableDebtTokenAddress).mint( + vars.onBehalfOf, + vars.amount, + reserve.variableBorrowIndex + ); } reserve.updateInterestRates( @@ -944,14 +955,15 @@ contract LendingPool is VersionedInitializable, ILendingPool { * @dev adds a reserve to the array of the _reserves address **/ function _addReserveToList(address asset) internal { - bool reserveAlreadyAdded = false; - for (uint256 i = 0; i < _reservesList.length; i++) - if (_reservesList[i] == asset) { - reserveAlreadyAdded = true; - } + require(_reservesCount < MAX_NUMBER_RESERVES, Errors.NO_MORE_RESERVES_ALLOWED); + + bool reserveAlreadyAdded = _reserves[asset].id != 0 || _reservesList[0] == asset; + if (!reserveAlreadyAdded) { - _reserves[asset].id = uint8(_reservesList.length); - _reservesList.push(asset); + _reserves[asset].id = uint8(_reservesCount); + _reservesList[_reservesCount] = asset; + + _reservesCount++; } } @@ -990,7 +1002,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { address user, uint256 amount ) external override view returns (bool) { - whenNotPaused(); + _whenNotPaused(); return GenericLogic.balanceDecreaseAllowed( asset, @@ -999,30 +1011,17 @@ contract LendingPool is VersionedInitializable, ILendingPool { _reserves, _usersConfig[user], _reservesList, + _reservesCount, _addressesProvider.getPriceOracle() ); } - /** - * @dev returns the list of the initialized reserves - **/ - function getReservesList() external view returns (address[] memory) { - return _reservesList; - } - - /** - * @dev returns the addresses provider - **/ - function getAddressesProvider() external view returns (ILendingPoolAddressesProvider) { - return _addressesProvider; - } - /** * @dev Set the _pause state * @param val the boolean value to set the current pause state of LendingPool */ function setPause(bool val) external override { - onlyLendingPoolConfigurator(); + _onlyLendingPoolConfigurator(); _paused = val; if (_paused) { @@ -1038,4 +1037,23 @@ contract LendingPool is VersionedInitializable, ILendingPool { function paused() external override view returns (bool) { return _paused; } + + /** + * @dev returns the list of the initialized reserves + **/ + function getReservesList() external override view returns (address[] memory) { + address[] memory _activeReserves = new address[](_reservesCount); + + for (uint256 i = 0; i < _reservesCount; i++) { + _activeReserves[i] = _reservesList[i]; + } + return _activeReserves; + } + + /** + * @dev returns the addresses provider + **/ + function getAddressesProvider() external view returns (ILendingPoolAddressesProvider) { + return _addressesProvider; + } } diff --git a/contracts/lendingpool/LendingPoolCollateralManager.sol b/contracts/lendingpool/LendingPoolCollateralManager.sol index 840e8150..1e5488a4 100644 --- a/contracts/lendingpool/LendingPoolCollateralManager.sol +++ b/contracts/lendingpool/LendingPoolCollateralManager.sol @@ -6,14 +6,13 @@ import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import { VersionedInitializable } from '../libraries/openzeppelin-upgradeability/VersionedInitializable.sol'; -import {LendingPoolAddressesProvider} from '../configuration/LendingPoolAddressesProvider.sol'; import {IAToken} from '../tokenization/interfaces/IAToken.sol'; import {IStableDebtToken} from '../tokenization/interfaces/IStableDebtToken.sol'; import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol'; +import {DebtTokenBase} from '../tokenization/base/DebtTokenBase.sol'; import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol'; import {GenericLogic} from '../libraries/logic/GenericLogic.sol'; import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol'; -import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol'; import {UserConfiguration} from '../libraries/configuration/UserConfiguration.sol'; import {Helpers} from '../libraries/helpers/Helpers.sol'; import {WadRayMath} from '../libraries/math/WadRayMath.sol'; @@ -22,6 +21,7 @@ import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import {ISwapAdapter} from '../interfaces/ISwapAdapter.sol'; import {Errors} from '../libraries/helpers/Errors.sol'; import {ValidationLogic} from '../libraries/logic/ValidationLogic.sol'; +import {LendingPoolStorage} from './LendingPoolStorage.sol'; /** * @title LendingPoolCollateralManager contract @@ -30,29 +30,15 @@ import {ValidationLogic} from '../libraries/logic/ValidationLogic.sol'; * @notice this contract will be ran always through delegatecall * @dev LendingPoolCollateralManager inherits VersionedInitializable from OpenZeppelin to have the same storage layout as LendingPool **/ -contract LendingPoolCollateralManager is VersionedInitializable { +contract LendingPoolCollateralManager is VersionedInitializable, LendingPoolStorage { using SafeERC20 for IERC20; using SafeMath for uint256; using WadRayMath for uint256; using PercentageMath for uint256; - using ReserveLogic for ReserveLogic.ReserveData; - using ReserveConfiguration for ReserveConfiguration.Map; - using UserConfiguration for UserConfiguration.Map; // IMPORTANT The storage layout of the LendingPool is reproduced here because this contract // is gonna be used through DELEGATECALL - LendingPoolAddressesProvider internal addressesProvider; - - mapping(address => ReserveLogic.ReserveData) internal reserves; - mapping(address => UserConfiguration.Map) internal usersConfig; - mapping(address => mapping(address => mapping(address => uint256))) internal _borrowAllowance; - - address[] internal reservesList; - - bool internal _flashLiquidationLocked; - bool public _paused; - uint256 internal constant LIQUIDATION_CLOSE_FACTOR_PERCENT = 5000; /** @@ -157,18 +143,19 @@ contract LendingPoolCollateralManager is VersionedInitializable { uint256 purchaseAmount, bool receiveAToken ) external returns (uint256, string memory) { - ReserveLogic.ReserveData storage collateralReserve = reserves[collateral]; - ReserveLogic.ReserveData storage principalReserve = reserves[principal]; - UserConfiguration.Map storage userConfig = usersConfig[user]; + ReserveLogic.ReserveData storage collateralReserve = _reserves[collateral]; + ReserveLogic.ReserveData storage principalReserve = _reserves[principal]; + UserConfiguration.Map storage userConfig = _usersConfig[user]; LiquidationCallLocalVars memory vars; (, , , , vars.healthFactor) = GenericLogic.calculateUserAccountData( user, - reserves, - usersConfig[user], - reservesList, - addressesProvider.getPriceOracle() + _reserves, + _usersConfig[user], + _reservesList, + _reservesCount, + _addressesProvider.getPriceOracle() ); //if the user hasn't borrowed the specific currency defined by asset, it cannot be liquidated @@ -236,7 +223,8 @@ contract LendingPoolCollateralManager is VersionedInitializable { } //update the principal reserve - principalReserve.updateCumulativeIndexesAndTimestamp(); + principalReserve.updateState(); + principalReserve.updateInterestRates( principal, principalReserve.aTokenAddress, @@ -247,13 +235,16 @@ contract LendingPoolCollateralManager is VersionedInitializable { if (vars.userVariableDebt >= vars.actualAmountToLiquidate) { IVariableDebtToken(principalReserve.variableDebtTokenAddress).burn( user, - vars.actualAmountToLiquidate + vars.actualAmountToLiquidate, + principalReserve.variableBorrowIndex ); } else { IVariableDebtToken(principalReserve.variableDebtTokenAddress).burn( user, - vars.userVariableDebt + vars.userVariableDebt, + principalReserve.variableBorrowIndex ); + IStableDebtToken(principalReserve.stableDebtTokenAddress).burn( user, vars.actualAmountToLiquidate.sub(vars.userVariableDebt) @@ -267,7 +258,7 @@ contract LendingPoolCollateralManager is VersionedInitializable { //otherwise receives the underlying asset //updating collateral reserve - collateralReserve.updateCumulativeIndexesAndTimestamp(); + collateralReserve.updateState(); collateralReserve.updateInterestRates( collateral, address(vars.collateralAtoken), @@ -324,18 +315,19 @@ contract LendingPoolCollateralManager is VersionedInitializable { address receiver, bytes calldata params ) external returns (uint256, string memory) { - ReserveLogic.ReserveData storage collateralReserve = reserves[collateral]; - ReserveLogic.ReserveData storage debtReserve = reserves[principal]; - UserConfiguration.Map storage userConfig = usersConfig[user]; + ReserveLogic.ReserveData storage collateralReserve = _reserves[collateral]; + ReserveLogic.ReserveData storage debtReserve = _reserves[principal]; + UserConfiguration.Map storage userConfig = _usersConfig[user]; LiquidationCallLocalVars memory vars; (, , , , vars.healthFactor) = GenericLogic.calculateUserAccountData( user, - reserves, - usersConfig[user], - reservesList, - addressesProvider.getPriceOracle() + _reserves, + _usersConfig[user], + _reservesList, + _reservesCount, + _addressesProvider.getPriceOracle() ); (vars.userStableDebt, vars.userVariableDebt) = Helpers.getUserCurrentDebt(user, debtReserve); @@ -382,7 +374,15 @@ contract LendingPoolCollateralManager is VersionedInitializable { vars.actualAmountToLiquidate = vars.principalAmountNeeded; } //updating collateral reserve indexes - collateralReserve.updateCumulativeIndexesAndTimestamp(); + collateralReserve.updateState(); + + //updating collateral reserve interest rates + collateralReserve.updateInterestRates( + collateral, + address(vars.collateralAtoken), + 0, + vars.maxCollateralToLiquidate + ); vars.collateralAtoken.burn( user, @@ -392,7 +392,7 @@ contract LendingPoolCollateralManager is VersionedInitializable { ); if (vars.userCollateralBalance == vars.maxCollateralToLiquidate) { - usersConfig[user].setUsingAsCollateral(collateralReserve.id, false); + _usersConfig[user].setUsingAsCollateral(collateralReserve.id, false); } vars.principalAToken = debtReserve.aTokenAddress; @@ -407,36 +407,37 @@ contract LendingPoolCollateralManager is VersionedInitializable { ); //updating debt reserve - debtReserve.updateCumulativeIndexesAndTimestamp(); + debtReserve.updateState(); debtReserve.updateInterestRates( principal, vars.principalAToken, vars.actualAmountToLiquidate, 0 ); - IERC20(principal).transferFrom(receiver, vars.principalAToken, vars.actualAmountToLiquidate); + IERC20(principal).safeTransferFrom( + receiver, + vars.principalAToken, + vars.actualAmountToLiquidate + ); if (vars.userVariableDebt >= vars.actualAmountToLiquidate) { IVariableDebtToken(debtReserve.variableDebtTokenAddress).burn( user, - vars.actualAmountToLiquidate + vars.actualAmountToLiquidate, + debtReserve.variableBorrowIndex ); } else { - IVariableDebtToken(debtReserve.variableDebtTokenAddress).burn(user, vars.userVariableDebt); + IVariableDebtToken(debtReserve.variableDebtTokenAddress).burn( + user, + vars.userVariableDebt, + debtReserve.variableBorrowIndex + ); IStableDebtToken(debtReserve.stableDebtTokenAddress).burn( user, vars.actualAmountToLiquidate.sub(vars.userVariableDebt) ); } - //updating collateral reserve - collateralReserve.updateInterestRates( - collateral, - address(vars.collateralAtoken), - 0, - vars.maxCollateralToLiquidate - ); - emit RepaidWithCollateral( collateral, principal, @@ -464,10 +465,9 @@ contract LendingPoolCollateralManager is VersionedInitializable { uint256 amountToSwap, bytes calldata params ) external returns (uint256, string memory) { - ReserveLogic.ReserveData storage fromReserve = reserves[fromAsset]; - ReserveLogic.ReserveData storage toReserve = reserves[toAsset]; + ReserveLogic.ReserveData storage fromReserve = _reserves[fromAsset]; + ReserveLogic.ReserveData storage toReserve = _reserves[toAsset]; - // Usage of a memory struct of vars to avoid "Stack too deep" errors due to local variables SwapLiquidityLocalVars memory vars; (vars.errorCode, vars.errorMsg) = ValidationLogic.validateSwapLiquidity( @@ -484,11 +484,11 @@ contract LendingPoolCollateralManager is VersionedInitializable { vars.fromReserveAToken = IAToken(fromReserve.aTokenAddress); vars.toReserveAToken = IAToken(toReserve.aTokenAddress); - fromReserve.updateCumulativeIndexesAndTimestamp(); - toReserve.updateCumulativeIndexesAndTimestamp(); + fromReserve.updateState(); + toReserve.updateState(); if (vars.fromReserveAToken.balanceOf(msg.sender) == amountToSwap) { - usersConfig[msg.sender].setUsingAsCollateral(fromReserve.id, false); + _usersConfig[msg.sender].setUsingAsCollateral(fromReserve.id, false); } fromReserve.updateInterestRates(fromAsset, address(vars.fromReserveAToken), 0, amountToSwap); @@ -510,14 +510,14 @@ contract LendingPoolCollateralManager is VersionedInitializable { vars.amountToReceive = IERC20(toAsset).balanceOf(receiverAddress); if (vars.amountToReceive != 0) { - IERC20(toAsset).transferFrom( + IERC20(toAsset).safeTransferFrom( receiverAddress, address(vars.toReserveAToken), vars.amountToReceive ); if (vars.toReserveAToken.balanceOf(msg.sender) == 0) { - usersConfig[msg.sender].setUsingAsCollateral(toReserve.id, true); + _usersConfig[msg.sender].setUsingAsCollateral(toReserve.id, true); } vars.toReserveAToken.mint(msg.sender, vars.amountToReceive, toReserve.liquidityIndex); @@ -531,10 +531,11 @@ contract LendingPoolCollateralManager is VersionedInitializable { (, , , , vars.healthFactor) = GenericLogic.calculateUserAccountData( msg.sender, - reserves, - usersConfig[msg.sender], - reservesList, - addressesProvider.getPriceOracle() + _reserves, + _usersConfig[msg.sender], + _reservesList, + _reservesCount, + _addressesProvider.getPriceOracle() ); if (vars.healthFactor < GenericLogic.HEALTH_FACTOR_LIQUIDATION_THRESHOLD) { @@ -568,9 +569,8 @@ contract LendingPoolCollateralManager is VersionedInitializable { ) internal view returns (uint256, uint256) { uint256 collateralAmount = 0; uint256 principalAmountNeeded = 0; - IPriceOracleGetter oracle = IPriceOracleGetter(addressesProvider.getPriceOracle()); + IPriceOracleGetter oracle = IPriceOracleGetter(_addressesProvider.getPriceOracle()); - // Usage of a memory struct of vars to avoid "Stack too deep" errors due to local variables AvailableCollateralToLiquidateLocalVars memory vars; vars.collateralPrice = oracle.getAssetPrice(collateralAddress); diff --git a/contracts/lendingpool/LendingPoolConfigurator.sol b/contracts/lendingpool/LendingPoolConfigurator.sol index 801523de..3f8643ee 100644 --- a/contracts/lendingpool/LendingPoolConfigurator.sol +++ b/contracts/lendingpool/LendingPoolConfigurator.sol @@ -118,6 +118,13 @@ contract LendingPoolConfigurator is VersionedInitializable { **/ event ReserveBaseLtvChanged(address asset, uint256 ltv); + /** + * @dev emitted when a reserve factor is updated + * @param asset the address of the reserve + * @param factor the new reserve factor + **/ + event ReserveFactorChanged(address asset, uint256 factor); + /** * @dev emitted when a reserve liquidation threshold is updated * @param asset the address of the reserve @@ -405,8 +412,8 @@ contract LendingPoolConfigurator is VersionedInitializable { function deactivateReserve(address asset) external onlyAaveAdmin { ( uint256 availableLiquidity, - uint256 totalBorrowsStable, - uint256 totalBorrowsVariable, + uint256 totalStableDebt, + uint256 totalVariableDebt, , , , @@ -416,7 +423,7 @@ contract LendingPoolConfigurator is VersionedInitializable { ) = pool.getReserveData(asset); require( - availableLiquidity == 0 && totalBorrowsStable == 0 && totalBorrowsVariable == 0, + availableLiquidity == 0 && totalStableDebt == 0 && totalVariableDebt == 0, Errors.RESERVE_LIQUIDITY_NOT_0 ); @@ -458,7 +465,7 @@ contract LendingPoolConfigurator is VersionedInitializable { } /** - * @dev emitted when a reserve loan to value is updated + * @dev updates the ltv of a reserve * @param asset the address of the reserve * @param ltv the new value for the loan to value **/ @@ -472,6 +479,21 @@ contract LendingPoolConfigurator is VersionedInitializable { emit ReserveBaseLtvChanged(asset, ltv); } + /** + * @dev updates the reserve factor of a reserve + * @param asset the address of the reserve + * @param reserveFactor the new reserve factor of the reserve + **/ + function setReserveFactor(address asset, uint256 reserveFactor) external onlyAaveAdmin { + ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset); + + currentConfig.setReserveFactor(reserveFactor); + + pool.setConfiguration(asset, currentConfig.data); + + emit ReserveFactorChanged(asset, reserveFactor); + } + /** * @dev updates the liquidation threshold of a reserve. * @param asset the address of the reserve @@ -559,7 +581,7 @@ contract LendingPoolConfigurator is VersionedInitializable { payable(proxyAddress) ); - (uint256 decimals, , , , , , , , , ) = pool.getReserveConfigurationData(asset); + (uint256 decimals, , , , , , , , , , ) = pool.getReserveConfigurationData(asset); bytes memory params = abi.encodeWithSignature( 'initialize(uint8,string,string)', diff --git a/contracts/lendingpool/LendingPoolStorage.sol b/contracts/lendingpool/LendingPoolStorage.sol new file mode 100644 index 00000000..1def3b12 --- /dev/null +++ b/contracts/lendingpool/LendingPoolStorage.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: agpl-3.0 +pragma solidity ^0.6.8; + +import {UserConfiguration} from '../libraries/configuration/UserConfiguration.sol'; +import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol'; +import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol'; +import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol'; + +contract LendingPoolStorage { + using ReserveLogic for ReserveLogic.ReserveData; + using ReserveConfiguration for ReserveConfiguration.Map; + using UserConfiguration for UserConfiguration.Map; + + ILendingPoolAddressesProvider internal _addressesProvider; + + mapping(address => ReserveLogic.ReserveData) internal _reserves; + mapping(address => UserConfiguration.Map) internal _usersConfig; + // debt token address => user who gives allowance => user who receives allowance => amount + mapping(address => mapping(address => mapping(address => uint256))) internal _borrowAllowance; + + // the list of the available reserves, structured as a mapping for gas savings reasons + mapping(uint256 => address) internal _reservesList; + + uint256 internal _reservesCount; + + bool internal _flashLiquidationLocked; + bool internal _paused; +} diff --git a/contracts/libraries/configuration/ReserveConfiguration.sol b/contracts/libraries/configuration/ReserveConfiguration.sol index 85cd4d64..5053c0fd 100644 --- a/contracts/libraries/configuration/ReserveConfiguration.sol +++ b/contracts/libraries/configuration/ReserveConfiguration.sol @@ -13,14 +13,25 @@ import {IPriceOracleGetter} from '../../interfaces/IPriceOracleGetter.sol'; * @notice Implements the bitmap logic to handle the reserve configuration */ library ReserveConfiguration { - uint256 constant LTV_MASK = 0xFFFFFFFFFFF0000; - uint256 constant LIQUIDATION_THRESHOLD_MASK = 0xFFFFFFF0000FFFF; - uint256 constant LIQUIDATION_BONUS_MASK = 0xFFF0000FFFFFFFF; - uint256 constant DECIMALS_MASK = 0xF00FFFFFFFFFFFF; - uint256 constant ACTIVE_MASK = 0xEFFFFFFFFFFFFFF; - uint256 constant FROZEN_MASK = 0xDFFFFFFFFFFFFFF; - uint256 constant BORROWING_MASK = 0xBFFFFFFFFFFFFFF; - uint256 constant STABLE_BORROWING_MASK = 0x7FFFFFFFFFFFFFF; + uint256 constant LTV_MASK = 0xFFFFFFFFFFFFFFFF0000; + uint256 constant LIQUIDATION_THRESHOLD_MASK = 0xFFFFFFFFFFFF0000FFFF; + uint256 constant LIQUIDATION_BONUS_MASK = 0xFFFFFFFF0000FFFFFFFF; + uint256 constant DECIMALS_MASK = 0xFFFFFF00FFFFFFFFFFFF; + uint256 constant ACTIVE_MASK = 0xFFFFFEFFFFFFFFFFFFFF; + uint256 constant FROZEN_MASK = 0xFFFFFDFFFFFFFFFFFFFF; + uint256 constant BORROWING_MASK = 0xFFFFFBFFFFFFFFFFFFFF; + uint256 constant STABLE_BORROWING_MASK = 0xFFFFF7FFFFFFFFFFFFFF; + uint256 constant RESERVE_FACTOR_MASK = 0xFFFFFFFFFFFFFFFF; + + /// @dev For the LTV, the start bit is 0 (up to 15), but we don't declare it as for 0 no bit movement is needed + uint256 constant LIQUIDATION_THRESHOLD_START_BIT_POSITION = 16; + uint256 constant LIQUIDATION_BONUS_START_BIT_POSITION = 32; + uint256 constant RESERVE_DECIMALS_START_BIT_POSITION = 48; + uint256 constant IS_ACTIVE_START_BIT_POSITION = 56; + uint256 constant IS_FROZEN_START_BIT_POSITION = 57; + uint256 constant BORROWING_ENABLED_START_BIT_POSITION = 58; + uint256 constant STABLE_BORROWING_ENABLED_START_BIT_POSITION = 59; + uint256 constant RESERVE_FACTOR_START_BIT_POSITION = 64; struct Map { //bit 0-15: LTV @@ -28,9 +39,11 @@ library ReserveConfiguration { //bit 32-47: Liq. bonus //bit 48-55: Decimals //bit 56: Reserve is active - //bit 57: reserve is freezed + //bit 57: reserve is frozen //bit 58: borrowing is enabled //bit 59: stable rate borrowing enabled + //bit 60-63: reserved + //bit 64-79: reserve factor uint256 data; } @@ -61,7 +74,9 @@ library ReserveConfiguration { internal pure { - self.data = (self.data & LIQUIDATION_THRESHOLD_MASK) | (threshold << 16); + self.data = + (self.data & LIQUIDATION_THRESHOLD_MASK) | + (threshold << LIQUIDATION_THRESHOLD_START_BIT_POSITION); } /** @@ -74,7 +89,7 @@ library ReserveConfiguration { view returns (uint256) { - return (self.data & ~LIQUIDATION_THRESHOLD_MASK) >> 16; + return (self.data & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION; } /** @@ -83,7 +98,9 @@ library ReserveConfiguration { * @param bonus the new liquidation bonus **/ function setLiquidationBonus(ReserveConfiguration.Map memory self, uint256 bonus) internal pure { - self.data = (self.data & LIQUIDATION_BONUS_MASK) | (bonus << 32); + self.data = + (self.data & LIQUIDATION_BONUS_MASK) | + (bonus << LIQUIDATION_BONUS_START_BIT_POSITION); } /** @@ -96,7 +113,7 @@ library ReserveConfiguration { view returns (uint256) { - return (self.data & ~LIQUIDATION_BONUS_MASK) >> 32; + return (self.data & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION; } /** @@ -105,7 +122,7 @@ library ReserveConfiguration { * @param decimals the decimals **/ function setDecimals(ReserveConfiguration.Map memory self, uint256 decimals) internal pure { - self.data = (self.data & DECIMALS_MASK) | (decimals << 48); + self.data = (self.data & DECIMALS_MASK) | (decimals << RESERVE_DECIMALS_START_BIT_POSITION); } /** @@ -114,7 +131,7 @@ library ReserveConfiguration { * @return the decimals of the asset **/ function getDecimals(ReserveConfiguration.Map storage self) internal view returns (uint256) { - return (self.data & ~DECIMALS_MASK) >> 48; + return (self.data & ~DECIMALS_MASK) >> RESERVE_DECIMALS_START_BIT_POSITION; } /** @@ -122,8 +139,10 @@ library ReserveConfiguration { * @param self the reserve configuration * @param active the active state **/ - function setActive(ReserveConfiguration.Map memory self, bool active) internal { - self.data = (self.data & ACTIVE_MASK) | (uint256(active ? 1 : 0) << 56); + function setActive(ReserveConfiguration.Map memory self, bool active) internal pure { + self.data = + (self.data & ACTIVE_MASK) | + (uint256(active ? 1 : 0) << IS_ACTIVE_START_BIT_POSITION); } /** @@ -132,7 +151,7 @@ library ReserveConfiguration { * @return the active state **/ function getActive(ReserveConfiguration.Map storage self) internal view returns (bool) { - return ((self.data & ~ACTIVE_MASK) >> 56) != 0; + return ((self.data & ~ACTIVE_MASK) >> IS_ACTIVE_START_BIT_POSITION) != 0; } /** @@ -141,7 +160,9 @@ library ReserveConfiguration { * @param frozen the frozen state **/ function setFrozen(ReserveConfiguration.Map memory self, bool frozen) internal pure { - self.data = (self.data & FROZEN_MASK) | (uint256(frozen ? 1 : 0) << 57); + self.data = + (self.data & FROZEN_MASK) | + (uint256(frozen ? 1 : 0) << IS_FROZEN_START_BIT_POSITION); } /** @@ -150,7 +171,7 @@ library ReserveConfiguration { * @return the frozen state **/ function getFrozen(ReserveConfiguration.Map storage self) internal view returns (bool) { - return ((self.data & ~FROZEN_MASK) >> 57) != 0; + return ((self.data & ~FROZEN_MASK) >> IS_FROZEN_START_BIT_POSITION) != 0; } /** @@ -159,7 +180,9 @@ library ReserveConfiguration { * @param enabled true if the borrowing needs to be enabled, false otherwise **/ function setBorrowingEnabled(ReserveConfiguration.Map memory self, bool enabled) internal pure { - self.data = (self.data & BORROWING_MASK) | (uint256(enabled ? 1 : 0) << 58); + self.data = + (self.data & BORROWING_MASK) | + (uint256(enabled ? 1 : 0) << BORROWING_ENABLED_START_BIT_POSITION); } /** @@ -168,7 +191,7 @@ library ReserveConfiguration { * @return the borrowing state **/ function getBorrowingEnabled(ReserveConfiguration.Map storage self) internal view returns (bool) { - return ((self.data & ~BORROWING_MASK) >> 58) != 0; + return ((self.data & ~BORROWING_MASK) >> BORROWING_ENABLED_START_BIT_POSITION) != 0; } /** @@ -180,7 +203,9 @@ library ReserveConfiguration { internal pure { - self.data = (self.data & STABLE_BORROWING_MASK) | (uint256(enabled ? 1 : 0) << 59); + self.data = + (self.data & STABLE_BORROWING_MASK) | + (uint256(enabled ? 1 : 0) << STABLE_BORROWING_ENABLED_START_BIT_POSITION); } /** @@ -193,7 +218,31 @@ library ReserveConfiguration { view returns (bool) { - return ((self.data & ~STABLE_BORROWING_MASK) >> 59) != 0; + return + ((self.data & ~STABLE_BORROWING_MASK) >> STABLE_BORROWING_ENABLED_START_BIT_POSITION) != 0; + } + + /** + * @dev sets the reserve factor of the reserve + * @param self the reserve configuration + * @param reserveFactor the reserve factor + **/ + function setReserveFactor(ReserveConfiguration.Map memory self, uint256 reserveFactor) + internal + pure + { + self.data = + (self.data & RESERVE_FACTOR_MASK) | + (reserveFactor << RESERVE_FACTOR_START_BIT_POSITION); + } + + /** + * @dev gets the reserve factor of the reserve + * @param self the reserve configuration + * @return the reserve factor + **/ + function getReserveFactor(ReserveConfiguration.Map storage self) internal view returns (uint256) { + return (self.data & ~RESERVE_FACTOR_MASK) >> RESERVE_FACTOR_START_BIT_POSITION; } /** @@ -214,10 +263,10 @@ library ReserveConfiguration { uint256 dataLocal = self.data; return ( - (dataLocal & ~ACTIVE_MASK) >> 56 != 0, - (dataLocal & ~FROZEN_MASK) >> 57 != 0, - (dataLocal & ~BORROWING_MASK) >> 58 != 0, - (dataLocal & ~STABLE_BORROWING_MASK) >> 59 != 0 + (dataLocal & ~ACTIVE_MASK) >> IS_ACTIVE_START_BIT_POSITION != 0, + (dataLocal & ~FROZEN_MASK) >> IS_FROZEN_START_BIT_POSITION != 0, + (dataLocal & ~BORROWING_MASK) >> BORROWING_ENABLED_START_BIT_POSITION != 0, + (dataLocal & ~STABLE_BORROWING_MASK) >> STABLE_BORROWING_ENABLED_START_BIT_POSITION != 0 ); } @@ -240,9 +289,9 @@ library ReserveConfiguration { return ( dataLocal & ~LTV_MASK, - (dataLocal & ~LIQUIDATION_THRESHOLD_MASK) >> 16, - (dataLocal & ~LIQUIDATION_BONUS_MASK) >> 32, - (dataLocal & ~DECIMALS_MASK) >> 48 + (dataLocal & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION, + (dataLocal & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION, + (dataLocal & ~DECIMALS_MASK) >> RESERVE_DECIMALS_START_BIT_POSITION ); } } diff --git a/contracts/libraries/helpers/Errors.sol b/contracts/libraries/helpers/Errors.sol index d25b041b..48fc7f32 100644 --- a/contracts/libraries/helpers/Errors.sol +++ b/contracts/libraries/helpers/Errors.sol @@ -43,12 +43,12 @@ library Errors { string public constant FAILED_REPAY_WITH_COLLATERAL = '53'; string public constant FAILED_COLLATERAL_SWAP = '55'; string public constant INVALID_EQUAL_ASSETS_TO_SWAP = '56'; + string public constant NO_MORE_RESERVES_ALLOWED = '59'; // require error messages - aToken string public constant CALLER_MUST_BE_LENDING_POOL = '28'; // 'The caller of this function must be a lending pool' string public constant CANNOT_GIVE_ALLOWANCE_TO_HIMSELF = '30'; // 'User cannot give allowance to himself' string public constant TRANSFER_AMOUNT_NOT_GT_0 = '31'; // 'Transferred amount needs to be greater than zero' - string public constant INVALID_ATOKEN_BALANCE = '52'; // balance on burning is invalid // require error messages - ReserveLogic string public constant RESERVE_ALREADY_INITIALIZED = '34'; // 'Reserve has already been initialized' diff --git a/contracts/libraries/helpers/Helpers.sol b/contracts/libraries/helpers/Helpers.sol index dda22eb4..e1d65502 100644 --- a/contracts/libraries/helpers/Helpers.sol +++ b/contracts/libraries/helpers/Helpers.sol @@ -26,21 +26,4 @@ library Helpers { DebtTokenBase(reserve.variableDebtTokenAddress).balanceOf(user) ); } - - /** - * @dev fetches the user principal stable and variable debt balances - * @param user the user - * @param reserve the reserve object - * @return the stable and variable debt balance - **/ - function getUserPrincipalDebt(address user, ReserveLogic.ReserveData storage reserve) - internal - view - returns (uint256, uint256) - { - return ( - DebtTokenBase(reserve.stableDebtTokenAddress).principalBalanceOf(user), - DebtTokenBase(reserve.variableDebtTokenAddress).principalBalanceOf(user) - ); - } } diff --git a/contracts/libraries/logic/GenericLogic.sol b/contracts/libraries/logic/GenericLogic.sol index 336f94b5..5c7dc3dc 100644 --- a/contracts/libraries/logic/GenericLogic.sol +++ b/contracts/libraries/logic/GenericLogic.sol @@ -29,11 +29,10 @@ library GenericLogic { struct balanceDecreaseAllowedLocalVars { uint256 decimals; - uint256 ltv; + uint256 liquidationThreshold; uint256 collateralBalanceETH; uint256 borrowBalanceETH; - uint256 currentLiquidationThreshold; - uint256 reserveLiquidationThreshold; + uint256 avgLiquidationThreshold; uint256 amountToDecreaseETH; uint256 collateralBalancefterDecrease; uint256 liquidationThresholdAfterDecrease; @@ -59,19 +58,19 @@ library GenericLogic { uint256 amount, mapping(address => ReserveLogic.ReserveData) storage reservesData, UserConfiguration.Map calldata userConfig, - address[] calldata reserves, + mapping(uint256 => address) storage reserves, + uint256 reservesCount, address oracle ) external view returns (bool) { if (!userConfig.isBorrowingAny() || !userConfig.isUsingAsCollateral(reservesData[asset].id)) { return true; } - // Usage of a memory struct of vars to avoid "Stack too deep" errors due to local variables balanceDecreaseAllowedLocalVars memory vars; - (vars.ltv, , , vars.decimals) = reservesData[asset].configuration.getParams(); + (, vars.liquidationThreshold, , vars.decimals) = reservesData[asset].configuration.getParams(); - if (vars.ltv == 0) { + if (vars.liquidationThreshold == 0) { return true; //if reserve is not used as collateral, no reasons to block the transfer } @@ -79,9 +78,9 @@ library GenericLogic { vars.collateralBalanceETH, vars.borrowBalanceETH, , - vars.currentLiquidationThreshold, + vars.avgLiquidationThreshold, - ) = calculateUserAccountData(user, reservesData, userConfig, reserves, oracle); + ) = calculateUserAccountData(user, reservesData, userConfig, reserves, reservesCount, oracle); if (vars.borrowBalanceETH == 0) { return true; //no borrows - no reasons to block the transfer @@ -100,8 +99,8 @@ library GenericLogic { vars.liquidationThresholdAfterDecrease = vars .collateralBalanceETH - .mul(vars.currentLiquidationThreshold) - .sub(vars.amountToDecreaseETH.mul(vars.reserveLiquidationThreshold)) + .mul(vars.avgLiquidationThreshold) + .sub(vars.amountToDecreaseETH.mul(vars.liquidationThreshold)) .div(vars.collateralBalancefterDecrease); uint256 healthFactorAfterDecrease = calculateHealthFactorFromBalances( @@ -151,7 +150,8 @@ library GenericLogic { address user, mapping(address => ReserveLogic.ReserveData) storage reservesData, UserConfiguration.Map memory userConfig, - address[] memory reserves, + mapping(uint256 => address) storage reserves, + uint256 reservesCount, address oracle ) internal @@ -169,7 +169,7 @@ library GenericLogic { if (userConfig.isEmpty()) { return (0, 0, 0, 0, uint256(-1)); } - for (vars.i = 0; vars.i < reserves.length; vars.i++) { + for (vars.i = 0; vars.i < reservesCount; vars.i++) { if (!userConfig.isUsingAsCollateralOrBorrowing(vars.i)) { continue; } @@ -184,7 +184,7 @@ library GenericLogic { vars.tokenUnit = 10**vars.decimals; vars.reserveUnitPrice = IPriceOracleGetter(oracle).getAssetPrice(vars.currentReserveAddress); - if (vars.ltv != 0 && userConfig.isUsingAsCollateral(vars.i)) { + if (vars.liquidationThreshold != 0 && userConfig.isUsingAsCollateral(vars.i)) { vars.compoundedLiquidityBalance = IERC20(currentReserve.aTokenAddress).balanceOf(user); uint256 liquidityBalanceETH = vars diff --git a/contracts/libraries/logic/ReserveLogic.sol b/contracts/libraries/logic/ReserveLogic.sol index f8ce2220..8a3604f7 100644 --- a/contracts/libraries/logic/ReserveLogic.sol +++ b/contracts/libraries/logic/ReserveLogic.sol @@ -6,10 +6,13 @@ import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {MathUtils} from '../math/MathUtils.sol'; import {IPriceOracleGetter} from '../../interfaces/IPriceOracleGetter.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; +import {IAToken} from '../../tokenization/interfaces/IAToken.sol'; import {IStableDebtToken} from '../../tokenization/interfaces/IStableDebtToken.sol'; +import {IVariableDebtToken} from '../../tokenization/interfaces/IVariableDebtToken.sol'; import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol'; import {IReserveInterestRateStrategy} from '../../interfaces/IReserveInterestRateStrategy.sol'; import {WadRayMath} from '../math/WadRayMath.sol'; +import {PercentageMath} from '../math/PercentageMath.sol'; import {Errors} from '../helpers/Errors.sol'; /** @@ -20,6 +23,7 @@ import {Errors} from '../helpers/Errors.sol'; library ReserveLogic { using SafeMath for uint256; using WadRayMath for uint256; + using PercentageMath for uint256; using SafeERC20 for IERC20; /** @@ -27,7 +31,6 @@ library ReserveLogic { * @param reserve the address of the reserve * @param liquidityRate the new liquidity rate * @param stableBorrowRate the new stable borrow rate - * @param averageStableBorrowRate the new average stable borrow rate * @param variableBorrowRate the new variable borrow rate * @param liquidityIndex the new liquidity index * @param variableBorrowIndex the new variable borrow index @@ -36,7 +39,6 @@ library ReserveLogic { address indexed reserve, uint256 liquidityRate, uint256 stableBorrowRate, - uint256 averageStableBorrowRate, uint256 variableBorrowRate, uint256 liquidityIndex, uint256 variableBorrowIndex @@ -66,6 +68,7 @@ library ReserveLogic { address aTokenAddress; address stableDebtTokenAddress; address variableDebtTokenAddress; + //address of the interest rate strategy address interestRateStrategyAddress; //the id of the reserve. Represents the position in the list of the active reserves uint8 id; @@ -124,7 +127,7 @@ library ReserveLogic { * @return an address of the corresponding debt token from reserve configuration **/ function getDebtTokenAddress(ReserveLogic.ReserveData storage reserve, uint256 interestRateMode) - internal + external view returns (address) { @@ -144,36 +147,25 @@ library ReserveLogic { * a formal specification. * @param reserve the reserve object **/ - function updateCumulativeIndexesAndTimestamp(ReserveData storage reserve) internal { - uint256 currentLiquidityRate = reserve.currentLiquidityRate; + function updateState(ReserveData storage reserve) external { + address variableDebtToken = reserve.variableDebtTokenAddress; + uint256 previousVariableBorrowIndex = reserve.variableBorrowIndex; + uint256 previousLiquidityIndex = reserve.liquidityIndex; - //only cumulating if there is any income being produced - if (currentLiquidityRate > 0) { - uint40 lastUpdateTimestamp = reserve.lastUpdateTimestamp; - uint256 cumulatedLiquidityInterest = MathUtils.calculateLinearInterest( - currentLiquidityRate, - lastUpdateTimestamp - ); - uint256 index = cumulatedLiquidityInterest.rayMul(reserve.liquidityIndex); - require(index < (1 << 128), Errors.LIQUIDITY_INDEX_OVERFLOW); + (uint256 newLiquidityIndex, uint256 newVariableBorrowIndex) = _updateIndexes( + reserve, + variableDebtToken, + previousLiquidityIndex, + previousVariableBorrowIndex + ); - reserve.liquidityIndex = uint128(index); - - //as the liquidity rate might come only from stable rate loans, we need to ensure - //that there is actual variable debt before accumulating - if (IERC20(reserve.variableDebtTokenAddress).totalSupply() > 0) { - uint256 cumulatedVariableBorrowInterest = MathUtils.calculateCompoundedInterest( - reserve.currentVariableBorrowRate, - lastUpdateTimestamp - ); - index = cumulatedVariableBorrowInterest.rayMul(reserve.variableBorrowIndex); - require(index < (1 << 128), Errors.VARIABLE_BORROW_INDEX_OVERFLOW); - reserve.variableBorrowIndex = uint128(index); - } - } - - //solium-disable-next-line - reserve.lastUpdateTimestamp = uint40(block.timestamp); + _mintToTreasury( + reserve, + variableDebtToken, + previousVariableBorrowIndex, + newLiquidityIndex, + newVariableBorrowIndex + ); } /** @@ -228,12 +220,13 @@ library ReserveLogic { } struct UpdateInterestRatesLocalVars { - uint256 currentAvgStableRate; - uint256 availableLiquidity; address stableDebtTokenAddress; + uint256 availableLiquidity; + uint256 totalStableDebt; uint256 newLiquidityRate; uint256 newStableRate; uint256 newVariableRate; + uint256 avgStableRate; } /** @@ -253,8 +246,10 @@ library ReserveLogic { UpdateInterestRatesLocalVars memory vars; vars.stableDebtTokenAddress = reserve.stableDebtTokenAddress; - vars.currentAvgStableRate = IStableDebtToken(vars.stableDebtTokenAddress) - .getAverageStableRate(); + + (vars.totalStableDebt, vars.avgStableRate) = IStableDebtToken(vars.stableDebtTokenAddress) + .getTotalSupplyAndAvgRate(); + vars.availableLiquidity = IERC20(reserveAddress).balanceOf(aTokenAddress); ( @@ -264,9 +259,10 @@ library ReserveLogic { ) = IReserveInterestRateStrategy(reserve.interestRateStrategyAddress).calculateInterestRates( reserveAddress, vars.availableLiquidity.add(liquidityAdded).sub(liquidityTaken), - IERC20(vars.stableDebtTokenAddress).totalSupply(), + vars.totalStableDebt, IERC20(reserve.variableDebtTokenAddress).totalSupply(), - vars.currentAvgStableRate + vars.avgStableRate, + reserve.configuration.getReserveFactor() ); require(vars.newLiquidityRate < (1 << 128), 'ReserveLogic: Liquidity rate overflow'); require(vars.newStableRate < (1 << 128), 'ReserveLogic: Stable borrow rate overflow'); @@ -280,10 +276,134 @@ library ReserveLogic { reserveAddress, vars.newLiquidityRate, vars.newStableRate, - vars.currentAvgStableRate, vars.newVariableRate, reserve.liquidityIndex, reserve.variableBorrowIndex ); } + + struct MintToTreasuryLocalVars { + uint256 currentStableDebt; + uint256 principalStableDebt; + uint256 previousStableDebt; + uint256 currentVariableDebt; + uint256 scaledVariableDebt; + uint256 previousVariableDebt; + uint256 avgStableRate; + uint256 cumulatedStableInterest; + uint256 totalDebtAccrued; + uint256 amountToMint; + uint256 reserveFactor; + uint40 stableSupplyUpdatedTimestamp; + } + + /** + * @dev mints part of the repaid interest to the reserve treasury, depending on the reserveFactor for the + * specific asset. + * @param reserve the reserve reserve to be updated + * @param variableDebtToken the debt token address + * @param previousVariableBorrowIndex the variable borrow index before the last accumulation of the interest + * @param newLiquidityIndex the new liquidity index + * @param newVariableBorrowIndex the variable borrow index after the last accumulation of the interest + **/ + function _mintToTreasury( + ReserveData storage reserve, + address variableDebtToken, + uint256 previousVariableBorrowIndex, + uint256 newLiquidityIndex, + uint256 newVariableBorrowIndex + ) internal { + MintToTreasuryLocalVars memory vars; + + vars.reserveFactor = reserve.configuration.getReserveFactor(); + + if (vars.reserveFactor == 0) { + return; + } + + //fetching the last scaled total variable debt + vars.scaledVariableDebt = IVariableDebtToken(variableDebtToken).scaledTotalSupply(); + + //fetching the principal, total stable debt and the avg stable rate + ( + vars.principalStableDebt, + vars.currentStableDebt, + vars.avgStableRate, + vars.stableSupplyUpdatedTimestamp + ) = IStableDebtToken(reserve.stableDebtTokenAddress).getSupplyData(); + + //calculate the last principal variable debt + vars.previousVariableDebt = vars.scaledVariableDebt.rayMul(previousVariableBorrowIndex); + + //calculate the new total supply after accumulation of the index + vars.currentVariableDebt = vars.scaledVariableDebt.rayMul(newVariableBorrowIndex); + + //calculate the stable debt until the last timestamp update + vars.cumulatedStableInterest = MathUtils.calculateCompoundedInterest( + vars.avgStableRate, + vars.stableSupplyUpdatedTimestamp + ); + + vars.previousStableDebt = vars.principalStableDebt.rayMul(vars.cumulatedStableInterest); + + //debt accrued is the sum of the current debt minus the sum of the debt at the last update + vars.totalDebtAccrued = vars + .currentVariableDebt + .add(vars.currentStableDebt) + .sub(vars.previousVariableDebt) + .sub(vars.previousStableDebt); + + vars.amountToMint = vars.totalDebtAccrued.percentMul(vars.reserveFactor); + + IAToken(reserve.aTokenAddress).mintToTreasury(vars.amountToMint, newLiquidityIndex); + } + + /** + * @dev updates the reserve indexes and the timestamp of the update + * @param reserve the reserve reserve to be updated + * @param variableDebtToken the debt token address + * @param liquidityIndex the last stored liquidity index + * @param variableBorrowIndex the last stored variable borrow index + **/ + function _updateIndexes( + ReserveData storage reserve, + address variableDebtToken, + uint256 liquidityIndex, + uint256 variableBorrowIndex + ) internal returns (uint256, uint256) { + uint40 timestamp = reserve.lastUpdateTimestamp; + + uint256 currentLiquidityRate = reserve.currentLiquidityRate; + + uint256 newLiquidityIndex = liquidityIndex; + uint256 newVariableBorrowIndex = variableBorrowIndex; + + //only cumulating if there is any income being produced + if (currentLiquidityRate > 0) { + uint256 cumulatedLiquidityInterest = MathUtils.calculateLinearInterest( + currentLiquidityRate, + timestamp + ); + newLiquidityIndex = cumulatedLiquidityInterest.rayMul(liquidityIndex); + require(newLiquidityIndex < (1 << 128), Errors.LIQUIDITY_INDEX_OVERFLOW); + + reserve.liquidityIndex = uint128(newLiquidityIndex); + + //as the liquidity rate might come only from stable rate loans, we need to ensure + //that there is actual variable debt before accumulating + if (IERC20(variableDebtToken).totalSupply() > 0) { + uint256 cumulatedVariableBorrowInterest = MathUtils.calculateCompoundedInterest( + reserve.currentVariableBorrowRate, + timestamp + ); + newVariableBorrowIndex = cumulatedVariableBorrowInterest.rayMul(variableBorrowIndex); + require(newVariableBorrowIndex < (1 << 128), Errors.VARIABLE_BORROW_INDEX_OVERFLOW); + reserve.variableBorrowIndex = uint128(newVariableBorrowIndex); + } + } + + //solium-disable-next-line + reserve.lastUpdateTimestamp = uint40(block.timestamp); + return (newLiquidityIndex, newVariableBorrowIndex); + } } diff --git a/contracts/libraries/logic/ValidationLogic.sol b/contracts/libraries/logic/ValidationLogic.sol index 5d201efd..ee13232b 100644 --- a/contracts/libraries/logic/ValidationLogic.sol +++ b/contracts/libraries/logic/ValidationLogic.sol @@ -34,7 +34,7 @@ library ValidationLogic { * @param reserve the reserve state on which the user is depositing * @param amount the amount to be deposited */ - function validateDeposit(ReserveLogic.ReserveData storage reserve, uint256 amount) internal view { + function validateDeposit(ReserveLogic.ReserveData storage reserve, uint256 amount) external view { (bool isActive, bool isFreezed, , ) = reserve.configuration.getFlags(); require(amount > 0, Errors.AMOUNT_NOT_GREATER_THAN_0); @@ -45,18 +45,17 @@ library ValidationLogic { /** * @dev validates a withdraw action. * @param reserveAddress the address of the reserve - * @param aTokenAddress the address of the aToken for the reserve * @param amount the amount to be withdrawn * @param userBalance the balance of the user */ function validateWithdraw( address reserveAddress, - address aTokenAddress, uint256 amount, uint256 userBalance, mapping(address => ReserveLogic.ReserveData) storage reservesData, UserConfiguration.Map storage userConfig, - address[] calldata reserves, + mapping(uint256 => address) storage reserves, + uint256 reservesCount, address oracle ) external view { require(amount > 0, Errors.AMOUNT_NOT_GREATER_THAN_0); @@ -71,6 +70,7 @@ library ValidationLogic { reservesData, userConfig, reserves, + reservesCount, oracle ), Errors.TRANSFER_NOT_ALLOWED @@ -121,7 +121,8 @@ library ValidationLogic { uint256 maxStableLoanPercent, mapping(address => ReserveLogic.ReserveData) storage reservesData, UserConfiguration.Map storage userConfig, - address[] calldata reserves, + mapping(uint256 => address) storage reserves, + uint256 reservesCount, address oracle ) external view { ValidateBorrowLocalVars memory vars; @@ -156,6 +157,7 @@ library ValidationLogic { reservesData, userConfig, reserves, + reservesCount, oracle ); @@ -300,7 +302,8 @@ library ValidationLogic { address reserveAddress, mapping(address => ReserveLogic.ReserveData) storage reservesData, UserConfiguration.Map storage userConfig, - address[] calldata reserves, + mapping(uint256 => address) storage reserves, + uint256 reservesCount, address oracle ) external view { uint256 underlyingBalance = IERC20(reserve.aTokenAddress).balanceOf(msg.sender); @@ -315,6 +318,7 @@ library ValidationLogic { reservesData, userConfig, reserves, + reservesCount, oracle ), Errors.DEPOSIT_ALREADY_IN_USE diff --git a/contracts/misc/AaveProtocolTestHelpers.sol b/contracts/misc/AaveProtocolTestHelpers.sol index 7b91bec2..75778f42 100644 --- a/contracts/misc/AaveProtocolTestHelpers.sol +++ b/contracts/misc/AaveProtocolTestHelpers.sol @@ -20,7 +20,7 @@ contract AaveProtocolTestHelpers { function getAllReservesTokens() external view returns (TokenData[] memory) { ILendingPool pool = ILendingPool(ADDRESSES_PROVIDER.getLendingPool()); - address[] memory reserves = pool.getReserves(); + address[] memory reserves = pool.getReservesList(); TokenData[] memory reservesTokens = new TokenData[](reserves.length); for (uint256 i = 0; i < reserves.length; i++) { reservesTokens[i] = TokenData({ @@ -35,7 +35,7 @@ contract AaveProtocolTestHelpers { function getAllATokens() external view returns (TokenData[] memory) { ILendingPool pool = ILendingPool(ADDRESSES_PROVIDER.getLendingPool()); - address[] memory reserves = pool.getReserves(); + address[] memory reserves = pool.getReservesList(); TokenData[] memory aTokens = new TokenData[](reserves.length); for (uint256 i = 0; i < reserves.length; i++) { (address aTokenAddress, , ) = pool.getReserveTokensAddresses(reserves[i]); diff --git a/contracts/misc/WalletBalanceProvider.sol b/contracts/misc/WalletBalanceProvider.sol index d4497178..1c46922a 100644 --- a/contracts/misc/WalletBalanceProvider.sol +++ b/contracts/misc/WalletBalanceProvider.sol @@ -86,12 +86,12 @@ contract WalletBalanceProvider { { ILendingPool pool = ILendingPool(_provider.getLendingPool()); - address[] memory reserves = pool.getReserves(); + address[] memory reserves = pool.getReservesList(); uint256[] memory balances = new uint256[](reserves.length); for (uint256 j = 0; j < reserves.length; j++) { - (, , , , , , , , bool isActive, ) = pool.getReserveConfigurationData(reserves[j]); + (, , , , , , , , , bool isActive, ) = pool.getReserveConfigurationData(reserves[j]); if (!isActive) { balances[j] = 0; diff --git a/contracts/mocks/upgradeability/MockAToken.sol b/contracts/mocks/upgradeability/MockAToken.sol index f84543d9..3e6a39b8 100644 --- a/contracts/mocks/upgradeability/MockAToken.sol +++ b/contracts/mocks/upgradeability/MockAToken.sol @@ -6,12 +6,23 @@ import {LendingPool} from '../../lendingpool/LendingPool.sol'; contract MockAToken is AToken { constructor( - LendingPool _pool, - address _underlyingAssetAddress, - string memory _tokenName, - string memory _tokenSymbol, + LendingPool pool, + address underlyingAssetAddress, + address reserveTreasury, + string memory tokenName, + string memory tokenSymbol, address incentivesController - ) public AToken(_pool, _underlyingAssetAddress, _tokenName, _tokenSymbol, incentivesController) {} + ) + public + AToken( + pool, + underlyingAssetAddress, + reserveTreasury, + tokenName, + tokenSymbol, + incentivesController + ) + {} function getRevision() internal override pure returns (uint256) { return 0x2; diff --git a/contracts/tokenization/AToken.sol b/contracts/tokenization/AToken.sol index 3bb54b49..98c54bcd 100644 --- a/contracts/tokenization/AToken.sol +++ b/contracts/tokenization/AToken.sol @@ -20,18 +20,8 @@ import {SafeERC20} from '../misc/SafeERC20.sol'; */ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken { using WadRayMath for uint256; - using SafeERC20 for IncentivizedERC20; + using SafeERC20 for IERC20; - uint256 public constant UINT_MAX_VALUE = uint256(-1); - address public immutable UNDERLYING_ASSET_ADDRESS; - LendingPool public immutable POOL; - - /// @dev owner => next valid nonce to submit with permit() - mapping(address => uint256) public _nonces; - - uint256 public constant ATOKEN_REVISION = 0x1; - - bytes32 public DOMAIN_SEPARATOR; bytes public constant EIP712_REVISION = bytes('1'); bytes32 internal constant EIP712_DOMAIN = keccak256( 'EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)' @@ -40,6 +30,17 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken { 'Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)' ); + uint256 public constant UINT_MAX_VALUE = uint256(-1); + uint256 public constant ATOKEN_REVISION = 0x1; + address public immutable UNDERLYING_ASSET_ADDRESS; + address public immutable RESERVE_TREASURY_ADDRESS; + LendingPool public immutable POOL; + + /// @dev owner => next valid nonce to submit with permit() + mapping(address => uint256) public _nonces; + + bytes32 public DOMAIN_SEPARATOR; + modifier onlyLendingPool { require(msg.sender == address(POOL), Errors.CALLER_MUST_BE_LENDING_POOL); _; @@ -48,12 +49,14 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken { constructor( LendingPool pool, address underlyingAssetAddress, + address reserveTreasuryAddress, string memory tokenName, string memory tokenSymbol, address incentivesController ) public IncentivizedERC20(tokenName, tokenSymbol, 18, incentivesController) { POOL = pool; UNDERLYING_ASSET_ADDRESS = underlyingAssetAddress; + RESERVE_TREASURY_ADDRESS = reserveTreasuryAddress; } function getRevision() internal virtual override pure returns (uint256) { @@ -98,20 +101,13 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken { uint256 amount, uint256 index ) external override onlyLendingPool { - uint256 currentBalance = balanceOf(user); - - require(amount <= currentBalance, Errors.INVALID_ATOKEN_BALANCE); - - uint256 scaledAmount = amount.rayDiv(index); - - _burn(user, scaledAmount); + _burn(user, amount.rayDiv(index)); //transfers the underlying to the target - IncentivizedERC20(UNDERLYING_ASSET_ADDRESS).safeTransfer(receiverOfUnderlying, amount); + IERC20(UNDERLYING_ASSET_ADDRESS).safeTransfer(receiverOfUnderlying, amount); //transfer event to track balances emit Transfer(user, address(0), amount); - emit Burn(msg.sender, receiverOfUnderlying, amount, index); } @@ -126,16 +122,22 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken { uint256 amount, uint256 index ) external override onlyLendingPool { - uint256 scaledAmount = amount.rayDiv(index); - //mint an equivalent amount of tokens to cover the new deposit - _mint(user, scaledAmount); + _mint(user, amount.rayDiv(index)); //transfer event to track balances emit Transfer(address(0), user, amount); emit Mint(user, amount, index); } + function mintToTreasury(uint256 amount, uint256 index) external override onlyLendingPool { + _mint(RESERVE_TREASURY_ADDRESS, amount.div(index)); + + //transfer event to track balances + emit Transfer(address(0), RESERVE_TREASURY_ADDRESS, amount); + emit Mint(RESERVE_TREASURY_ADDRESS, amount, index); + } + /** * @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 @@ -209,6 +211,14 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken { return currentSupplyScaled.rayMul(POOL.getReserveNormalizedIncome(UNDERLYING_ASSET_ADDRESS)); } + /** + * @dev Returns the scaled total supply of the variable debt token. Represents sum(borrows/index) + * @return the scaled total supply + **/ + function scaledTotalSupply() public virtual override view returns (uint256) { + return super.totalSupply(); + } + /** * @dev Used to validate transfers before actually executing them. * @param user address of the user to check @@ -232,7 +242,7 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken { onlyLendingPool returns (uint256) { - IncentivizedERC20(UNDERLYING_ASSET_ADDRESS).safeTransfer(target, amount); + IERC20(UNDERLYING_ASSET_ADDRESS).safeTransfer(target, amount); return amount; } @@ -271,6 +281,14 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken { _approve(owner, spender, value); } + /** + * @dev transfers the aTokens between two users. Validates the transfer + * (ie checks for valid HF after the transfer) if required + * @param from the source address + * @param to the destination address + * @param amount the amount to transfer + * @param validate true if the transfer needs to be validated + **/ function _transfer( address from, address to, @@ -283,13 +301,17 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken { uint256 index = POOL.getReserveNormalizedIncome(UNDERLYING_ASSET_ADDRESS); - uint256 scaledAmount = amount.rayDiv(index); - - super._transfer(from, to, scaledAmount); + super._transfer(from, to, amount.rayDiv(index)); emit BalanceTransfer(from, to, amount, index); } + /** + * @dev overrides the parent _transfer to force validated transfer() and transferFrom() + * @param from the source address + * @param to the destination address + * @param amount the amount to transfer + **/ function _transfer( address from, address to, diff --git a/contracts/tokenization/StableDebtToken.sol b/contracts/tokenization/StableDebtToken.sol index 447a7fa7..66ad4782 100644 --- a/contracts/tokenization/StableDebtToken.sol +++ b/contracts/tokenization/StableDebtToken.sol @@ -21,6 +21,7 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase { uint256 private _avgStableRate; mapping(address => uint40) _timestamps; + uint40 _totalSupplyTimestamp; constructor( address pool, @@ -68,7 +69,7 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase { * @return the accumulated debt of the user **/ function balanceOf(address account) public virtual override view returns (uint256) { - uint256 accountBalance = principalBalanceOf(account); + uint256 accountBalance = super.balanceOf(account); uint256 stableRate = _usersData[account]; if (accountBalance == 0) { return 0; @@ -77,14 +78,15 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase { stableRate, _timestamps[account] ); - return accountBalance.wadToRay().rayMul(cumulatedInterest).rayToWad(); + return accountBalance.rayMul(cumulatedInterest); } struct MintLocalVars { - uint256 supplyAfterMint; - uint256 supplyBeforeMint; + uint256 previousSupply; + uint256 nextSupply; uint256 amountInRay; uint256 newStableRate; + uint256 currentAvgStableRate; } /** @@ -108,8 +110,10 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase { uint256 balanceIncrease ) = _calculateBalanceIncrease(user); - vars.supplyBeforeMint = totalSupply().add(balanceIncrease); - vars.supplyAfterMint = vars.supplyBeforeMint.add(amount); + //accrueing the interest accumulation to the stored total supply and caching it + vars.previousSupply = totalSupply(); + vars.currentAvgStableRate = _avgStableRate; + vars.nextSupply = _totalSupply = vars.previousSupply.add(amount); vars.amountInRay = amount.wadToRay(); @@ -122,16 +126,18 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase { require(vars.newStableRate < (1 << 128), 'Debt token: stable rate overflow'); _usersData[user] = vars.newStableRate; + //updating the user and supply timestamp //solium-disable-next-line - _timestamps[user] = uint40(block.timestamp); + _totalSupplyTimestamp = _timestamps[user] = uint40(block.timestamp); //calculates the updated average stable rate - _avgStableRate = _avgStableRate - .rayMul(vars.supplyBeforeMint.wadToRay()) + _avgStableRate = vars + .currentAvgStableRate + .rayMul(vars.previousSupply.wadToRay()) .add(rate.rayMul(vars.amountInRay)) - .rayDiv(vars.supplyAfterMint.wadToRay()); + .rayDiv(vars.nextSupply.wadToRay()); - _mint(user, amount.add(balanceIncrease)); + _mint(user, amount.add(balanceIncrease), vars.previousSupply); // transfer event to track balances emit Transfer(address(0), user, amount); @@ -158,16 +164,21 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase { uint256 balanceIncrease ) = _calculateBalanceIncrease(user); - uint256 supplyBeforeBurn = totalSupply().add(balanceIncrease); - uint256 supplyAfterBurn = supplyBeforeBurn.sub(amount); + uint256 previousSupply = totalSupply(); - if (supplyAfterBurn == 0) { + //since the total supply and each single user debt accrue separately, + //there might be accumulation errors so that the last borrower repaying + //might actually try to repay more than the available debt supply. + //in this case we simply set the total supply and the avg stable rate to 0 + if (previousSupply <= amount) { _avgStableRate = 0; + _totalSupply = 0; } else { + uint256 nextSupply = _totalSupply = previousSupply.sub(amount); _avgStableRate = _avgStableRate - .rayMul(supplyBeforeBurn.wadToRay()) + .rayMul(previousSupply.wadToRay()) .sub(_usersData[user].rayMul(amount.wadToRay())) - .rayDiv(supplyAfterBurn.wadToRay()); + .rayDiv(nextSupply.wadToRay()); } if (amount == currentBalance) { @@ -177,11 +188,13 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase { //solium-disable-next-line _timestamps[user] = uint40(block.timestamp); } + //solium-disable-next-line + _totalSupplyTimestamp = uint40(block.timestamp); if (balanceIncrease > amount) { - _mint(user, balanceIncrease.sub(amount)); + _mint(user, balanceIncrease.sub(amount), previousSupply); } else { - _burn(user, amount.sub(balanceIncrease)); + _burn(user, amount.sub(balanceIncrease), previousSupply); } // transfer event to track balances @@ -189,4 +202,142 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase { emit BurnDebt(user, amount, previousBalance, currentBalance, balanceIncrease); } + + /** + * @dev Calculates the increase in balance since the last user interaction + * @param user The address of the user for which the interest is being accumulated + * @return The previous principal balance, the new principal balance, the balance increase + * and the new user index + **/ + function _calculateBalanceIncrease(address user) + internal + view + returns ( + uint256, + uint256, + uint256 + ) + { + uint256 previousPrincipalBalance = super.balanceOf(user); + + if (previousPrincipalBalance == 0) { + return (0, 0, 0); + } + + // Calculation of the accrued interest since the last accumulation + uint256 balanceIncrease = balanceOf(user).sub(previousPrincipalBalance); + + return ( + previousPrincipalBalance, + previousPrincipalBalance.add(balanceIncrease), + balanceIncrease + ); + } + + /** + * @dev returns the principal and total supply, the average borrow rate and the last supply update timestamp + **/ + function getSupplyData() + public + override + view + returns ( + uint256, + uint256, + uint256, + uint40 + ) + { + uint256 avgRate = _avgStableRate; + return (super.totalSupply(), _calcTotalSupply(avgRate), avgRate, _totalSupplyTimestamp); + } + + /** + * @dev returns the the total supply and the average stable rate + **/ + function getTotalSupplyAndAvgRate() public override view returns (uint256, uint256) { + uint256 avgRate = _avgStableRate; + return (_calcTotalSupply(avgRate), avgRate); + } + + /** + * @dev returns the total supply + **/ + function totalSupply() public override view returns (uint256) { + return _calcTotalSupply(_avgStableRate); + } + + /** + * @dev returns the timestamp at which the total supply was updated + **/ + function getTotalSupplyLastUpdated() public override view returns (uint40) { + return _totalSupplyTimestamp; + } + + /** + * @dev Returns the principal debt balance of the user from + * @param user the user + * @return The debt balance of the user since the last burn/mint action + **/ + function principalBalanceOf(address user) external virtual override view returns (uint256) { + return super.balanceOf(user); + } + + /** + * @dev calculates the total supply + * @param avgRate the average rate at which calculate the total supply + * @return The debt balance of the user since the last burn/mint action + **/ + function _calcTotalSupply(uint256 avgRate) internal view returns (uint256) { + uint256 principalSupply = super.totalSupply(); + + if (principalSupply == 0) { + return 0; + } + + uint256 cumulatedInterest = MathUtils.calculateCompoundedInterest( + avgRate, + _totalSupplyTimestamp + ); + + return principalSupply.rayMul(cumulatedInterest); + } + + /** + * @dev mints stable debt tokens to an user + * @param account the account receiving the debt tokens + * @param amount the amount being minted + * @param oldTotalSupply the total supply before the minting event + **/ + function _mint( + address account, + uint256 amount, + uint256 oldTotalSupply + ) internal { + uint256 oldAccountBalance = _balances[account]; + _balances[account] = oldAccountBalance.add(amount); + + if (address(_incentivesController) != address(0)) { + _incentivesController.handleAction(account, oldTotalSupply, oldAccountBalance); + } + } + + /** + * @dev burns stable debt tokens of an user + * @param account the user getting his debt burned + * @param amount the amount being burned + * @param oldTotalSupply the total supply before the burning event + **/ + function _burn( + address account, + uint256 amount, + uint256 oldTotalSupply + ) internal { + uint256 oldAccountBalance = _balances[account]; + _balances[account] = oldAccountBalance.sub(amount, 'ERC20: burn amount exceeds balance'); + + if (address(_incentivesController) != address(0)) { + _incentivesController.handleAction(account, oldTotalSupply, oldAccountBalance); + } + } } diff --git a/contracts/tokenization/VariableDebtToken.sol b/contracts/tokenization/VariableDebtToken.sol index 7ec1d8e3..5582db9a 100644 --- a/contracts/tokenization/VariableDebtToken.sol +++ b/contracts/tokenization/VariableDebtToken.sol @@ -39,79 +39,84 @@ contract VariableDebtToken is DebtTokenBase, IVariableDebtToken { * @return the debt balance of the user **/ function balanceOf(address user) public virtual override view returns (uint256) { - uint256 userBalance = principalBalanceOf(user); - uint256 index = _usersData[user]; - if (userBalance == 0) { + uint256 scaledBalance = super.balanceOf(user); + + if (scaledBalance == 0) { return 0; } - return - userBalance - .wadToRay() - .rayMul(POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET)) - .rayDiv(index) - .rayToWad(); - } - - /** - * @dev returns the index of the last user action - * @return the user index - **/ - - function getUserIndex(address user) external virtual override view returns (uint256) { - return _usersData[user]; + return scaledBalance.rayMul(POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET)); } /** * @dev mints new variable debt * @param user the user receiving the debt * @param amount the amount of debt being minted + * @param index the variable debt index of the reserve **/ - function mint(address user, uint256 amount) external override onlyLendingPool { - ( - uint256 previousBalance, - uint256 currentBalance, - uint256 balanceIncrease - ) = _calculateBalanceIncrease(user); - - _mint(user, amount.add(balanceIncrease)); - - uint256 newUserIndex = POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET); - require(newUserIndex < (1 << 128), 'Debt token: Index overflow'); - _usersData[user] = newUserIndex; + function mint( + address user, + uint256 amount, + uint256 index + ) external override onlyLendingPool { + _mint(user, amount.rayDiv(index)); emit Transfer(address(0), user, amount); - emit MintDebt(user, amount, previousBalance, currentBalance, balanceIncrease, newUserIndex); + emit Mint(user, amount, index); } /** * @dev burns user variable debt * @param user the user which debt is burnt - * @param amount the amount of debt being burned + * @param index the variable debt index of the reserve **/ - function burn(address user, uint256 amount) external override onlyLendingPool { - ( - uint256 previousBalance, - uint256 currentBalance, - uint256 balanceIncrease - ) = _calculateBalanceIncrease(user); + function burn( + address user, + uint256 amount, + uint256 index + ) external override onlyLendingPool { + _burn(user, amount.rayDiv(index)); - if (balanceIncrease > amount) { - _mint(user, balanceIncrease.sub(amount)); - } else { - _burn(user, amount.sub(balanceIncrease)); - } - - uint256 newUserIndex = 0; - //if user not repaid everything - if (currentBalance != amount) { - newUserIndex = POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET); - require(newUserIndex < (1 << 128), 'Debt token: Index overflow'); - } - _usersData[user] = newUserIndex; - - // transfer event to track the balances emit Transfer(user, address(0), amount); - emit BurnDebt(user, amount, previousBalance, currentBalance, balanceIncrease, newUserIndex); + emit Burn(user, amount, index); + } + + /** + * @dev Returns the principal debt balance of the user from + * @return The debt balance of the user since the last burn/mint action + **/ + function scaledBalanceOf(address user) public virtual override view returns (uint256) { + return super.balanceOf(user); + } + + /** + * @dev Returns the total supply of the variable debt token. Represents the total debt accrued by the users + * @return the total supply + **/ + function totalSupply() public virtual override view returns (uint256) { + return super.totalSupply().rayMul(POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET)); + } + + /** + * @dev Returns the scaled total supply of the variable debt token. Represents sum(borrows/index) + * @return the scaled total supply + **/ + function scaledTotalSupply() public virtual override view returns (uint256) { + return super.totalSupply(); + } + + /** + * @dev returns the principal balance of the user and principal total supply. + * @param user the address of the user + * @return the principal balance of the user + * @return the principal total supply + **/ + function getScaledUserBalanceAndSupply(address user) + external + override + view + returns (uint256, uint256) + { + return (super.balanceOf(user), super.totalSupply()); } } diff --git a/contracts/tokenization/base/DebtTokenBase.sol b/contracts/tokenization/base/DebtTokenBase.sol index ceb51688..36d99d8e 100644 --- a/contracts/tokenization/base/DebtTokenBase.sol +++ b/contracts/tokenization/base/DebtTokenBase.sol @@ -65,14 +65,6 @@ abstract contract DebtTokenBase is IncentivizedERC20, VersionedInitializable { return UNDERLYING_ASSET; } - /** - * @dev Returns the principal debt balance of the user from - * @return The debt balance of the user since the last burn/mint action - **/ - function principalBalanceOf(address user) public view returns (uint256) { - return super.balanceOf(user); - } - /** * @dev Being non transferrable, the debt token does not implement any of the * standard ERC20 functions for transfer and allowance. @@ -133,35 +125,4 @@ abstract contract DebtTokenBase is IncentivizedERC20, VersionedInitializable { subtractedValue; revert('ALLOWANCE_NOT_SUPPORTED'); } - - /** - * @dev Calculates the increase in balance since the last user interaction - * @param user The address of the user for which the interest is being accumulated - * @return The previous principal balance, the new principal balance, the balance increase - * and the new user index - **/ - function _calculateBalanceIncrease(address user) - internal - view - returns ( - uint256, - uint256, - uint256 - ) - { - uint256 previousPrincipalBalance = principalBalanceOf(user); - - if (previousPrincipalBalance == 0) { - return (0, 0, 0); - } - - // Calculation of the accrued interest since the last accumulation - uint256 balanceIncrease = balanceOf(user).sub(previousPrincipalBalance); - - return ( - previousPrincipalBalance, - previousPrincipalBalance.add(balanceIncrease), - balanceIncrease - ); - } } diff --git a/contracts/tokenization/interfaces/IAToken.sol b/contracts/tokenization/interfaces/IAToken.sol index d8f63d6c..612abdc5 100644 --- a/contracts/tokenization/interfaces/IAToken.sol +++ b/contracts/tokenization/interfaces/IAToken.sol @@ -2,8 +2,9 @@ pragma solidity ^0.6.8; import {IERC20} from '../../interfaces/IERC20.sol'; +import {IScaledBalanceToken} from './IScaledBalanceToken.sol'; -interface IAToken is IERC20 { +interface IAToken is IERC20, IScaledBalanceToken { /** * @dev emitted after aTokens are burned * @param from the address performing the redeem @@ -11,15 +12,6 @@ interface IAToken is IERC20 { * @param index the last index of the reserve **/ event Burn(address indexed from, address indexed target, uint256 value, uint256 index); - - /** - * @dev emitted after the mint action - * @param from the address performing the mint - * @param value the amount to be minted - * @param index the last index of the reserve - **/ - event Mint(address indexed from, uint256 value, uint256 index); - /** * @dev emitted during the transfer action * @param from the address from which the tokens are being transferred @@ -43,17 +35,11 @@ interface IAToken is IERC20 { ) external; /** - * @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 index the liquidity index - */ - function mint( - address user, - uint256 amount, - uint256 index - ) external; + * @dev mints aTokens to the reserve treasury + * @param amount the amount to mint + * @param index the liquidity index of the reserve + **/ + function mintToTreasury(uint256 amount, uint256 index) external; /** * @dev transfers tokens in the event of a borrow being liquidated, in case the liquidators reclaims the aToken @@ -68,28 +54,6 @@ interface IAToken is IERC20 { 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 - * @return the principal balance of the user - **/ - function scaledBalanceOf(address user) external view returns (uint256); - - /** - * @dev returns the principal balance of the user and principal total supply. - * @param user the address of the user - * @return the principal balance of the user - * @return the principal total supply - **/ - function getScaledUserBalanceAndSupply(address user) external view returns (uint256, 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 - **/ function isTransferAllowed(address user, uint256 amount) external view returns (bool); /** @@ -98,6 +62,5 @@ interface IAToken is IERC20 { * @param amount the amount to transfer * @return the amount transferred **/ - function transferUnderlyingTo(address user, uint256 amount) external returns (uint256); } diff --git a/contracts/tokenization/interfaces/IScaledBalanceToken.sol b/contracts/tokenization/interfaces/IScaledBalanceToken.sol new file mode 100644 index 00000000..5d2796e9 --- /dev/null +++ b/contracts/tokenization/interfaces/IScaledBalanceToken.sol @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: agpl-3.0 +pragma solidity ^0.6.8; + +interface IScaledBalanceToken { + /** + * @dev emitted after the mint action + * @param from the address performing the mint + * @param value the amount to be minted + * @param index the last index of the reserve + **/ + event Mint(address indexed from, uint256 value, uint256 index); + + /** + * @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 index the liquidity index + */ + function mint( + address user, + uint256 amount, + uint256 index + ) 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 + * @return the principal balance of the user + **/ + function scaledBalanceOf(address user) external view returns (uint256); + + /** + * @dev returns the principal balance of the user and principal total supply. + * @param user the address of the user + * @return the principal balance of the user + * @return the principal total supply + **/ + function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256); + + /** + * @dev Returns the scaled total supply of the variable debt token. Represents sum(borrows/index) + * @return the scaled total supply + **/ + function scaledTotalSupply() external view returns (uint256); +} diff --git a/contracts/tokenization/interfaces/IStableDebtToken.sol b/contracts/tokenization/interfaces/IStableDebtToken.sol index 0aaccd26..6e03e989 100644 --- a/contracts/tokenization/interfaces/IStableDebtToken.sol +++ b/contracts/tokenization/interfaces/IStableDebtToken.sol @@ -84,4 +84,34 @@ interface IStableDebtToken { * @return the timestamp **/ function getUserLastUpdated(address user) external view returns (uint40); + + /** + * @dev returns the principal, the total supply and the average stable rate + **/ + function getSupplyData() + external + view + returns ( + uint256, + uint256, + uint256, + uint40 + ); + + /** + * @dev returns the timestamp of the last update of the total supply + * @return the timestamp + **/ + function getTotalSupplyLastUpdated() external view returns (uint40); + + /** + * @dev returns the total supply and the average stable rate + **/ + function getTotalSupplyAndAvgRate() external view returns (uint256, uint256); + + /** + * @dev Returns the principal debt balance of the user + * @return The debt balance of the user since the last burn/mint action + **/ + function principalBalanceOf(address user) external view returns (uint256); } diff --git a/contracts/tokenization/interfaces/IVariableDebtToken.sol b/contracts/tokenization/interfaces/IVariableDebtToken.sol index fdd86a0d..f1988be8 100644 --- a/contracts/tokenization/interfaces/IVariableDebtToken.sol +++ b/contracts/tokenization/interfaces/IVariableDebtToken.sol @@ -1,66 +1,30 @@ // SPDX-License-Identifier: agpl-3.0 pragma solidity ^0.6.8; +import {IScaledBalanceToken} from './IScaledBalanceToken.sol'; + /** * @title interface IVariableDebtToken * @author Aave * @notice defines the basic interface for a variable debt token. - * @dev does not inherit from IERC20 to save in contract size **/ -interface IVariableDebtToken { - /** - * @dev emitted when new variable debt is minted - * @param user the user receiving the debt - * @param amount the amount of debt being minted - * @param previousBalance the previous balance of the user - * @param currentBalance the current balance of the user - * @param balanceIncrease the debt accumulated since the last action - * @param index the index of the user - **/ - event MintDebt( - address user, - uint256 amount, - uint256 previousBalance, - uint256 currentBalance, - uint256 balanceIncrease, - uint256 index - ); - +interface IVariableDebtToken is IScaledBalanceToken { /** * @dev emitted when variable debt is burnt * @param user the user which debt has been burned * @param amount the amount of debt being burned - * @param previousBalance the previous balance of the user - * @param currentBalance the current balance of the user - * @param balanceIncrease the debt accumulated since the last action * @param index the index of the user **/ - event BurnDebt( - address user, - uint256 amount, - uint256 previousBalance, - uint256 currentBalance, - uint256 balanceIncrease, - uint256 index - ); - - /** - * @dev mints new variable debt - * @param user the user receiving the debt - * @param amount the amount of debt being minted - **/ - function mint(address user, uint256 amount) external; + event Burn(address indexed user, uint256 amount, uint256 index); /** * @dev burns user variable debt * @param user the user which debt is burnt - * @param amount the amount of debt being burned + * @param index the variable debt index of the reserve **/ - function burn(address user, uint256 amount) external; - - /** - * @dev returns the last index of the user - * @return the index of the user - **/ - function getUserIndex(address user) external view returns (uint256); + function burn( + address user, + uint256 amount, + uint256 index + ) external; } diff --git a/coverage.json b/coverage.json new file mode 100644 index 00000000..a5225afd --- /dev/null +++ b/coverage.json @@ -0,0 +1,7373 @@ +{ + "contracts/configuration/LendingPoolAddressesProvider.sol": { + "l": { + "38": 9, + "46": 1, + "47": 1, + "55": 119, + "63": 1, + "64": 1, + "75": 37, + "83": 1, + "84": 1, + "93": 124, + "97": 1, + "98": 1, + "102": 168, + "106": 1, + "107": 1, + "111": 234, + "115": 1, + "116": 1, + "125": 2, + "127": 2, + "130": 2, + "132": 2, + "133": 2, + "134": 2, + "135": 2, + "136": 2, + "138": 0 + }, + "path": "/src/contracts/configuration/LendingPoolAddressesProvider.sol", + "s": { + "1": 9, + "2": 1, + "3": 1, + "4": 119, + "5": 1, + "6": 1, + "7": 37, + "8": 1, + "9": 1, + "10": 124, + "11": 1, + "12": 1, + "13": 168, + "14": 1, + "15": 1, + "16": 234, + "17": 1, + "18": 1, + "19": 2, + "20": 2, + "21": 2, + "22": 2, + "23": 2, + "24": 2, + "25": 2, + "26": 2, + "27": 0 + }, + "b": {"1": [2, 0]}, + "f": { + "1": 9, + "2": 1, + "3": 119, + "4": 1, + "5": 37, + "6": 1, + "7": 124, + "8": 1, + "9": 168, + "10": 1, + "11": 234, + "12": 1, + "13": 2 + }, + "fnMap": { + "1": { + "name": "getLendingPool", + "line": 37, + "loc": {"start": {"line": 37, "column": 2}, "end": {"line": 39, "column": 2}} + }, + "2": { + "name": "setLendingPoolImpl", + "line": 45, + "loc": {"start": {"line": 45, "column": 2}, "end": {"line": 48, "column": 2}} + }, + "3": { + "name": "getLendingPoolConfigurator", + "line": 54, + "loc": {"start": {"line": 54, "column": 2}, "end": {"line": 56, "column": 2}} + }, + "4": { + "name": "setLendingPoolConfiguratorImpl", + "line": 62, + "loc": {"start": {"line": 62, "column": 2}, "end": {"line": 65, "column": 2}} + }, + "5": { + "name": "getLendingPoolCollateralManager", + "line": 74, + "loc": {"start": {"line": 74, "column": 2}, "end": {"line": 76, "column": 2}} + }, + "6": { + "name": "setLendingPoolCollateralManager", + "line": 82, + "loc": {"start": {"line": 82, "column": 2}, "end": {"line": 85, "column": 2}} + }, + "7": { + "name": "getAaveAdmin", + "line": 92, + "loc": {"start": {"line": 92, "column": 2}, "end": {"line": 94, "column": 2}} + }, + "8": { + "name": "setAaveAdmin", + "line": 96, + "loc": {"start": {"line": 96, "column": 2}, "end": {"line": 99, "column": 2}} + }, + "9": { + "name": "getPriceOracle", + "line": 101, + "loc": {"start": {"line": 101, "column": 2}, "end": {"line": 103, "column": 2}} + }, + "10": { + "name": "setPriceOracle", + "line": 105, + "loc": {"start": {"line": 105, "column": 2}, "end": {"line": 108, "column": 2}} + }, + "11": { + "name": "getLendingRateOracle", + "line": 110, + "loc": {"start": {"line": 110, "column": 2}, "end": {"line": 112, "column": 2}} + }, + "12": { + "name": "setLendingRateOracle", + "line": 114, + "loc": {"start": {"line": 114, "column": 2}, "end": {"line": 117, "column": 2}} + }, + "13": { + "name": "_updateImpl", + "line": 124, + "loc": {"start": {"line": 124, "column": 2}, "end": {"line": 140, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 38, "column": 4}, "end": {"line": 38, "column": 35}}, + "2": {"start": {"line": 46, "column": 4}, "end": {"line": 46, "column": 34}}, + "3": {"start": {"line": 47, "column": 4}, "end": {"line": 47, "column": 33}}, + "4": {"start": {"line": 55, "column": 4}, "end": {"line": 55, "column": 48}}, + "5": {"start": {"line": 63, "column": 4}, "end": {"line": 63, "column": 55}}, + "6": {"start": {"line": 64, "column": 4}, "end": {"line": 64, "column": 53}}, + "7": {"start": {"line": 75, "column": 4}, "end": {"line": 75, "column": 54}}, + "8": {"start": {"line": 83, "column": 4}, "end": {"line": 83, "column": 56}}, + "9": {"start": {"line": 84, "column": 4}, "end": {"line": 84, "column": 53}}, + "10": {"start": {"line": 93, "column": 4}, "end": {"line": 93, "column": 33}}, + "11": {"start": {"line": 97, "column": 4}, "end": {"line": 97, "column": 37}}, + "12": {"start": {"line": 98, "column": 4}, "end": {"line": 98, "column": 36}}, + "13": {"start": {"line": 102, "column": 4}, "end": {"line": 102, "column": 35}}, + "14": {"start": {"line": 106, "column": 4}, "end": {"line": 106, "column": 41}}, + "15": {"start": {"line": 107, "column": 4}, "end": {"line": 107, "column": 40}}, + "16": {"start": {"line": 111, "column": 4}, "end": {"line": 111, "column": 42}}, + "17": {"start": {"line": 115, "column": 4}, "end": {"line": 115, "column": 54}}, + "18": {"start": {"line": 116, "column": 4}, "end": {"line": 116, "column": 52}}, + "19": {"start": {"line": 125, "column": 4}, "end": {"line": 125, "column": 58}}, + "20": {"start": {"line": 127, "column": 4}, "end": {"line": 127, "column": 4874}}, + "21": {"start": {"line": 130, "column": 4}, "end": {"line": 130, "column": 87}}, + "22": {"start": {"line": 132, "column": 4}, "end": {"line": 132, "column": 5078}}, + "23": {"start": {"line": 133, "column": 6}, "end": {"line": 133, "column": 56}}, + "24": {"start": {"line": 134, "column": 6}, "end": {"line": 134, "column": 56}}, + "25": {"start": {"line": 135, "column": 6}, "end": {"line": 135, "column": 36}}, + "26": {"start": {"line": 136, "column": 6}, "end": {"line": 136, "column": 43}}, + "27": {"start": {"line": 138, "column": 6}, "end": {"line": 138, "column": 47}} + }, + "branchMap": { + "1": { + "line": 132, + "type": "if", + "locations": [ + {"start": {"line": 132, "column": 4}, "end": {"line": 132, "column": 4}}, + {"start": {"line": 132, "column": 4}, "end": {"line": 132, "column": 4}} + ] + } + } + }, + "contracts/configuration/LendingPoolAddressesProviderRegistry.sol": { + "l": { + "31": 1, + "39": 3, + "41": 3, + "43": 3, + "44": 5, + "45": 4, + "49": 3, + "57": 2, + "58": 2, + "59": 2, + "67": 1, + "68": 1, + "69": 1, + "77": 2, + "78": 1, + "79": 0, + "83": 2 + }, + "path": "/src/contracts/configuration/LendingPoolAddressesProviderRegistry.sol", + "s": { + "1": 1, + "2": 3, + "3": 3, + "4": 3, + "5": 5, + "6": 4, + "7": 3, + "8": 2, + "9": 2, + "10": 2, + "11": 1, + "12": 1, + "13": 1, + "14": 2, + "15": 1, + "16": 0, + "17": 2 + }, + "b": {"1": [4, 1], "2": [1, 0], "3": [0, 1]}, + "f": {"1": 1, "2": 3, "3": 2, "4": 1, "5": 2}, + "fnMap": { + "1": { + "name": "isAddressesProviderRegistered", + "line": 25, + "loc": {"start": {"line": 25, "column": 2}, "end": {"line": 32, "column": 2}} + }, + "2": { + "name": "getAddressesProvidersList", + "line": 38, + "loc": {"start": {"line": 38, "column": 2}, "end": {"line": 50, "column": 2}} + }, + "3": { + "name": "registerAddressesProvider", + "line": 56, + "loc": {"start": {"line": 56, "column": 2}, "end": {"line": 60, "column": 2}} + }, + "4": { + "name": "unregisterAddressesProvider", + "line": 66, + "loc": {"start": {"line": 66, "column": 2}, "end": {"line": 70, "column": 2}} + }, + "5": { + "name": "_addToAddressesProvidersList", + "line": 76, + "loc": {"start": {"line": 76, "column": 2}, "end": {"line": 84, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 31, "column": 4}, "end": {"line": 31, "column": 39}}, + "2": {"start": {"line": 39, "column": 4}, "end": {"line": 39, "column": 53}}, + "3": {"start": {"line": 41, "column": 4}, "end": {"line": 41, "column": 63}}, + "4": {"start": {"line": 43, "column": 4}, "end": {"line": 43, "column": 1323}}, + "5": {"start": {"line": 44, "column": 6}, "end": {"line": 44, "column": 1393}}, + "6": {"start": {"line": 45, "column": 8}, "end": {"line": 45, "column": 53}}, + "7": {"start": {"line": 49, "column": 4}, "end": {"line": 49, "column": 26}}, + "8": {"start": {"line": 57, "column": 4}, "end": {"line": 57, "column": 36}}, + "9": {"start": {"line": 58, "column": 4}, "end": {"line": 58, "column": 41}}, + "10": {"start": {"line": 59, "column": 4}, "end": {"line": 59, "column": 46}}, + "11": {"start": {"line": 67, "column": 4}, "end": {"line": 67, "column": 76}}, + "12": {"start": {"line": 68, "column": 4}, "end": {"line": 68, "column": 35}}, + "13": {"start": {"line": 69, "column": 4}, "end": {"line": 69, "column": 48}}, + "14": {"start": {"line": 77, "column": 4}, "end": {"line": 77, "column": 2552}}, + "15": {"start": {"line": 78, "column": 6}, "end": {"line": 78, "column": 2622}}, + "16": {"start": {"line": 79, "column": 8}, "end": {"line": 79, "column": 14}}, + "17": {"start": {"line": 83, "column": 4}, "end": {"line": 83, "column": 40}} + }, + "branchMap": { + "1": { + "line": 44, + "type": "if", + "locations": [ + {"start": {"line": 44, "column": 6}, "end": {"line": 44, "column": 6}}, + {"start": {"line": 44, "column": 6}, "end": {"line": 44, "column": 6}} + ] + }, + "2": { + "line": 67, + "type": "if", + "locations": [ + {"start": {"line": 67, "column": 4}, "end": {"line": 67, "column": 4}}, + {"start": {"line": 67, "column": 4}, "end": {"line": 67, "column": 4}} + ] + }, + "3": { + "line": 78, + "type": "if", + "locations": [ + {"start": {"line": 78, "column": 6}, "end": {"line": 78, "column": 6}}, + {"start": {"line": 78, "column": 6}, "end": {"line": 78, "column": 6}} + ] + } + } + }, + "contracts/flashloan/base/FlashLoanReceiverBase.sol": { + "l": {"18": 3}, + "path": "/src/contracts/flashloan/base/FlashLoanReceiverBase.sol", + "s": {"1": 3}, + "b": {}, + "f": {"1": 3}, + "fnMap": { + "1": { + "name": "constructor", + "line": 17, + "loc": {"start": {"line": 17, "column": 2}, "end": {"line": 19, "column": 2}} + } + }, + "statementMap": {"1": {"start": {"line": 18, "column": 4}, "end": {"line": 18, "column": 32}}}, + "branchMap": {} + }, + "contracts/flashloan/interfaces/IFlashLoanReceiver.sol": { + "l": {}, + "path": "/src/contracts/flashloan/interfaces/IFlashLoanReceiver.sol", + "s": {}, + "b": {}, + "f": {}, + "fnMap": {}, + "statementMap": {}, + "branchMap": {} + }, + "contracts/lendingpool/DefaultReserveInterestRateStrategy.sol": { + "l": { + "62": 51, + "63": 51, + "64": 51, + "65": 51, + "66": 51, + "67": 51, + "75": 0, + "79": 0, + "83": 0, + "87": 0, + "91": 0, + "95": 7, + "137": 234, + "139": 234, + "140": 234, + "141": 234, + "142": 234, + "144": 234, + "148": 234, + "151": 234, + "152": 4, + "156": 4, + "160": 4, + "164": 230, + "167": 230, + "172": 234, + "181": 234, + "198": 234, + "200": 234, + "202": 86, + "206": 86, + "210": 86, + "214": 86 + }, + "path": "/src/contracts/lendingpool/DefaultReserveInterestRateStrategy.sol", + "s": { + "1": 51, + "2": 51, + "3": 51, + "4": 51, + "5": 51, + "6": 51, + "7": 0, + "8": 0, + "9": 0, + "10": 0, + "11": 0, + "12": 7, + "13": 234, + "14": 234, + "15": 234, + "16": 234, + "17": 234, + "18": 234, + "19": 234, + "20": 234, + "21": 4, + "22": 4, + "23": 4, + "24": 230, + "25": 230, + "26": 234, + "27": 234, + "28": 234, + "29": 234, + "30": 148, + "31": 86, + "32": 86, + "33": 86, + "34": 86 + }, + "b": {"1": [4, 230], "2": [148, 86]}, + "f": {"1": 51, "2": 0, "3": 0, "4": 0, "5": 0, "6": 0, "7": 7, "8": 234, "9": 234}, + "fnMap": { + "1": { + "name": "constructor", + "line": 54, + "loc": {"start": {"line": 54, "column": 2}, "end": {"line": 68, "column": 2}} + }, + "2": { + "name": "variableRateSlope1", + "line": 74, + "loc": {"start": {"line": 74, "column": 2}, "end": {"line": 76, "column": 2}} + }, + "3": { + "name": "variableRateSlope2", + "line": 78, + "loc": {"start": {"line": 78, "column": 2}, "end": {"line": 80, "column": 2}} + }, + "4": { + "name": "stableRateSlope1", + "line": 82, + "loc": {"start": {"line": 82, "column": 2}, "end": {"line": 84, "column": 2}} + }, + "5": { + "name": "stableRateSlope2", + "line": 86, + "loc": {"start": {"line": 86, "column": 2}, "end": {"line": 88, "column": 2}} + }, + "6": { + "name": "baseVariableBorrowRate", + "line": 90, + "loc": {"start": {"line": 90, "column": 2}, "end": {"line": 92, "column": 2}} + }, + "7": { + "name": "getMaxVariableBorrowRate", + "line": 94, + "loc": {"start": {"line": 94, "column": 2}, "end": {"line": 96, "column": 2}} + }, + "8": { + "name": "calculateInterestRates", + "line": 119, + "loc": {"start": {"line": 119, "column": 2}, "end": {"line": 182, "column": 2}} + }, + "9": { + "name": "_getOverallBorrowRate", + "line": 192, + "loc": {"start": {"line": 192, "column": 2}, "end": {"line": 215, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 62, "column": 4}, "end": {"line": 62, "column": 31}}, + "2": {"start": {"line": 63, "column": 4}, "end": {"line": 63, "column": 51}}, + "3": {"start": {"line": 64, "column": 4}, "end": {"line": 64, "column": 43}}, + "4": {"start": {"line": 65, "column": 4}, "end": {"line": 65, "column": 43}}, + "5": {"start": {"line": 66, "column": 4}, "end": {"line": 66, "column": 39}}, + "6": {"start": {"line": 67, "column": 4}, "end": {"line": 67, "column": 39}}, + "7": {"start": {"line": 75, "column": 4}, "end": {"line": 75, "column": 30}}, + "8": {"start": {"line": 79, "column": 4}, "end": {"line": 79, "column": 30}}, + "9": {"start": {"line": 83, "column": 4}, "end": {"line": 83, "column": 28}}, + "10": {"start": {"line": 87, "column": 4}, "end": {"line": 87, "column": 28}}, + "11": {"start": {"line": 91, "column": 4}, "end": {"line": 91, "column": 34}}, + "12": {"start": {"line": 95, "column": 4}, "end": {"line": 95, "column": 84}}, + "13": {"start": {"line": 137, "column": 4}, "end": {"line": 137, "column": 42}}, + "14": {"start": {"line": 139, "column": 4}, "end": {"line": 139, "column": 61}}, + "15": {"start": {"line": 140, "column": 4}, "end": {"line": 140, "column": 37}}, + "16": {"start": {"line": 141, "column": 4}, "end": {"line": 141, "column": 35}}, + "17": {"start": {"line": 142, "column": 4}, "end": {"line": 142, "column": 32}}, + "18": {"start": {"line": 144, "column": 4}, "end": {"line": 144, "column": 5183}}, + "19": {"start": {"line": 148, "column": 4}, "end": {"line": 148, "column": 5283}}, + "20": {"start": {"line": 151, "column": 4}, "end": {"line": 151, "column": 5387}}, + "21": {"start": {"line": 152, "column": 6}, "end": {"line": 152, "column": 5446}}, + "22": {"start": {"line": 156, "column": 6}, "end": {"line": 156, "column": 5584}}, + "23": {"start": {"line": 160, "column": 6}, "end": {"line": 160, "column": 5749}}, + "24": {"start": {"line": 164, "column": 6}, "end": {"line": 164, "column": 5927}}, + "25": {"start": {"line": 167, "column": 6}, "end": {"line": 167, "column": 6090}}, + "26": {"start": {"line": 172, "column": 4}, "end": {"line": 172, "column": 6320}}, + "27": {"start": {"line": 181, "column": 4}, "end": {"line": 181, "column": 100}}, + "28": {"start": {"line": 198, "column": 4}, "end": {"line": 198, "column": 65}}, + "29": {"start": {"line": 200, "column": 4}, "end": {"line": 200, "column": 35}}, + "30": {"start": {"line": 200, "column": 27}, "end": {"line": 200, "column": 35}}, + "31": {"start": {"line": 202, "column": 4}, "end": {"line": 202, "column": 7483}}, + "32": {"start": {"line": 206, "column": 4}, "end": {"line": 206, "column": 7595}}, + "33": {"start": {"line": 210, "column": 4}, "end": {"line": 210, "column": 7708}}, + "34": {"start": {"line": 214, "column": 4}, "end": {"line": 214, "column": 28}} + }, + "branchMap": { + "1": { + "line": 151, + "type": "if", + "locations": [ + {"start": {"line": 151, "column": 4}, "end": {"line": 151, "column": 4}}, + {"start": {"line": 151, "column": 4}, "end": {"line": 151, "column": 4}} + ] + }, + "2": { + "line": 200, + "type": "if", + "locations": [ + {"start": {"line": 200, "column": 4}, "end": {"line": 200, "column": 4}}, + {"start": {"line": 200, "column": 4}, "end": {"line": 200, "column": 4}} + ] + } + } + }, + "contracts/lendingpool/LendingPool.sol": { + "l": { + "55": 118, + "68": 300, + "72": 1, + "81": 1, + "97": 105, + "98": 104, + "100": 104, + "102": 102, + "104": 102, + "105": 102, + "107": 102, + "108": 102, + "109": 93, + "112": 102, + "115": 102, + "117": 102, + "126": 26, + "127": 25, + "129": 25, + "131": 25, + "133": 25, + "136": 25, + "137": 19, + "140": 25, + "150": 22, + "152": 22, + "154": 22, + "155": 18, + "158": 22, + "160": 22, + "177": 3, + "194": 5, + "195": 4, + "197": 3, + "198": 3, + "217": 62, + "218": 61, + "220": 61, + "221": 4, + "223": 4, + "229": 59, + "257": 21, + "259": 20, + "261": 20, + "263": 20, + "266": 20, + "270": 20, + "271": 5, + "274": 20, + "283": 17, + "286": 17, + "287": 9, + "289": 8, + "296": 17, + "297": 17, + "299": 17, + "300": 12, + "303": 17, + "305": 17, + "314": 5, + "315": 4, + "317": 4, + "319": 4, + "321": 4, + "329": 2, + "331": 2, + "333": 1, + "334": 1, + "341": 1, + "346": 1, + "353": 2, + "355": 2, + "367": 8, + "369": 7, + "371": 7, + "372": 7, + "373": 7, + "375": 7, + "378": 7, + "379": 7, + "380": 7, + "387": 7, + "388": 7, + "394": 7, + "401": 1, + "403": 1, + "404": 1, + "406": 1, + "408": 1, + "418": 8, + "419": 7, + "421": 7, + "430": 6, + "432": 6, + "433": 2, + "435": 4, + "455": 11, + "456": 10, + "459": 10, + "469": 10, + "471": 10, + "473": 10, + "475": 5, + "499": 21, + "500": 20, + "501": 18, + "503": 18, + "506": 18, + "517": 18, + "519": 16, + "521": 16, + "522": 5, + "525": 11, + "555": 14, + "556": 13, + "557": 13, + "559": 13, + "561": 13, + "563": 13, + "565": 11, + "567": 11, + "570": 11, + "573": 9, + "575": 9, + "577": 9, + "578": 5, + "580": 3, + "581": 3, + "582": 3, + "584": 3, + "587": 4, + "617": 10, + "618": 9, + "621": 9, + "631": 9, + "633": 7, + "635": 7, + "636": 5, + "662": 97, + "664": 97, + "689": 710, + "691": 710, + "715": 363, + "717": 363, + "744": 21, + "758": 21, + "781": 343, + "783": 343, + "784": 343, + "785": 343, + "786": 343, + "787": 343, + "788": 343, + "789": 343, + "792": 343, + "796": 3, + "800": 0, + "816": 17, + "817": 17, + "823": 17, + "836": 0, + "837": 0, + "841": 75, + "842": 75, + "851": 75, + "872": 63, + "873": 63, + "875": 63, + "877": 63, + "881": 63, + "894": 50, + "895": 50, + "896": 37, + "899": 50, + "902": 50, + "904": 50, + "907": 25, + "909": 25, + "915": 25, + "922": 50, + "929": 50, + "930": 47, + "933": 50, + "950": 17, + "951": 17, + "952": 17, + "953": 136, + "954": 0, + "956": 17, + "957": 17, + "958": 17, + "968": 648, + "982": 810, + "997": 4, + "998": 3, + "1015": 26, + "1017": 26, + "1018": 26, + "1019": 13, + "1021": 13, + "1029": 0 + }, + "path": "/src/contracts/lendingpool/LendingPool.sol", + "s": { + "1": 118, + "2": 300, + "3": 1, + "4": 1, + "5": 105, + "6": 104, + "7": 104, + "8": 102, + "9": 102, + "10": 102, + "11": 102, + "12": 102, + "13": 93, + "14": 102, + "15": 102, + "16": 102, + "17": 26, + "18": 25, + "19": 25, + "20": 25, + "21": 25, + "22": 25, + "23": 19, + "24": 25, + "25": 22, + "26": 22, + "27": 22, + "28": 18, + "29": 22, + "30": 22, + "31": 3, + "32": 5, + "33": 4, + "34": 3, + "35": 3, + "36": 62, + "37": 61, + "38": 61, + "39": 4, + "40": 4, + "41": 59, + "42": 21, + "43": 20, + "44": 20, + "45": 20, + "46": 20, + "47": 20, + "48": 5, + "49": 20, + "50": 17, + "51": 17, + "52": 9, + "53": 8, + "54": 17, + "55": 17, + "56": 17, + "57": 12, + "58": 17, + "59": 17, + "60": 5, + "61": 4, + "62": 4, + "63": 4, + "64": 4, + "65": 2, + "66": 2, + "67": 1, + "68": 1, + "69": 1, + "70": 1, + "71": 2, + "72": 2, + "73": 8, + "74": 7, + "75": 7, + "76": 7, + "77": 7, + "78": 7, + "79": 7, + "80": 7, + "81": 7, + "82": 7, + "83": 7, + "84": 7, + "85": 1, + "86": 1, + "87": 1, + "88": 1, + "89": 1, + "90": 8, + "91": 7, + "92": 7, + "93": 6, + "94": 6, + "95": 2, + "96": 4, + "97": 11, + "98": 10, + "99": 10, + "100": 10, + "101": 10, + "102": 10, + "103": 5, + "104": 21, + "105": 20, + "106": 18, + "107": 18, + "108": 18, + "109": 18, + "110": 16, + "111": 16, + "112": 5, + "113": 11, + "114": 14, + "115": 13, + "116": 13, + "117": 13, + "118": 13, + "119": 13, + "120": 11, + "121": 11, + "122": 11, + "123": 9, + "124": 9, + "125": 9, + "126": 5, + "127": 3, + "128": 3, + "129": 3, + "130": 3, + "131": 4, + "132": 10, + "133": 9, + "134": 9, + "135": 9, + "136": 7, + "137": 7, + "138": 5, + "139": 97, + "140": 97, + "141": 710, + "142": 710, + "143": 363, + "144": 363, + "145": 21, + "146": 21, + "147": 343, + "148": 343, + "149": 343, + "150": 343, + "151": 343, + "152": 343, + "153": 343, + "154": 343, + "155": 343, + "156": 3, + "157": 17, + "158": 17, + "159": 17, + "160": 0, + "161": 0, + "162": 75, + "163": 75, + "164": 75, + "165": 63, + "166": 63, + "167": 63, + "168": 63, + "169": 63, + "170": 50, + "171": 50, + "172": 37, + "173": 50, + "174": 50, + "175": 50, + "176": 25, + "177": 25, + "178": 25, + "179": 50, + "180": 50, + "181": 47, + "182": 50, + "183": 17, + "184": 17, + "185": 17, + "186": 136, + "187": 0, + "188": 17, + "189": 17, + "190": 17, + "191": 648, + "192": 810, + "193": 4, + "194": 3, + "195": 26, + "196": 26, + "197": 26, + "198": 13, + "199": 13, + "200": 0 + }, + "b": { + "1": [118, 0], + "2": [287, 13], + "3": [93, 9], + "4": [19, 6], + "5": [18, 4], + "6": [4, 57], + "7": [5, 15], + "8": [9, 8], + "9": [12, 5], + "10": [1, 1], + "11": [1, 6], + "12": [2, 4], + "13": [10, 0], + "14": [5, 5], + "15": [18, 2], + "16": [16, 2], + "17": [5, 11], + "18": [5, 4], + "19": [7, 2], + "20": [5, 2], + "21": [37, 13], + "22": [25, 25], + "23": [47, 3], + "24": [17, 0], + "25": [0, 136], + "26": [17, 0], + "27": [13, 13] + }, + "f": { + "1": 118, + "2": 300, + "3": 1, + "4": 1, + "5": 105, + "6": 26, + "7": 3, + "8": 5, + "9": 62, + "10": 21, + "11": 5, + "12": 8, + "13": 8, + "14": 11, + "15": 21, + "16": 14, + "17": 10, + "18": 97, + "19": 710, + "20": 363, + "21": 21, + "22": 343, + "23": 3, + "24": 17, + "25": 0, + "26": 75, + "27": 75, + "28": 63, + "29": 17, + "30": 648, + "31": 810, + "32": 4, + "33": 26, + "34": 0 + }, + "fnMap": { + "1": { + "name": "_onlyLendingPoolConfigurator", + "line": 54, + "loc": {"start": {"line": 54, "column": 2}, "end": {"line": 59, "column": 2}} + }, + "2": { + "name": "_whenNotPaused", + "line": 67, + "loc": {"start": {"line": 67, "column": 2}, "end": {"line": 69, "column": 2}} + }, + "3": { + "name": "getRevision", + "line": 71, + "loc": {"start": {"line": 71, "column": 2}, "end": {"line": 73, "column": 2}} + }, + "4": { + "name": "initialize", + "line": 80, + "loc": {"start": {"line": 80, "column": 2}, "end": {"line": 82, "column": 2}} + }, + "5": { + "name": "deposit", + "line": 91, + "loc": {"start": {"line": 91, "column": 2}, "end": {"line": 118, "column": 2}} + }, + "6": { + "name": "withdraw", + "line": 125, + "loc": {"start": {"line": 125, "column": 2}, "end": {"line": 161, "column": 2}} + }, + "7": { + "name": "getBorrowAllowance", + "line": 171, + "loc": {"start": {"line": 171, "column": 2}, "end": {"line": 179, "column": 2}} + }, + "8": { + "name": "delegateBorrowAllowance", + "line": 188, + "loc": {"start": {"line": 188, "column": 2}, "end": {"line": 199, "column": 2}} + }, + "9": { + "name": "borrow", + "line": 210, + "loc": {"start": {"line": 210, "column": 2}, "end": {"line": 241, "column": 2}} + }, + "10": { + "name": "repay", + "line": 251, + "loc": {"start": {"line": 251, "column": 2}, "end": {"line": 306, "column": 2}} + }, + "11": { + "name": "swapBorrowRateMode", + "line": 313, + "loc": {"start": {"line": 313, "column": 2}, "end": {"line": 356, "column": 2}} + }, + "12": { + "name": "rebalanceStableBorrowRate", + "line": 365, + "loc": {"start": {"line": 365, "column": 2}, "end": {"line": 410, "column": 2}} + }, + "13": { + "name": "setUserUseReserveAsCollateral", + "line": 417, + "loc": {"start": {"line": 417, "column": 2}, "end": {"line": 437, "column": 2}} + }, + "14": { + "name": "liquidationCall", + "line": 448, + "loc": {"start": {"line": 448, "column": 2}, "end": {"line": 477, "column": 2}} + }, + "15": { + "name": "repayWithCollateral", + "line": 491, + "loc": {"start": {"line": 491, "column": 2}, "end": {"line": 526, "column": 2}} + }, + "16": { + "name": "flashLoan", + "line": 547, + "loc": {"start": {"line": 547, "column": 2}, "end": {"line": 600, "column": 2}} + }, + "17": { + "name": "swapLiquidity", + "line": 610, + "loc": {"start": {"line": 610, "column": 2}, "end": {"line": 638, "column": 2}} + }, + "18": { + "name": "getReserveConfigurationData", + "line": 644, + "loc": {"start": {"line": 644, "column": 2}, "end": {"line": 677, "column": 2}} + }, + "19": { + "name": "getReserveTokensAddresses", + "line": 679, + "loc": {"start": {"line": 679, "column": 2}, "end": {"line": 696, "column": 2}} + }, + "20": { + "name": "getReserveData", + "line": 698, + "loc": {"start": {"line": 698, "column": 2}, "end": {"line": 729, "column": 2}} + }, + "21": { + "name": "getUserAccountData", + "line": 731, + "loc": {"start": {"line": 731, "column": 2}, "end": {"line": 763, "column": 2}} + }, + "22": { + "name": "getUserReserveData", + "line": 765, + "loc": {"start": {"line": 765, "column": 2}, "end": {"line": 793, "column": 2}} + }, + "23": { + "name": "getReserves", + "line": 795, + "loc": {"start": {"line": 795, "column": 2}, "end": {"line": 797, "column": 2}} + }, + "24": { + "name": "initReserve", + "line": 809, + "loc": {"start": {"line": 809, "column": 2}, "end": {"line": 824, "column": 2}} + }, + "25": { + "name": "setReserveInterestRateStrategyAddress", + "line": 832, + "loc": {"start": {"line": 832, "column": 2}, "end": {"line": 838, "column": 2}} + }, + "26": { + "name": "setConfiguration", + "line": 840, + "loc": {"start": {"line": 840, "column": 2}, "end": {"line": 843, "column": 2}} + }, + "27": { + "name": "getConfiguration", + "line": 845, + "loc": {"start": {"line": 845, "column": 2}, "end": {"line": 852, "column": 2}} + }, + "28": { + "name": "_executeBorrow", + "line": 871, + "loc": {"start": {"line": 871, "column": 2}, "end": {"line": 944, "column": 2}} + }, + "29": { + "name": "_addReserveToList", + "line": 949, + "loc": {"start": {"line": 949, "column": 2}, "end": {"line": 960, "column": 2}} + }, + "30": { + "name": "getReserveNormalizedIncome", + "line": 967, + "loc": {"start": {"line": 967, "column": 2}, "end": {"line": 969, "column": 2}} + }, + "31": { + "name": "getReserveNormalizedVariableDebt", + "line": 976, + "loc": {"start": {"line": 976, "column": 2}, "end": {"line": 983, "column": 2}} + }, + "32": { + "name": "balanceDecreaseAllowed", + "line": 992, + "loc": {"start": {"line": 992, "column": 2}, "end": {"line": 1008, "column": 2}} + }, + "33": { + "name": "setPause", + "line": 1014, + "loc": {"start": {"line": 1014, "column": 2}, "end": {"line": 1023, "column": 2}} + }, + "34": { + "name": "paused", + "line": 1028, + "loc": {"start": {"line": 1028, "column": 2}, "end": {"line": 1030, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 55, "column": 4}, "end": {"line": 55, "column": 2946}}, + "2": {"start": {"line": 68, "column": 4}, "end": {"line": 68, "column": 38}}, + "3": {"start": {"line": 72, "column": 4}, "end": {"line": 72, "column": 31}}, + "4": {"start": {"line": 81, "column": 4}, "end": {"line": 81, "column": 32}}, + "5": {"start": {"line": 97, "column": 4}, "end": {"line": 97, "column": 19}}, + "6": {"start": {"line": 98, "column": 4}, "end": {"line": 98, "column": 63}}, + "7": {"start": {"line": 100, "column": 4}, "end": {"line": 100, "column": 51}}, + "8": {"start": {"line": 102, "column": 4}, "end": {"line": 102, "column": 42}}, + "9": {"start": {"line": 104, "column": 4}, "end": {"line": 104, "column": 24}}, + "10": {"start": {"line": 105, "column": 4}, "end": {"line": 105, "column": 56}}, + "11": {"start": {"line": 107, "column": 4}, "end": {"line": 107, "column": 68}}, + "12": {"start": {"line": 108, "column": 4}, "end": {"line": 108, "column": 4605}}, + "13": {"start": {"line": 109, "column": 6}, "end": {"line": 109, "column": 68}}, + "14": {"start": {"line": 112, "column": 4}, "end": {"line": 112, "column": 67}}, + "15": {"start": {"line": 115, "column": 4}, "end": {"line": 115, "column": 61}}, + "16": {"start": {"line": 117, "column": 4}, "end": {"line": 117, "column": 69}}, + "17": {"start": {"line": 126, "column": 4}, "end": {"line": 126, "column": 19}}, + "18": {"start": {"line": 127, "column": 4}, "end": {"line": 127, "column": 63}}, + "19": {"start": {"line": 129, "column": 4}, "end": {"line": 129, "column": 42}}, + "20": {"start": {"line": 131, "column": 4}, "end": {"line": 131, "column": 63}}, + "21": {"start": {"line": 133, "column": 4}, "end": {"line": 133, "column": 37}}, + "22": {"start": {"line": 136, "column": 4}, "end": {"line": 136, "column": 5500}}, + "23": {"start": {"line": 137, "column": 6}, "end": {"line": 137, "column": 35}}, + "24": {"start": {"line": 140, "column": 4}, "end": {"line": 140, "column": 5584}}, + "25": {"start": {"line": 150, "column": 4}, "end": {"line": 150, "column": 24}}, + "26": {"start": {"line": 152, "column": 4}, "end": {"line": 152, "column": 66}}, + "27": {"start": {"line": 154, "column": 4}, "end": {"line": 154, "column": 5896}}, + "28": {"start": {"line": 155, "column": 6}, "end": {"line": 155, "column": 69}}, + "29": {"start": {"line": 158, "column": 4}, "end": {"line": 158, "column": 89}}, + "30": {"start": {"line": 160, "column": 4}, "end": {"line": 160, "column": 44}}, + "31": {"start": {"line": 177, "column": 4}, "end": {"line": 177, "column": 6759}}, + "32": {"start": {"line": 194, "column": 4}, "end": {"line": 194, "column": 19}}, + "33": {"start": {"line": 195, "column": 4}, "end": {"line": 195, "column": 78}}, + "34": {"start": {"line": 197, "column": 4}, "end": {"line": 197, "column": 57}}, + "35": {"start": {"line": 198, "column": 4}, "end": {"line": 198, "column": 84}}, + "36": {"start": {"line": 217, "column": 4}, "end": {"line": 217, "column": 19}}, + "37": {"start": {"line": 218, "column": 4}, "end": {"line": 218, "column": 63}}, + "38": {"start": {"line": 220, "column": 4}, "end": {"line": 220, "column": 8253}}, + "39": {"start": {"line": 221, "column": 6}, "end": {"line": 221, "column": 71}}, + "40": {"start": {"line": 223, "column": 6}, "end": {"line": 223, "column": 8367}}, + "41": {"start": {"line": 229, "column": 4}, "end": {"line": 229, "column": 8567}}, + "42": {"start": {"line": 257, "column": 4}, "end": {"line": 257, "column": 19}}, + "43": {"start": {"line": 259, "column": 4}, "end": {"line": 259, "column": 63}}, + "44": {"start": {"line": 261, "column": 4}, "end": {"line": 261, "column": 96}}, + "45": {"start": {"line": 263, "column": 4}, "end": {"line": 263, "column": 92}}, + "46": {"start": {"line": 266, "column": 4}, "end": {"line": 266, "column": 9784}}, + "47": {"start": {"line": 270, "column": 4}, "end": {"line": 270, "column": 9895}}, + "48": {"start": {"line": 271, "column": 6}, "end": {"line": 271, "column": 27}}, + "49": {"start": {"line": 274, "column": 4}, "end": {"line": 274, "column": 9997}}, + "50": {"start": {"line": 283, "column": 4}, "end": {"line": 283, "column": 24}}, + "51": {"start": {"line": 286, "column": 4}, "end": {"line": 286, "column": 10224}}, + "52": {"start": {"line": 287, "column": 6}, "end": {"line": 287, "column": 85}}, + "53": {"start": {"line": 289, "column": 6}, "end": {"line": 289, "column": 10397}}, + "54": {"start": {"line": 296, "column": 4}, "end": {"line": 296, "column": 42}}, + "55": {"start": {"line": 297, "column": 4}, "end": {"line": 297, "column": 63}}, + "56": {"start": {"line": 299, "column": 4}, "end": {"line": 299, "column": 10664}}, + "57": {"start": {"line": 300, "column": 6}, "end": {"line": 300, "column": 61}}, + "58": {"start": {"line": 303, "column": 4}, "end": {"line": 303, "column": 68}}, + "59": {"start": {"line": 305, "column": 4}, "end": {"line": 305, "column": 60}}, + "60": {"start": {"line": 314, "column": 4}, "end": {"line": 314, "column": 19}}, + "61": {"start": {"line": 315, "column": 4}, "end": {"line": 315, "column": 63}}, + "62": {"start": {"line": 317, "column": 4}, "end": {"line": 317, "column": 96}}, + "63": {"start": {"line": 319, "column": 4}, "end": {"line": 319, "column": 92}}, + "64": {"start": {"line": 321, "column": 4}, "end": {"line": 321, "column": 11549}}, + "65": {"start": {"line": 329, "column": 4}, "end": {"line": 329, "column": 24}}, + "66": {"start": {"line": 331, "column": 4}, "end": {"line": 331, "column": 11735}}, + "67": {"start": {"line": 333, "column": 6}, "end": {"line": 333, "column": 82}}, + "68": {"start": {"line": 334, "column": 6}, "end": {"line": 334, "column": 11951}}, + "69": {"start": {"line": 341, "column": 6}, "end": {"line": 341, "column": 12138}}, + "70": {"start": {"line": 346, "column": 6}, "end": {"line": 346, "column": 12290}}, + "71": {"start": {"line": 353, "column": 4}, "end": {"line": 353, "column": 66}}, + "72": {"start": {"line": 355, "column": 4}, "end": {"line": 355, "column": 32}}, + "73": {"start": {"line": 367, "column": 4}, "end": {"line": 367, "column": 19}}, + "74": {"start": {"line": 369, "column": 4}, "end": {"line": 369, "column": 63}}, + "75": {"start": {"line": 371, "column": 4}, "end": {"line": 371, "column": 67}}, + "76": {"start": {"line": 372, "column": 4}, "end": {"line": 372, "column": 71}}, + "77": {"start": {"line": 373, "column": 4}, "end": {"line": 373, "column": 49}}, + "78": {"start": {"line": 375, "column": 4}, "end": {"line": 375, "column": 73}}, + "79": {"start": {"line": 378, "column": 4}, "end": {"line": 378, "column": 104}}, + "80": {"start": {"line": 379, "column": 4}, "end": {"line": 379, "column": 82}}, + "81": {"start": {"line": 380, "column": 4}, "end": {"line": 380, "column": 13692}}, + "82": {"start": {"line": 387, "column": 4}, "end": {"line": 387, "column": 63}}, + "83": {"start": {"line": 388, "column": 4}, "end": {"line": 388, "column": 14007}}, + "84": {"start": {"line": 394, "column": 4}, "end": {"line": 394, "column": 14137}}, + "85": {"start": {"line": 401, "column": 4}, "end": {"line": 401, "column": 24}}, + "86": {"start": {"line": 403, "column": 4}, "end": {"line": 403, "column": 77}}, + "87": {"start": {"line": 404, "column": 4}, "end": {"line": 404, "column": 110}}, + "88": {"start": {"line": 406, "column": 4}, "end": {"line": 406, "column": 58}}, + "89": {"start": {"line": 408, "column": 4}, "end": {"line": 408, "column": 47}}, + "90": {"start": {"line": 418, "column": 4}, "end": {"line": 418, "column": 19}}, + "91": {"start": {"line": 419, "column": 4}, "end": {"line": 419, "column": 63}}, + "92": {"start": {"line": 421, "column": 4}, "end": {"line": 421, "column": 15152}}, + "93": {"start": {"line": 430, "column": 4}, "end": {"line": 430, "column": 77}}, + "94": {"start": {"line": 432, "column": 4}, "end": {"line": 432, "column": 15436}}, + "95": {"start": {"line": 433, "column": 6}, "end": {"line": 433, "column": 60}}, + "96": {"start": {"line": 435, "column": 6}, "end": {"line": 435, "column": 61}}, + "97": {"start": {"line": 455, "column": 4}, "end": {"line": 455, "column": 19}}, + "98": {"start": {"line": 456, "column": 4}, "end": {"line": 456, "column": 84}}, + "99": {"start": {"line": 459, "column": 4}, "end": {"line": 459, "column": 16409}}, + "100": {"start": {"line": 469, "column": 4}, "end": {"line": 469, "column": 51}}, + "101": {"start": {"line": 471, "column": 4}, "end": {"line": 471, "column": 93}}, + "102": {"start": {"line": 473, "column": 4}, "end": {"line": 473, "column": 16839}}, + "103": {"start": {"line": 475, "column": 6}, "end": {"line": 475, "column": 52}}, + "104": {"start": {"line": 499, "column": 4}, "end": {"line": 499, "column": 19}}, + "105": {"start": {"line": 500, "column": 4}, "end": {"line": 500, "column": 67}}, + "106": {"start": {"line": 501, "column": 4}, "end": {"line": 501, "column": 33}}, + "107": {"start": {"line": 503, "column": 4}, "end": {"line": 503, "column": 84}}, + "108": {"start": {"line": 506, "column": 4}, "end": {"line": 506, "column": 18211}}, + "109": {"start": {"line": 517, "column": 4}, "end": {"line": 517, "column": 56}}, + "110": {"start": {"line": 519, "column": 4}, "end": {"line": 519, "column": 93}}, + "111": {"start": {"line": 521, "column": 4}, "end": {"line": 521, "column": 18675}}, + "112": {"start": {"line": 522, "column": 6}, "end": {"line": 522, "column": 52}}, + "113": {"start": {"line": 525, "column": 4}, "end": {"line": 525, "column": 34}}, + "114": {"start": {"line": 555, "column": 4}, "end": {"line": 555, "column": 19}}, + "115": {"start": {"line": 556, "column": 4}, "end": {"line": 556, "column": 63}}, + "116": {"start": {"line": 557, "column": 4}, "end": {"line": 557, "column": 34}}, + "117": {"start": {"line": 559, "column": 4}, "end": {"line": 559, "column": 45}}, + "118": {"start": {"line": 561, "column": 4}, "end": {"line": 561, "column": 64}}, + "119": {"start": {"line": 563, "column": 4}, "end": {"line": 563, "column": 56}}, + "120": {"start": {"line": 565, "column": 4}, "end": {"line": 565, "column": 80}}, + "121": {"start": {"line": 567, "column": 4}, "end": {"line": 567, "column": 54}}, + "122": {"start": {"line": 570, "column": 4}, "end": {"line": 570, "column": 76}}, + "123": {"start": {"line": 573, "column": 4}, "end": {"line": 573, "column": 70}}, + "124": {"start": {"line": 575, "column": 4}, "end": {"line": 575, "column": 52}}, + "125": {"start": {"line": 577, "column": 4}, "end": {"line": 577, "column": 20770}}, + "126": {"start": {"line": 578, "column": 6}, "end": {"line": 578, "column": 92}}, + "127": {"start": {"line": 580, "column": 6}, "end": {"line": 580, "column": 26}}, + "128": {"start": {"line": 581, "column": 6}, "end": {"line": 581, "column": 93}}, + "129": {"start": {"line": 582, "column": 6}, "end": {"line": 582, "column": 76}}, + "130": {"start": {"line": 584, "column": 6}, "end": {"line": 584, "column": 80}}, + "131": {"start": {"line": 587, "column": 6}, "end": {"line": 587, "column": 21346}}, + "132": {"start": {"line": 617, "column": 4}, "end": {"line": 617, "column": 19}}, + "133": {"start": {"line": 618, "column": 4}, "end": {"line": 618, "column": 84}}, + "134": {"start": {"line": 621, "column": 4}, "end": {"line": 621, "column": 22445}}, + "135": {"start": {"line": 631, "column": 4}, "end": {"line": 631, "column": 50}}, + "136": {"start": {"line": 633, "column": 4}, "end": {"line": 633, "column": 93}}, + "137": {"start": {"line": 635, "column": 4}, "end": {"line": 635, "column": 22876}}, + "138": {"start": {"line": 636, "column": 6}, "end": {"line": 636, "column": 52}}, + "139": {"start": {"line": 662, "column": 4}, "end": {"line": 662, "column": 63}}, + "140": {"start": {"line": 664, "column": 4}, "end": {"line": 664, "column": 23557}}, + "141": {"start": {"line": 689, "column": 4}, "end": {"line": 689, "column": 63}}, + "142": {"start": {"line": 691, "column": 4}, "end": {"line": 691, "column": 24379}}, + "143": {"start": {"line": 715, "column": 4}, "end": {"line": 715, "column": 62}}, + "144": {"start": {"line": 717, "column": 4}, "end": {"line": 717, "column": 25005}}, + "145": {"start": {"line": 744, "column": 4}, "end": {"line": 744, "column": 25791}}, + "146": {"start": {"line": 758, "column": 4}, "end": {"line": 758, "column": 26088}}, + "147": {"start": {"line": 781, "column": 4}, "end": {"line": 781, "column": 63}}, + "148": {"start": {"line": 783, "column": 4}, "end": {"line": 783, "column": 71}}, + "149": {"start": {"line": 784, "column": 4}, "end": {"line": 784, "column": 87}}, + "150": {"start": {"line": 785, "column": 4}, "end": {"line": 785, "column": 98}}, + "151": {"start": {"line": 786, "column": 4}, "end": {"line": 786, "column": 98}}, + "152": {"start": {"line": 787, "column": 4}, "end": {"line": 787, "column": 47}}, + "153": {"start": {"line": 788, "column": 4}, "end": {"line": 788, "column": 94}}, + "154": {"start": {"line": 789, "column": 4}, "end": {"line": 789, "column": 27231}}, + "155": {"start": {"line": 792, "column": 4}, "end": {"line": 792, "column": 80}}, + "156": {"start": {"line": 796, "column": 4}, "end": {"line": 796, "column": 24}}, + "157": {"start": {"line": 816, "column": 4}, "end": {"line": 816, "column": 33}}, + "158": {"start": {"line": 817, "column": 4}, "end": {"line": 817, "column": 28078}}, + "159": {"start": {"line": 823, "column": 4}, "end": {"line": 823, "column": 27}}, + "160": {"start": {"line": 836, "column": 4}, "end": {"line": 836, "column": 33}}, + "161": {"start": {"line": 837, "column": 4}, "end": {"line": 837, "column": 69}}, + "162": {"start": {"line": 841, "column": 4}, "end": {"line": 841, "column": 33}}, + "163": {"start": {"line": 842, "column": 4}, "end": {"line": 842, "column": 54}}, + "164": {"start": {"line": 851, "column": 4}, "end": {"line": 851, "column": 41}}, + "165": {"start": {"line": 872, "column": 4}, "end": {"line": 872, "column": 68}}, + "166": {"start": {"line": 873, "column": 4}, "end": {"line": 873, "column": 76}}, + "167": {"start": {"line": 875, "column": 4}, "end": {"line": 875, "column": 56}}, + "168": {"start": {"line": 877, "column": 4}, "end": {"line": 877, "column": 29792}}, + "169": {"start": {"line": 881, "column": 4}, "end": {"line": 881, "column": 29946}}, + "170": {"start": {"line": 894, "column": 4}, "end": {"line": 894, "column": 34}}, + "171": {"start": {"line": 895, "column": 4}, "end": {"line": 895, "column": 30243}}, + "172": {"start": {"line": 896, "column": 6}, "end": {"line": 896, "column": 45}}, + "173": {"start": {"line": 899, "column": 4}, "end": {"line": 899, "column": 24}}, + "174": {"start": {"line": 902, "column": 4}, "end": {"line": 902, "column": 33}}, + "175": {"start": {"line": 904, "column": 4}, "end": {"line": 904, "column": 30453}}, + "176": {"start": {"line": 907, "column": 6}, "end": {"line": 907, "column": 56}}, + "177": {"start": {"line": 909, "column": 6}, "end": {"line": 909, "column": 30633}}, + "178": {"start": {"line": 915, "column": 6}, "end": {"line": 915, "column": 30788}}, + "179": {"start": {"line": 922, "column": 4}, "end": {"line": 922, "column": 30947}}, + "180": {"start": {"line": 929, "column": 4}, "end": {"line": 929, "column": 31088}}, + "181": {"start": {"line": 930, "column": 6}, "end": {"line": 930, "column": 77}}, + "182": {"start": {"line": 933, "column": 4}, "end": {"line": 933, "column": 31210}}, + "183": {"start": {"line": 950, "column": 4}, "end": {"line": 950, "column": 36}}, + "184": {"start": {"line": 951, "column": 4}, "end": {"line": 951, "column": 87}}, + "185": {"start": {"line": 952, "column": 4}, "end": {"line": 952, "column": 31801}}, + "186": {"start": {"line": 953, "column": 6}, "end": {"line": 953, "column": 31858}}, + "187": {"start": {"line": 954, "column": 8}, "end": {"line": 954, "column": 33}}, + "188": {"start": {"line": 956, "column": 4}, "end": {"line": 956, "column": 31937}}, + "189": {"start": {"line": 957, "column": 6}, "end": {"line": 957, "column": 54}}, + "190": {"start": {"line": 958, "column": 6}, "end": {"line": 958, "column": 30}}, + "191": {"start": {"line": 968, "column": 4}, "end": {"line": 968, "column": 49}}, + "192": {"start": {"line": 982, "column": 4}, "end": {"line": 982, "column": 47}}, + "193": {"start": {"line": 997, "column": 4}, "end": {"line": 997, "column": 19}}, + "194": {"start": {"line": 998, "column": 4}, "end": {"line": 998, "column": 33188}}, + "195": {"start": {"line": 1015, "column": 4}, "end": {"line": 1015, "column": 33}}, + "196": {"start": {"line": 1017, "column": 4}, "end": {"line": 1017, "column": 16}}, + "197": {"start": {"line": 1018, "column": 4}, "end": {"line": 1018, "column": 33641}}, + "198": {"start": {"line": 1019, "column": 6}, "end": {"line": 1019, "column": 19}}, + "199": {"start": {"line": 1021, "column": 6}, "end": {"line": 1021, "column": 21}}, + "200": {"start": {"line": 1029, "column": 4}, "end": {"line": 1029, "column": 18}} + }, + "branchMap": { + "1": { + "line": 55, + "type": "if", + "locations": [ + {"start": {"line": 55, "column": 4}, "end": {"line": 55, "column": 4}}, + {"start": {"line": 55, "column": 4}, "end": {"line": 55, "column": 4}} + ] + }, + "2": { + "line": 68, + "type": "if", + "locations": [ + {"start": {"line": 68, "column": 4}, "end": {"line": 68, "column": 4}}, + {"start": {"line": 68, "column": 4}, "end": {"line": 68, "column": 4}} + ] + }, + "3": { + "line": 108, + "type": "if", + "locations": [ + {"start": {"line": 108, "column": 4}, "end": {"line": 108, "column": 4}}, + {"start": {"line": 108, "column": 4}, "end": {"line": 108, "column": 4}} + ] + }, + "4": { + "line": 136, + "type": "if", + "locations": [ + {"start": {"line": 136, "column": 4}, "end": {"line": 136, "column": 4}}, + {"start": {"line": 136, "column": 4}, "end": {"line": 136, "column": 4}} + ] + }, + "5": { + "line": 154, + "type": "if", + "locations": [ + {"start": {"line": 154, "column": 4}, "end": {"line": 154, "column": 4}}, + {"start": {"line": 154, "column": 4}, "end": {"line": 154, "column": 4}} + ] + }, + "6": { + "line": 220, + "type": "if", + "locations": [ + {"start": {"line": 220, "column": 4}, "end": {"line": 220, "column": 4}}, + {"start": {"line": 220, "column": 4}, "end": {"line": 220, "column": 4}} + ] + }, + "7": { + "line": 270, + "type": "if", + "locations": [ + {"start": {"line": 270, "column": 4}, "end": {"line": 270, "column": 4}}, + {"start": {"line": 270, "column": 4}, "end": {"line": 270, "column": 4}} + ] + }, + "8": { + "line": 286, + "type": "if", + "locations": [ + {"start": {"line": 286, "column": 4}, "end": {"line": 286, "column": 4}}, + {"start": {"line": 286, "column": 4}, "end": {"line": 286, "column": 4}} + ] + }, + "9": { + "line": 299, + "type": "if", + "locations": [ + {"start": {"line": 299, "column": 4}, "end": {"line": 299, "column": 4}}, + {"start": {"line": 299, "column": 4}, "end": {"line": 299, "column": 4}} + ] + }, + "10": { + "line": 331, + "type": "if", + "locations": [ + {"start": {"line": 331, "column": 4}, "end": {"line": 331, "column": 4}}, + {"start": {"line": 331, "column": 4}, "end": {"line": 331, "column": 4}} + ] + }, + "11": { + "line": 394, + "type": "if", + "locations": [ + {"start": {"line": 394, "column": 4}, "end": {"line": 394, "column": 4}}, + {"start": {"line": 394, "column": 4}, "end": {"line": 394, "column": 4}} + ] + }, + "12": { + "line": 432, + "type": "if", + "locations": [ + {"start": {"line": 432, "column": 4}, "end": {"line": 432, "column": 4}}, + {"start": {"line": 432, "column": 4}, "end": {"line": 432, "column": 4}} + ] + }, + "13": { + "line": 469, + "type": "if", + "locations": [ + {"start": {"line": 469, "column": 4}, "end": {"line": 469, "column": 4}}, + {"start": {"line": 469, "column": 4}, "end": {"line": 469, "column": 4}} + ] + }, + "14": { + "line": 473, + "type": "if", + "locations": [ + {"start": {"line": 473, "column": 4}, "end": {"line": 473, "column": 4}}, + {"start": {"line": 473, "column": 4}, "end": {"line": 473, "column": 4}} + ] + }, + "15": { + "line": 500, + "type": "if", + "locations": [ + {"start": {"line": 500, "column": 4}, "end": {"line": 500, "column": 4}}, + {"start": {"line": 500, "column": 4}, "end": {"line": 500, "column": 4}} + ] + }, + "16": { + "line": 517, + "type": "if", + "locations": [ + {"start": {"line": 517, "column": 4}, "end": {"line": 517, "column": 4}}, + {"start": {"line": 517, "column": 4}, "end": {"line": 517, "column": 4}} + ] + }, + "17": { + "line": 521, + "type": "if", + "locations": [ + {"start": {"line": 521, "column": 4}, "end": {"line": 521, "column": 4}}, + {"start": {"line": 521, "column": 4}, "end": {"line": 521, "column": 4}} + ] + }, + "18": { + "line": 577, + "type": "if", + "locations": [ + {"start": {"line": 577, "column": 4}, "end": {"line": 577, "column": 4}}, + {"start": {"line": 577, "column": 4}, "end": {"line": 577, "column": 4}} + ] + }, + "19": { + "line": 631, + "type": "if", + "locations": [ + {"start": {"line": 631, "column": 4}, "end": {"line": 631, "column": 4}}, + {"start": {"line": 631, "column": 4}, "end": {"line": 631, "column": 4}} + ] + }, + "20": { + "line": 635, + "type": "if", + "locations": [ + {"start": {"line": 635, "column": 4}, "end": {"line": 635, "column": 4}}, + {"start": {"line": 635, "column": 4}, "end": {"line": 635, "column": 4}} + ] + }, + "21": { + "line": 895, + "type": "if", + "locations": [ + {"start": {"line": 895, "column": 4}, "end": {"line": 895, "column": 4}}, + {"start": {"line": 895, "column": 4}, "end": {"line": 895, "column": 4}} + ] + }, + "22": { + "line": 904, + "type": "if", + "locations": [ + {"start": {"line": 904, "column": 4}, "end": {"line": 904, "column": 4}}, + {"start": {"line": 904, "column": 4}, "end": {"line": 904, "column": 4}} + ] + }, + "23": { + "line": 929, + "type": "if", + "locations": [ + {"start": {"line": 929, "column": 4}, "end": {"line": 929, "column": 4}}, + {"start": {"line": 929, "column": 4}, "end": {"line": 929, "column": 4}} + ] + }, + "24": { + "line": 951, + "type": "if", + "locations": [ + {"start": {"line": 951, "column": 4}, "end": {"line": 951, "column": 4}}, + {"start": {"line": 951, "column": 4}, "end": {"line": 951, "column": 4}} + ] + }, + "25": { + "line": 953, + "type": "if", + "locations": [ + {"start": {"line": 953, "column": 6}, "end": {"line": 953, "column": 6}}, + {"start": {"line": 953, "column": 6}, "end": {"line": 953, "column": 6}} + ] + }, + "26": { + "line": 956, + "type": "if", + "locations": [ + {"start": {"line": 956, "column": 4}, "end": {"line": 956, "column": 4}}, + {"start": {"line": 956, "column": 4}, "end": {"line": 956, "column": 4}} + ] + }, + "27": { + "line": 1018, + "type": "if", + "locations": [ + {"start": {"line": 1018, "column": 4}, "end": {"line": 1018, "column": 4}}, + {"start": {"line": 1018, "column": 4}, "end": {"line": 1018, "column": 4}} + ] + } + } + }, + "contracts/lendingpool/LendingPoolCollateralManager.sol": { + "l": { + "127": 0, + "146": 10, + "147": 10, + "148": 10, + "150": 10, + "152": 10, + "161": 10, + "166": 10, + "175": 10, + "176": 5, + "179": 5, + "181": 5, + "183": 5, + "187": 5, + "191": 5, + "207": 5, + "208": 1, + "212": 5, + "213": 3, + "216": 3, + "217": 0, + "225": 5, + "227": 5, + "234": 5, + "235": 1, + "241": 4, + "247": 4, + "254": 5, + "255": 2, + "260": 3, + "261": 3, + "269": 3, + "278": 5, + "284": 5, + "294": 5, + "317": 18, + "318": 18, + "319": 18, + "321": 18, + "323": 18, + "331": 18, + "333": 18, + "343": 18, + "344": 5, + "347": 13, + "349": 13, + "353": 13, + "354": 13, + "356": 13, + "371": 13, + "372": 2, + "375": 13, + "377": 13, + "384": 13, + "385": 2, + "388": 13, + "391": 13, + "400": 11, + "401": 11, + "407": 11, + "409": 11, + "410": 9, + "416": 2, + "421": 2, + "428": 11, + "435": 11, + "444": 11, + "462": 9, + "463": 9, + "465": 9, + "467": 9, + "474": 9, + "475": 4, + "478": 5, + "479": 5, + "481": 5, + "482": 5, + "484": 5, + "485": 1, + "488": 5, + "490": 4, + "497": 3, + "505": 3, + "506": 3, + "507": 3, + "513": 3, + "514": 1, + "517": 3, + "518": 3, + "526": 3, + "534": 3, + "535": 1, + "541": 2, + "563": 18, + "564": 18, + "565": 18, + "567": 18, + "569": 18, + "570": 18, + "572": 18, + "575": 18, + "579": 18, + "586": 18, + "587": 3, + "588": 3, + "595": 15, + "596": 15, + "598": 18 + }, + "path": "/src/contracts/lendingpool/LendingPoolCollateralManager.sol", + "s": { + "1": 0, + "2": 10, + "3": 10, + "4": 10, + "5": 10, + "6": 10, + "7": 10, + "8": 10, + "9": 10, + "10": 5, + "11": 5, + "12": 5, + "13": 5, + "14": 5, + "15": 5, + "16": 5, + "17": 1, + "18": 5, + "19": 3, + "20": 3, + "21": 0, + "22": 5, + "23": 5, + "24": 5, + "25": 1, + "26": 4, + "27": 4, + "28": 5, + "29": 2, + "30": 3, + "31": 3, + "32": 3, + "33": 5, + "34": 5, + "35": 5, + "36": 18, + "37": 18, + "38": 18, + "39": 18, + "40": 18, + "41": 18, + "42": 18, + "43": 18, + "44": 5, + "45": 13, + "46": 13, + "47": 13, + "48": 13, + "49": 13, + "50": 13, + "51": 2, + "52": 13, + "53": 13, + "54": 13, + "55": 2, + "56": 13, + "57": 13, + "58": 11, + "59": 11, + "60": 11, + "61": 11, + "62": 9, + "63": 2, + "64": 2, + "65": 11, + "66": 11, + "67": 11, + "68": 9, + "69": 9, + "70": 9, + "71": 9, + "72": 9, + "73": 4, + "74": 5, + "75": 5, + "76": 5, + "77": 5, + "78": 5, + "79": 1, + "80": 5, + "81": 4, + "82": 3, + "83": 3, + "84": 3, + "85": 3, + "86": 3, + "87": 1, + "88": 3, + "89": 3, + "90": 3, + "91": 3, + "92": 1, + "93": 2, + "94": 18, + "95": 18, + "96": 18, + "97": 18, + "98": 18, + "99": 18, + "100": 18, + "101": 18, + "102": 18, + "103": 18, + "104": 3, + "105": 3, + "106": 15, + "107": 15, + "108": 18 + }, + "b": { + "1": [5, 5], + "2": [1, 4], + "3": [3, 2], + "4": [0, 3], + "5": [1, 4], + "6": [2, 3], + "7": [5, 13], + "8": [2, 11], + "9": [2, 11], + "10": [9, 2], + "11": [4, 5], + "12": [1, 4], + "13": [3, 0], + "14": [1, 2], + "15": [1, 2], + "16": [3, 15] + }, + "f": {"1": 0, "2": 10, "3": 18, "4": 9, "5": 18}, + "fnMap": { + "1": { + "name": "getRevision", + "line": 126, + "loc": {"start": {"line": 126, "column": 2}, "end": {"line": 128, "column": 2}} + }, + "2": { + "name": "liquidationCall", + "line": 139, + "loc": {"start": {"line": 139, "column": 2}, "end": {"line": 295, "column": 2}} + }, + "3": { + "name": "repayWithCollateral", + "line": 309, + "loc": {"start": {"line": 309, "column": 2}, "end": {"line": 445, "column": 2}} + }, + "4": { + "name": "swapLiquidity", + "line": 455, + "loc": {"start": {"line": 455, "column": 2}, "end": {"line": 542, "column": 2}} + }, + "5": { + "name": "calculateAvailableCollateralToLiquidate", + "line": 555, + "loc": {"start": {"line": 555, "column": 2}, "end": {"line": 599, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 127, "column": 4}, "end": {"line": 127, "column": 12}}, + "2": {"start": {"line": 146, "column": 4}, "end": {"line": 146, "column": 78}}, + "3": {"start": {"line": 147, "column": 4}, "end": {"line": 147, "column": 76}}, + "4": {"start": {"line": 148, "column": 4}, "end": {"line": 148, "column": 65}}, + "5": {"start": {"line": 150, "column": 4}, "end": {"line": 150, "column": 40}}, + "6": {"start": {"line": 152, "column": 4}, "end": {"line": 152, "column": 6033}}, + "7": {"start": {"line": 161, "column": 4}, "end": {"line": 161, "column": 6330}}, + "8": {"start": {"line": 166, "column": 4}, "end": {"line": 166, "column": 6452}}, + "9": {"start": {"line": 175, "column": 4}, "end": {"line": 175, "column": 6686}}, + "10": {"start": {"line": 176, "column": 6}, "end": {"line": 176, "column": 44}}, + "11": {"start": {"line": 179, "column": 4}, "end": {"line": 179, "column": 67}}, + "12": {"start": {"line": 181, "column": 4}, "end": {"line": 181, "column": 69}}, + "13": {"start": {"line": 183, "column": 4}, "end": {"line": 183, "column": 6984}}, + "14": {"start": {"line": 187, "column": 4}, "end": {"line": 187, "column": 7148}}, + "15": {"start": {"line": 191, "column": 4}, "end": {"line": 191, "column": 7286}}, + "16": {"start": {"line": 207, "column": 4}, "end": {"line": 207, "column": 7770}}, + "17": {"start": {"line": 208, "column": 6}, "end": {"line": 208, "column": 62}}, + "18": {"start": {"line": 212, "column": 4}, "end": {"line": 212, "column": 8027}}, + "19": {"start": {"line": 213, "column": 6}, "end": {"line": 213, "column": 8058}}, + "20": {"start": {"line": 216, "column": 6}, "end": {"line": 216, "column": 8178}}, + "21": {"start": {"line": 217, "column": 8}, "end": {"line": 217, "column": 8255}}, + "22": {"start": {"line": 225, "column": 4}, "end": {"line": 225, "column": 33}}, + "23": {"start": {"line": 227, "column": 4}, "end": {"line": 227, "column": 8484}}, + "24": {"start": {"line": 234, "column": 4}, "end": {"line": 234, "column": 8633}}, + "25": {"start": {"line": 235, "column": 6}, "end": {"line": 235, "column": 8702}}, + "26": {"start": {"line": 241, "column": 6}, "end": {"line": 241, "column": 8895}}, + "27": {"start": {"line": 247, "column": 6}, "end": {"line": 247, "column": 9069}}, + "28": {"start": {"line": 254, "column": 4}, "end": {"line": 254, "column": 9311}}, + "29": {"start": {"line": 255, "column": 6}, "end": {"line": 255, "column": 97}}, + "30": {"start": {"line": 260, "column": 6}, "end": {"line": 260, "column": 36}}, + "31": {"start": {"line": 261, "column": 6}, "end": {"line": 261, "column": 9577}}, + "32": {"start": {"line": 269, "column": 6}, "end": {"line": 269, "column": 9786}}, + "33": {"start": {"line": 278, "column": 4}, "end": {"line": 278, "column": 9999}}, + "34": {"start": {"line": 284, "column": 4}, "end": {"line": 284, "column": 10139}}, + "35": {"start": {"line": 294, "column": 4}, "end": {"line": 294, "column": 79}}, + "36": {"start": {"line": 317, "column": 4}, "end": {"line": 317, "column": 78}}, + "37": {"start": {"line": 318, "column": 4}, "end": {"line": 318, "column": 71}}, + "38": {"start": {"line": 319, "column": 4}, "end": {"line": 319, "column": 65}}, + "39": {"start": {"line": 321, "column": 4}, "end": {"line": 321, "column": 40}}, + "40": {"start": {"line": 323, "column": 4}, "end": {"line": 323, "column": 11674}}, + "41": {"start": {"line": 331, "column": 4}, "end": {"line": 331, "column": 95}}, + "42": {"start": {"line": 333, "column": 4}, "end": {"line": 333, "column": 11972}}, + "43": {"start": {"line": 343, "column": 4}, "end": {"line": 343, "column": 12217}}, + "44": {"start": {"line": 344, "column": 6}, "end": {"line": 344, "column": 44}}, + "45": {"start": {"line": 347, "column": 4}, "end": {"line": 347, "column": 86}}, + "46": {"start": {"line": 349, "column": 4}, "end": {"line": 349, "column": 12479}}, + "47": {"start": {"line": 353, "column": 4}, "end": {"line": 353, "column": 67}}, + "48": {"start": {"line": 354, "column": 4}, "end": {"line": 354, "column": 69}}, + "49": {"start": {"line": 356, "column": 4}, "end": {"line": 356, "column": 12761}}, + "50": {"start": {"line": 371, "column": 4}, "end": {"line": 371, "column": 13239}}, + "51": {"start": {"line": 372, "column": 6}, "end": {"line": 372, "column": 62}}, + "52": {"start": {"line": 375, "column": 4}, "end": {"line": 375, "column": 34}}, + "53": {"start": {"line": 377, "column": 4}, "end": {"line": 377, "column": 13459}}, + "54": {"start": {"line": 384, "column": 4}, "end": {"line": 384, "column": 13603}}, + "55": {"start": {"line": 385, "column": 6}, "end": {"line": 385, "column": 73}}, + "56": {"start": {"line": 388, "column": 4}, "end": {"line": 388, "column": 51}}, + "57": {"start": {"line": 391, "column": 4}, "end": {"line": 391, "column": 13905}}, + "58": {"start": {"line": 400, "column": 4}, "end": {"line": 400, "column": 28}}, + "59": {"start": {"line": 401, "column": 4}, "end": {"line": 401, "column": 14123}}, + "60": {"start": {"line": 407, "column": 4}, "end": {"line": 407, "column": 95}}, + "61": {"start": {"line": 409, "column": 4}, "end": {"line": 409, "column": 14355}}, + "62": {"start": {"line": 410, "column": 6}, "end": {"line": 410, "column": 14424}}, + "63": {"start": {"line": 416, "column": 6}, "end": {"line": 416, "column": 14607}}, + "64": {"start": {"line": 421, "column": 6}, "end": {"line": 421, "column": 14770}}, + "65": {"start": {"line": 428, "column": 4}, "end": {"line": 428, "column": 14959}}, + "66": {"start": {"line": 435, "column": 4}, "end": {"line": 435, "column": 15112}}, + "67": {"start": {"line": 444, "column": 4}, "end": {"line": 444, "column": 79}}, + "68": {"start": {"line": 462, "column": 4}, "end": {"line": 462, "column": 71}}, + "69": {"start": {"line": 463, "column": 4}, "end": {"line": 463, "column": 67}}, + "70": {"start": {"line": 465, "column": 4}, "end": {"line": 465, "column": 38}}, + "71": {"start": {"line": 467, "column": 4}, "end": {"line": 467, "column": 16281}}, + "72": {"start": {"line": 474, "column": 4}, "end": {"line": 474, "column": 16433}}, + "73": {"start": {"line": 475, "column": 6}, "end": {"line": 475, "column": 44}}, + "74": {"start": {"line": 478, "column": 4}, "end": {"line": 478, "column": 62}}, + "75": {"start": {"line": 479, "column": 4}, "end": {"line": 479, "column": 58}}, + "76": {"start": {"line": 481, "column": 4}, "end": {"line": 481, "column": 28}}, + "77": {"start": {"line": 482, "column": 4}, "end": {"line": 482, "column": 26}}, + "78": {"start": {"line": 484, "column": 4}, "end": {"line": 484, "column": 16775}}, + "79": {"start": {"line": 485, "column": 6}, "end": {"line": 485, "column": 73}}, + "80": {"start": {"line": 488, "column": 4}, "end": {"line": 488, "column": 95}}, + "81": {"start": {"line": 490, "column": 4}, "end": {"line": 490, "column": 17029}}, + "82": {"start": {"line": 497, "column": 4}, "end": {"line": 497, "column": 17256}}, + "83": {"start": {"line": 505, "column": 4}, "end": {"line": 505, "column": 68}}, + "84": {"start": {"line": 506, "column": 4}, "end": {"line": 506, "column": 17473}}, + "85": {"start": {"line": 507, "column": 6}, "end": {"line": 507, "column": 17514}}, + "86": {"start": {"line": 513, "column": 6}, "end": {"line": 513, "column": 17653}}, + "87": {"start": {"line": 514, "column": 8}, "end": {"line": 514, "column": 72}}, + "88": {"start": {"line": 517, "column": 6}, "end": {"line": 517, "column": 90}}, + "89": {"start": {"line": 518, "column": 6}, "end": {"line": 518, "column": 17891}}, + "90": {"start": {"line": 526, "column": 4}, "end": {"line": 526, "column": 18036}}, + "91": {"start": {"line": 534, "column": 4}, "end": {"line": 534, "column": 18247}}, + "92": {"start": {"line": 535, "column": 6}, "end": {"line": 535, "column": 18332}}, + "93": {"start": {"line": 541, "column": 4}, "end": {"line": 541, "column": 79}}, + "94": {"start": {"line": 563, "column": 4}, "end": {"line": 563, "column": 32}}, + "95": {"start": {"line": 564, "column": 4}, "end": {"line": 564, "column": 37}}, + "96": {"start": {"line": 565, "column": 4}, "end": {"line": 565, "column": 87}}, + "97": {"start": {"line": 567, "column": 4}, "end": {"line": 567, "column": 55}}, + "98": {"start": {"line": 569, "column": 4}, "end": {"line": 569, "column": 65}}, + "99": {"start": {"line": 570, "column": 4}, "end": {"line": 570, "column": 71}}, + "100": {"start": {"line": 572, "column": 4}, "end": {"line": 572, "column": 20103}}, + "101": {"start": {"line": 575, "column": 4}, "end": {"line": 575, "column": 72}}, + "102": {"start": {"line": 579, "column": 4}, "end": {"line": 579, "column": 20496}}, + "103": {"start": {"line": 586, "column": 4}, "end": {"line": 586, "column": 20713}}, + "104": {"start": {"line": 587, "column": 6}, "end": {"line": 587, "column": 45}}, + "105": {"start": {"line": 588, "column": 6}, "end": {"line": 588, "column": 20871}}, + "106": {"start": {"line": 595, "column": 6}, "end": {"line": 595, "column": 59}}, + "107": {"start": {"line": 596, "column": 6}, "end": {"line": 596, "column": 43}}, + "108": {"start": {"line": 598, "column": 4}, "end": {"line": 598, "column": 52}} + }, + "branchMap": { + "1": { + "line": 175, + "type": "if", + "locations": [ + {"start": {"line": 175, "column": 4}, "end": {"line": 175, "column": 4}}, + {"start": {"line": 175, "column": 4}, "end": {"line": 175, "column": 4}} + ] + }, + "2": { + "line": 207, + "type": "if", + "locations": [ + {"start": {"line": 207, "column": 4}, "end": {"line": 207, "column": 4}}, + {"start": {"line": 207, "column": 4}, "end": {"line": 207, "column": 4}} + ] + }, + "3": { + "line": 212, + "type": "if", + "locations": [ + {"start": {"line": 212, "column": 4}, "end": {"line": 212, "column": 4}}, + {"start": {"line": 212, "column": 4}, "end": {"line": 212, "column": 4}} + ] + }, + "4": { + "line": 216, + "type": "if", + "locations": [ + {"start": {"line": 216, "column": 6}, "end": {"line": 216, "column": 6}}, + {"start": {"line": 216, "column": 6}, "end": {"line": 216, "column": 6}} + ] + }, + "5": { + "line": 234, + "type": "if", + "locations": [ + {"start": {"line": 234, "column": 4}, "end": {"line": 234, "column": 4}}, + {"start": {"line": 234, "column": 4}, "end": {"line": 234, "column": 4}} + ] + }, + "6": { + "line": 254, + "type": "if", + "locations": [ + {"start": {"line": 254, "column": 4}, "end": {"line": 254, "column": 4}}, + {"start": {"line": 254, "column": 4}, "end": {"line": 254, "column": 4}} + ] + }, + "7": { + "line": 343, + "type": "if", + "locations": [ + {"start": {"line": 343, "column": 4}, "end": {"line": 343, "column": 4}}, + {"start": {"line": 343, "column": 4}, "end": {"line": 343, "column": 4}} + ] + }, + "8": { + "line": 371, + "type": "if", + "locations": [ + {"start": {"line": 371, "column": 4}, "end": {"line": 371, "column": 4}}, + {"start": {"line": 371, "column": 4}, "end": {"line": 371, "column": 4}} + ] + }, + "9": { + "line": 384, + "type": "if", + "locations": [ + {"start": {"line": 384, "column": 4}, "end": {"line": 384, "column": 4}}, + {"start": {"line": 384, "column": 4}, "end": {"line": 384, "column": 4}} + ] + }, + "10": { + "line": 409, + "type": "if", + "locations": [ + {"start": {"line": 409, "column": 4}, "end": {"line": 409, "column": 4}}, + {"start": {"line": 409, "column": 4}, "end": {"line": 409, "column": 4}} + ] + }, + "11": { + "line": 474, + "type": "if", + "locations": [ + {"start": {"line": 474, "column": 4}, "end": {"line": 474, "column": 4}}, + {"start": {"line": 474, "column": 4}, "end": {"line": 474, "column": 4}} + ] + }, + "12": { + "line": 484, + "type": "if", + "locations": [ + {"start": {"line": 484, "column": 4}, "end": {"line": 484, "column": 4}}, + {"start": {"line": 484, "column": 4}, "end": {"line": 484, "column": 4}} + ] + }, + "13": { + "line": 506, + "type": "if", + "locations": [ + {"start": {"line": 506, "column": 4}, "end": {"line": 506, "column": 4}}, + {"start": {"line": 506, "column": 4}, "end": {"line": 506, "column": 4}} + ] + }, + "14": { + "line": 513, + "type": "if", + "locations": [ + {"start": {"line": 513, "column": 6}, "end": {"line": 513, "column": 6}}, + {"start": {"line": 513, "column": 6}, "end": {"line": 513, "column": 6}} + ] + }, + "15": { + "line": 534, + "type": "if", + "locations": [ + {"start": {"line": 534, "column": 4}, "end": {"line": 534, "column": 4}}, + {"start": {"line": 534, "column": 4}, "end": {"line": 534, "column": 4}} + ] + }, + "16": { + "line": 586, + "type": "if", + "locations": [ + {"start": {"line": 586, "column": 4}, "end": {"line": 586, "column": 4}}, + {"start": {"line": 586, "column": 4}, "end": {"line": 586, "column": 4}} + ] + } + } + }, + "contracts/lendingpool/LendingPoolConfigurator.sol": { + "l": { + "187": 124, + "188": 105, + "194": 1, + "198": 1, + "199": 1, + "219": 17, + "221": 17, + "226": 17, + "231": 17, + "239": 17, + "241": 17, + "243": 17, + "244": 17, + "246": 17, + "248": 17, + "263": 1, + "265": 1, + "267": 1, + "276": 1, + "278": 1, + "280": 1, + "289": 1, + "291": 1, + "293": 1, + "305": 18, + "307": 18, + "308": 18, + "310": 18, + "312": 18, + "320": 1, + "322": 1, + "324": 1, + "325": 1, + "341": 14, + "343": 14, + "344": 14, + "345": 14, + "347": 14, + "349": 14, + "357": 1, + "359": 1, + "361": 1, + "363": 1, + "371": 1, + "373": 1, + "375": 1, + "377": 1, + "385": 1, + "387": 1, + "389": 1, + "391": 1, + "399": 7, + "401": 7, + "403": 7, + "405": 7, + "413": 8, + "425": 8, + "430": 7, + "432": 7, + "434": 7, + "436": 7, + "444": 2, + "446": 2, + "448": 2, + "450": 2, + "458": 2, + "460": 2, + "462": 2, + "464": 2, + "473": 1, + "475": 1, + "477": 1, + "479": 1, + "488": 1, + "490": 1, + "492": 1, + "494": 1, + "504": 1, + "506": 1, + "508": 1, + "510": 1, + "519": 1, + "521": 1, + "523": 1, + "525": 1, + "534": 0, + "536": 0, + "538": 0, + "540": 0, + "552": 0, + "553": 0, + "562": 51, + "564": 51, + "571": 51, + "573": 51, + "581": 3, + "585": 3, + "587": 3, + "594": 3, + "602": 26 + }, + "path": "/src/contracts/lendingpool/LendingPoolConfigurator.sol", + "s": { + "1": 124, + "2": 1, + "3": 1, + "4": 1, + "5": 17, + "6": 17, + "7": 17, + "8": 17, + "9": 17, + "10": 17, + "11": 17, + "12": 17, + "13": 17, + "14": 17, + "15": 1, + "16": 1, + "17": 1, + "18": 1, + "19": 1, + "20": 1, + "21": 1, + "22": 1, + "23": 1, + "24": 18, + "25": 18, + "26": 18, + "27": 18, + "28": 18, + "29": 1, + "30": 1, + "31": 1, + "32": 1, + "33": 14, + "34": 14, + "35": 14, + "36": 14, + "37": 14, + "38": 14, + "39": 1, + "40": 1, + "41": 1, + "42": 1, + "43": 1, + "44": 1, + "45": 1, + "46": 1, + "47": 1, + "48": 1, + "49": 1, + "50": 1, + "51": 7, + "52": 7, + "53": 7, + "54": 7, + "55": 8, + "56": 8, + "57": 7, + "58": 7, + "59": 7, + "60": 7, + "61": 2, + "62": 2, + "63": 2, + "64": 2, + "65": 2, + "66": 2, + "67": 2, + "68": 2, + "69": 1, + "70": 1, + "71": 1, + "72": 1, + "73": 1, + "74": 1, + "75": 1, + "76": 1, + "77": 1, + "78": 1, + "79": 1, + "80": 1, + "81": 1, + "82": 1, + "83": 1, + "84": 1, + "85": 0, + "86": 0, + "87": 0, + "88": 0, + "89": 0, + "90": 0, + "91": 51, + "92": 51, + "93": 51, + "94": 51, + "95": 3, + "96": 3, + "97": 3, + "98": 3, + "99": 26 + }, + "b": {"1": [105, 19], "2": [7, 1]}, + "f": { + "1": 124, + "2": 1, + "3": 1, + "4": 17, + "5": 1, + "6": 1, + "7": 1, + "8": 18, + "9": 1, + "10": 14, + "11": 1, + "12": 1, + "13": 1, + "14": 7, + "15": 8, + "16": 2, + "17": 2, + "18": 1, + "19": 1, + "20": 1, + "21": 1, + "22": 0, + "23": 0, + "24": 51, + "25": 3, + "26": 26 + }, + "fnMap": { + "1": { + "name": "onlyAaveAdmin", + "line": 186, + "loc": {"start": {"line": 186, "column": 2}, "end": {"line": 189, "column": 2}} + }, + "2": { + "name": "getRevision", + "line": 193, + "loc": {"start": {"line": 193, "column": 2}, "end": {"line": 195, "column": 2}} + }, + "3": { + "name": "initialize", + "line": 197, + "loc": {"start": {"line": 197, "column": 2}, "end": {"line": 200, "column": 2}} + }, + "4": { + "name": "initReserve", + "line": 218, + "loc": {"start": {"line": 211, "column": 2}, "end": {"line": 255, "column": 2}} + }, + "5": { + "name": "updateAToken", + "line": 262, + "loc": {"start": {"line": 262, "column": 2}, "end": {"line": 268, "column": 2}} + }, + "6": { + "name": "updateStableDebtToken", + "line": 275, + "loc": {"start": {"line": 275, "column": 2}, "end": {"line": 281, "column": 2}} + }, + "7": { + "name": "updateVariableDebtToken", + "line": 288, + "loc": {"start": {"line": 288, "column": 2}, "end": {"line": 294, "column": 2}} + }, + "8": { + "name": "enableBorrowingOnReserve", + "line": 303, + "loc": {"start": {"line": 301, "column": 2}, "end": {"line": 313, "column": 2}} + }, + "9": { + "name": "disableBorrowingOnReserve", + "line": 319, + "loc": {"start": {"line": 319, "column": 2}, "end": {"line": 326, "column": 2}} + }, + "10": { + "name": "enableReserveAsCollateral", + "line": 340, + "loc": {"start": {"line": 335, "column": 2}, "end": {"line": 350, "column": 2}} + }, + "11": { + "name": "disableReserveAsCollateral", + "line": 356, + "loc": {"start": {"line": 356, "column": 2}, "end": {"line": 364, "column": 2}} + }, + "12": { + "name": "enableReserveStableRate", + "line": 370, + "loc": {"start": {"line": 370, "column": 2}, "end": {"line": 378, "column": 2}} + }, + "13": { + "name": "disableReserveStableRate", + "line": 384, + "loc": {"start": {"line": 384, "column": 2}, "end": {"line": 392, "column": 2}} + }, + "14": { + "name": "activateReserve", + "line": 398, + "loc": {"start": {"line": 398, "column": 2}, "end": {"line": 406, "column": 2}} + }, + "15": { + "name": "deactivateReserve", + "line": 412, + "loc": {"start": {"line": 412, "column": 2}, "end": {"line": 437, "column": 2}} + }, + "16": { + "name": "freezeReserve", + "line": 443, + "loc": {"start": {"line": 443, "column": 2}, "end": {"line": 451, "column": 2}} + }, + "17": { + "name": "unfreezeReserve", + "line": 457, + "loc": {"start": {"line": 457, "column": 2}, "end": {"line": 465, "column": 2}} + }, + "18": { + "name": "setLtv", + "line": 472, + "loc": {"start": {"line": 472, "column": 2}, "end": {"line": 480, "column": 2}} + }, + "19": { + "name": "setReserveFactor", + "line": 487, + "loc": {"start": {"line": 487, "column": 2}, "end": {"line": 495, "column": 2}} + }, + "20": { + "name": "setLiquidationThreshold", + "line": 503, + "loc": {"start": {"line": 503, "column": 2}, "end": {"line": 511, "column": 2}} + }, + "21": { + "name": "setLiquidationBonus", + "line": 518, + "loc": {"start": {"line": 518, "column": 2}, "end": {"line": 526, "column": 2}} + }, + "22": { + "name": "setReserveDecimals", + "line": 533, + "loc": {"start": {"line": 533, "column": 2}, "end": {"line": 541, "column": 2}} + }, + "23": { + "name": "setReserveInterestRateStrategyAddress", + "line": 550, + "loc": {"start": {"line": 548, "column": 2}, "end": {"line": 554, "column": 2}} + }, + "24": { + "name": "_initTokenWithProxy", + "line": 561, + "loc": {"start": {"line": 561, "column": 2}, "end": {"line": 574, "column": 2}} + }, + "25": { + "name": "_upgradeTokenImplementation", + "line": 576, + "loc": {"start": {"line": 576, "column": 2}, "end": {"line": 595, "column": 2}} + }, + "26": { + "name": "setPoolPause", + "line": 601, + "loc": {"start": {"line": 601, "column": 2}, "end": {"line": 603, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 187, "column": 4}, "end": {"line": 187, "column": 88}}, + "2": {"start": {"line": 194, "column": 4}, "end": {"line": 194, "column": 32}}, + "3": {"start": {"line": 198, "column": 4}, "end": {"line": 198, "column": 31}}, + "4": {"start": {"line": 199, "column": 4}, "end": {"line": 199, "column": 58}}, + "5": {"start": {"line": 219, "column": 4}, "end": {"line": 219, "column": 89}}, + "6": {"start": {"line": 221, "column": 4}, "end": {"line": 221, "column": 7918}}, + "7": {"start": {"line": 226, "column": 4}, "end": {"line": 226, "column": 8046}}, + "8": {"start": {"line": 231, "column": 4}, "end": {"line": 231, "column": 8177}}, + "9": {"start": {"line": 239, "column": 4}, "end": {"line": 239, "column": 80}}, + "10": {"start": {"line": 241, "column": 4}, "end": {"line": 241, "column": 53}}, + "11": {"start": {"line": 243, "column": 4}, "end": {"line": 243, "column": 32}}, + "12": {"start": {"line": 244, "column": 4}, "end": {"line": 244, "column": 33}}, + "13": {"start": {"line": 246, "column": 4}, "end": {"line": 246, "column": 51}}, + "14": {"start": {"line": 248, "column": 4}, "end": {"line": 248, "column": 8620}}, + "15": {"start": {"line": 263, "column": 4}, "end": {"line": 263, "column": 71}}, + "16": {"start": {"line": 265, "column": 4}, "end": {"line": 265, "column": 68}}, + "17": {"start": {"line": 267, "column": 4}, "end": {"line": 267, "column": 61}}, + "18": {"start": {"line": 276, "column": 4}, "end": {"line": 276, "column": 73}}, + "19": {"start": {"line": 278, "column": 4}, "end": {"line": 278, "column": 70}}, + "20": {"start": {"line": 280, "column": 4}, "end": {"line": 280, "column": 72}}, + "21": {"start": {"line": 289, "column": 4}, "end": {"line": 289, "column": 75}}, + "22": {"start": {"line": 291, "column": 4}, "end": {"line": 291, "column": 72}}, + "23": {"start": {"line": 293, "column": 4}, "end": {"line": 293, "column": 76}}, + "24": {"start": {"line": 305, "column": 4}, "end": {"line": 305, "column": 80}}, + "25": {"start": {"line": 307, "column": 4}, "end": {"line": 307, "column": 42}}, + "26": {"start": {"line": 308, "column": 4}, "end": {"line": 308, "column": 71}}, + "27": {"start": {"line": 310, "column": 4}, "end": {"line": 310, "column": 51}}, + "28": {"start": {"line": 312, "column": 4}, "end": {"line": 312, "column": 66}}, + "29": {"start": {"line": 320, "column": 4}, "end": {"line": 320, "column": 80}}, + "30": {"start": {"line": 322, "column": 4}, "end": {"line": 322, "column": 43}}, + "31": {"start": {"line": 324, "column": 4}, "end": {"line": 324, "column": 51}}, + "32": {"start": {"line": 325, "column": 4}, "end": {"line": 325, "column": 42}}, + "33": {"start": {"line": 341, "column": 4}, "end": {"line": 341, "column": 80}}, + "34": {"start": {"line": 343, "column": 4}, "end": {"line": 343, "column": 28}}, + "35": {"start": {"line": 344, "column": 4}, "end": {"line": 344, "column": 62}}, + "36": {"start": {"line": 345, "column": 4}, "end": {"line": 345, "column": 54}}, + "37": {"start": {"line": 347, "column": 4}, "end": {"line": 347, "column": 51}}, + "38": {"start": {"line": 349, "column": 4}, "end": {"line": 349, "column": 87}}, + "39": {"start": {"line": 357, "column": 4}, "end": {"line": 357, "column": 80}}, + "40": {"start": {"line": 359, "column": 4}, "end": {"line": 359, "column": 26}}, + "41": {"start": {"line": 361, "column": 4}, "end": {"line": 361, "column": 51}}, + "42": {"start": {"line": 363, "column": 4}, "end": {"line": 363, "column": 43}}, + "43": {"start": {"line": 371, "column": 4}, "end": {"line": 371, "column": 80}}, + "44": {"start": {"line": 373, "column": 4}, "end": {"line": 373, "column": 52}}, + "45": {"start": {"line": 375, "column": 4}, "end": {"line": 375, "column": 51}}, + "46": {"start": {"line": 377, "column": 4}, "end": {"line": 377, "column": 42}}, + "47": {"start": {"line": 385, "column": 4}, "end": {"line": 385, "column": 80}}, + "48": {"start": {"line": 387, "column": 4}, "end": {"line": 387, "column": 53}}, + "49": {"start": {"line": 389, "column": 4}, "end": {"line": 389, "column": 51}}, + "50": {"start": {"line": 391, "column": 4}, "end": {"line": 391, "column": 43}}, + "51": {"start": {"line": 399, "column": 4}, "end": {"line": 399, "column": 80}}, + "52": {"start": {"line": 401, "column": 4}, "end": {"line": 401, "column": 32}}, + "53": {"start": {"line": 403, "column": 4}, "end": {"line": 403, "column": 51}}, + "54": {"start": {"line": 405, "column": 4}, "end": {"line": 405, "column": 32}}, + "55": {"start": {"line": 413, "column": 4}, "end": {"line": 413, "column": 14228}}, + "56": {"start": {"line": 425, "column": 4}, "end": {"line": 425, "column": 14387}}, + "57": {"start": {"line": 430, "column": 4}, "end": {"line": 430, "column": 80}}, + "58": {"start": {"line": 432, "column": 4}, "end": {"line": 432, "column": 33}}, + "59": {"start": {"line": 434, "column": 4}, "end": {"line": 434, "column": 51}}, + "60": {"start": {"line": 436, "column": 4}, "end": {"line": 436, "column": 34}}, + "61": {"start": {"line": 444, "column": 4}, "end": {"line": 444, "column": 80}}, + "62": {"start": {"line": 446, "column": 4}, "end": {"line": 446, "column": 32}}, + "63": {"start": {"line": 448, "column": 4}, "end": {"line": 448, "column": 51}}, + "64": {"start": {"line": 450, "column": 4}, "end": {"line": 450, "column": 30}}, + "65": {"start": {"line": 458, "column": 4}, "end": {"line": 458, "column": 80}}, + "66": {"start": {"line": 460, "column": 4}, "end": {"line": 460, "column": 33}}, + "67": {"start": {"line": 462, "column": 4}, "end": {"line": 462, "column": 51}}, + "68": {"start": {"line": 464, "column": 4}, "end": {"line": 464, "column": 32}}, + "69": {"start": {"line": 473, "column": 4}, "end": {"line": 473, "column": 80}}, + "70": {"start": {"line": 475, "column": 4}, "end": {"line": 475, "column": 28}}, + "71": {"start": {"line": 477, "column": 4}, "end": {"line": 477, "column": 51}}, + "72": {"start": {"line": 479, "column": 4}, "end": {"line": 479, "column": 42}}, + "73": {"start": {"line": 488, "column": 4}, "end": {"line": 488, "column": 80}}, + "74": {"start": {"line": 490, "column": 4}, "end": {"line": 490, "column": 48}}, + "75": {"start": {"line": 492, "column": 4}, "end": {"line": 492, "column": 51}}, + "76": {"start": {"line": 494, "column": 4}, "end": {"line": 494, "column": 51}}, + "77": {"start": {"line": 504, "column": 4}, "end": {"line": 504, "column": 80}}, + "78": {"start": {"line": 506, "column": 4}, "end": {"line": 506, "column": 51}}, + "79": {"start": {"line": 508, "column": 4}, "end": {"line": 508, "column": 51}}, + "80": {"start": {"line": 510, "column": 4}, "end": {"line": 510, "column": 61}}, + "81": {"start": {"line": 519, "column": 4}, "end": {"line": 519, "column": 80}}, + "82": {"start": {"line": 521, "column": 4}, "end": {"line": 521, "column": 43}}, + "83": {"start": {"line": 523, "column": 4}, "end": {"line": 523, "column": 51}}, + "84": {"start": {"line": 525, "column": 4}, "end": {"line": 525, "column": 53}}, + "85": {"start": {"line": 534, "column": 4}, "end": {"line": 534, "column": 80}}, + "86": {"start": {"line": 536, "column": 4}, "end": {"line": 536, "column": 38}}, + "87": {"start": {"line": 538, "column": 4}, "end": {"line": 538, "column": 51}}, + "88": {"start": {"line": 540, "column": 4}, "end": {"line": 540, "column": 48}}, + "89": {"start": {"line": 552, "column": 4}, "end": {"line": 552, "column": 73}}, + "90": {"start": {"line": 553, "column": 4}, "end": {"line": 553, "column": 71}}, + "91": {"start": {"line": 562, "column": 4}, "end": {"line": 562, "column": 93}}, + "92": {"start": {"line": 564, "column": 4}, "end": {"line": 564, "column": 18940}}, + "93": {"start": {"line": 571, "column": 4}, "end": {"line": 571, "column": 58}}, + "94": {"start": {"line": 573, "column": 4}, "end": {"line": 573, "column": 25}}, + "95": {"start": {"line": 581, "column": 4}, "end": {"line": 581, "column": 19368}}, + "96": {"start": {"line": 585, "column": 4}, "end": {"line": 585, "column": 84}}, + "97": {"start": {"line": 587, "column": 4}, "end": {"line": 587, "column": 19580}}, + "98": {"start": {"line": 594, "column": 4}, "end": {"line": 594, "column": 49}}, + "99": {"start": {"line": 602, "column": 4}, "end": {"line": 602, "column": 21}} + }, + "branchMap": { + "1": { + "line": 187, + "type": "if", + "locations": [ + {"start": {"line": 187, "column": 4}, "end": {"line": 187, "column": 4}}, + {"start": {"line": 187, "column": 4}, "end": {"line": 187, "column": 4}} + ] + }, + "2": { + "line": 425, + "type": "if", + "locations": [ + {"start": {"line": 425, "column": 4}, "end": {"line": 425, "column": 4}}, + {"start": {"line": 425, "column": 4}, "end": {"line": 425, "column": 4}} + ] + } + } + }, + "contracts/lendingpool/LendingPoolStorage.sol": { + "l": {"30": 0, "37": 0}, + "path": "/src/contracts/lendingpool/LendingPoolStorage.sol", + "s": {"1": 0, "2": 0}, + "b": {}, + "f": {"1": 0, "2": 0}, + "fnMap": { + "1": { + "name": "getReservesList", + "line": 29, + "loc": {"start": {"line": 29, "column": 2}, "end": {"line": 31, "column": 2}} + }, + "2": { + "name": "getAddressesProvider", + "line": 36, + "loc": {"start": {"line": 36, "column": 2}, "end": {"line": 38, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 30, "column": 4}, "end": {"line": 30, "column": 24}}, + "2": {"start": {"line": 37, "column": 4}, "end": {"line": 37, "column": 29}} + }, + "branchMap": {} + }, + "contracts/libraries/configuration/ReserveConfiguration.sol": { + "l": { + "46": 1, + "55": 570, + "63": 16, + "72": 194, + "84": 15, + "97": 112, + "106": 15, + "119": 97, + "128": 17, + "137": 178, + "146": 31, + "155": 179, + "164": 21, + "173": 97, + "182": 19, + "191": 97, + "202": 20, + "215": 97, + "233": 179, + "235": 179, + "258": 209, + "260": 209 + }, + "path": "/src/contracts/libraries/configuration/ReserveConfiguration.sol", + "s": { + "1": 1, + "2": 570, + "3": 16, + "4": 194, + "5": 15, + "6": 112, + "7": 15, + "8": 97, + "9": 17, + "10": 178, + "11": 31, + "12": 179, + "13": 21, + "14": 97, + "15": 19, + "16": 97, + "17": 20, + "18": 97, + "19": 179, + "20": 179, + "21": 209, + "22": 209 + }, + "b": {}, + "f": { + "1": 1, + "2": 570, + "3": 16, + "4": 194, + "5": 15, + "6": 112, + "7": 15, + "8": 97, + "9": 17, + "10": 178, + "11": 31, + "12": 179, + "13": 21, + "14": 97, + "15": 19, + "16": 97, + "17": 20, + "18": 97, + "19": 179, + "20": 209 + }, + "fnMap": { + "1": { + "name": "setReserveFactor", + "line": 44, + "loc": {"start": {"line": 44, "column": 2}, "end": {"line": 47, "column": 2}} + }, + "2": { + "name": "getReserveFactor", + "line": 54, + "loc": {"start": {"line": 54, "column": 2}, "end": {"line": 56, "column": 2}} + }, + "3": { + "name": "setLtv", + "line": 62, + "loc": {"start": {"line": 62, "column": 2}, "end": {"line": 64, "column": 2}} + }, + "4": { + "name": "getLtv", + "line": 71, + "loc": {"start": {"line": 71, "column": 2}, "end": {"line": 73, "column": 2}} + }, + "5": { + "name": "setLiquidationThreshold", + "line": 80, + "loc": {"start": {"line": 80, "column": 2}, "end": {"line": 85, "column": 2}} + }, + "6": { + "name": "getLiquidationThreshold", + "line": 92, + "loc": {"start": {"line": 92, "column": 2}, "end": {"line": 98, "column": 2}} + }, + "7": { + "name": "setLiquidationBonus", + "line": 105, + "loc": {"start": {"line": 105, "column": 2}, "end": {"line": 107, "column": 2}} + }, + "8": { + "name": "getLiquidationBonus", + "line": 114, + "loc": {"start": {"line": 114, "column": 2}, "end": {"line": 120, "column": 2}} + }, + "9": { + "name": "setDecimals", + "line": 127, + "loc": {"start": {"line": 127, "column": 2}, "end": {"line": 129, "column": 2}} + }, + "10": { + "name": "getDecimals", + "line": 136, + "loc": {"start": {"line": 136, "column": 2}, "end": {"line": 138, "column": 2}} + }, + "11": { + "name": "setActive", + "line": 145, + "loc": {"start": {"line": 145, "column": 2}, "end": {"line": 147, "column": 2}} + }, + "12": { + "name": "getActive", + "line": 154, + "loc": {"start": {"line": 154, "column": 2}, "end": {"line": 156, "column": 2}} + }, + "13": { + "name": "setFrozen", + "line": 163, + "loc": {"start": {"line": 163, "column": 2}, "end": {"line": 165, "column": 2}} + }, + "14": { + "name": "getFrozen", + "line": 172, + "loc": {"start": {"line": 172, "column": 2}, "end": {"line": 174, "column": 2}} + }, + "15": { + "name": "setBorrowingEnabled", + "line": 181, + "loc": {"start": {"line": 181, "column": 2}, "end": {"line": 183, "column": 2}} + }, + "16": { + "name": "getBorrowingEnabled", + "line": 190, + "loc": {"start": {"line": 190, "column": 2}, "end": {"line": 192, "column": 2}} + }, + "17": { + "name": "setStableRateBorrowingEnabled", + "line": 199, + "loc": {"start": {"line": 199, "column": 2}, "end": {"line": 203, "column": 2}} + }, + "18": { + "name": "getStableRateBorrowingEnabled", + "line": 210, + "loc": {"start": {"line": 210, "column": 2}, "end": {"line": 216, "column": 2}} + }, + "19": { + "name": "getFlags", + "line": 223, + "loc": {"start": {"line": 223, "column": 2}, "end": {"line": 241, "column": 2}} + }, + "20": { + "name": "getParams", + "line": 248, + "loc": {"start": {"line": 248, "column": 2}, "end": {"line": 266, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 46, "column": 4}, "end": {"line": 46, "column": 70}}, + "2": {"start": {"line": 55, "column": 4}, "end": {"line": 55, "column": 51}}, + "3": {"start": {"line": 63, "column": 4}, "end": {"line": 63, "column": 43}}, + "4": {"start": {"line": 72, "column": 4}, "end": {"line": 72, "column": 32}}, + "5": {"start": {"line": 84, "column": 4}, "end": {"line": 84, "column": 75}}, + "6": {"start": {"line": 97, "column": 4}, "end": {"line": 97, "column": 58}}, + "7": {"start": {"line": 106, "column": 4}, "end": {"line": 106, "column": 67}}, + "8": {"start": {"line": 119, "column": 4}, "end": {"line": 119, "column": 54}}, + "9": {"start": {"line": 128, "column": 4}, "end": {"line": 128, "column": 61}}, + "10": {"start": {"line": 137, "column": 4}, "end": {"line": 137, "column": 45}}, + "11": {"start": {"line": 146, "column": 4}, "end": {"line": 146, "column": 74}}, + "12": {"start": {"line": 155, "column": 4}, "end": {"line": 155, "column": 50}}, + "13": {"start": {"line": 164, "column": 4}, "end": {"line": 164, "column": 74}}, + "14": {"start": {"line": 173, "column": 4}, "end": {"line": 173, "column": 50}}, + "15": {"start": {"line": 182, "column": 4}, "end": {"line": 182, "column": 78}}, + "16": {"start": {"line": 191, "column": 4}, "end": {"line": 191, "column": 53}}, + "17": {"start": {"line": 202, "column": 4}, "end": {"line": 202, "column": 85}}, + "18": {"start": {"line": 215, "column": 4}, "end": {"line": 215, "column": 60}}, + "19": {"start": {"line": 233, "column": 4}, "end": {"line": 233, "column": 33}}, + "20": {"start": {"line": 235, "column": 4}, "end": {"line": 235, "column": 7613}}, + "21": {"start": {"line": 258, "column": 4}, "end": {"line": 258, "column": 33}}, + "22": {"start": {"line": 260, "column": 4}, "end": {"line": 260, "column": 8256}} + }, + "branchMap": {} + }, + "contracts/libraries/configuration/UserConfiguration.sol": { + "l": {"31": 49, "47": 121, "63": 1853, "77": 235, "91": 550, "100": 33, "109": 119}, + "path": "/src/contracts/libraries/configuration/UserConfiguration.sol", + "s": {"1": 49, "2": 121, "3": 1853, "4": 235, "5": 550, "6": 33, "7": 119}, + "b": {}, + "f": {"1": 49, "2": 121, "3": 1853, "4": 235, "5": 550, "6": 33, "7": 119}, + "fnMap": { + "1": { + "name": "setBorrowing", + "line": 26, + "loc": {"start": {"line": 26, "column": 2}, "end": {"line": 34, "column": 2}} + }, + "2": { + "name": "setUsingAsCollateral", + "line": 42, + "loc": {"start": {"line": 42, "column": 2}, "end": {"line": 50, "column": 2}} + }, + "3": { + "name": "isUsingAsCollateralOrBorrowing", + "line": 58, + "loc": {"start": {"line": 58, "column": 2}, "end": {"line": 64, "column": 2}} + }, + "4": { + "name": "isBorrowing", + "line": 72, + "loc": {"start": {"line": 72, "column": 2}, "end": {"line": 78, "column": 2}} + }, + "5": { + "name": "isUsingAsCollateral", + "line": 86, + "loc": {"start": {"line": 86, "column": 2}, "end": {"line": 92, "column": 2}} + }, + "6": { + "name": "isBorrowingAny", + "line": 99, + "loc": {"start": {"line": 99, "column": 2}, "end": {"line": 101, "column": 2}} + }, + "7": { + "name": "isEmpty", + "line": 108, + "loc": {"start": {"line": 108, "column": 2}, "end": {"line": 110, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 31, "column": 4}, "end": {"line": 31, "column": 1104}}, + "2": {"start": {"line": 47, "column": 4}, "end": {"line": 47, "column": 1694}}, + "3": {"start": {"line": 63, "column": 4}, "end": {"line": 63, "column": 53}}, + "4": {"start": {"line": 77, "column": 4}, "end": {"line": 77, "column": 53}}, + "5": {"start": {"line": 91, "column": 4}, "end": {"line": 91, "column": 57}}, + "6": {"start": {"line": 100, "column": 4}, "end": {"line": 100, "column": 42}}, + "7": {"start": {"line": 109, "column": 4}, "end": {"line": 109, "column": 25}} + }, + "branchMap": {} + }, + "contracts/libraries/helpers/Errors.sol": { + "l": {}, + "path": "/src/contracts/libraries/helpers/Errors.sol", + "s": {}, + "b": {}, + "f": {}, + "fnMap": {}, + "statementMap": {}, + "branchMap": {} + }, + "contracts/libraries/helpers/Helpers.sol": { + "l": {"24": 395}, + "path": "/src/contracts/libraries/helpers/Helpers.sol", + "s": {"1": 395}, + "b": {}, + "f": {"1": 395}, + "fnMap": { + "1": { + "name": "getUserCurrentDebt", + "line": 19, + "loc": {"start": {"line": 19, "column": 2}, "end": {"line": 28, "column": 2}} + } + }, + "statementMap": {"1": {"start": {"line": 24, "column": 4}, "end": {"line": 24, "column": 653}}}, + "branchMap": {} + }, + "contracts/libraries/logic/GenericLogic.sol": { + "l": { + "65": 33, + "69": 27, + "72": 6, + "74": 6, + "76": 6, + "77": 0, + "80": 6, + "88": 6, + "89": 0, + "92": 6, + "96": 6, + "99": 6, + "100": 3, + "103": 3, + "109": 3, + "115": 3, + "169": 119, + "171": 119, + "172": 10, + "174": 109, + "175": 1853, + "176": 1668, + "179": 185, + "180": 185, + "182": 185, + "186": 185, + "187": 185, + "189": 185, + "190": 128, + "192": 128, + "197": 128, + "199": 128, + "200": 128, + "205": 185, + "206": 63, + "209": 63, + "213": 63, + "219": 109, + "222": 109, + "226": 109, + "231": 109, + "252": 112, + "254": 64, + "271": 21, + "273": 21, + "274": 11, + "277": 10, + "278": 10 + }, + "path": "/src/contracts/libraries/logic/GenericLogic.sol", + "s": { + "1": 33, + "2": 27, + "3": 6, + "4": 6, + "5": 6, + "6": 0, + "7": 6, + "8": 6, + "9": 0, + "10": 6, + "11": 6, + "12": 6, + "13": 3, + "14": 3, + "15": 3, + "16": 3, + "17": 119, + "18": 119, + "19": 10, + "20": 109, + "21": 1853, + "22": 185, + "23": 185, + "24": 185, + "25": 185, + "26": 185, + "27": 185, + "28": 128, + "29": 128, + "30": 128, + "31": 128, + "32": 128, + "33": 185, + "34": 63, + "35": 63, + "36": 63, + "37": 109, + "38": 109, + "39": 109, + "40": 109, + "41": 112, + "42": 48, + "43": 64, + "44": 21, + "45": 21, + "46": 11, + "47": 10, + "48": 10 + }, + "b": { + "1": [27, 6], + "2": [0, 6], + "3": [0, 6], + "4": [3, 3], + "5": [10, 109], + "6": [1668, 185], + "7": [128, 57], + "8": [63, 122], + "9": [48, 64], + "10": [11, 10] + }, + "f": {"1": 33, "2": 119, "3": 112, "4": 21}, + "fnMap": { + "1": { + "name": "balanceDecreaseAllowed", + "line": 56, + "loc": {"start": {"line": 56, "column": 2}, "end": {"line": 116, "column": 2}} + }, + "2": { + "name": "calculateUserAccountData", + "line": 152, + "loc": {"start": {"line": 152, "column": 2}, "end": {"line": 238, "column": 2}} + }, + "3": { + "name": "calculateHealthFactorFromBalances", + "line": 247, + "loc": {"start": {"line": 247, "column": 2}, "end": {"line": 255, "column": 2}} + }, + "4": { + "name": "calculateAvailableBorrowsETH", + "line": 266, + "loc": {"start": {"line": 266, "column": 2}, "end": {"line": 279, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 65, "column": 4}, "end": {"line": 65, "column": 2530}}, + "2": {"start": {"line": 69, "column": 6}, "end": {"line": 69, "column": 17}}, + "3": {"start": {"line": 72, "column": 4}, "end": {"line": 72, "column": 47}}, + "4": {"start": {"line": 74, "column": 4}, "end": {"line": 74, "column": 80}}, + "5": {"start": {"line": 76, "column": 4}, "end": {"line": 76, "column": 2807}}, + "6": {"start": {"line": 77, "column": 6}, "end": {"line": 77, "column": 17}}, + "7": {"start": {"line": 80, "column": 4}, "end": {"line": 80, "column": 3008}}, + "8": {"start": {"line": 88, "column": 4}, "end": {"line": 88, "column": 3133}}, + "9": {"start": {"line": 89, "column": 6}, "end": {"line": 89, "column": 17}}, + "10": {"start": {"line": 92, "column": 4}, "end": {"line": 92, "column": 3245}}, + "11": {"start": {"line": 96, "column": 4}, "end": {"line": 96, "column": 95}}, + "12": {"start": {"line": 99, "column": 4}, "end": {"line": 99, "column": 3528}}, + "13": {"start": {"line": 100, "column": 6}, "end": {"line": 100, "column": 18}}, + "14": {"start": {"line": 103, "column": 4}, "end": {"line": 103, "column": 3647}}, + "15": {"start": {"line": 109, "column": 4}, "end": {"line": 109, "column": 3854}}, + "16": {"start": {"line": 115, "column": 4}, "end": {"line": 115, "column": 87}}, + "17": {"start": {"line": 169, "column": 4}, "end": {"line": 169, "column": 44}}, + "18": {"start": {"line": 171, "column": 4}, "end": {"line": 171, "column": 5830}}, + "19": {"start": {"line": 172, "column": 6}, "end": {"line": 172, "column": 38}}, + "20": {"start": {"line": 174, "column": 4}, "end": {"line": 174, "column": 5908}}, + "21": {"start": {"line": 175, "column": 6}, "end": {"line": 175, "column": 5971}}, + "22": {"start": {"line": 179, "column": 6}, "end": {"line": 179, "column": 50}}, + "23": {"start": {"line": 180, "column": 6}, "end": {"line": 180, "column": 96}}, + "24": {"start": {"line": 182, "column": 6}, "end": {"line": 182, "column": 6227}}, + "25": {"start": {"line": 186, "column": 6}, "end": {"line": 186, "column": 39}}, + "26": {"start": {"line": 187, "column": 6}, "end": {"line": 187, "column": 97}}, + "27": {"start": {"line": 189, "column": 6}, "end": {"line": 189, "column": 6481}}, + "28": {"start": {"line": 190, "column": 8}, "end": {"line": 190, "column": 93}}, + "29": {"start": {"line": 192, "column": 8}, "end": {"line": 192, "column": 6673}}, + "30": {"start": {"line": 197, "column": 8}, "end": {"line": 197, "column": 95}}, + "31": {"start": {"line": 199, "column": 8}, "end": {"line": 199, "column": 71}}, + "32": {"start": {"line": 200, "column": 8}, "end": {"line": 200, "column": 6976}}, + "33": {"start": {"line": 205, "column": 6}, "end": {"line": 205, "column": 7126}}, + "34": {"start": {"line": 206, "column": 8}, "end": {"line": 206, "column": 7174}}, + "35": {"start": {"line": 209, "column": 8}, "end": {"line": 209, "column": 7296}}, + "36": {"start": {"line": 213, "column": 8}, "end": {"line": 213, "column": 7455}}, + "37": {"start": {"line": 219, "column": 4}, "end": {"line": 219, "column": 7632}}, + "38": {"start": {"line": 222, "column": 4}, "end": {"line": 222, "column": 7752}}, + "39": {"start": {"line": 226, "column": 4}, "end": {"line": 226, "column": 7903}}, + "40": {"start": {"line": 231, "column": 4}, "end": {"line": 231, "column": 8077}}, + "41": {"start": {"line": 252, "column": 4}, "end": {"line": 252, "column": 49}}, + "42": {"start": {"line": 252, "column": 31}, "end": {"line": 252, "column": 49}}, + "43": {"start": {"line": 254, "column": 4}, "end": {"line": 254, "column": 91}}, + "44": {"start": {"line": 271, "column": 4}, "end": {"line": 271, "column": 70}}, + "45": {"start": {"line": 273, "column": 4}, "end": {"line": 273, "column": 9571}}, + "46": {"start": {"line": 274, "column": 6}, "end": {"line": 274, "column": 14}}, + "47": {"start": {"line": 277, "column": 4}, "end": {"line": 277, "column": 66}}, + "48": {"start": {"line": 278, "column": 4}, "end": {"line": 278, "column": 30}} + }, + "branchMap": { + "1": { + "line": 65, + "type": "if", + "locations": [ + {"start": {"line": 65, "column": 4}, "end": {"line": 65, "column": 4}}, + {"start": {"line": 65, "column": 4}, "end": {"line": 65, "column": 4}} + ] + }, + "2": { + "line": 76, + "type": "if", + "locations": [ + {"start": {"line": 76, "column": 4}, "end": {"line": 76, "column": 4}}, + {"start": {"line": 76, "column": 4}, "end": {"line": 76, "column": 4}} + ] + }, + "3": { + "line": 88, + "type": "if", + "locations": [ + {"start": {"line": 88, "column": 4}, "end": {"line": 88, "column": 4}}, + {"start": {"line": 88, "column": 4}, "end": {"line": 88, "column": 4}} + ] + }, + "4": { + "line": 99, + "type": "if", + "locations": [ + {"start": {"line": 99, "column": 4}, "end": {"line": 99, "column": 4}}, + {"start": {"line": 99, "column": 4}, "end": {"line": 99, "column": 4}} + ] + }, + "5": { + "line": 171, + "type": "if", + "locations": [ + {"start": {"line": 171, "column": 4}, "end": {"line": 171, "column": 4}}, + {"start": {"line": 171, "column": 4}, "end": {"line": 171, "column": 4}} + ] + }, + "6": { + "line": 175, + "type": "if", + "locations": [ + {"start": {"line": 175, "column": 6}, "end": {"line": 175, "column": 6}}, + {"start": {"line": 175, "column": 6}, "end": {"line": 175, "column": 6}} + ] + }, + "7": { + "line": 189, + "type": "if", + "locations": [ + {"start": {"line": 189, "column": 6}, "end": {"line": 189, "column": 6}}, + {"start": {"line": 189, "column": 6}, "end": {"line": 189, "column": 6}} + ] + }, + "8": { + "line": 205, + "type": "if", + "locations": [ + {"start": {"line": 205, "column": 6}, "end": {"line": 205, "column": 6}}, + {"start": {"line": 205, "column": 6}, "end": {"line": 205, "column": 6}} + ] + }, + "9": { + "line": 252, + "type": "if", + "locations": [ + {"start": {"line": 252, "column": 4}, "end": {"line": 252, "column": 4}}, + {"start": {"line": 252, "column": 4}, "end": {"line": 252, "column": 4}} + ] + }, + "10": { + "line": 273, + "type": "if", + "locations": [ + {"start": {"line": 273, "column": 4}, "end": {"line": 273, "column": 4}}, + {"start": {"line": 273, "column": 4}, "end": {"line": 273, "column": 4}} + ] + } + } + }, + "contracts/libraries/logic/ReserveLogic.sol": { + "l": { + "85": 648, + "88": 648, + "90": 370, + "93": 278, + "97": 278, + "108": 810, + "111": 810, + "113": 498, + "116": 312, + "120": 312, + "134": 11, + "139": 10, + "151": 239, + "152": 239, + "153": 239, + "155": 239, + "162": 239, + "183": 3, + "185": 3, + "187": 3, + "188": 3, + "190": 3, + "206": 17, + "207": 17, + "209": 17, + "212": 17, + "213": 17, + "216": 17, + "217": 17, + "218": 17, + "219": 17, + "246": 235, + "248": 235, + "250": 235, + "253": 235, + "255": 235, + "267": 234, + "268": 234, + "269": 234, + "271": 234, + "272": 234, + "273": 234, + "275": 234, + "316": 239, + "318": 239, + "320": 239, + "321": 239, + "325": 0, + "328": 0, + "336": 0, + "339": 0, + "342": 0, + "347": 0, + "350": 0, + "356": 0, + "358": 0, + "374": 239, + "376": 239, + "378": 239, + "379": 239, + "382": 239, + "383": 69, + "387": 69, + "388": 69, + "390": 69, + "394": 69, + "395": 39, + "399": 39, + "400": 39, + "401": 39, + "406": 239, + "407": 239 + }, + "path": "/src/contracts/libraries/logic/ReserveLogic.sol", + "s": { + "1": 648, + "2": 648, + "3": 370, + "4": 278, + "5": 278, + "6": 810, + "7": 810, + "8": 498, + "9": 312, + "10": 312, + "11": 11, + "12": 10, + "13": 239, + "14": 239, + "15": 239, + "16": 239, + "17": 239, + "18": 3, + "19": 3, + "20": 3, + "21": 3, + "22": 3, + "23": 17, + "24": 17, + "25": 17, + "26": 17, + "27": 17, + "28": 17, + "29": 17, + "30": 17, + "31": 17, + "32": 235, + "33": 235, + "34": 235, + "35": 235, + "36": 235, + "37": 234, + "38": 234, + "39": 234, + "40": 234, + "41": 234, + "42": 234, + "43": 234, + "44": 239, + "45": 239, + "46": 239, + "47": 239, + "48": 0, + "49": 0, + "50": 0, + "51": 0, + "52": 0, + "53": 0, + "54": 0, + "55": 0, + "56": 0, + "57": 239, + "58": 239, + "59": 239, + "60": 239, + "61": 239, + "62": 69, + "63": 69, + "64": 69, + "65": 69, + "66": 69, + "67": 39, + "68": 39, + "69": 39, + "70": 39, + "71": 239, + "72": 239 + }, + "b": { + "1": [370, 278], + "2": [498, 312], + "3": [10, 1], + "4": [3, 0], + "5": [17, 0], + "6": [17, 0], + "7": [17, 0], + "8": [234, 0], + "9": [234, 0], + "10": [234, 0], + "11": [239, 0], + "12": [69, 170], + "13": [69, 0], + "14": [39, 30], + "15": [39, 0] + }, + "f": {"1": 648, "2": 810, "3": 11, "4": 239, "5": 3, "6": 17, "7": 235, "8": 239, "9": 239}, + "fnMap": { + "1": { + "name": "getNormalizedIncome", + "line": 84, + "loc": {"start": {"line": 84, "column": 2}, "end": {"line": 98, "column": 2}} + }, + "2": { + "name": "getNormalizedDebt", + "line": 107, + "loc": {"start": {"line": 107, "column": 2}, "end": {"line": 121, "column": 2}} + }, + "3": { + "name": "getDebtTokenAddress", + "line": 129, + "loc": {"start": {"line": 129, "column": 2}, "end": {"line": 143, "column": 2}} + }, + "4": { + "name": "updateState", + "line": 150, + "loc": {"start": {"line": 150, "column": 2}, "end": {"line": 169, "column": 2}} + }, + "5": { + "name": "cumulateToLiquidityIndex", + "line": 178, + "loc": {"start": {"line": 178, "column": 2}, "end": {"line": 191, "column": 2}} + }, + "6": { + "name": "init", + "line": 199, + "loc": {"start": {"line": 199, "column": 2}, "end": {"line": 220, "column": 2}} + }, + "7": { + "name": "updateInterestRates", + "line": 239, + "loc": {"start": {"line": 239, "column": 2}, "end": {"line": 283, "column": 2}} + }, + "8": { + "name": "_mintToTreasury", + "line": 309, + "loc": {"start": {"line": 309, "column": 2}, "end": {"line": 359, "column": 2}} + }, + "9": { + "name": "_updateIndexes", + "line": 368, + "loc": {"start": {"line": 368, "column": 2}, "end": {"line": 408, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 85, "column": 4}, "end": {"line": 85, "column": 50}}, + "2": {"start": {"line": 88, "column": 4}, "end": {"line": 88, "column": 3533}}, + "3": {"start": {"line": 90, "column": 6}, "end": {"line": 90, "column": 35}}, + "4": {"start": {"line": 93, "column": 4}, "end": {"line": 93, "column": 3745}}, + "5": {"start": {"line": 97, "column": 4}, "end": {"line": 97, "column": 20}}, + "6": {"start": {"line": 108, "column": 4}, "end": {"line": 108, "column": 50}}, + "7": {"start": {"line": 111, "column": 4}, "end": {"line": 111, "column": 4417}}, + "8": {"start": {"line": 113, "column": 6}, "end": {"line": 113, "column": 40}}, + "9": {"start": {"line": 116, "column": 4}, "end": {"line": 116, "column": 4639}}, + "10": {"start": {"line": 120, "column": 4}, "end": {"line": 120, "column": 20}}, + "11": {"start": {"line": 134, "column": 4}, "end": {"line": 134, "column": 5256}}, + "12": {"start": {"line": 139, "column": 4}, "end": {"line": 139, "column": 5559}}, + "13": {"start": {"line": 151, "column": 4}, "end": {"line": 151, "column": 64}}, + "14": {"start": {"line": 152, "column": 4}, "end": {"line": 152, "column": 69}}, + "15": {"start": {"line": 153, "column": 4}, "end": {"line": 153, "column": 59}}, + "16": {"start": {"line": 155, "column": 4}, "end": {"line": 155, "column": 6182}}, + "17": {"start": {"line": 162, "column": 4}, "end": {"line": 162, "column": 6375}}, + "18": {"start": {"line": 183, "column": 4}, "end": {"line": 183, "column": 88}}, + "19": {"start": {"line": 185, "column": 4}, "end": {"line": 185, "column": 65}}, + "20": {"start": {"line": 187, "column": 4}, "end": {"line": 187, "column": 49}}, + "21": {"start": {"line": 188, "column": 4}, "end": {"line": 188, "column": 64}}, + "22": {"start": {"line": 190, "column": 4}, "end": {"line": 190, "column": 43}}, + "23": {"start": {"line": 206, "column": 4}, "end": {"line": 206, "column": 83}}, + "24": {"start": {"line": 207, "column": 4}, "end": {"line": 207, "column": 7908}}, + "25": {"start": {"line": 209, "column": 6}, "end": {"line": 209, "column": 55}}, + "26": {"start": {"line": 212, "column": 4}, "end": {"line": 212, "column": 8064}}, + "27": {"start": {"line": 213, "column": 6}, "end": {"line": 213, "column": 60}}, + "28": {"start": {"line": 216, "column": 4}, "end": {"line": 216, "column": 40}}, + "29": {"start": {"line": 217, "column": 4}, "end": {"line": 217, "column": 58}}, + "30": {"start": {"line": 218, "column": 4}, "end": {"line": 218, "column": 62}}, + "31": {"start": {"line": 219, "column": 4}, "end": {"line": 219, "column": 68}}, + "32": {"start": {"line": 246, "column": 4}, "end": {"line": 246, "column": 44}}, + "33": {"start": {"line": 248, "column": 4}, "end": {"line": 248, "column": 63}}, + "34": {"start": {"line": 250, "column": 4}, "end": {"line": 250, "column": 9530}}, + "35": {"start": {"line": 253, "column": 4}, "end": {"line": 253, "column": 76}}, + "36": {"start": {"line": 255, "column": 4}, "end": {"line": 255, "column": 9713}}, + "37": {"start": {"line": 267, "column": 4}, "end": {"line": 267, "column": 87}}, + "38": {"start": {"line": 268, "column": 4}, "end": {"line": 268, "column": 88}}, + "39": {"start": {"line": 269, "column": 4}, "end": {"line": 269, "column": 92}}, + "40": {"start": {"line": 271, "column": 4}, "end": {"line": 271, "column": 64}}, + "41": {"start": {"line": 272, "column": 4}, "end": {"line": 272, "column": 64}}, + "42": {"start": {"line": 273, "column": 4}, "end": {"line": 273, "column": 68}}, + "43": {"start": {"line": 275, "column": 4}, "end": {"line": 275, "column": 10646}}, + "44": {"start": {"line": 316, "column": 4}, "end": {"line": 316, "column": 39}}, + "45": {"start": {"line": 318, "column": 4}, "end": {"line": 318, "column": 64}}, + "46": {"start": {"line": 320, "column": 4}, "end": {"line": 320, "column": 12121}}, + "47": {"start": {"line": 321, "column": 6}, "end": {"line": 321, "column": 12}}, + "48": {"start": {"line": 325, "column": 4}, "end": {"line": 325, "column": 86}}, + "49": {"start": {"line": 328, "column": 4}, "end": {"line": 328, "column": 12457}}, + "50": {"start": {"line": 336, "column": 4}, "end": {"line": 336, "column": 90}}, + "51": {"start": {"line": 339, "column": 4}, "end": {"line": 339, "column": 84}}, + "52": {"start": {"line": 342, "column": 4}, "end": {"line": 342, "column": 12963}}, + "53": {"start": {"line": 347, "column": 4}, "end": {"line": 347, "column": 90}}, + "54": {"start": {"line": 350, "column": 4}, "end": {"line": 350, "column": 13330}}, + "55": {"start": {"line": 356, "column": 4}, "end": {"line": 356, "column": 75}}, + "56": {"start": {"line": 358, "column": 4}, "end": {"line": 358, "column": 86}}, + "57": {"start": {"line": 374, "column": 4}, "end": {"line": 374, "column": 50}}, + "58": {"start": {"line": 376, "column": 4}, "end": {"line": 376, "column": 63}}, + "59": {"start": {"line": 378, "column": 4}, "end": {"line": 378, "column": 46}}, + "60": {"start": {"line": 379, "column": 4}, "end": {"line": 379, "column": 56}}, + "61": {"start": {"line": 382, "column": 4}, "end": {"line": 382, "column": 14442}}, + "62": {"start": {"line": 383, "column": 6}, "end": {"line": 383, "column": 14483}}, + "63": {"start": {"line": 387, "column": 6}, "end": {"line": 387, "column": 74}}, + "64": {"start": {"line": 388, "column": 6}, "end": {"line": 388, "column": 77}}, + "65": {"start": {"line": 390, "column": 6}, "end": {"line": 390, "column": 56}}, + "66": {"start": {"line": 394, "column": 6}, "end": {"line": 394, "column": 14986}}, + "67": {"start": {"line": 395, "column": 8}, "end": {"line": 395, "column": 15048}}, + "68": {"start": {"line": 399, "column": 8}, "end": {"line": 399, "column": 91}}, + "69": {"start": {"line": 400, "column": 8}, "end": {"line": 400, "column": 90}}, + "70": {"start": {"line": 401, "column": 8}, "end": {"line": 401, "column": 68}}, + "71": {"start": {"line": 406, "column": 4}, "end": {"line": 406, "column": 56}}, + "72": {"start": {"line": 407, "column": 4}, "end": {"line": 407, "column": 54}} + }, + "branchMap": { + "1": { + "line": 88, + "type": "if", + "locations": [ + {"start": {"line": 88, "column": 4}, "end": {"line": 88, "column": 4}}, + {"start": {"line": 88, "column": 4}, "end": {"line": 88, "column": 4}} + ] + }, + "2": { + "line": 111, + "type": "if", + "locations": [ + {"start": {"line": 111, "column": 4}, "end": {"line": 111, "column": 4}}, + {"start": {"line": 111, "column": 4}, "end": {"line": 111, "column": 4}} + ] + }, + "3": { + "line": 134, + "type": "if", + "locations": [ + {"start": {"line": 134, "column": 4}, "end": {"line": 134, "column": 4}}, + {"start": {"line": 134, "column": 4}, "end": {"line": 134, "column": 4}} + ] + }, + "4": { + "line": 188, + "type": "if", + "locations": [ + {"start": {"line": 188, "column": 4}, "end": {"line": 188, "column": 4}}, + {"start": {"line": 188, "column": 4}, "end": {"line": 188, "column": 4}} + ] + }, + "5": { + "line": 206, + "type": "if", + "locations": [ + {"start": {"line": 206, "column": 4}, "end": {"line": 206, "column": 4}}, + {"start": {"line": 206, "column": 4}, "end": {"line": 206, "column": 4}} + ] + }, + "6": { + "line": 207, + "type": "if", + "locations": [ + {"start": {"line": 207, "column": 4}, "end": {"line": 207, "column": 4}}, + {"start": {"line": 207, "column": 4}, "end": {"line": 207, "column": 4}} + ] + }, + "7": { + "line": 212, + "type": "if", + "locations": [ + {"start": {"line": 212, "column": 4}, "end": {"line": 212, "column": 4}}, + {"start": {"line": 212, "column": 4}, "end": {"line": 212, "column": 4}} + ] + }, + "8": { + "line": 267, + "type": "if", + "locations": [ + {"start": {"line": 267, "column": 4}, "end": {"line": 267, "column": 4}}, + {"start": {"line": 267, "column": 4}, "end": {"line": 267, "column": 4}} + ] + }, + "9": { + "line": 268, + "type": "if", + "locations": [ + {"start": {"line": 268, "column": 4}, "end": {"line": 268, "column": 4}}, + {"start": {"line": 268, "column": 4}, "end": {"line": 268, "column": 4}} + ] + }, + "10": { + "line": 269, + "type": "if", + "locations": [ + {"start": {"line": 269, "column": 4}, "end": {"line": 269, "column": 4}}, + {"start": {"line": 269, "column": 4}, "end": {"line": 269, "column": 4}} + ] + }, + "11": { + "line": 320, + "type": "if", + "locations": [ + {"start": {"line": 320, "column": 4}, "end": {"line": 320, "column": 4}}, + {"start": {"line": 320, "column": 4}, "end": {"line": 320, "column": 4}} + ] + }, + "12": { + "line": 382, + "type": "if", + "locations": [ + {"start": {"line": 382, "column": 4}, "end": {"line": 382, "column": 4}}, + {"start": {"line": 382, "column": 4}, "end": {"line": 382, "column": 4}} + ] + }, + "13": { + "line": 388, + "type": "if", + "locations": [ + {"start": {"line": 388, "column": 6}, "end": {"line": 388, "column": 6}}, + {"start": {"line": 388, "column": 6}, "end": {"line": 388, "column": 6}} + ] + }, + "14": { + "line": 394, + "type": "if", + "locations": [ + {"start": {"line": 394, "column": 6}, "end": {"line": 394, "column": 6}}, + {"start": {"line": 394, "column": 6}, "end": {"line": 394, "column": 6}} + ] + }, + "15": { + "line": 400, + "type": "if", + "locations": [ + {"start": {"line": 400, "column": 8}, "end": {"line": 400, "column": 8}}, + {"start": {"line": 400, "column": 8}, "end": {"line": 400, "column": 8}} + ] + } + } + }, + "contracts/libraries/logic/ValidationLogic.sol": { + "l": { + "38": 104, + "40": 104, + "41": 102, + "42": 102, + "60": 25, + "62": 24, + "64": 23, + "125": 63, + "127": 63, + "134": 63, + "135": 63, + "137": 63, + "140": 63, + "146": 61, + "160": 61, + "162": 55, + "168": 55, + "172": 55, + "186": 50, + "189": 0, + "191": 0, + "200": 0, + "202": 0, + "222": 20, + "224": 20, + "226": 20, + "228": 18, + "236": 18, + "257": 4, + "259": 4, + "260": 4, + "262": 4, + "263": 2, + "265": 2, + "273": 1, + "275": 1, + "283": 0, + "304": 7, + "306": 7, + "308": 7, + "328": 13, + "329": 12, + "349": 10, + "352": 2, + "355": 8, + "356": 1, + "362": 7, + "366": 7, + "367": 1, + "373": 6, + "374": 1, + "380": 5, + "402": 18, + "405": 2, + "408": 16, + "411": 0, + "417": 16, + "418": 8, + "422": 8, + "423": 1, + "430": 15, + "431": 2, + "437": 13, + "453": 9, + "454": 1, + "460": 8, + "461": 8, + "462": 2, + "464": 6, + "465": 1, + "471": 5 + }, + "path": "/src/contracts/libraries/logic/ValidationLogic.sol", + "s": { + "1": 104, + "2": 104, + "3": 102, + "4": 102, + "5": 25, + "6": 24, + "7": 23, + "8": 63, + "9": 63, + "10": 63, + "11": 63, + "12": 63, + "13": 63, + "14": 61, + "15": 61, + "16": 55, + "17": 55, + "18": 55, + "19": 50, + "20": 0, + "21": 0, + "22": 0, + "23": 0, + "24": 20, + "25": 20, + "26": 20, + "27": 18, + "28": 18, + "29": 4, + "30": 4, + "31": 4, + "32": 4, + "33": 2, + "34": 2, + "35": 2, + "36": 1, + "37": 1, + "38": 0, + "39": 7, + "40": 7, + "41": 7, + "42": 13, + "43": 12, + "44": 10, + "45": 2, + "46": 8, + "47": 1, + "48": 7, + "49": 7, + "50": 1, + "51": 6, + "52": 1, + "53": 5, + "54": 18, + "55": 2, + "56": 16, + "57": 0, + "58": 16, + "59": 8, + "60": 8, + "61": 1, + "62": 15, + "63": 2, + "64": 13, + "65": 9, + "66": 1, + "67": 8, + "68": 8, + "69": 2, + "70": 6, + "71": 1, + "72": 5 + }, + "b": { + "1": [102, 2], + "2": [102, 0], + "3": [102, 0], + "4": [24, 1], + "5": [23, 1], + "6": [22, 1], + "7": [63, 0], + "8": [63, 0], + "9": [63, 0], + "10": [61, 2], + "11": [55, 6], + "12": [55, 0], + "13": [50, 5], + "14": [0, 50], + "15": [0, 0], + "16": [0, 0], + "17": [0, 0], + "18": [20, 0], + "19": [18, 2], + "20": [18, 0], + "21": [17, 1], + "22": [4, 0], + "23": [4, 0], + "24": [2, 2], + "25": [1, 1], + "26": [2, 0], + "27": [1, 1], + "28": [1, 0], + "29": [1, 0], + "30": [7, 0], + "31": [6, 1], + "32": [12, 1], + "33": [11, 1], + "34": [2, 8], + "35": [1, 7], + "36": [1, 6], + "37": [1, 5], + "38": [2, 16], + "39": [0, 16], + "40": [8, 8], + "41": [1, 7], + "42": [2, 13], + "43": [1, 8], + "44": [2, 6], + "45": [1, 5] + }, + "f": {"1": 104, "2": 25, "3": 63, "4": 20, "5": 4, "6": 7, "7": 13, "8": 10, "9": 18, "10": 9}, + "fnMap": { + "1": { + "name": "validateDeposit", + "line": 37, + "loc": {"start": {"line": 37, "column": 2}, "end": {"line": 43, "column": 2}} + }, + "2": { + "name": "validateWithdraw", + "line": 51, + "loc": {"start": {"line": 51, "column": 2}, "end": {"line": 76, "column": 2}} + }, + "3": { + "name": "validateBorrow", + "line": 113, + "loc": {"start": {"line": 113, "column": 2}, "end": {"line": 204, "column": 2}} + }, + "4": { + "name": "validateRepay", + "line": 214, + "loc": {"start": {"line": 214, "column": 2}, "end": {"line": 240, "column": 2}} + }, + "5": { + "name": "validateSwapRateMode", + "line": 250, + "loc": {"start": {"line": 250, "column": 2}, "end": {"line": 285, "column": 2}} + }, + "6": { + "name": "validateSetUseReserveAsCollateral", + "line": 296, + "loc": {"start": {"line": 296, "column": 2}, "end": {"line": 320, "column": 2}} + }, + "7": { + "name": "validateFlashloan", + "line": 327, + "loc": {"start": {"line": 327, "column": 2}, "end": {"line": 330, "column": 2}} + }, + "8": { + "name": "validateLiquidationCall", + "line": 341, + "loc": {"start": {"line": 341, "column": 2}, "end": {"line": 381, "column": 2}} + }, + "9": { + "name": "validateRepayWithCollateral", + "line": 393, + "loc": {"start": {"line": 393, "column": 2}, "end": {"line": 438, "column": 2}} + }, + "10": { + "name": "validateSwapLiquidity", + "line": 447, + "loc": {"start": {"line": 447, "column": 2}, "end": {"line": 472, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 38, "column": 4}, "end": {"line": 38, "column": 74}}, + "2": {"start": {"line": 40, "column": 4}, "end": {"line": 40, "column": 56}}, + "3": {"start": {"line": 41, "column": 4}, "end": {"line": 41, "column": 46}}, + "4": {"start": {"line": 42, "column": 4}, "end": {"line": 42, "column": 51}}, + "5": {"start": {"line": 60, "column": 4}, "end": {"line": 60, "column": 56}}, + "6": {"start": {"line": 62, "column": 4}, "end": {"line": 62, "column": 75}}, + "7": {"start": {"line": 64, "column": 4}, "end": {"line": 64, "column": 2437}}, + "8": {"start": {"line": 125, "column": 4}, "end": {"line": 125, "column": 39}}, + "9": {"start": {"line": 127, "column": 4}, "end": {"line": 127, "column": 4488}}, + "10": {"start": {"line": 134, "column": 4}, "end": {"line": 134, "column": 51}}, + "11": {"start": {"line": 135, "column": 4}, "end": {"line": 135, "column": 56}}, + "12": {"start": {"line": 137, "column": 4}, "end": {"line": 137, "column": 63}}, + "13": {"start": {"line": 140, "column": 4}, "end": {"line": 140, "column": 4827}}, + "14": {"start": {"line": 146, "column": 4}, "end": {"line": 146, "column": 5049}}, + "15": {"start": {"line": 160, "column": 4}, "end": {"line": 160, "column": 77}}, + "16": {"start": {"line": 162, "column": 4}, "end": {"line": 162, "column": 5434}}, + "17": {"start": {"line": 168, "column": 4}, "end": {"line": 168, "column": 5703}}, + "18": {"start": {"line": 172, "column": 4}, "end": {"line": 172, "column": 5861}}, + "19": {"start": {"line": 186, "column": 4}, "end": {"line": 186, "column": 6430}}, + "20": {"start": {"line": 189, "column": 6}, "end": {"line": 189, "column": 82}}, + "21": {"start": {"line": 191, "column": 6}, "end": {"line": 191, "column": 6685}}, + "22": {"start": {"line": 200, "column": 6}, "end": {"line": 200, "column": 90}}, + "23": {"start": {"line": 202, "column": 6}, "end": {"line": 202, "column": 89}}, + "24": {"start": {"line": 222, "column": 4}, "end": {"line": 222, "column": 53}}, + "25": {"start": {"line": 224, "column": 4}, "end": {"line": 224, "column": 46}}, + "26": {"start": {"line": 226, "column": 4}, "end": {"line": 226, "column": 60}}, + "27": {"start": {"line": 228, "column": 4}, "end": {"line": 228, "column": 8040}}, + "28": {"start": {"line": 236, "column": 4}, "end": {"line": 236, "column": 8339}}, + "29": {"start": {"line": 257, "column": 4}, "end": {"line": 257, "column": 96}}, + "30": {"start": {"line": 259, "column": 4}, "end": {"line": 259, "column": 46}}, + "31": {"start": {"line": 260, "column": 4}, "end": {"line": 260, "column": 51}}, + "32": {"start": {"line": 262, "column": 4}, "end": {"line": 262, "column": 9332}}, + "33": {"start": {"line": 263, "column": 6}, "end": {"line": 263, "column": 76}}, + "34": {"start": {"line": 264, "column": 11}, "end": {"line": 264, "column": 9485}}, + "35": {"start": {"line": 265, "column": 6}, "end": {"line": 265, "column": 80}}, + "36": {"start": {"line": 273, "column": 6}, "end": {"line": 273, "column": 68}}, + "37": {"start": {"line": 275, "column": 6}, "end": {"line": 275, "column": 10079}}, + "38": {"start": {"line": 283, "column": 6}, "end": {"line": 283, "column": 55}}, + "39": {"start": {"line": 304, "column": 4}, "end": {"line": 304, "column": 83}}, + "40": {"start": {"line": 306, "column": 4}, "end": {"line": 306, "column": 79}}, + "41": {"start": {"line": 308, "column": 4}, "end": {"line": 308, "column": 11408}}, + "42": {"start": {"line": 328, "column": 4}, "end": {"line": 328, "column": 58}}, + "43": {"start": {"line": 329, "column": 4}, "end": {"line": 329, "column": 98}}, + "44": {"start": {"line": 349, "column": 4}, "end": {"line": 349, "column": 12893}}, + "45": {"start": {"line": 352, "column": 6}, "end": {"line": 352, "column": 98}}, + "46": {"start": {"line": 355, "column": 4}, "end": {"line": 355, "column": 13115}}, + "47": {"start": {"line": 356, "column": 6}, "end": {"line": 356, "column": 13200}}, + "48": {"start": {"line": 362, "column": 4}, "end": {"line": 362, "column": 13408}}, + "49": {"start": {"line": 366, "column": 4}, "end": {"line": 366, "column": 13592}}, + "50": {"start": {"line": 367, "column": 6}, "end": {"line": 367, "column": 13629}}, + "51": {"start": {"line": 373, "column": 4}, "end": {"line": 373, "column": 13783}}, + "52": {"start": {"line": 374, "column": 6}, "end": {"line": 374, "column": 13844}}, + "53": {"start": {"line": 380, "column": 4}, "end": {"line": 380, "column": 79}}, + "54": {"start": {"line": 402, "column": 4}, "end": {"line": 402, "column": 14907}}, + "55": {"start": {"line": 405, "column": 6}, "end": {"line": 405, "column": 98}}, + "56": {"start": {"line": 408, "column": 4}, "end": {"line": 408, "column": 15129}}, + "57": {"start": {"line": 411, "column": 6}, "end": {"line": 411, "column": 15248}}, + "58": {"start": {"line": 417, "column": 4}, "end": {"line": 417, "column": 15402}}, + "59": {"start": {"line": 418, "column": 6}, "end": {"line": 418, "column": 15490}}, + "60": {"start": {"line": 422, "column": 6}, "end": {"line": 422, "column": 15680}}, + "61": {"start": {"line": 423, "column": 8}, "end": {"line": 423, "column": 15719}}, + "62": {"start": {"line": 430, "column": 4}, "end": {"line": 430, "column": 15885}}, + "63": {"start": {"line": 431, "column": 6}, "end": {"line": 431, "column": 15946}}, + "64": {"start": {"line": 437, "column": 4}, "end": {"line": 437, "column": 79}}, + "65": {"start": {"line": 453, "column": 4}, "end": {"line": 453, "column": 16711}}, + "66": {"start": {"line": 454, "column": 6}, "end": {"line": 454, "column": 16748}}, + "67": {"start": {"line": 460, "column": 4}, "end": {"line": 460, "column": 80}}, + "68": {"start": {"line": 461, "column": 4}, "end": {"line": 461, "column": 16978}}, + "69": {"start": {"line": 462, "column": 6}, "end": {"line": 462, "column": 98}}, + "70": {"start": {"line": 464, "column": 4}, "end": {"line": 464, "column": 17149}}, + "71": {"start": {"line": 465, "column": 6}, "end": {"line": 465, "column": 17177}}, + "72": {"start": {"line": 471, "column": 4}, "end": {"line": 471, "column": 79}} + }, + "branchMap": { + "1": { + "line": 40, + "type": "if", + "locations": [ + {"start": {"line": 40, "column": 4}, "end": {"line": 40, "column": 4}}, + {"start": {"line": 40, "column": 4}, "end": {"line": 40, "column": 4}} + ] + }, + "2": { + "line": 41, + "type": "if", + "locations": [ + {"start": {"line": 41, "column": 4}, "end": {"line": 41, "column": 4}}, + {"start": {"line": 41, "column": 4}, "end": {"line": 41, "column": 4}} + ] + }, + "3": { + "line": 42, + "type": "if", + "locations": [ + {"start": {"line": 42, "column": 4}, "end": {"line": 42, "column": 4}}, + {"start": {"line": 42, "column": 4}, "end": {"line": 42, "column": 4}} + ] + }, + "4": { + "line": 60, + "type": "if", + "locations": [ + {"start": {"line": 60, "column": 4}, "end": {"line": 60, "column": 4}}, + {"start": {"line": 60, "column": 4}, "end": {"line": 60, "column": 4}} + ] + }, + "5": { + "line": 62, + "type": "if", + "locations": [ + {"start": {"line": 62, "column": 4}, "end": {"line": 62, "column": 4}}, + {"start": {"line": 62, "column": 4}, "end": {"line": 62, "column": 4}} + ] + }, + "6": { + "line": 64, + "type": "if", + "locations": [ + {"start": {"line": 64, "column": 4}, "end": {"line": 64, "column": 4}}, + {"start": {"line": 64, "column": 4}, "end": {"line": 64, "column": 4}} + ] + }, + "7": { + "line": 134, + "type": "if", + "locations": [ + {"start": {"line": 134, "column": 4}, "end": {"line": 134, "column": 4}}, + {"start": {"line": 134, "column": 4}, "end": {"line": 134, "column": 4}} + ] + }, + "8": { + "line": 135, + "type": "if", + "locations": [ + {"start": {"line": 135, "column": 4}, "end": {"line": 135, "column": 4}}, + {"start": {"line": 135, "column": 4}, "end": {"line": 135, "column": 4}} + ] + }, + "9": { + "line": 137, + "type": "if", + "locations": [ + {"start": {"line": 137, "column": 4}, "end": {"line": 137, "column": 4}}, + {"start": {"line": 137, "column": 4}, "end": {"line": 137, "column": 4}} + ] + }, + "10": { + "line": 140, + "type": "if", + "locations": [ + {"start": {"line": 140, "column": 4}, "end": {"line": 140, "column": 4}}, + {"start": {"line": 140, "column": 4}, "end": {"line": 140, "column": 4}} + ] + }, + "11": { + "line": 160, + "type": "if", + "locations": [ + {"start": {"line": 160, "column": 4}, "end": {"line": 160, "column": 4}}, + {"start": {"line": 160, "column": 4}, "end": {"line": 160, "column": 4}} + ] + }, + "12": { + "line": 162, + "type": "if", + "locations": [ + {"start": {"line": 162, "column": 4}, "end": {"line": 162, "column": 4}}, + {"start": {"line": 162, "column": 4}, "end": {"line": 162, "column": 4}} + ] + }, + "13": { + "line": 172, + "type": "if", + "locations": [ + {"start": {"line": 172, "column": 4}, "end": {"line": 172, "column": 4}}, + {"start": {"line": 172, "column": 4}, "end": {"line": 172, "column": 4}} + ] + }, + "14": { + "line": 186, + "type": "if", + "locations": [ + {"start": {"line": 186, "column": 4}, "end": {"line": 186, "column": 4}}, + {"start": {"line": 186, "column": 4}, "end": {"line": 186, "column": 4}} + ] + }, + "15": { + "line": 189, + "type": "if", + "locations": [ + {"start": {"line": 189, "column": 6}, "end": {"line": 189, "column": 6}}, + {"start": {"line": 189, "column": 6}, "end": {"line": 189, "column": 6}} + ] + }, + "16": { + "line": 191, + "type": "if", + "locations": [ + {"start": {"line": 191, "column": 6}, "end": {"line": 191, "column": 6}}, + {"start": {"line": 191, "column": 6}, "end": {"line": 191, "column": 6}} + ] + }, + "17": { + "line": 202, + "type": "if", + "locations": [ + {"start": {"line": 202, "column": 6}, "end": {"line": 202, "column": 6}}, + {"start": {"line": 202, "column": 6}, "end": {"line": 202, "column": 6}} + ] + }, + "18": { + "line": 224, + "type": "if", + "locations": [ + {"start": {"line": 224, "column": 4}, "end": {"line": 224, "column": 4}}, + {"start": {"line": 224, "column": 4}, "end": {"line": 224, "column": 4}} + ] + }, + "19": { + "line": 226, + "type": "if", + "locations": [ + {"start": {"line": 226, "column": 4}, "end": {"line": 226, "column": 4}}, + {"start": {"line": 226, "column": 4}, "end": {"line": 226, "column": 4}} + ] + }, + "20": { + "line": 228, + "type": "if", + "locations": [ + {"start": {"line": 228, "column": 4}, "end": {"line": 228, "column": 4}}, + {"start": {"line": 228, "column": 4}, "end": {"line": 228, "column": 4}} + ] + }, + "21": { + "line": 236, + "type": "if", + "locations": [ + {"start": {"line": 236, "column": 4}, "end": {"line": 236, "column": 4}}, + {"start": {"line": 236, "column": 4}, "end": {"line": 236, "column": 4}} + ] + }, + "22": { + "line": 259, + "type": "if", + "locations": [ + {"start": {"line": 259, "column": 4}, "end": {"line": 259, "column": 4}}, + {"start": {"line": 259, "column": 4}, "end": {"line": 259, "column": 4}} + ] + }, + "23": { + "line": 260, + "type": "if", + "locations": [ + {"start": {"line": 260, "column": 4}, "end": {"line": 260, "column": 4}}, + {"start": {"line": 260, "column": 4}, "end": {"line": 260, "column": 4}} + ] + }, + "24": { + "line": 262, + "type": "if", + "locations": [ + {"start": {"line": 262, "column": 4}, "end": {"line": 262, "column": 4}}, + {"start": {"line": 262, "column": 4}, "end": {"line": 262, "column": 4}} + ] + }, + "25": { + "line": 263, + "type": "if", + "locations": [ + {"start": {"line": 263, "column": 6}, "end": {"line": 263, "column": 6}}, + {"start": {"line": 263, "column": 6}, "end": {"line": 263, "column": 6}} + ] + }, + "26": { + "line": 264, + "type": "if", + "locations": [ + {"start": {"line": 264, "column": 11}, "end": {"line": 264, "column": 11}}, + {"start": {"line": 264, "column": 11}, "end": {"line": 264, "column": 11}} + ] + }, + "27": { + "line": 265, + "type": "if", + "locations": [ + {"start": {"line": 265, "column": 6}, "end": {"line": 265, "column": 6}}, + {"start": {"line": 265, "column": 6}, "end": {"line": 265, "column": 6}} + ] + }, + "28": { + "line": 273, + "type": "if", + "locations": [ + {"start": {"line": 273, "column": 6}, "end": {"line": 273, "column": 6}}, + {"start": {"line": 273, "column": 6}, "end": {"line": 273, "column": 6}} + ] + }, + "29": { + "line": 275, + "type": "if", + "locations": [ + {"start": {"line": 275, "column": 6}, "end": {"line": 275, "column": 6}}, + {"start": {"line": 275, "column": 6}, "end": {"line": 275, "column": 6}} + ] + }, + "30": { + "line": 306, + "type": "if", + "locations": [ + {"start": {"line": 306, "column": 4}, "end": {"line": 306, "column": 4}}, + {"start": {"line": 306, "column": 4}, "end": {"line": 306, "column": 4}} + ] + }, + "31": { + "line": 308, + "type": "if", + "locations": [ + {"start": {"line": 308, "column": 4}, "end": {"line": 308, "column": 4}}, + {"start": {"line": 308, "column": 4}, "end": {"line": 308, "column": 4}} + ] + }, + "32": { + "line": 328, + "type": "if", + "locations": [ + {"start": {"line": 328, "column": 4}, "end": {"line": 328, "column": 4}}, + {"start": {"line": 328, "column": 4}, "end": {"line": 328, "column": 4}} + ] + }, + "33": { + "line": 329, + "type": "if", + "locations": [ + {"start": {"line": 329, "column": 4}, "end": {"line": 329, "column": 4}}, + {"start": {"line": 329, "column": 4}, "end": {"line": 329, "column": 4}} + ] + }, + "34": { + "line": 349, + "type": "if", + "locations": [ + {"start": {"line": 349, "column": 4}, "end": {"line": 349, "column": 4}}, + {"start": {"line": 349, "column": 4}, "end": {"line": 349, "column": 4}} + ] + }, + "35": { + "line": 355, + "type": "if", + "locations": [ + {"start": {"line": 355, "column": 4}, "end": {"line": 355, "column": 4}}, + {"start": {"line": 355, "column": 4}, "end": {"line": 355, "column": 4}} + ] + }, + "36": { + "line": 366, + "type": "if", + "locations": [ + {"start": {"line": 366, "column": 4}, "end": {"line": 366, "column": 4}}, + {"start": {"line": 366, "column": 4}, "end": {"line": 366, "column": 4}} + ] + }, + "37": { + "line": 373, + "type": "if", + "locations": [ + {"start": {"line": 373, "column": 4}, "end": {"line": 373, "column": 4}}, + {"start": {"line": 373, "column": 4}, "end": {"line": 373, "column": 4}} + ] + }, + "38": { + "line": 402, + "type": "if", + "locations": [ + {"start": {"line": 402, "column": 4}, "end": {"line": 402, "column": 4}}, + {"start": {"line": 402, "column": 4}, "end": {"line": 402, "column": 4}} + ] + }, + "39": { + "line": 408, + "type": "if", + "locations": [ + {"start": {"line": 408, "column": 4}, "end": {"line": 408, "column": 4}}, + {"start": {"line": 408, "column": 4}, "end": {"line": 408, "column": 4}} + ] + }, + "40": { + "line": 417, + "type": "if", + "locations": [ + {"start": {"line": 417, "column": 4}, "end": {"line": 417, "column": 4}}, + {"start": {"line": 417, "column": 4}, "end": {"line": 417, "column": 4}} + ] + }, + "41": { + "line": 422, + "type": "if", + "locations": [ + {"start": {"line": 422, "column": 6}, "end": {"line": 422, "column": 6}}, + {"start": {"line": 422, "column": 6}, "end": {"line": 422, "column": 6}} + ] + }, + "42": { + "line": 430, + "type": "if", + "locations": [ + {"start": {"line": 430, "column": 4}, "end": {"line": 430, "column": 4}}, + {"start": {"line": 430, "column": 4}, "end": {"line": 430, "column": 4}} + ] + }, + "43": { + "line": 453, + "type": "if", + "locations": [ + {"start": {"line": 453, "column": 4}, "end": {"line": 453, "column": 4}}, + {"start": {"line": 453, "column": 4}, "end": {"line": 453, "column": 4}} + ] + }, + "44": { + "line": 461, + "type": "if", + "locations": [ + {"start": {"line": 461, "column": 4}, "end": {"line": 461, "column": 4}}, + {"start": {"line": 461, "column": 4}, "end": {"line": 461, "column": 4}} + ] + }, + "45": { + "line": 464, + "type": "if", + "locations": [ + {"start": {"line": 464, "column": 4}, "end": {"line": 464, "column": 4}}, + {"start": {"line": 464, "column": 4}, "end": {"line": 464, "column": 4}} + ] + } + } + }, + "contracts/libraries/math/MathUtils.sol": { + "l": { + "26": 347, + "28": 347, + "30": 347, + "52": 672, + "54": 672, + "55": 116, + "58": 556, + "60": 556, + "62": 556, + "64": 556, + "65": 556, + "67": 556, + "68": 556, + "70": 556 + }, + "path": "/src/contracts/libraries/math/MathUtils.sol", + "s": { + "1": 347, + "2": 347, + "3": 347, + "4": 672, + "5": 672, + "6": 116, + "7": 556, + "8": 556, + "9": 556, + "10": 556, + "11": 556, + "12": 556, + "13": 556, + "14": 556 + }, + "b": {"1": [116, 556]}, + "f": {"1": 347, "2": 672}, + "fnMap": { + "1": { + "name": "calculateLinearInterest", + "line": 20, + "loc": {"start": {"line": 20, "column": 2}, "end": {"line": 31, "column": 2}} + }, + "2": { + "name": "calculateCompoundedInterest", + "line": 46, + "loc": {"start": {"line": 46, "column": 2}, "end": {"line": 71, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 26, "column": 4}, "end": {"line": 26, "column": 78}}, + "2": {"start": {"line": 28, "column": 4}, "end": {"line": 28, "column": 85}}, + "3": {"start": {"line": 30, "column": 4}, "end": {"line": 30, "column": 55}}, + "4": {"start": {"line": 52, "column": 4}, "end": {"line": 52, "column": 67}}, + "5": {"start": {"line": 54, "column": 4}, "end": {"line": 54, "column": 1957}}, + "6": {"start": {"line": 55, "column": 6}, "end": {"line": 55, "column": 29}}, + "7": {"start": {"line": 58, "column": 4}, "end": {"line": 58, "column": 33}}, + "8": {"start": {"line": 60, "column": 4}, "end": {"line": 60, "column": 47}}, + "9": {"start": {"line": 62, "column": 4}, "end": {"line": 62, "column": 51}}, + "10": {"start": {"line": 64, "column": 4}, "end": {"line": 64, "column": 62}}, + "11": {"start": {"line": 65, "column": 4}, "end": {"line": 65, "column": 63}}, + "12": {"start": {"line": 67, "column": 4}, "end": {"line": 67, "column": 67}}, + "13": {"start": {"line": 68, "column": 4}, "end": {"line": 68, "column": 85}}, + "14": {"start": {"line": 70, "column": 4}, "end": {"line": 70, "column": 86}} + }, + "branchMap": { + "1": { + "line": 54, + "type": "if", + "locations": [ + {"start": {"line": 54, "column": 4}, "end": {"line": 54, "column": 4}}, + {"start": {"line": 54, "column": 4}, "end": {"line": 54, "column": 4}} + ] + } + } + }, + "contracts/libraries/math/PercentageMath.sol": { + "l": { + "25": 343, + "26": 148, + "29": 195, + "31": 195, + "33": 195, + "35": 195, + "37": 195, + "47": 58, + "48": 58, + "50": 58, + "52": 58, + "54": 58, + "56": 58, + "58": 58 + }, + "path": "/src/contracts/libraries/math/PercentageMath.sol", + "s": { + "1": 343, + "2": 148, + "3": 195, + "4": 195, + "5": 195, + "6": 195, + "7": 195, + "8": 58, + "9": 58, + "10": 58, + "11": 58, + "12": 58, + "13": 58, + "14": 58 + }, + "b": {"1": [148, 195], "2": [195, 0], "3": [195, 0], "4": [58, 0], "5": [58, 0], "6": [58, 0]}, + "f": {"1": 343, "2": 58}, + "fnMap": { + "1": { + "name": "percentMul", + "line": 24, + "loc": {"start": {"line": 24, "column": 2}, "end": {"line": 38, "column": 2}} + }, + "2": { + "name": "percentDiv", + "line": 46, + "loc": {"start": {"line": 46, "column": 2}, "end": {"line": 59, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 25, "column": 4}, "end": {"line": 25, "column": 891}}, + "2": {"start": {"line": 26, "column": 6}, "end": {"line": 26, "column": 14}}, + "3": {"start": {"line": 29, "column": 4}, "end": {"line": 29, "column": 39}}, + "4": {"start": {"line": 31, "column": 4}, "end": {"line": 31, "column": 72}}, + "5": {"start": {"line": 33, "column": 4}, "end": {"line": 33, "column": 25}}, + "6": {"start": {"line": 35, "column": 4}, "end": {"line": 35, "column": 60}}, + "7": {"start": {"line": 37, "column": 4}, "end": {"line": 37, "column": 37}}, + "8": {"start": {"line": 47, "column": 4}, "end": {"line": 47, "column": 52}}, + "9": {"start": {"line": 48, "column": 4}, "end": {"line": 48, "column": 43}}, + "10": {"start": {"line": 50, "column": 4}, "end": {"line": 50, "column": 46}}, + "11": {"start": {"line": 52, "column": 4}, "end": {"line": 52, "column": 79}}, + "12": {"start": {"line": 54, "column": 4}, "end": {"line": 54, "column": 27}}, + "13": {"start": {"line": 56, "column": 4}, "end": {"line": 56, "column": 62}}, + "14": {"start": {"line": 58, "column": 4}, "end": {"line": 58, "column": 30}} + }, + "branchMap": { + "1": { + "line": 25, + "type": "if", + "locations": [ + {"start": {"line": 25, "column": 4}, "end": {"line": 25, "column": 4}}, + {"start": {"line": 25, "column": 4}, "end": {"line": 25, "column": 4}} + ] + }, + "2": { + "line": 31, + "type": "if", + "locations": [ + {"start": {"line": 31, "column": 4}, "end": {"line": 31, "column": 4}}, + {"start": {"line": 31, "column": 4}, "end": {"line": 31, "column": 4}} + ] + }, + "3": { + "line": 35, + "type": "if", + "locations": [ + {"start": {"line": 35, "column": 4}, "end": {"line": 35, "column": 4}}, + {"start": {"line": 35, "column": 4}, "end": {"line": 35, "column": 4}} + ] + }, + "4": { + "line": 47, + "type": "if", + "locations": [ + {"start": {"line": 47, "column": 4}, "end": {"line": 47, "column": 4}}, + {"start": {"line": 47, "column": 4}, "end": {"line": 47, "column": 4}} + ] + }, + "5": { + "line": 52, + "type": "if", + "locations": [ + {"start": {"line": 52, "column": 4}, "end": {"line": 52, "column": 4}}, + {"start": {"line": 52, "column": 4}, "end": {"line": 52, "column": 4}} + ] + }, + "6": { + "line": 56, + "type": "if", + "locations": [ + {"start": {"line": 56, "column": 4}, "end": {"line": 56, "column": 4}}, + {"start": {"line": 56, "column": 4}, "end": {"line": 56, "column": 4}} + ] + } + } + }, + "contracts/libraries/math/SafeMath.sol": { + "l": { + "28": 450, + "29": 450, + "31": 450, + "44": 124, + "61": 212, + "62": 211, + "64": 211, + "80": 0, + "81": 0, + "84": 0, + "85": 0, + "87": 0, + "102": 0, + "122": 0, + "123": 0, + "126": 0, + "141": 0, + "160": 0, + "161": 0 + }, + "path": "/src/contracts/libraries/math/SafeMath.sol", + "s": { + "1": 450, + "2": 450, + "3": 450, + "4": 124, + "5": 212, + "6": 211, + "7": 211, + "8": 0, + "9": 0, + "10": 0, + "11": 0, + "12": 0, + "13": 0, + "14": 0, + "15": 0, + "16": 0, + "17": 0, + "18": 0, + "19": 0 + }, + "b": {"1": [450, 0], "2": [211, 1], "3": [0, 0], "4": [0, 0], "5": [0, 0], "6": [0, 0]}, + "f": {"1": 450, "2": 124, "3": 212, "4": 0, "5": 0, "6": 0, "7": 0, "8": 0}, + "fnMap": { + "1": { + "name": "add", + "line": 27, + "loc": {"start": {"line": 27, "column": 2}, "end": {"line": 32, "column": 2}} + }, + "2": { + "name": "sub", + "line": 43, + "loc": {"start": {"line": 43, "column": 2}, "end": {"line": 45, "column": 2}} + }, + "3": { + "name": "sub", + "line": 56, + "loc": {"start": {"line": 56, "column": 2}, "end": {"line": 65, "column": 2}} + }, + "4": { + "name": "mul", + "line": 76, + "loc": {"start": {"line": 76, "column": 2}, "end": {"line": 88, "column": 2}} + }, + "5": { + "name": "div", + "line": 101, + "loc": {"start": {"line": 101, "column": 2}, "end": {"line": 103, "column": 2}} + }, + "6": { + "name": "div", + "line": 116, + "loc": {"start": {"line": 116, "column": 2}, "end": {"line": 127, "column": 2}} + }, + "7": { + "name": "mod", + "line": 140, + "loc": {"start": {"line": 140, "column": 2}, "end": {"line": 142, "column": 2}} + }, + "8": { + "name": "mod", + "line": 155, + "loc": {"start": {"line": 155, "column": 2}, "end": {"line": 162, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 28, "column": 4}, "end": {"line": 28, "column": 21}}, + "2": {"start": {"line": 29, "column": 4}, "end": {"line": 29, "column": 49}}, + "3": {"start": {"line": 31, "column": 4}, "end": {"line": 31, "column": 12}}, + "4": {"start": {"line": 44, "column": 4}, "end": {"line": 44, "column": 54}}, + "5": {"start": {"line": 61, "column": 4}, "end": {"line": 61, "column": 32}}, + "6": {"start": {"line": 62, "column": 4}, "end": {"line": 62, "column": 21}}, + "7": {"start": {"line": 64, "column": 4}, "end": {"line": 64, "column": 12}}, + "8": {"start": {"line": 80, "column": 4}, "end": {"line": 80, "column": 2341}}, + "9": {"start": {"line": 81, "column": 6}, "end": {"line": 81, "column": 14}}, + "10": {"start": {"line": 84, "column": 4}, "end": {"line": 84, "column": 21}}, + "11": {"start": {"line": 85, "column": 4}, "end": {"line": 85, "column": 59}}, + "12": {"start": {"line": 87, "column": 4}, "end": {"line": 87, "column": 12}}, + "13": {"start": {"line": 102, "column": 4}, "end": {"line": 102, "column": 50}}, + "14": {"start": {"line": 122, "column": 4}, "end": {"line": 122, "column": 31}}, + "15": {"start": {"line": 123, "column": 4}, "end": {"line": 123, "column": 21}}, + "16": {"start": {"line": 126, "column": 4}, "end": {"line": 126, "column": 12}}, + "17": {"start": {"line": 141, "column": 4}, "end": {"line": 141, "column": 48}}, + "18": {"start": {"line": 160, "column": 4}, "end": {"line": 160, "column": 32}}, + "19": {"start": {"line": 161, "column": 4}, "end": {"line": 161, "column": 16}} + }, + "branchMap": { + "1": { + "line": 29, + "type": "if", + "locations": [ + {"start": {"line": 29, "column": 4}, "end": {"line": 29, "column": 4}}, + {"start": {"line": 29, "column": 4}, "end": {"line": 29, "column": 4}} + ] + }, + "2": { + "line": 61, + "type": "if", + "locations": [ + {"start": {"line": 61, "column": 4}, "end": {"line": 61, "column": 4}}, + {"start": {"line": 61, "column": 4}, "end": {"line": 61, "column": 4}} + ] + }, + "3": { + "line": 80, + "type": "if", + "locations": [ + {"start": {"line": 80, "column": 4}, "end": {"line": 80, "column": 4}}, + {"start": {"line": 80, "column": 4}, "end": {"line": 80, "column": 4}} + ] + }, + "4": { + "line": 85, + "type": "if", + "locations": [ + {"start": {"line": 85, "column": 4}, "end": {"line": 85, "column": 4}}, + {"start": {"line": 85, "column": 4}, "end": {"line": 85, "column": 4}} + ] + }, + "5": { + "line": 122, + "type": "if", + "locations": [ + {"start": {"line": 122, "column": 4}, "end": {"line": 122, "column": 4}}, + {"start": {"line": 122, "column": 4}, "end": {"line": 122, "column": 4}} + ] + }, + "6": { + "line": 160, + "type": "if", + "locations": [ + {"start": {"line": 160, "column": 4}, "end": {"line": 160, "column": 4}}, + {"start": {"line": 160, "column": 4}, "end": {"line": 160, "column": 4}} + ] + } + } + }, + "contracts/libraries/math/WadRayMath.sol": { + "l": { + "25": 1056, + "33": 0, + "40": 0, + "47": 0, + "57": 0, + "58": 0, + "61": 0, + "63": 0, + "65": 0, + "67": 0, + "69": 0, + "79": 64, + "81": 64, + "83": 64, + "85": 64, + "87": 64, + "89": 64, + "91": 64, + "101": 4935, + "102": 1581, + "105": 3354, + "107": 3354, + "109": 3354, + "111": 3354, + "113": 3354, + "123": 1257, + "125": 1257, + "127": 1257, + "129": 1257, + "131": 1257, + "133": 1257, + "135": 1257, + "144": 0, + "145": 0, + "146": 0, + "148": 0, + "157": 1134, + "158": 1134, + "159": 1134 + }, + "path": "/src/contracts/libraries/math/WadRayMath.sol", + "s": { + "1": 1056, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 0, + "8": 0, + "9": 0, + "10": 0, + "11": 0, + "12": 64, + "13": 64, + "14": 64, + "15": 64, + "16": 64, + "17": 64, + "18": 64, + "19": 4935, + "20": 1581, + "21": 3354, + "22": 3354, + "23": 3354, + "24": 3354, + "25": 3354, + "26": 1257, + "27": 1257, + "28": 1257, + "29": 1257, + "30": 1257, + "31": 1257, + "32": 1257, + "33": 0, + "34": 0, + "35": 0, + "36": 0, + "37": 1134, + "38": 1134, + "39": 1134 + }, + "b": { + "1": [0, 0], + "2": [0, 0], + "3": [0, 0], + "4": [64, 0], + "5": [64, 0], + "6": [64, 0], + "7": [1581, 3354], + "8": [3354, 0], + "9": [3354, 0], + "10": [1257, 0], + "11": [1257, 0], + "12": [1257, 0], + "13": [0, 0], + "14": [1134, 0] + }, + "f": { + "1": 1056, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 64, + "7": 4935, + "8": 1257, + "9": 0, + "10": 1134 + }, + "fnMap": { + "1": { + "name": "ray", + "line": 24, + "loc": {"start": {"line": 24, "column": 2}, "end": {"line": 26, "column": 2}} + }, + "2": { + "name": "wad", + "line": 32, + "loc": {"start": {"line": 32, "column": 2}, "end": {"line": 34, "column": 2}} + }, + "3": { + "name": "halfRay", + "line": 39, + "loc": {"start": {"line": 39, "column": 2}, "end": {"line": 41, "column": 2}} + }, + "4": { + "name": "halfWad", + "line": 46, + "loc": {"start": {"line": 46, "column": 2}, "end": {"line": 48, "column": 2}} + }, + "5": { + "name": "wadMul", + "line": 56, + "loc": {"start": {"line": 56, "column": 2}, "end": {"line": 70, "column": 2}} + }, + "6": { + "name": "wadDiv", + "line": 78, + "loc": {"start": {"line": 78, "column": 2}, "end": {"line": 92, "column": 2}} + }, + "7": { + "name": "rayMul", + "line": 100, + "loc": {"start": {"line": 100, "column": 2}, "end": {"line": 114, "column": 2}} + }, + "8": { + "name": "rayDiv", + "line": 122, + "loc": {"start": {"line": 122, "column": 2}, "end": {"line": 136, "column": 2}} + }, + "9": { + "name": "rayToWad", + "line": 143, + "loc": {"start": {"line": 143, "column": 2}, "end": {"line": 149, "column": 2}} + }, + "10": { + "name": "wadToRay", + "line": 156, + "loc": {"start": {"line": 156, "column": 2}, "end": {"line": 160, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 25, "column": 4}, "end": {"line": 25, "column": 14}}, + "2": {"start": {"line": 33, "column": 4}, "end": {"line": 33, "column": 14}}, + "3": {"start": {"line": 40, "column": 4}, "end": {"line": 40, "column": 18}}, + "4": {"start": {"line": 47, "column": 4}, "end": {"line": 47, "column": 18}}, + "5": {"start": {"line": 57, "column": 4}, "end": {"line": 57, "column": 1244}}, + "6": {"start": {"line": 58, "column": 6}, "end": {"line": 58, "column": 14}}, + "7": {"start": {"line": 61, "column": 4}, "end": {"line": 61, "column": 26}}, + "8": {"start": {"line": 63, "column": 4}, "end": {"line": 63, "column": 59}}, + "9": {"start": {"line": 65, "column": 4}, "end": {"line": 65, "column": 20}}, + "10": {"start": {"line": 67, "column": 4}, "end": {"line": 67, "column": 55}}, + "11": {"start": {"line": 69, "column": 4}, "end": {"line": 69, "column": 23}}, + "12": {"start": {"line": 79, "column": 4}, "end": {"line": 79, "column": 43}}, + "13": {"start": {"line": 81, "column": 4}, "end": {"line": 81, "column": 25}}, + "14": {"start": {"line": 83, "column": 4}, "end": {"line": 83, "column": 28}}, + "15": {"start": {"line": 85, "column": 4}, "end": {"line": 85, "column": 61}}, + "16": {"start": {"line": 87, "column": 4}, "end": {"line": 87, "column": 18}}, + "17": {"start": {"line": 89, "column": 4}, "end": {"line": 89, "column": 53}}, + "18": {"start": {"line": 91, "column": 4}, "end": {"line": 91, "column": 21}}, + "19": {"start": {"line": 101, "column": 4}, "end": {"line": 101, "column": 2221}}, + "20": {"start": {"line": 102, "column": 6}, "end": {"line": 102, "column": 14}}, + "21": {"start": {"line": 105, "column": 4}, "end": {"line": 105, "column": 26}}, + "22": {"start": {"line": 107, "column": 4}, "end": {"line": 107, "column": 59}}, + "23": {"start": {"line": 109, "column": 4}, "end": {"line": 109, "column": 20}}, + "24": {"start": {"line": 111, "column": 4}, "end": {"line": 111, "column": 55}}, + "25": {"start": {"line": 113, "column": 4}, "end": {"line": 113, "column": 23}}, + "26": {"start": {"line": 123, "column": 4}, "end": {"line": 123, "column": 43}}, + "27": {"start": {"line": 125, "column": 4}, "end": {"line": 125, "column": 25}}, + "28": {"start": {"line": 127, "column": 4}, "end": {"line": 127, "column": 28}}, + "29": {"start": {"line": 129, "column": 4}, "end": {"line": 129, "column": 61}}, + "30": {"start": {"line": 131, "column": 4}, "end": {"line": 131, "column": 18}}, + "31": {"start": {"line": 133, "column": 4}, "end": {"line": 133, "column": 53}}, + "32": {"start": {"line": 135, "column": 4}, "end": {"line": 135, "column": 21}}, + "33": {"start": {"line": 144, "column": 4}, "end": {"line": 144, "column": 41}}, + "34": {"start": {"line": 145, "column": 4}, "end": {"line": 145, "column": 34}}, + "35": {"start": {"line": 146, "column": 4}, "end": {"line": 146, "column": 57}}, + "36": {"start": {"line": 148, "column": 4}, "end": {"line": 148, "column": 33}}, + "37": {"start": {"line": 157, "column": 4}, "end": {"line": 157, "column": 38}}, + "38": {"start": {"line": 158, "column": 4}, "end": {"line": 158, "column": 71}}, + "39": {"start": {"line": 159, "column": 4}, "end": {"line": 159, "column": 17}} + }, + "branchMap": { + "1": { + "line": 57, + "type": "if", + "locations": [ + {"start": {"line": 57, "column": 4}, "end": {"line": 57, "column": 4}}, + {"start": {"line": 57, "column": 4}, "end": {"line": 57, "column": 4}} + ] + }, + "2": { + "line": 63, + "type": "if", + "locations": [ + {"start": {"line": 63, "column": 4}, "end": {"line": 63, "column": 4}}, + {"start": {"line": 63, "column": 4}, "end": {"line": 63, "column": 4}} + ] + }, + "3": { + "line": 67, + "type": "if", + "locations": [ + {"start": {"line": 67, "column": 4}, "end": {"line": 67, "column": 4}}, + {"start": {"line": 67, "column": 4}, "end": {"line": 67, "column": 4}} + ] + }, + "4": { + "line": 79, + "type": "if", + "locations": [ + {"start": {"line": 79, "column": 4}, "end": {"line": 79, "column": 4}}, + {"start": {"line": 79, "column": 4}, "end": {"line": 79, "column": 4}} + ] + }, + "5": { + "line": 85, + "type": "if", + "locations": [ + {"start": {"line": 85, "column": 4}, "end": {"line": 85, "column": 4}}, + {"start": {"line": 85, "column": 4}, "end": {"line": 85, "column": 4}} + ] + }, + "6": { + "line": 89, + "type": "if", + "locations": [ + {"start": {"line": 89, "column": 4}, "end": {"line": 89, "column": 4}}, + {"start": {"line": 89, "column": 4}, "end": {"line": 89, "column": 4}} + ] + }, + "7": { + "line": 101, + "type": "if", + "locations": [ + {"start": {"line": 101, "column": 4}, "end": {"line": 101, "column": 4}}, + {"start": {"line": 101, "column": 4}, "end": {"line": 101, "column": 4}} + ] + }, + "8": { + "line": 107, + "type": "if", + "locations": [ + {"start": {"line": 107, "column": 4}, "end": {"line": 107, "column": 4}}, + {"start": {"line": 107, "column": 4}, "end": {"line": 107, "column": 4}} + ] + }, + "9": { + "line": 111, + "type": "if", + "locations": [ + {"start": {"line": 111, "column": 4}, "end": {"line": 111, "column": 4}}, + {"start": {"line": 111, "column": 4}, "end": {"line": 111, "column": 4}} + ] + }, + "10": { + "line": 123, + "type": "if", + "locations": [ + {"start": {"line": 123, "column": 4}, "end": {"line": 123, "column": 4}}, + {"start": {"line": 123, "column": 4}, "end": {"line": 123, "column": 4}} + ] + }, + "11": { + "line": 129, + "type": "if", + "locations": [ + {"start": {"line": 129, "column": 4}, "end": {"line": 129, "column": 4}}, + {"start": {"line": 129, "column": 4}, "end": {"line": 129, "column": 4}} + ] + }, + "12": { + "line": 133, + "type": "if", + "locations": [ + {"start": {"line": 133, "column": 4}, "end": {"line": 133, "column": 4}}, + {"start": {"line": 133, "column": 4}, "end": {"line": 133, "column": 4}} + ] + }, + "13": { + "line": 146, + "type": "if", + "locations": [ + {"start": {"line": 146, "column": 4}, "end": {"line": 146, "column": 4}}, + {"start": {"line": 146, "column": 4}, "end": {"line": 146, "column": 4}} + ] + }, + "14": { + "line": 158, + "type": "if", + "locations": [ + {"start": {"line": 158, "column": 4}, "end": {"line": 158, "column": 4}}, + {"start": {"line": 158, "column": 4}, "end": {"line": 158, "column": 4}} + ] + } + } + }, + "contracts/libraries/openzeppelin-upgradeability/AdminUpgradeabilityProxy.sol": { + "l": {"26": 0, "27": 0, "34": 0}, + "path": "/src/contracts/libraries/openzeppelin-upgradeability/AdminUpgradeabilityProxy.sol", + "s": {"1": 0, "2": 0, "3": 0}, + "b": {"1": [0, 0]}, + "f": {"1": 0, "2": 0}, + "fnMap": { + "1": { + "name": "constructor", + "line": 25, + "loc": {"start": {"line": 21, "column": 2}, "end": {"line": 28, "column": 2}} + }, + "2": { + "name": "_willFallback", + "line": 33, + "loc": {"start": {"line": 33, "column": 2}, "end": {"line": 35, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 26, "column": 4}, "end": {"line": 26, "column": 79}}, + "2": {"start": {"line": 27, "column": 4}, "end": {"line": 27, "column": 20}}, + "3": {"start": {"line": 34, "column": 4}, "end": {"line": 34, "column": 47}} + }, + "branchMap": { + "1": { + "line": 26, + "type": "if", + "locations": [ + {"start": {"line": 26, "column": 4}, "end": {"line": 26, "column": 4}}, + {"start": {"line": 26, "column": 4}, "end": {"line": 26, "column": 4}} + ] + } + } + }, + "contracts/libraries/openzeppelin-upgradeability/BaseAdminUpgradeabilityProxy.sol": { + "l": { + "35": 3, + "36": 3, + "38": 0, + "46": 0, + "53": 0, + "62": 0, + "63": 0, + "64": 0, + "73": 0, + "90": 3, + "91": 3, + "92": 3, + "99": 9902, + "101": 9902, + "111": 53, + "113": 53, + "122": 9899, + "123": 9899 + }, + "path": "/src/contracts/libraries/openzeppelin-upgradeability/BaseAdminUpgradeabilityProxy.sol", + "s": { + "1": 3, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 0, + "8": 0, + "9": 3, + "10": 3, + "11": 3, + "12": 9902, + "13": 53, + "14": 9899, + "15": 9899 + }, + "b": {"1": [3, 0], "2": [0, 0], "3": [3, 0], "4": [9899, 0]}, + "f": {"1": 3, "2": 0, "3": 0, "4": 0, "5": 0, "6": 3, "7": 9902, "8": 53, "9": 9899}, + "fnMap": { + "1": { + "name": "ifAdmin", + "line": 34, + "loc": {"start": {"line": 34, "column": 2}, "end": {"line": 40, "column": 2}} + }, + "2": { + "name": "admin", + "line": 45, + "loc": {"start": {"line": 45, "column": 2}, "end": {"line": 47, "column": 2}} + }, + "3": { + "name": "implementation", + "line": 52, + "loc": {"start": {"line": 52, "column": 2}, "end": {"line": 54, "column": 2}} + }, + "4": { + "name": "changeAdmin", + "line": 61, + "loc": {"start": {"line": 61, "column": 2}, "end": {"line": 65, "column": 2}} + }, + "5": { + "name": "upgradeTo", + "line": 72, + "loc": {"start": {"line": 72, "column": 2}, "end": {"line": 74, "column": 2}} + }, + "6": { + "name": "upgradeToAndCall", + "line": 88, + "loc": {"start": {"line": 85, "column": 2}, "end": {"line": 93, "column": 2}} + }, + "7": { + "name": "_admin", + "line": 98, + "loc": {"start": {"line": 98, "column": 2}, "end": {"line": 104, "column": 2}} + }, + "8": { + "name": "_setAdmin", + "line": 110, + "loc": {"start": {"line": 110, "column": 2}, "end": {"line": 116, "column": 2}} + }, + "9": { + "name": "_willFallback", + "line": 121, + "loc": {"start": {"line": 121, "column": 2}, "end": {"line": 124, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 35, "column": 4}, "end": {"line": 35, "column": 1284}}, + "2": {"start": {"line": 38, "column": 6}, "end": {"line": 38, "column": 16}}, + "3": {"start": {"line": 46, "column": 4}, "end": {"line": 46, "column": 19}}, + "4": {"start": {"line": 53, "column": 4}, "end": {"line": 53, "column": 28}}, + "5": {"start": {"line": 62, "column": 4}, "end": {"line": 62, "column": 92}}, + "6": {"start": {"line": 63, "column": 4}, "end": {"line": 63, "column": 41}}, + "7": {"start": {"line": 64, "column": 4}, "end": {"line": 64, "column": 22}}, + "8": {"start": {"line": 73, "column": 4}, "end": {"line": 73, "column": 32}}, + "9": {"start": {"line": 90, "column": 4}, "end": {"line": 90, "column": 32}}, + "10": {"start": {"line": 91, "column": 4}, "end": {"line": 91, "column": 59}}, + "11": {"start": {"line": 92, "column": 4}, "end": {"line": 92, "column": 19}}, + "12": {"start": {"line": 99, "column": 4}, "end": {"line": 99, "column": 29}}, + "13": {"start": {"line": 111, "column": 4}, "end": {"line": 111, "column": 29}}, + "14": {"start": {"line": 122, "column": 4}, "end": {"line": 122, "column": 88}}, + "15": {"start": {"line": 123, "column": 4}, "end": {"line": 123, "column": 24}} + }, + "branchMap": { + "1": { + "line": 35, + "type": "if", + "locations": [ + {"start": {"line": 35, "column": 4}, "end": {"line": 35, "column": 4}}, + {"start": {"line": 35, "column": 4}, "end": {"line": 35, "column": 4}} + ] + }, + "2": { + "line": 62, + "type": "if", + "locations": [ + {"start": {"line": 62, "column": 4}, "end": {"line": 62, "column": 4}}, + {"start": {"line": 62, "column": 4}, "end": {"line": 62, "column": 4}} + ] + }, + "3": { + "line": 92, + "type": "if", + "locations": [ + {"start": {"line": 92, "column": 4}, "end": {"line": 92, "column": 4}}, + {"start": {"line": 92, "column": 4}, "end": {"line": 92, "column": 4}} + ] + }, + "4": { + "line": 122, + "type": "if", + "locations": [ + {"start": {"line": 122, "column": 4}, "end": {"line": 122, "column": 4}}, + {"start": {"line": 122, "column": 4}, "end": {"line": 122, "column": 4}} + ] + } + } + }, + "contracts/libraries/openzeppelin-upgradeability/BaseUpgradeabilityProxy.sol": { + "l": {"32": 10005, "34": 10005, "44": 3, "45": 3, "53": 56, "58": 56, "61": 56}, + "path": "/src/contracts/libraries/openzeppelin-upgradeability/BaseUpgradeabilityProxy.sol", + "s": {"1": 10005, "2": 3, "3": 3, "4": 56, "5": 56}, + "b": {"1": [56, 0]}, + "f": {"1": 10005, "2": 3, "3": 56}, + "fnMap": { + "1": { + "name": "_implementation", + "line": 31, + "loc": {"start": {"line": 31, "column": 2}, "end": {"line": 37, "column": 2}} + }, + "2": { + "name": "_upgradeTo", + "line": 43, + "loc": {"start": {"line": 43, "column": 2}, "end": {"line": 46, "column": 2}} + }, + "3": { + "name": "_setImplementation", + "line": 52, + "loc": {"start": {"line": 52, "column": 2}, "end": {"line": 64, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 32, "column": 4}, "end": {"line": 32, "column": 38}}, + "2": {"start": {"line": 44, "column": 4}, "end": {"line": 44, "column": 40}}, + "3": {"start": {"line": 45, "column": 4}, "end": {"line": 45, "column": 36}}, + "4": {"start": {"line": 53, "column": 4}, "end": {"line": 53, "column": 1706}}, + "5": {"start": {"line": 58, "column": 4}, "end": {"line": 58, "column": 38}} + }, + "branchMap": { + "1": { + "line": 53, + "type": "if", + "locations": [ + {"start": {"line": 53, "column": 4}, "end": {"line": 53, "column": 4}}, + {"start": {"line": 53, "column": 4}, "end": {"line": 53, "column": 4}} + ] + } + } + }, + "contracts/libraries/openzeppelin-upgradeability/Initializable.sol": { + "l": { + "31": 0, + "36": 0, + "37": 0, + "38": 0, + "39": 0, + "42": 0, + "44": 0, + "45": 0, + "56": 0, + "58": 0, + "61": 0 + }, + "path": "/src/contracts/libraries/openzeppelin-upgradeability/Initializable.sol", + "s": {"1": 0, "2": 0, "3": 0, "4": 0, "5": 0, "6": 0, "7": 0, "8": 0, "9": 0}, + "b": {"1": [0, 0], "2": [0, 0], "3": [0, 0]}, + "f": {"1": 0, "2": 0}, + "fnMap": { + "1": { + "name": "initializer", + "line": 30, + "loc": {"start": {"line": 30, "column": 2}, "end": {"line": 47, "column": 2}} + }, + "2": { + "name": "isConstructor", + "line": 50, + "loc": {"start": {"line": 50, "column": 2}, "end": {"line": 62, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 31, "column": 4}, "end": {"line": 31, "column": 1056}}, + "2": {"start": {"line": 36, "column": 4}, "end": {"line": 36, "column": 39}}, + "3": {"start": {"line": 37, "column": 4}, "end": {"line": 37, "column": 1228}}, + "4": {"start": {"line": 38, "column": 6}, "end": {"line": 38, "column": 24}}, + "5": {"start": {"line": 39, "column": 6}, "end": {"line": 39, "column": 23}}, + "6": {"start": {"line": 44, "column": 4}, "end": {"line": 44, "column": 1322}}, + "7": {"start": {"line": 45, "column": 6}, "end": {"line": 45, "column": 25}}, + "8": {"start": {"line": 56, "column": 4}, "end": {"line": 56, "column": 14}}, + "9": {"start": {"line": 61, "column": 4}, "end": {"line": 61, "column": 18}} + }, + "branchMap": { + "1": { + "line": 31, + "type": "if", + "locations": [ + {"start": {"line": 31, "column": 4}, "end": {"line": 31, "column": 4}}, + {"start": {"line": 31, "column": 4}, "end": {"line": 31, "column": 4}} + ] + }, + "2": { + "line": 37, + "type": "if", + "locations": [ + {"start": {"line": 37, "column": 4}, "end": {"line": 37, "column": 4}}, + {"start": {"line": 37, "column": 4}, "end": {"line": 37, "column": 4}} + ] + }, + "3": { + "line": 44, + "type": "if", + "locations": [ + {"start": {"line": 44, "column": 4}, "end": {"line": 44, "column": 4}}, + {"start": {"line": 44, "column": 4}, "end": {"line": 44, "column": 4}} + ] + } + } + }, + "contracts/libraries/openzeppelin-upgradeability/InitializableAdminUpgradeabilityProxy.sol": { + "l": {"30": 53, "31": 53, "32": 53, "33": 53, "40": 9899}, + "path": "/src/contracts/libraries/openzeppelin-upgradeability/InitializableAdminUpgradeabilityProxy.sol", + "s": {"1": 53, "2": 53, "3": 53, "4": 53, "5": 9899}, + "b": {"1": [53, 0], "2": [53, 0]}, + "f": {"1": 53, "2": 9899}, + "fnMap": { + "1": { + "name": "initialize", + "line": 25, + "loc": {"start": {"line": 25, "column": 2}, "end": {"line": 34, "column": 2}} + }, + "2": { + "name": "_willFallback", + "line": 39, + "loc": {"start": {"line": 39, "column": 2}, "end": {"line": 41, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 30, "column": 4}, "end": {"line": 30, "column": 43}}, + "2": {"start": {"line": 31, "column": 4}, "end": {"line": 31, "column": 59}}, + "3": {"start": {"line": 32, "column": 4}, "end": {"line": 32, "column": 79}}, + "4": {"start": {"line": 33, "column": 4}, "end": {"line": 33, "column": 19}}, + "5": {"start": {"line": 40, "column": 4}, "end": {"line": 40, "column": 47}} + }, + "branchMap": { + "1": { + "line": 30, + "type": "if", + "locations": [ + {"start": {"line": 30, "column": 4}, "end": {"line": 30, "column": 4}}, + {"start": {"line": 30, "column": 4}, "end": {"line": 30, "column": 4}} + ] + }, + "2": { + "line": 32, + "type": "if", + "locations": [ + {"start": {"line": 32, "column": 4}, "end": {"line": 32, "column": 4}}, + {"start": {"line": 32, "column": 4}, "end": {"line": 32, "column": 4}} + ] + } + } + }, + "contracts/libraries/openzeppelin-upgradeability/InitializableUpgradeabilityProxy.sol": { + "l": {"21": 53, "22": 53, "23": 53, "24": 53, "25": 53, "26": 53}, + "path": "/src/contracts/libraries/openzeppelin-upgradeability/InitializableUpgradeabilityProxy.sol", + "s": {"1": 53, "2": 53, "3": 53, "4": 53, "5": 53, "6": 53}, + "b": {"1": [53, 0], "2": [53, 0], "3": [53, 0], "4": [53, 0]}, + "f": {"1": 53}, + "fnMap": { + "1": { + "name": "initialize", + "line": 20, + "loc": {"start": {"line": 20, "column": 2}, "end": {"line": 28, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 21, "column": 4}, "end": {"line": 21, "column": 43}}, + "2": {"start": {"line": 22, "column": 4}, "end": {"line": 22, "column": 97}}, + "3": {"start": {"line": 23, "column": 4}, "end": {"line": 23, "column": 29}}, + "4": {"start": {"line": 24, "column": 4}, "end": {"line": 24, "column": 1119}}, + "5": {"start": {"line": 25, "column": 6}, "end": {"line": 25, "column": 51}}, + "6": {"start": {"line": 26, "column": 6}, "end": {"line": 26, "column": 21}} + }, + "branchMap": { + "1": { + "line": 21, + "type": "if", + "locations": [ + {"start": {"line": 21, "column": 4}, "end": {"line": 21, "column": 4}}, + {"start": {"line": 21, "column": 4}, "end": {"line": 21, "column": 4}} + ] + }, + "2": { + "line": 22, + "type": "if", + "locations": [ + {"start": {"line": 22, "column": 4}, "end": {"line": 22, "column": 4}}, + {"start": {"line": 22, "column": 4}, "end": {"line": 22, "column": 4}} + ] + }, + "3": { + "line": 24, + "type": "if", + "locations": [ + {"start": {"line": 24, "column": 4}, "end": {"line": 24, "column": 4}}, + {"start": {"line": 24, "column": 4}, "end": {"line": 24, "column": 4}} + ] + }, + "4": { + "line": 26, + "type": "if", + "locations": [ + {"start": {"line": 26, "column": 6}, "end": {"line": 26, "column": 6}}, + {"start": {"line": 26, "column": 6}, "end": {"line": 26, "column": 6}} + ] + } + } + }, + "contracts/libraries/openzeppelin-upgradeability/Proxy.sol": { + "l": {"17": 9899, "33": 9899, "69": 9899, "70": 9899}, + "path": "/src/contracts/libraries/openzeppelin-upgradeability/Proxy.sol", + "s": {"1": 9899, "2": 9899, "3": 9899}, + "b": {}, + "f": {"1": 9899, "2": 9899, "3": 9899, "4": 9899}, + "fnMap": { + "1": { + "name": null, + "line": 16, + "loc": {"start": {"line": 16, "column": 2}, "end": {"line": 18, "column": 2}} + }, + "2": { + "name": "_delegate", + "line": 31, + "loc": {"start": {"line": 31, "column": 2}, "end": {"line": 55, "column": 2}} + }, + "3": { + "name": "_willFallback", + "line": 62, + "loc": {"start": {"line": 62, "column": 2}, "end": {"line": 62, "column": 45}} + }, + "4": { + "name": "_fallback", + "line": 68, + "loc": {"start": {"line": 68, "column": 2}, "end": {"line": 71, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 17, "column": 4}, "end": {"line": 17, "column": 14}}, + "2": {"start": {"line": 69, "column": 4}, "end": {"line": 69, "column": 18}}, + "3": {"start": {"line": 70, "column": 4}, "end": {"line": 70, "column": 31}} + }, + "branchMap": {} + }, + "contracts/libraries/openzeppelin-upgradeability/UpgradeabilityProxy.sol": { + "l": {"21": 0, "22": 0, "23": 0, "24": 0, "25": 0}, + "path": "/src/contracts/libraries/openzeppelin-upgradeability/UpgradeabilityProxy.sol", + "s": {"1": 0, "2": 0, "3": 0, "4": 0, "5": 0}, + "b": {"1": [0, 0], "2": [0, 0], "3": [0, 0]}, + "f": {"1": 0}, + "fnMap": { + "1": { + "name": "constructor", + "line": 20, + "loc": {"start": {"line": 20, "column": 2}, "end": {"line": 27, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 21, "column": 4}, "end": {"line": 21, "column": 97}}, + "2": {"start": {"line": 22, "column": 4}, "end": {"line": 22, "column": 29}}, + "3": {"start": {"line": 23, "column": 4}, "end": {"line": 23, "column": 1038}}, + "4": {"start": {"line": 24, "column": 6}, "end": {"line": 24, "column": 51}}, + "5": {"start": {"line": 25, "column": 6}, "end": {"line": 25, "column": 21}} + }, + "branchMap": { + "1": { + "line": 21, + "type": "if", + "locations": [ + {"start": {"line": 21, "column": 4}, "end": {"line": 21, "column": 4}}, + {"start": {"line": 21, "column": 4}, "end": {"line": 21, "column": 4}} + ] + }, + "2": { + "line": 23, + "type": "if", + "locations": [ + {"start": {"line": 23, "column": 4}, "end": {"line": 23, "column": 4}}, + {"start": {"line": 23, "column": 4}, "end": {"line": 23, "column": 4}} + ] + }, + "3": { + "line": 25, + "type": "if", + "locations": [ + {"start": {"line": 25, "column": 6}, "end": {"line": 25, "column": 6}}, + {"start": {"line": 25, "column": 6}, "end": {"line": 25, "column": 6}} + ] + } + } + }, + "contracts/libraries/openzeppelin-upgradeability/VersionedInitializable.sol": { + "l": { + "33": 56, + "34": 56, + "39": 56, + "40": 56, + "41": 56, + "42": 56, + "45": 56, + "47": 56, + "48": 56, + "63": 56, + "65": 56, + "68": 56 + }, + "path": "/src/contracts/libraries/openzeppelin-upgradeability/VersionedInitializable.sol", + "s": { + "1": 56, + "2": 56, + "3": 56, + "4": 56, + "5": 56, + "6": 56, + "7": 56, + "8": 56, + "9": 56, + "10": 56 + }, + "b": {"1": [56, 0], "2": [56, 0], "3": [56, 0]}, + "f": {"1": 56, "2": 56}, + "fnMap": { + "1": { + "name": "initializer", + "line": 32, + "loc": {"start": {"line": 32, "column": 2}, "end": {"line": 50, "column": 2}} + }, + "2": { + "name": "isConstructor", + "line": 57, + "loc": {"start": {"line": 57, "column": 2}, "end": {"line": 69, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 33, "column": 4}, "end": {"line": 33, "column": 36}}, + "2": {"start": {"line": 34, "column": 4}, "end": {"line": 34, "column": 1202}}, + "3": {"start": {"line": 39, "column": 4}, "end": {"line": 39, "column": 39}}, + "4": {"start": {"line": 40, "column": 4}, "end": {"line": 40, "column": 1396}}, + "5": {"start": {"line": 41, "column": 6}, "end": {"line": 41, "column": 24}}, + "6": {"start": {"line": 42, "column": 6}, "end": {"line": 42, "column": 39}}, + "7": {"start": {"line": 47, "column": 4}, "end": {"line": 47, "column": 1506}}, + "8": {"start": {"line": 48, "column": 6}, "end": {"line": 48, "column": 25}}, + "9": {"start": {"line": 63, "column": 4}, "end": {"line": 63, "column": 14}}, + "10": {"start": {"line": 68, "column": 4}, "end": {"line": 68, "column": 18}} + }, + "branchMap": { + "1": { + "line": 34, + "type": "if", + "locations": [ + {"start": {"line": 34, "column": 4}, "end": {"line": 34, "column": 4}}, + {"start": {"line": 34, "column": 4}, "end": {"line": 34, "column": 4}} + ] + }, + "2": { + "line": 40, + "type": "if", + "locations": [ + {"start": {"line": 40, "column": 4}, "end": {"line": 40, "column": 4}}, + {"start": {"line": 40, "column": 4}, "end": {"line": 40, "column": 4}} + ] + }, + "3": { + "line": 47, + "type": "if", + "locations": [ + {"start": {"line": 47, "column": 4}, "end": {"line": 47, "column": 4}}, + {"start": {"line": 47, "column": 4}, "end": {"line": 47, "column": 4}} + ] + } + } + }, + "contracts/misc/AaveProtocolTestHelpers.sol": { + "l": { + "18": 3, + "22": 1, + "23": 1, + "24": 1, + "25": 1, + "26": 17, + "33": 1, + "37": 2, + "38": 2, + "39": 2, + "40": 2, + "41": 34, + "42": 34, + "47": 2 + }, + "path": "/src/contracts/misc/AaveProtocolTestHelpers.sol", + "s": { + "1": 3, + "2": 1, + "3": 1, + "4": 1, + "5": 1, + "6": 17, + "7": 1, + "8": 2, + "9": 2, + "10": 2, + "11": 2, + "12": 34, + "13": 34, + "14": 2 + }, + "b": {}, + "f": {"1": 3, "2": 1, "3": 2}, + "fnMap": { + "1": { + "name": "constructor", + "line": 17, + "loc": {"start": {"line": 17, "column": 2}, "end": {"line": 19, "column": 2}} + }, + "2": { + "name": "getAllReservesTokens", + "line": 21, + "loc": {"start": {"line": 21, "column": 2}, "end": {"line": 34, "column": 2}} + }, + "3": { + "name": "getAllATokens", + "line": 36, + "loc": {"start": {"line": 36, "column": 2}, "end": {"line": 48, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 18, "column": 4}, "end": {"line": 18, "column": 41}}, + "2": {"start": {"line": 22, "column": 4}, "end": {"line": 22, "column": 73}}, + "3": {"start": {"line": 23, "column": 4}, "end": {"line": 23, "column": 50}}, + "4": {"start": {"line": 24, "column": 4}, "end": {"line": 24, "column": 72}}, + "5": {"start": {"line": 25, "column": 4}, "end": {"line": 25, "column": 904}}, + "6": {"start": {"line": 26, "column": 6}, "end": {"line": 26, "column": 961}}, + "7": {"start": {"line": 33, "column": 4}, "end": {"line": 33, "column": 25}}, + "8": {"start": {"line": 37, "column": 4}, "end": {"line": 37, "column": 73}}, + "9": {"start": {"line": 38, "column": 4}, "end": {"line": 38, "column": 50}}, + "10": {"start": {"line": 39, "column": 4}, "end": {"line": 39, "column": 65}}, + "11": {"start": {"line": 40, "column": 4}, "end": {"line": 40, "column": 1486}}, + "12": {"start": {"line": 41, "column": 6}, "end": {"line": 41, "column": 79}}, + "13": {"start": {"line": 42, "column": 6}, "end": {"line": 42, "column": 1624}}, + "14": {"start": {"line": 47, "column": 4}, "end": {"line": 47, "column": 18}} + }, + "branchMap": {} + }, + "contracts/misc/Address.sol": { + "l": {"29": 99, "30": 99, "32": 99, "35": 99, "55": 0, "58": 0, "59": 0}, + "path": "/src/contracts/misc/Address.sol", + "s": {"1": 99, "2": 99, "3": 99, "4": 0, "5": 0, "6": 0}, + "b": {"1": [0, 0], "2": [0, 0]}, + "f": {"1": 99, "2": 0}, + "fnMap": { + "1": { + "name": "isContract", + "line": 25, + "loc": {"start": {"line": 25, "column": 2}, "end": {"line": 36, "column": 2}} + }, + "2": { + "name": "sendValue", + "line": 54, + "loc": {"start": {"line": 54, "column": 2}, "end": {"line": 60, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 29, "column": 4}, "end": {"line": 29, "column": 20}}, + "2": {"start": {"line": 30, "column": 4}, "end": {"line": 30, "column": 92}}, + "3": {"start": {"line": 35, "column": 4}, "end": {"line": 35, "column": 55}}, + "4": {"start": {"line": 55, "column": 4}, "end": {"line": 55, "column": 76}}, + "5": {"start": {"line": 58, "column": 4}, "end": {"line": 58, "column": 56}}, + "6": {"start": {"line": 59, "column": 4}, "end": {"line": 59, "column": 81}} + }, + "branchMap": { + "1": { + "line": 55, + "type": "if", + "locations": [ + {"start": {"line": 55, "column": 4}, "end": {"line": 55, "column": 4}}, + {"start": {"line": 55, "column": 4}, "end": {"line": 55, "column": 4}} + ] + }, + "2": { + "line": 59, + "type": "if", + "locations": [ + {"start": {"line": 59, "column": 4}, "end": {"line": 59, "column": 4}}, + {"start": {"line": 59, "column": 4}, "end": {"line": 59, "column": 4}} + ] + } + } + }, + "contracts/misc/ChainlinkProxyPriceProvider.sol": { + "l": { + "37": 3, + "38": 3, + "48": 0, + "55": 0, + "62": 3, + "63": 3, + "64": 72, + "65": 72, + "72": 3, + "73": 3, + "79": 0, + "81": 0, + "82": 0, + "84": 0, + "85": 0, + "86": 0, + "88": 0, + "96": 0, + "97": 0, + "98": 0, + "100": 0, + "107": 0, + "113": 0 + }, + "path": "/src/contracts/misc/ChainlinkProxyPriceProvider.sol", + "s": { + "1": 3, + "2": 3, + "3": 0, + "4": 0, + "5": 3, + "6": 3, + "7": 72, + "8": 72, + "9": 3, + "10": 3, + "11": 0, + "12": 0, + "13": 0, + "14": 0, + "15": 0, + "16": 0, + "17": 0, + "18": 0, + "19": 0, + "20": 0, + "21": 0, + "22": 0, + "23": 0 + }, + "b": {"1": [3, 0], "2": [0, 0], "3": [0, 0]}, + "f": {"1": 3, "2": 0, "3": 0, "4": 3, "5": 3, "6": 0, "7": 0, "8": 0, "9": 0}, + "fnMap": { + "1": { + "name": "constructor", + "line": 32, + "loc": {"start": {"line": 32, "column": 2}, "end": {"line": 39, "column": 2}} + }, + "2": { + "name": "setAssetSources", + "line": 46, + "loc": {"start": {"line": 44, "column": 2}, "end": {"line": 49, "column": 2}} + }, + "3": { + "name": "setFallbackOracle", + "line": 54, + "loc": {"start": {"line": 54, "column": 2}, "end": {"line": 56, "column": 2}} + }, + "4": { + "name": "_setAssetsSources", + "line": 61, + "loc": {"start": {"line": 61, "column": 2}, "end": {"line": 67, "column": 2}} + }, + "5": { + "name": "_setFallbackOracle", + "line": 71, + "loc": {"start": {"line": 71, "column": 2}, "end": {"line": 74, "column": 2}} + }, + "6": { + "name": "getAssetPrice", + "line": 78, + "loc": {"start": {"line": 78, "column": 2}, "end": {"line": 91, "column": 2}} + }, + "7": { + "name": "getAssetsPrices", + "line": 95, + "loc": {"start": {"line": 95, "column": 2}, "end": {"line": 101, "column": 2}} + }, + "8": { + "name": "getSourceOfAsset", + "line": 106, + "loc": {"start": {"line": 106, "column": 2}, "end": {"line": 108, "column": 2}} + }, + "9": { + "name": "getFallbackOracle", + "line": 112, + "loc": {"start": {"line": 112, "column": 2}, "end": {"line": 114, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 37, "column": 4}, "end": {"line": 37, "column": 37}}, + "2": {"start": {"line": 38, "column": 4}, "end": {"line": 38, "column": 37}}, + "3": {"start": {"line": 48, "column": 4}, "end": {"line": 48, "column": 37}}, + "4": {"start": {"line": 55, "column": 4}, "end": {"line": 55, "column": 37}}, + "5": {"start": {"line": 62, "column": 4}, "end": {"line": 62, "column": 73}}, + "6": {"start": {"line": 63, "column": 4}, "end": {"line": 63, "column": 2670}}, + "7": {"start": {"line": 64, "column": 6}, "end": {"line": 64, "column": 64}}, + "8": {"start": {"line": 65, "column": 6}, "end": {"line": 65, "column": 52}}, + "9": {"start": {"line": 72, "column": 4}, "end": {"line": 72, "column": 55}}, + "10": {"start": {"line": 73, "column": 4}, "end": {"line": 73, "column": 46}}, + "11": {"start": {"line": 79, "column": 4}, "end": {"line": 79, "column": 54}}, + "12": {"start": {"line": 81, "column": 4}, "end": {"line": 81, "column": 3446}}, + "13": {"start": {"line": 82, "column": 6}, "end": {"line": 82, "column": 49}}, + "14": {"start": {"line": 84, "column": 6}, "end": {"line": 84, "column": 64}}, + "15": {"start": {"line": 85, "column": 6}, "end": {"line": 85, "column": 3621}}, + "16": {"start": {"line": 86, "column": 8}, "end": {"line": 86, "column": 29}}, + "17": {"start": {"line": 88, "column": 8}, "end": {"line": 88, "column": 51}}, + "18": {"start": {"line": 96, "column": 4}, "end": {"line": 96, "column": 58}}, + "19": {"start": {"line": 97, "column": 4}, "end": {"line": 97, "column": 4032}}, + "20": {"start": {"line": 98, "column": 6}, "end": {"line": 98, "column": 41}}, + "21": {"start": {"line": 100, "column": 4}, "end": {"line": 100, "column": 17}}, + "22": {"start": {"line": 107, "column": 4}, "end": {"line": 107, "column": 40}}, + "23": {"start": {"line": 113, "column": 4}, "end": {"line": 113, "column": 35}} + }, + "branchMap": { + "1": { + "line": 62, + "type": "if", + "locations": [ + {"start": {"line": 62, "column": 4}, "end": {"line": 62, "column": 4}}, + {"start": {"line": 62, "column": 4}, "end": {"line": 62, "column": 4}} + ] + }, + "2": { + "line": 81, + "type": "if", + "locations": [ + {"start": {"line": 81, "column": 4}, "end": {"line": 81, "column": 4}}, + {"start": {"line": 81, "column": 4}, "end": {"line": 81, "column": 4}} + ] + }, + "3": { + "line": 85, + "type": "if", + "locations": [ + {"start": {"line": 85, "column": 6}, "end": {"line": 85, "column": 6}}, + {"start": {"line": 85, "column": 6}, "end": {"line": 85, "column": 6}} + ] + } + } + }, + "contracts/misc/Context.sol": { + "l": {"16": 4, "20": 0, "21": 0}, + "path": "/src/contracts/misc/Context.sol", + "s": {"1": 4, "2": 0}, + "b": {}, + "f": {"1": 4, "2": 0}, + "fnMap": { + "1": { + "name": "_msgSender", + "line": 15, + "loc": {"start": {"line": 15, "column": 2}, "end": {"line": 17, "column": 2}} + }, + "2": { + "name": "_msgData", + "line": 19, + "loc": {"start": {"line": 19, "column": 2}, "end": {"line": 22, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 16, "column": 4}, "end": {"line": 16, "column": 21}}, + "2": {"start": {"line": 21, "column": 4}, "end": {"line": 21, "column": 19}} + }, + "branchMap": {} + }, + "contracts/misc/IERC20DetailedBytes.sol": { + "l": {}, + "path": "/src/contracts/misc/IERC20DetailedBytes.sol", + "s": {}, + "b": {}, + "f": {}, + "fnMap": {}, + "statementMap": {}, + "branchMap": {} + }, + "contracts/misc/SafeERC20.sol": { + "l": {"27": 99, "36": 0, "44": 0, "48": 0, "52": 99, "55": 99, "56": 99, "58": 97, "61": 97}, + "path": "/src/contracts/misc/SafeERC20.sol", + "s": {"1": 99, "2": 0, "3": 0, "4": 0, "5": 99, "6": 99, "7": 99, "8": 97, "9": 97}, + "b": {"1": [0, 0], "2": [99, 0], "3": [97, 2], "4": [97, 0], "5": [97, 0]}, + "f": {"1": 99, "2": 0, "3": 0, "4": 99}, + "fnMap": { + "1": { + "name": "safeTransfer", + "line": 22, + "loc": {"start": {"line": 22, "column": 2}, "end": {"line": 28, "column": 2}} + }, + "2": { + "name": "safeTransferFrom", + "line": 30, + "loc": {"start": {"line": 30, "column": 2}, "end": {"line": 37, "column": 2}} + }, + "3": { + "name": "safeApprove", + "line": 39, + "loc": {"start": {"line": 39, "column": 2}, "end": {"line": 49, "column": 2}} + }, + "4": { + "name": "callOptionalReturn", + "line": 51, + "loc": {"start": {"line": 51, "column": 2}, "end": {"line": 63, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 27, "column": 4}, "end": {"line": 27, "column": 88}}, + "2": {"start": {"line": 36, "column": 4}, "end": {"line": 36, "column": 98}}, + "3": {"start": {"line": 44, "column": 4}, "end": {"line": 44, "column": 1254}}, + "4": {"start": {"line": 48, "column": 4}, "end": {"line": 48, "column": 92}}, + "5": {"start": {"line": 52, "column": 4}, "end": {"line": 52, "column": 74}}, + "6": {"start": {"line": 55, "column": 4}, "end": {"line": 55, "column": 71}}, + "7": {"start": {"line": 56, "column": 4}, "end": {"line": 56, "column": 55}}, + "8": {"start": {"line": 58, "column": 4}, "end": {"line": 58, "column": 1845}}, + "9": {"start": {"line": 61, "column": 6}, "end": {"line": 61, "column": 90}} + }, + "branchMap": { + "1": { + "line": 44, + "type": "if", + "locations": [ + {"start": {"line": 44, "column": 4}, "end": {"line": 44, "column": 4}}, + {"start": {"line": 44, "column": 4}, "end": {"line": 44, "column": 4}} + ] + }, + "2": { + "line": 52, + "type": "if", + "locations": [ + {"start": {"line": 52, "column": 4}, "end": {"line": 52, "column": 4}}, + {"start": {"line": 52, "column": 4}, "end": {"line": 52, "column": 4}} + ] + }, + "3": { + "line": 56, + "type": "if", + "locations": [ + {"start": {"line": 56, "column": 4}, "end": {"line": 56, "column": 4}}, + {"start": {"line": 56, "column": 4}, "end": {"line": 56, "column": 4}} + ] + }, + "4": { + "line": 58, + "type": "if", + "locations": [ + {"start": {"line": 58, "column": 4}, "end": {"line": 58, "column": 4}}, + {"start": {"line": 58, "column": 4}, "end": {"line": 58, "column": 4}} + ] + }, + "5": { + "line": 61, + "type": "if", + "locations": [ + {"start": {"line": 61, "column": 6}, "end": {"line": 61, "column": 6}}, + {"start": {"line": 61, "column": 6}, "end": {"line": 61, "column": 6}} + ] + } + } + }, + "contracts/misc/WalletBalanceProvider.sol": { + "l": { + "26": 3, + "34": 0, + "45": 0, + "46": 0, + "48": 0, + "63": 0, + "65": 0, + "66": 0, + "67": 0, + "68": 0, + "69": 0, + "71": 0, + "76": 0, + "87": 0, + "89": 0, + "91": 0, + "93": 0, + "94": 0, + "96": 0, + "97": 0, + "98": 0, + "100": 0, + "103": 0 + }, + "path": "/src/contracts/misc/WalletBalanceProvider.sol", + "s": { + "1": 3, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 0, + "8": 0, + "9": 0, + "10": 0, + "11": 0, + "12": 0, + "13": 0, + "14": 0, + "15": 0, + "16": 0, + "17": 0, + "18": 0, + "19": 0, + "20": 0, + "21": 0 + }, + "b": {"1": [0, 0], "2": [0, 0], "3": [0, 0], "4": [0, 0]}, + "f": {"1": 3, "2": 0, "3": 0, "4": 0}, + "fnMap": { + "1": { + "name": "constructor", + "line": 25, + "loc": {"start": {"line": 25, "column": 2}, "end": {"line": 27, "column": 2}} + }, + "2": { + "name": "balanceOf", + "line": 43, + "loc": {"start": {"line": 43, "column": 2}, "end": {"line": 50, "column": 2}} + }, + "3": { + "name": "batchBalanceOf", + "line": 58, + "loc": {"start": {"line": 58, "column": 2}, "end": {"line": 77, "column": 2}} + }, + "4": { + "name": "getUserWalletBalances", + "line": 82, + "loc": {"start": {"line": 82, "column": 2}, "end": {"line": 104, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 26, "column": 4}, "end": {"line": 26, "column": 23}}, + "2": {"start": {"line": 45, "column": 4}, "end": {"line": 45, "column": 1672}}, + "3": {"start": {"line": 46, "column": 6}, "end": {"line": 46, "column": 42}}, + "4": {"start": {"line": 48, "column": 6}, "end": {"line": 48, "column": 14}}, + "5": {"start": {"line": 63, "column": 4}, "end": {"line": 63, "column": 75}}, + "6": {"start": {"line": 65, "column": 4}, "end": {"line": 65, "column": 2271}}, + "7": {"start": {"line": 66, "column": 6}, "end": {"line": 66, "column": 2324}}, + "8": {"start": {"line": 67, "column": 8}, "end": {"line": 67, "column": 43}}, + "9": {"start": {"line": 68, "column": 8}, "end": {"line": 68, "column": 2425}}, + "10": {"start": {"line": 69, "column": 10}, "end": {"line": 69, "column": 32}}, + "11": {"start": {"line": 71, "column": 10}, "end": {"line": 71, "column": 63}}, + "12": {"start": {"line": 76, "column": 4}, "end": {"line": 76, "column": 19}}, + "13": {"start": {"line": 87, "column": 4}, "end": {"line": 87, "column": 64}}, + "14": {"start": {"line": 89, "column": 4}, "end": {"line": 89, "column": 50}}, + "15": {"start": {"line": 91, "column": 4}, "end": {"line": 91, "column": 62}}, + "16": {"start": {"line": 93, "column": 4}, "end": {"line": 93, "column": 3026}}, + "17": {"start": {"line": 94, "column": 6}, "end": {"line": 94, "column": 89}}, + "18": {"start": {"line": 96, "column": 6}, "end": {"line": 96, "column": 3174}}, + "19": {"start": {"line": 97, "column": 8}, "end": {"line": 97, "column": 22}}, + "20": {"start": {"line": 100, "column": 6}, "end": {"line": 100, "column": 47}}, + "21": {"start": {"line": 103, "column": 4}, "end": {"line": 103, "column": 31}} + }, + "branchMap": { + "1": { + "line": 34, + "type": "if", + "locations": [ + {"start": {"line": 34, "column": 4}, "end": {"line": 34, "column": 4}}, + {"start": {"line": 34, "column": 4}, "end": {"line": 34, "column": 4}} + ] + }, + "2": { + "line": 45, + "type": "if", + "locations": [ + {"start": {"line": 45, "column": 4}, "end": {"line": 45, "column": 4}}, + {"start": {"line": 45, "column": 4}, "end": {"line": 45, "column": 4}} + ] + }, + "3": { + "line": 68, + "type": "if", + "locations": [ + {"start": {"line": 68, "column": 8}, "end": {"line": 68, "column": 8}}, + {"start": {"line": 68, "column": 8}, "end": {"line": 68, "column": 8}} + ] + }, + "4": { + "line": 96, + "type": "if", + "locations": [ + {"start": {"line": 96, "column": 6}, "end": {"line": 96, "column": 6}}, + {"start": {"line": 96, "column": 6}, "end": {"line": 96, "column": 6}} + ] + } + } + }, + "contracts/tokenization/AToken.sol": { + "l": { + "45": 211, + "46": 207, + "57": 54, + "58": 54, + "59": 54, + "63": 17, + "71": 17, + "74": 17, + "78": 17, + "88": 17, + "89": 17, + "90": 17, + "104": 42, + "107": 41, + "110": 41, + "111": 41, + "126": 105, + "129": 105, + "130": 105, + "134": 0, + "137": 0, + "138": 0, + "155": 2, + "170": 641, + "180": 333, + "195": 0, + "205": 3, + "207": 3, + "208": 0, + "211": 3, + "219": 0, + "229": 4, + "245": 58, + "246": 56, + "268": 6, + "270": 5, + "271": 3, + "272": 3, + "279": 3, + "280": 0, + "281": 0, + "298": 6, + "299": 4, + "302": 4, + "304": 4, + "306": 4, + "320": 4, + "327": 0 + }, + "path": "/src/contracts/tokenization/AToken.sol", + "s": { + "1": 211, + "2": 54, + "3": 54, + "4": 54, + "5": 17, + "6": 17, + "7": 17, + "8": 17, + "9": 17, + "10": 17, + "11": 42, + "12": 41, + "13": 41, + "14": 41, + "15": 105, + "16": 105, + "17": 105, + "18": 0, + "19": 0, + "20": 0, + "21": 2, + "22": 641, + "23": 333, + "24": 0, + "25": 3, + "26": 3, + "27": 0, + "28": 3, + "29": 0, + "30": 4, + "31": 58, + "32": 56, + "33": 6, + "34": 5, + "35": 3, + "36": 3, + "37": 3, + "38": 0, + "39": 0, + "40": 6, + "41": 4, + "42": 4, + "43": 4, + "44": 4, + "45": 4 + }, + "b": { + "1": [207, 4], + "2": [0, 3], + "3": [5, 1], + "4": [3, 2], + "5": [0, 3], + "6": [4, 2], + "7": [2, 2] + }, + "f": { + "1": 211, + "2": 54, + "3": 17, + "4": 17, + "5": 42, + "6": 105, + "7": 0, + "8": 2, + "9": 641, + "10": 333, + "11": 0, + "12": 3, + "13": 0, + "14": 4, + "15": 58, + "16": 6, + "17": 6, + "18": 4 + }, + "fnMap": { + "1": { + "name": "onlyLendingPool", + "line": 44, + "loc": {"start": {"line": 44, "column": 2}, "end": {"line": 47, "column": 2}} + }, + "2": { + "name": "constructor", + "line": 56, + "loc": {"start": {"line": 49, "column": 2}, "end": {"line": 60, "column": 2}} + }, + "3": { + "name": "getRevision", + "line": 62, + "loc": {"start": {"line": 62, "column": 2}, "end": {"line": 64, "column": 2}} + }, + "4": { + "name": "initialize", + "line": 70, + "loc": {"start": {"line": 66, "column": 2}, "end": {"line": 91, "column": 2}} + }, + "5": { + "name": "burn", + "line": 103, + "loc": {"start": {"line": 98, "column": 2}, "end": {"line": 112, "column": 2}} + }, + "6": { + "name": "mint", + "line": 124, + "loc": {"start": {"line": 120, "column": 2}, "end": {"line": 131, "column": 2}} + }, + "7": { + "name": "mintToTreasury", + "line": 133, + "loc": {"start": {"line": 133, "column": 2}, "end": {"line": 139, "column": 2}} + }, + "8": { + "name": "transferOnLiquidation", + "line": 152, + "loc": {"start": {"line": 148, "column": 2}, "end": {"line": 156, "column": 2}} + }, + "9": { + "name": "balanceOf", + "line": 164, + "loc": {"start": {"line": 164, "column": 2}, "end": {"line": 171, "column": 2}} + }, + "10": { + "name": "scaledBalanceOf", + "line": 179, + "loc": {"start": {"line": 179, "column": 2}, "end": {"line": 181, "column": 2}} + }, + "11": { + "name": "getScaledUserBalanceAndSupply", + "line": 189, + "loc": {"start": {"line": 189, "column": 2}, "end": {"line": 196, "column": 2}} + }, + "12": { + "name": "totalSupply", + "line": 204, + "loc": {"start": {"line": 204, "column": 2}, "end": {"line": 212, "column": 2}} + }, + "13": { + "name": "scaledTotalSupply", + "line": 218, + "loc": {"start": {"line": 218, "column": 2}, "end": {"line": 220, "column": 2}} + }, + "14": { + "name": "isTransferAllowed", + "line": 228, + "loc": {"start": {"line": 228, "column": 2}, "end": {"line": 230, "column": 2}} + }, + "15": { + "name": "transferUnderlyingTo", + "line": 242, + "loc": {"start": {"line": 239, "column": 2}, "end": {"line": 247, "column": 2}} + }, + "16": { + "name": "permit", + "line": 259, + "loc": {"start": {"line": 259, "column": 2}, "end": {"line": 282, "column": 2}} + }, + "17": { + "name": "_transfer", + "line": 292, + "loc": {"start": {"line": 292, "column": 2}, "end": {"line": 307, "column": 2}} + }, + "18": { + "name": "_transfer", + "line": 315, + "loc": {"start": {"line": 315, "column": 2}, "end": {"line": 321, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 45, "column": 4}, "end": {"line": 45, "column": 75}}, + "2": {"start": {"line": 57, "column": 4}, "end": {"line": 57, "column": 14}}, + "3": {"start": {"line": 58, "column": 4}, "end": {"line": 58, "column": 52}}, + "4": {"start": {"line": 59, "column": 4}, "end": {"line": 59, "column": 52}}, + "5": {"start": {"line": 63, "column": 4}, "end": {"line": 63, "column": 26}}, + "6": {"start": {"line": 71, "column": 4}, "end": {"line": 71, "column": 19}}, + "7": {"start": {"line": 78, "column": 4}, "end": {"line": 78, "column": 2480}}, + "8": {"start": {"line": 88, "column": 4}, "end": {"line": 88, "column": 22}}, + "9": {"start": {"line": 89, "column": 4}, "end": {"line": 89, "column": 26}}, + "10": {"start": {"line": 90, "column": 4}, "end": {"line": 90, "column": 40}}, + "11": {"start": {"line": 104, "column": 4}, "end": {"line": 104, "column": 36}}, + "12": {"start": {"line": 107, "column": 4}, "end": {"line": 107, "column": 78}}, + "13": {"start": {"line": 110, "column": 4}, "end": {"line": 110, "column": 43}}, + "14": {"start": {"line": 111, "column": 4}, "end": {"line": 111, "column": 62}}, + "15": {"start": {"line": 126, "column": 4}, "end": {"line": 126, "column": 36}}, + "16": {"start": {"line": 129, "column": 4}, "end": {"line": 129, "column": 43}}, + "17": {"start": {"line": 130, "column": 4}, "end": {"line": 130, "column": 34}}, + "18": {"start": {"line": 134, "column": 4}, "end": {"line": 134, "column": 53}}, + "19": {"start": {"line": 137, "column": 4}, "end": {"line": 137, "column": 63}}, + "20": {"start": {"line": 138, "column": 4}, "end": {"line": 138, "column": 54}}, + "21": {"start": {"line": 155, "column": 4}, "end": {"line": 155, "column": 36}}, + "22": {"start": {"line": 170, "column": 4}, "end": {"line": 170, "column": 98}}, + "23": {"start": {"line": 180, "column": 4}, "end": {"line": 180, "column": 32}}, + "24": {"start": {"line": 195, "column": 4}, "end": {"line": 195, "column": 55}}, + "25": {"start": {"line": 205, "column": 4}, "end": {"line": 205, "column": 53}}, + "26": {"start": {"line": 207, "column": 4}, "end": {"line": 207, "column": 6560}}, + "27": {"start": {"line": 208, "column": 6}, "end": {"line": 208, "column": 14}}, + "28": {"start": {"line": 211, "column": 4}, "end": {"line": 211, "column": 96}}, + "29": {"start": {"line": 219, "column": 4}, "end": {"line": 219, "column": 30}}, + "30": {"start": {"line": 229, "column": 4}, "end": {"line": 229, "column": 78}}, + "31": {"start": {"line": 245, "column": 4}, "end": {"line": 245, "column": 64}}, + "32": {"start": {"line": 246, "column": 4}, "end": {"line": 246, "column": 17}}, + "33": {"start": {"line": 268, "column": 4}, "end": {"line": 268, "column": 48}}, + "34": {"start": {"line": 270, "column": 4}, "end": {"line": 270, "column": 61}}, + "35": {"start": {"line": 271, "column": 4}, "end": {"line": 271, "column": 46}}, + "36": {"start": {"line": 272, "column": 4}, "end": {"line": 272, "column": 8691}}, + "37": {"start": {"line": 279, "column": 4}, "end": {"line": 279, "column": 68}}, + "38": {"start": {"line": 280, "column": 4}, "end": {"line": 280, "column": 44}}, + "39": {"start": {"line": 281, "column": 4}, "end": {"line": 281, "column": 34}}, + "40": {"start": {"line": 298, "column": 4}, "end": {"line": 298, "column": 9504}}, + "41": {"start": {"line": 299, "column": 6}, "end": {"line": 299, "column": 74}}, + "42": {"start": {"line": 302, "column": 4}, "end": {"line": 302, "column": 77}}, + "43": {"start": {"line": 304, "column": 4}, "end": {"line": 304, "column": 50}}, + "44": {"start": {"line": 306, "column": 4}, "end": {"line": 306, "column": 49}}, + "45": {"start": {"line": 320, "column": 4}, "end": {"line": 320, "column": 36}} + }, + "branchMap": { + "1": { + "line": 45, + "type": "if", + "locations": [ + {"start": {"line": 45, "column": 4}, "end": {"line": 45, "column": 4}}, + {"start": {"line": 45, "column": 4}, "end": {"line": 45, "column": 4}} + ] + }, + "2": { + "line": 207, + "type": "if", + "locations": [ + {"start": {"line": 207, "column": 4}, "end": {"line": 207, "column": 4}}, + {"start": {"line": 207, "column": 4}, "end": {"line": 207, "column": 4}} + ] + }, + "3": { + "line": 268, + "type": "if", + "locations": [ + {"start": {"line": 268, "column": 4}, "end": {"line": 268, "column": 4}}, + {"start": {"line": 268, "column": 4}, "end": {"line": 268, "column": 4}} + ] + }, + "4": { + "line": 270, + "type": "if", + "locations": [ + {"start": {"line": 270, "column": 4}, "end": {"line": 270, "column": 4}}, + {"start": {"line": 270, "column": 4}, "end": {"line": 270, "column": 4}} + ] + }, + "5": { + "line": 279, + "type": "if", + "locations": [ + {"start": {"line": 279, "column": 4}, "end": {"line": 279, "column": 4}}, + {"start": {"line": 279, "column": 4}, "end": {"line": 279, "column": 4}} + ] + }, + "6": { + "line": 298, + "type": "if", + "locations": [ + {"start": {"line": 298, "column": 4}, "end": {"line": 298, "column": 4}}, + {"start": {"line": 298, "column": 4}, "end": {"line": 298, "column": 4}} + ] + }, + "7": { + "line": 299, + "type": "if", + "locations": [ + {"start": {"line": 299, "column": 6}, "end": {"line": 299, "column": 6}}, + {"start": {"line": 299, "column": 6}, "end": {"line": 299, "column": 6}} + ] + } + } + }, + "contracts/tokenization/base/DebtTokenBase.sol": { + "l": { + "29": 99, + "30": 95, + "44": 108, + "45": 108, + "59": 36, + "60": 36, + "61": 36, + "65": 0, + "73": 0, + "74": 0, + "75": 0, + "85": 0, + "86": 0, + "87": 0, + "91": 0, + "92": 0, + "93": 0, + "101": 0, + "102": 0, + "103": 0, + "104": 0, + "113": 0, + "114": 0, + "115": 0, + "124": 0, + "125": 0, + "126": 0 + }, + "path": "/src/contracts/tokenization/base/DebtTokenBase.sol", + "s": { + "1": 99, + "2": 108, + "3": 108, + "4": 36, + "5": 36, + "6": 36, + "7": 0, + "8": 0, + "9": 0, + "10": 0, + "11": 0, + "12": 0, + "13": 0 + }, + "b": {"1": [95, 4]}, + "f": {"1": 99, "2": 108, "3": 36, "4": 0, "5": 0, "6": 0, "7": 0, "8": 0, "9": 0, "10": 0}, + "fnMap": { + "1": { + "name": "onlyLendingPool", + "line": 28, + "loc": {"start": {"line": 28, "column": 2}, "end": {"line": 31, "column": 2}} + }, + "2": { + "name": "constructor", + "line": 43, + "loc": {"start": {"line": 37, "column": 2}, "end": {"line": 46, "column": 2}} + }, + "3": { + "name": "initialize", + "line": 58, + "loc": {"start": {"line": 54, "column": 2}, "end": {"line": 62, "column": 2}} + }, + "4": { + "name": "underlyingAssetAddress", + "line": 64, + "loc": {"start": {"line": 64, "column": 2}, "end": {"line": 66, "column": 2}} + }, + "5": { + "name": "transfer", + "line": 72, + "loc": {"start": {"line": 72, "column": 2}, "end": {"line": 76, "column": 2}} + }, + "6": { + "name": "allowance", + "line": 78, + "loc": {"start": {"line": 78, "column": 2}, "end": {"line": 88, "column": 2}} + }, + "7": { + "name": "approve", + "line": 90, + "loc": {"start": {"line": 90, "column": 2}, "end": {"line": 94, "column": 2}} + }, + "8": { + "name": "transferFrom", + "line": 96, + "loc": {"start": {"line": 96, "column": 2}, "end": {"line": 105, "column": 2}} + }, + "9": { + "name": "increaseAllowance", + "line": 107, + "loc": {"start": {"line": 107, "column": 2}, "end": {"line": 116, "column": 2}} + }, + "10": { + "name": "decreaseAllowance", + "line": 118, + "loc": {"start": {"line": 118, "column": 2}, "end": {"line": 127, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 29, "column": 4}, "end": {"line": 29, "column": 75}}, + "2": {"start": {"line": 44, "column": 4}, "end": {"line": 44, "column": 28}}, + "3": {"start": {"line": 45, "column": 4}, "end": {"line": 45, "column": 44}}, + "4": {"start": {"line": 59, "column": 4}, "end": {"line": 59, "column": 17}}, + "5": {"start": {"line": 60, "column": 4}, "end": {"line": 60, "column": 21}}, + "6": {"start": {"line": 61, "column": 4}, "end": {"line": 61, "column": 25}}, + "7": {"start": {"line": 65, "column": 4}, "end": {"line": 65, "column": 27}}, + "8": {"start": {"line": 75, "column": 4}, "end": {"line": 75, "column": 35}}, + "9": {"start": {"line": 87, "column": 4}, "end": {"line": 87, "column": 36}}, + "10": {"start": {"line": 93, "column": 4}, "end": {"line": 93, "column": 35}}, + "11": {"start": {"line": 104, "column": 4}, "end": {"line": 104, "column": 35}}, + "12": {"start": {"line": 115, "column": 4}, "end": {"line": 115, "column": 36}}, + "13": {"start": {"line": 126, "column": 4}, "end": {"line": 126, "column": 36}} + }, + "branchMap": { + "1": { + "line": 29, + "type": "if", + "locations": [ + {"start": {"line": 29, "column": 4}, "end": {"line": 29, "column": 4}}, + {"start": {"line": 29, "column": 4}, "end": {"line": 29, "column": 4}} + ] + } + } + }, + "contracts/tokenization/IncentivizedERC20.sol": { + "l": { + "34": 162, + "35": 162, + "36": 162, + "37": 162, + "44": 67, + "51": 88, + "58": 0, + "65": 2318, + "72": 2652, + "82": 4, + "83": 2, + "84": 2, + "100": 4, + "109": 0, + "110": 0, + "125": 0, + "126": 0, + "131": 0, + "132": 0, + "142": 0, + "143": 0, + "157": 0, + "165": 0, + "173": 4, + "174": 4, + "176": 4, + "178": 4, + "179": 4, + "180": 4, + "181": 4, + "183": 4, + "184": 0, + "185": 0, + "186": 0, + "187": 0, + "193": 131, + "195": 131, + "197": 131, + "198": 131, + "200": 131, + "201": 131, + "203": 131, + "204": 0, + "209": 67, + "211": 67, + "213": 67, + "214": 67, + "216": 67, + "217": 67, + "219": 66, + "220": 0, + "229": 0, + "230": 0, + "232": 0, + "233": 0, + "237": 54, + "241": 54, + "245": 54 + }, + "path": "/src/contracts/tokenization/IncentivizedERC20.sol", + "s": { + "1": 162, + "2": 162, + "3": 162, + "4": 162, + "5": 67, + "6": 88, + "7": 0, + "8": 2318, + "9": 2652, + "10": 4, + "11": 2, + "12": 2, + "13": 4, + "14": 0, + "15": 0, + "16": 0, + "17": 0, + "18": 0, + "19": 0, + "20": 0, + "21": 0, + "22": 0, + "23": 0, + "24": 4, + "25": 4, + "26": 4, + "27": 4, + "28": 4, + "29": 4, + "30": 4, + "31": 4, + "32": 0, + "33": 0, + "34": 0, + "35": 0, + "36": 131, + "37": 131, + "38": 131, + "39": 131, + "40": 131, + "41": 131, + "42": 131, + "43": 0, + "44": 67, + "45": 67, + "46": 67, + "47": 67, + "48": 67, + "49": 67, + "50": 66, + "51": 0, + "52": 0, + "53": 0, + "54": 0, + "55": 0, + "56": 54, + "57": 54, + "58": 54 + }, + "b": { + "1": [4, 0], + "2": [4, 0], + "3": [0, 4], + "4": [0, 0], + "5": [131, 0], + "6": [0, 131], + "7": [67, 0], + "8": [0, 66], + "9": [0, 0], + "10": [0, 0] + }, + "f": { + "1": 162, + "2": 67, + "3": 88, + "4": 0, + "5": 2318, + "6": 2652, + "7": 4, + "8": 4, + "9": 0, + "10": 0, + "11": 0, + "12": 0, + "13": 4, + "14": 131, + "15": 67, + "16": 0, + "17": 54, + "18": 54, + "19": 54, + "20": 202 + }, + "fnMap": { + "1": { + "name": "constructor", + "line": 28, + "loc": {"start": {"line": 28, "column": 2}, "end": {"line": 38, "column": 2}} + }, + "2": { + "name": "name", + "line": 43, + "loc": {"start": {"line": 43, "column": 2}, "end": {"line": 45, "column": 2}} + }, + "3": { + "name": "symbol", + "line": 50, + "loc": {"start": {"line": 50, "column": 2}, "end": {"line": 52, "column": 2}} + }, + "4": { + "name": "decimals", + "line": 57, + "loc": {"start": {"line": 57, "column": 2}, "end": {"line": 59, "column": 2}} + }, + "5": { + "name": "totalSupply", + "line": 64, + "loc": {"start": {"line": 64, "column": 2}, "end": {"line": 66, "column": 2}} + }, + "6": { + "name": "balanceOf", + "line": 71, + "loc": {"start": {"line": 71, "column": 2}, "end": {"line": 73, "column": 2}} + }, + "7": { + "name": "transfer", + "line": 81, + "loc": {"start": {"line": 81, "column": 2}, "end": {"line": 85, "column": 2}} + }, + "8": { + "name": "allowance", + "line": 93, + "loc": {"start": {"line": 93, "column": 2}, "end": {"line": 101, "column": 2}} + }, + "9": { + "name": "approve", + "line": 108, + "loc": {"start": {"line": 108, "column": 2}, "end": {"line": 111, "column": 2}} + }, + "10": { + "name": "transferFrom", + "line": 120, + "loc": {"start": {"line": 120, "column": 2}, "end": {"line": 133, "column": 2}} + }, + "11": { + "name": "increaseAllowance", + "line": 141, + "loc": {"start": {"line": 141, "column": 2}, "end": {"line": 144, "column": 2}} + }, + "12": { + "name": "decreaseAllowance", + "line": 152, + "loc": {"start": {"line": 152, "column": 2}, "end": {"line": 166, "column": 2}} + }, + "13": { + "name": "_transfer", + "line": 168, + "loc": {"start": {"line": 168, "column": 2}, "end": {"line": 190, "column": 2}} + }, + "14": { + "name": "_mint", + "line": 192, + "loc": {"start": {"line": 192, "column": 2}, "end": {"line": 206, "column": 2}} + }, + "15": { + "name": "_burn", + "line": 208, + "loc": {"start": {"line": 208, "column": 2}, "end": {"line": 222, "column": 2}} + }, + "16": { + "name": "_approve", + "line": 224, + "loc": {"start": {"line": 224, "column": 2}, "end": {"line": 234, "column": 2}} + }, + "17": { + "name": "_setName", + "line": 236, + "loc": {"start": {"line": 236, "column": 2}, "end": {"line": 238, "column": 2}} + }, + "18": { + "name": "_setSymbol", + "line": 240, + "loc": {"start": {"line": 240, "column": 2}, "end": {"line": 242, "column": 2}} + }, + "19": { + "name": "_setDecimals", + "line": 244, + "loc": {"start": {"line": 244, "column": 2}, "end": {"line": 246, "column": 2}} + }, + "20": { + "name": "_beforeTokenTransfer", + "line": 248, + "loc": {"start": {"line": 248, "column": 2}, "end": {"line": 252, "column": 22}} + } + }, + "statementMap": { + "1": {"start": {"line": 34, "column": 4}, "end": {"line": 34, "column": 15}}, + "2": {"start": {"line": 35, "column": 4}, "end": {"line": 35, "column": 19}}, + "3": {"start": {"line": 36, "column": 4}, "end": {"line": 36, "column": 23}}, + "4": {"start": {"line": 37, "column": 4}, "end": {"line": 37, "column": 74}}, + "5": {"start": {"line": 44, "column": 4}, "end": {"line": 44, "column": 16}}, + "6": {"start": {"line": 51, "column": 4}, "end": {"line": 51, "column": 18}}, + "7": {"start": {"line": 58, "column": 4}, "end": {"line": 58, "column": 20}}, + "8": {"start": {"line": 65, "column": 4}, "end": {"line": 65, "column": 23}}, + "9": {"start": {"line": 72, "column": 4}, "end": {"line": 72, "column": 29}}, + "10": {"start": {"line": 82, "column": 4}, "end": {"line": 82, "column": 45}}, + "11": {"start": {"line": 83, "column": 4}, "end": {"line": 83, "column": 48}}, + "12": {"start": {"line": 84, "column": 4}, "end": {"line": 84, "column": 15}}, + "13": {"start": {"line": 100, "column": 4}, "end": {"line": 100, "column": 38}}, + "14": {"start": {"line": 109, "column": 4}, "end": {"line": 109, "column": 42}}, + "15": {"start": {"line": 110, "column": 4}, "end": {"line": 110, "column": 15}}, + "16": {"start": {"line": 125, "column": 4}, "end": {"line": 125, "column": 39}}, + "17": {"start": {"line": 126, "column": 4}, "end": {"line": 126, "column": 3648}}, + "18": {"start": {"line": 131, "column": 4}, "end": {"line": 131, "column": 44}}, + "19": {"start": {"line": 132, "column": 4}, "end": {"line": 132, "column": 15}}, + "20": {"start": {"line": 142, "column": 4}, "end": {"line": 142, "column": 86}}, + "21": {"start": {"line": 143, "column": 4}, "end": {"line": 143, "column": 15}}, + "22": {"start": {"line": 157, "column": 4}, "end": {"line": 157, "column": 4675}}, + "23": {"start": {"line": 165, "column": 4}, "end": {"line": 165, "column": 15}}, + "24": {"start": {"line": 173, "column": 4}, "end": {"line": 173, "column": 73}}, + "25": {"start": {"line": 174, "column": 4}, "end": {"line": 174, "column": 74}}, + "26": {"start": {"line": 176, "column": 4}, "end": {"line": 176, "column": 50}}, + "27": {"start": {"line": 178, "column": 4}, "end": {"line": 178, "column": 48}}, + "28": {"start": {"line": 179, "column": 4}, "end": {"line": 179, "column": 93}}, + "29": {"start": {"line": 180, "column": 4}, "end": {"line": 180, "column": 54}}, + "30": {"start": {"line": 181, "column": 4}, "end": {"line": 181, "column": 58}}, + "31": {"start": {"line": 183, "column": 4}, "end": {"line": 183, "column": 5459}}, + "32": {"start": {"line": 184, "column": 6}, "end": {"line": 184, "column": 40}}, + "33": {"start": {"line": 185, "column": 6}, "end": {"line": 185, "column": 78}}, + "34": {"start": {"line": 186, "column": 6}, "end": {"line": 186, "column": 5642}}, + "35": {"start": {"line": 187, "column": 8}, "end": {"line": 187, "column": 86}}, + "36": {"start": {"line": 193, "column": 4}, "end": {"line": 193, "column": 68}}, + "37": {"start": {"line": 195, "column": 4}, "end": {"line": 195, "column": 52}}, + "38": {"start": {"line": 197, "column": 4}, "end": {"line": 197, "column": 41}}, + "39": {"start": {"line": 198, "column": 4}, "end": {"line": 198, "column": 44}}, + "40": {"start": {"line": 200, "column": 4}, "end": {"line": 200, "column": 50}}, + "41": {"start": {"line": 201, "column": 4}, "end": {"line": 201, "column": 53}}, + "42": {"start": {"line": 203, "column": 4}, "end": {"line": 203, "column": 6176}}, + "43": {"start": {"line": 204, "column": 6}, "end": {"line": 204, "column": 83}}, + "44": {"start": {"line": 209, "column": 4}, "end": {"line": 209, "column": 70}}, + "45": {"start": {"line": 211, "column": 4}, "end": {"line": 211, "column": 52}}, + "46": {"start": {"line": 213, "column": 4}, "end": {"line": 213, "column": 41}}, + "47": {"start": {"line": 214, "column": 4}, "end": {"line": 214, "column": 44}}, + "48": {"start": {"line": 216, "column": 4}, "end": {"line": 216, "column": 50}}, + "49": {"start": {"line": 217, "column": 4}, "end": {"line": 217, "column": 91}}, + "50": {"start": {"line": 219, "column": 4}, "end": {"line": 219, "column": 6766}}, + "51": {"start": {"line": 220, "column": 6}, "end": {"line": 220, "column": 83}}, + "52": {"start": {"line": 229, "column": 4}, "end": {"line": 229, "column": 71}}, + "53": {"start": {"line": 230, "column": 4}, "end": {"line": 230, "column": 71}}, + "54": {"start": {"line": 232, "column": 4}, "end": {"line": 232, "column": 39}}, + "55": {"start": {"line": 233, "column": 4}, "end": {"line": 233, "column": 41}}, + "56": {"start": {"line": 237, "column": 4}, "end": {"line": 237, "column": 18}}, + "57": {"start": {"line": 241, "column": 4}, "end": {"line": 241, "column": 22}}, + "58": {"start": {"line": 245, "column": 4}, "end": {"line": 245, "column": 26}} + }, + "branchMap": { + "1": { + "line": 173, + "type": "if", + "locations": [ + {"start": {"line": 173, "column": 4}, "end": {"line": 173, "column": 4}}, + {"start": {"line": 173, "column": 4}, "end": {"line": 173, "column": 4}} + ] + }, + "2": { + "line": 174, + "type": "if", + "locations": [ + {"start": {"line": 174, "column": 4}, "end": {"line": 174, "column": 4}}, + {"start": {"line": 174, "column": 4}, "end": {"line": 174, "column": 4}} + ] + }, + "3": { + "line": 183, + "type": "if", + "locations": [ + {"start": {"line": 183, "column": 4}, "end": {"line": 183, "column": 4}}, + {"start": {"line": 183, "column": 4}, "end": {"line": 183, "column": 4}} + ] + }, + "4": { + "line": 186, + "type": "if", + "locations": [ + {"start": {"line": 186, "column": 6}, "end": {"line": 186, "column": 6}}, + {"start": {"line": 186, "column": 6}, "end": {"line": 186, "column": 6}} + ] + }, + "5": { + "line": 193, + "type": "if", + "locations": [ + {"start": {"line": 193, "column": 4}, "end": {"line": 193, "column": 4}}, + {"start": {"line": 193, "column": 4}, "end": {"line": 193, "column": 4}} + ] + }, + "6": { + "line": 203, + "type": "if", + "locations": [ + {"start": {"line": 203, "column": 4}, "end": {"line": 203, "column": 4}}, + {"start": {"line": 203, "column": 4}, "end": {"line": 203, "column": 4}} + ] + }, + "7": { + "line": 209, + "type": "if", + "locations": [ + {"start": {"line": 209, "column": 4}, "end": {"line": 209, "column": 4}}, + {"start": {"line": 209, "column": 4}, "end": {"line": 209, "column": 4}} + ] + }, + "8": { + "line": 219, + "type": "if", + "locations": [ + {"start": {"line": 219, "column": 4}, "end": {"line": 219, "column": 4}}, + {"start": {"line": 219, "column": 4}, "end": {"line": 219, "column": 4}} + ] + }, + "9": { + "line": 229, + "type": "if", + "locations": [ + {"start": {"line": 229, "column": 4}, "end": {"line": 229, "column": 4}}, + {"start": {"line": 229, "column": 4}, "end": {"line": 229, "column": 4}} + ] + }, + "10": { + "line": 230, + "type": "if", + "locations": [ + {"start": {"line": 230, "column": 4}, "end": {"line": 230, "column": 4}}, + {"start": {"line": 230, "column": 4}, "end": {"line": 230, "column": 4}} + ] + } + } + }, + "contracts/tokenization/interfaces/IAToken.sol": { + "l": {}, + "path": "/src/contracts/tokenization/interfaces/IAToken.sol", + "s": {}, + "b": {}, + "f": {}, + "fnMap": {}, + "statementMap": {}, + "branchMap": {} + }, + "contracts/tokenization/interfaces/IScaledBalanceToken.sol": { + "l": {}, + "path": "/src/contracts/tokenization/interfaces/IScaledBalanceToken.sol", + "s": {}, + "b": {}, + "f": {}, + "fnMap": {}, + "statementMap": {}, + "branchMap": {} + }, + "contracts/tokenization/interfaces/IStableDebtToken.sol": { + "l": {}, + "path": "/src/contracts/tokenization/interfaces/IStableDebtToken.sol", + "s": {}, + "b": {}, + "f": {}, + "fnMap": {}, + "statementMap": {}, + "branchMap": {} + }, + "contracts/tokenization/interfaces/IVariableDebtToken.sol": { + "l": {}, + "path": "/src/contracts/tokenization/interfaces/IVariableDebtToken.sol", + "s": {}, + "b": {}, + "f": {}, + "fnMap": {}, + "statementMap": {}, + "branchMap": {} + }, + "contracts/tokenization/StableDebtToken.sol": { + "l": { + "39": 17, + "47": 363, + "55": 343, + "64": 343, + "72": 488, + "73": 488, + "74": 488, + "75": 366, + "77": 122, + "81": 122, + "104": 27, + "107": 27, + "114": 27, + "115": 27, + "116": 27, + "118": 27, + "121": 27, + "126": 27, + "127": 27, + "131": 27, + "134": 27, + "139": 27, + "142": 27, + "144": 27, + "160": 17, + "167": 17, + "173": 17, + "174": 8, + "175": 8, + "177": 9, + "178": 9, + "184": 17, + "185": 11, + "186": 11, + "190": 6, + "193": 17, + "195": 17, + "196": 0, + "198": 17, + "202": 17, + "204": 17, + "222": 44, + "224": 44, + "225": 22, + "229": 22, + "231": 22, + "242": 331, + "243": 331, + "250": 235, + "251": 235, + "258": 414, + "265": 331, + "274": 343, + "284": 980, + "286": 980, + "287": 781, + "290": 199, + "295": 199, + "306": 27, + "307": 27, + "309": 27, + "310": 0, + "322": 17, + "323": 17, + "325": 17, + "326": 0 + }, + "path": "/src/contracts/tokenization/StableDebtToken.sol", + "s": { + "1": 17, + "2": 363, + "3": 343, + "4": 343, + "5": 488, + "6": 488, + "7": 488, + "8": 366, + "9": 122, + "10": 122, + "11": 27, + "12": 27, + "13": 27, + "14": 27, + "15": 27, + "16": 27, + "17": 27, + "18": 27, + "19": 27, + "20": 27, + "21": 27, + "22": 27, + "23": 27, + "24": 27, + "25": 17, + "26": 17, + "27": 17, + "28": 8, + "29": 8, + "30": 9, + "31": 9, + "32": 17, + "33": 11, + "34": 11, + "35": 6, + "36": 17, + "37": 17, + "38": 0, + "39": 17, + "40": 17, + "41": 17, + "42": 44, + "43": 44, + "44": 22, + "45": 22, + "46": 22, + "47": 331, + "48": 331, + "49": 235, + "50": 235, + "51": 414, + "52": 331, + "53": 343, + "54": 980, + "55": 980, + "56": 781, + "57": 199, + "58": 199, + "59": 27, + "60": 27, + "61": 27, + "62": 0, + "63": 17, + "64": 17, + "65": 17, + "66": 0 + }, + "b": { + "1": [366, 122], + "2": [27, 0], + "3": [8, 9], + "4": [11, 6], + "5": [0, 17], + "6": [22, 22], + "7": [781, 199], + "8": [0, 27], + "9": [0, 17] + }, + "f": { + "1": 54, + "2": 17, + "3": 363, + "4": 343, + "5": 343, + "6": 488, + "7": 27, + "8": 17, + "9": 44, + "10": 331, + "11": 235, + "12": 414, + "13": 331, + "14": 343, + "15": 980, + "16": 27, + "17": 17 + }, + "fnMap": { + "1": { + "name": "constructor", + "line": 32, + "loc": {"start": {"line": 26, "column": 2}, "end": {"line": 32, "column": 85}} + }, + "2": { + "name": "getRevision", + "line": 38, + "loc": {"start": {"line": 38, "column": 2}, "end": {"line": 40, "column": 2}} + }, + "3": { + "name": "getAverageStableRate", + "line": 46, + "loc": {"start": {"line": 46, "column": 2}, "end": {"line": 48, "column": 2}} + }, + "4": { + "name": "getUserLastUpdated", + "line": 54, + "loc": {"start": {"line": 54, "column": 2}, "end": {"line": 56, "column": 2}} + }, + "5": { + "name": "getUserStableRate", + "line": 63, + "loc": {"start": {"line": 63, "column": 2}, "end": {"line": 65, "column": 2}} + }, + "6": { + "name": "balanceOf", + "line": 71, + "loc": {"start": {"line": 71, "column": 2}, "end": {"line": 82, "column": 2}} + }, + "7": { + "name": "mint", + "line": 103, + "loc": {"start": {"line": 99, "column": 2}, "end": {"line": 152, "column": 2}} + }, + "8": { + "name": "burn", + "line": 159, + "loc": {"start": {"line": 159, "column": 2}, "end": {"line": 205, "column": 2}} + }, + "9": { + "name": "_calculateBalanceIncrease", + "line": 213, + "loc": {"start": {"line": 213, "column": 2}, "end": {"line": 236, "column": 2}} + }, + "10": { + "name": "getSupplyData", + "line": 241, + "loc": {"start": {"line": 241, "column": 2}, "end": {"line": 244, "column": 2}} + }, + "11": { + "name": "getTotalSupplyAndAvgRate", + "line": 249, + "loc": {"start": {"line": 249, "column": 2}, "end": {"line": 252, "column": 2}} + }, + "12": { + "name": "totalSupply", + "line": 257, + "loc": {"start": {"line": 257, "column": 2}, "end": {"line": 259, "column": 2}} + }, + "13": { + "name": "getTotalSupplyLastUpdated", + "line": 264, + "loc": {"start": {"line": 264, "column": 2}, "end": {"line": 266, "column": 2}} + }, + "14": { + "name": "principalBalanceOf", + "line": 273, + "loc": {"start": {"line": 273, "column": 2}, "end": {"line": 275, "column": 2}} + }, + "15": { + "name": "_calcTotalSupply", + "line": 283, + "loc": {"start": {"line": 283, "column": 2}, "end": {"line": 296, "column": 2}} + }, + "16": { + "name": "_mint", + "line": 304, + "loc": {"start": {"line": 304, "column": 3}, "end": {"line": 312, "column": 2}} + }, + "17": { + "name": "_burn", + "line": 320, + "loc": {"start": {"line": 320, "column": 2}, "end": {"line": 328, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 39, "column": 4}, "end": {"line": 39, "column": 30}}, + "2": {"start": {"line": 47, "column": 4}, "end": {"line": 47, "column": 25}}, + "3": {"start": {"line": 55, "column": 4}, "end": {"line": 55, "column": 28}}, + "4": {"start": {"line": 64, "column": 4}, "end": {"line": 64, "column": 27}}, + "5": {"start": {"line": 72, "column": 4}, "end": {"line": 72, "column": 53}}, + "6": {"start": {"line": 73, "column": 4}, "end": {"line": 73, "column": 44}}, + "7": {"start": {"line": 74, "column": 4}, "end": {"line": 74, "column": 2428}}, + "8": {"start": {"line": 75, "column": 6}, "end": {"line": 75, "column": 14}}, + "9": {"start": {"line": 77, "column": 4}, "end": {"line": 77, "column": 2482}}, + "10": {"start": {"line": 81, "column": 4}, "end": {"line": 81, "column": 51}}, + "11": {"start": {"line": 104, "column": 4}, "end": {"line": 104, "column": 29}}, + "12": {"start": {"line": 107, "column": 4}, "end": {"line": 107, "column": 3360}}, + "13": {"start": {"line": 114, "column": 4}, "end": {"line": 114, "column": 38}}, + "14": {"start": {"line": 115, "column": 4}, "end": {"line": 115, "column": 45}}, + "15": {"start": {"line": 116, "column": 4}, "end": {"line": 116, "column": 67}}, + "16": {"start": {"line": 118, "column": 4}, "end": {"line": 118, "column": 39}}, + "17": {"start": {"line": 121, "column": 4}, "end": {"line": 121, "column": 3848}}, + "18": {"start": {"line": 126, "column": 4}, "end": {"line": 126, "column": 79}}, + "19": {"start": {"line": 127, "column": 4}, "end": {"line": 127, "column": 40}}, + "20": {"start": {"line": 131, "column": 4}, "end": {"line": 131, "column": 70}}, + "21": {"start": {"line": 134, "column": 4}, "end": {"line": 134, "column": 4342}}, + "22": {"start": {"line": 139, "column": 4}, "end": {"line": 139, "column": 64}}, + "23": {"start": {"line": 142, "column": 4}, "end": {"line": 142, "column": 43}}, + "24": {"start": {"line": 144, "column": 4}, "end": {"line": 144, "column": 4640}}, + "25": {"start": {"line": 160, "column": 4}, "end": {"line": 160, "column": 5054}}, + "26": {"start": {"line": 167, "column": 4}, "end": {"line": 167, "column": 42}}, + "27": {"start": {"line": 173, "column": 4}, "end": {"line": 173, "column": 5510}}, + "28": {"start": {"line": 174, "column": 6}, "end": {"line": 174, "column": 23}}, + "29": {"start": {"line": 175, "column": 6}, "end": {"line": 175, "column": 21}}, + "30": {"start": {"line": 177, "column": 7}, "end": {"line": 177, "column": 69}}, + "31": {"start": {"line": 178, "column": 6}, "end": {"line": 178, "column": 5715}}, + "32": {"start": {"line": 184, "column": 4}, "end": {"line": 184, "column": 5865}}, + "33": {"start": {"line": 185, "column": 6}, "end": {"line": 185, "column": 25}}, + "34": {"start": {"line": 186, "column": 6}, "end": {"line": 186, "column": 26}}, + "35": {"start": {"line": 190, "column": 6}, "end": {"line": 190, "column": 48}}, + "36": {"start": {"line": 193, "column": 4}, "end": {"line": 193, "column": 50}}, + "37": {"start": {"line": 195, "column": 4}, "end": {"line": 195, "column": 6147}}, + "38": {"start": {"line": 196, "column": 6}, "end": {"line": 196, "column": 61}}, + "39": {"start": {"line": 198, "column": 6}, "end": {"line": 198, "column": 61}}, + "40": {"start": {"line": 202, "column": 4}, "end": {"line": 202, "column": 43}}, + "41": {"start": {"line": 204, "column": 4}, "end": {"line": 204, "column": 81}}, + "42": {"start": {"line": 222, "column": 4}, "end": {"line": 222, "column": 60}}, + "43": {"start": {"line": 224, "column": 4}, "end": {"line": 224, "column": 7006}}, + "44": {"start": {"line": 225, "column": 6}, "end": {"line": 225, "column": 22}}, + "45": {"start": {"line": 229, "column": 4}, "end": {"line": 229, "column": 75}}, + "46": {"start": {"line": 231, "column": 4}, "end": {"line": 231, "column": 7228}}, + "47": {"start": {"line": 242, "column": 4}, "end": {"line": 242, "column": 36}}, + "48": {"start": {"line": 243, "column": 4}, "end": {"line": 243, "column": 91}}, + "49": {"start": {"line": 250, "column": 4}, "end": {"line": 250, "column": 36}}, + "50": {"start": {"line": 251, "column": 4}, "end": {"line": 251, "column": 47}}, + "51": {"start": {"line": 258, "column": 4}, "end": {"line": 258, "column": 43}}, + "52": {"start": {"line": 265, "column": 4}, "end": {"line": 265, "column": 32}}, + "53": {"start": {"line": 274, "column": 4}, "end": {"line": 274, "column": 32}}, + "54": {"start": {"line": 284, "column": 4}, "end": {"line": 284, "column": 49}}, + "55": {"start": {"line": 286, "column": 4}, "end": {"line": 286, "column": 8975}}, + "56": {"start": {"line": 287, "column": 6}, "end": {"line": 287, "column": 14}}, + "57": {"start": {"line": 290, "column": 4}, "end": {"line": 290, "column": 9031}}, + "58": {"start": {"line": 295, "column": 4}, "end": {"line": 295, "column": 52}}, + "59": {"start": {"line": 306, "column": 4}, "end": {"line": 306, "column": 50}}, + "60": {"start": {"line": 307, "column": 4}, "end": {"line": 307, "column": 53}}, + "61": {"start": {"line": 309, "column": 4}, "end": {"line": 309, "column": 9637}}, + "62": {"start": {"line": 310, "column": 6}, "end": {"line": 310, "column": 83}}, + "63": {"start": {"line": 322, "column": 4}, "end": {"line": 322, "column": 50}}, + "64": {"start": {"line": 323, "column": 4}, "end": {"line": 323, "column": 91}}, + "65": {"start": {"line": 325, "column": 4}, "end": {"line": 325, "column": 10249}}, + "66": {"start": {"line": 326, "column": 6}, "end": {"line": 326, "column": 83}} + }, + "branchMap": { + "1": { + "line": 74, + "type": "if", + "locations": [ + {"start": {"line": 74, "column": 4}, "end": {"line": 74, "column": 4}}, + {"start": {"line": 74, "column": 4}, "end": {"line": 74, "column": 4}} + ] + }, + "2": { + "line": 126, + "type": "if", + "locations": [ + {"start": {"line": 126, "column": 4}, "end": {"line": 126, "column": 4}}, + {"start": {"line": 126, "column": 4}, "end": {"line": 126, "column": 4}} + ] + }, + "3": { + "line": 173, + "type": "if", + "locations": [ + {"start": {"line": 173, "column": 4}, "end": {"line": 173, "column": 4}}, + {"start": {"line": 173, "column": 4}, "end": {"line": 173, "column": 4}} + ] + }, + "4": { + "line": 184, + "type": "if", + "locations": [ + {"start": {"line": 184, "column": 4}, "end": {"line": 184, "column": 4}}, + {"start": {"line": 184, "column": 4}, "end": {"line": 184, "column": 4}} + ] + }, + "5": { + "line": 195, + "type": "if", + "locations": [ + {"start": {"line": 195, "column": 4}, "end": {"line": 195, "column": 4}}, + {"start": {"line": 195, "column": 4}, "end": {"line": 195, "column": 4}} + ] + }, + "6": { + "line": 224, + "type": "if", + "locations": [ + {"start": {"line": 224, "column": 4}, "end": {"line": 224, "column": 4}}, + {"start": {"line": 224, "column": 4}, "end": {"line": 224, "column": 4}} + ] + }, + "7": { + "line": 286, + "type": "if", + "locations": [ + {"start": {"line": 286, "column": 4}, "end": {"line": 286, "column": 4}}, + {"start": {"line": 286, "column": 4}, "end": {"line": 286, "column": 4}} + ] + }, + "8": { + "line": 309, + "type": "if", + "locations": [ + {"start": {"line": 309, "column": 4}, "end": {"line": 309, "column": 4}}, + {"start": {"line": 309, "column": 4}, "end": {"line": 309, "column": 4}} + ] + }, + "9": { + "line": 325, + "type": "if", + "locations": [ + {"start": {"line": 325, "column": 4}, "end": {"line": 325, "column": 4}}, + {"start": {"line": 325, "column": 4}, "end": {"line": 325, "column": 4}} + ] + } + } + }, + "contracts/tokenization/VariableDebtToken.sol": { + "l": { + "34": 17, + "42": 460, + "44": 460, + "45": 323, + "48": 137, + "63": 26, + "65": 26, + "66": 26, + "79": 25, + "81": 25, + "82": 25, + "90": 343, + "98": 673, + "106": 331, + "116": 0 + }, + "path": "/src/contracts/tokenization/VariableDebtToken.sol", + "s": { + "1": 17, + "2": 460, + "3": 460, + "4": 323, + "5": 137, + "6": 26, + "7": 26, + "8": 26, + "9": 25, + "10": 25, + "11": 25, + "12": 343, + "13": 673, + "14": 331, + "15": 0 + }, + "b": {"1": [323, 137]}, + "f": {"1": 54, "2": 17, "3": 460, "4": 26, "5": 25, "6": 343, "7": 673, "8": 331, "9": 0}, + "fnMap": { + "1": { + "name": "constructor", + "line": 27, + "loc": {"start": {"line": 21, "column": 2}, "end": {"line": 27, "column": 85}} + }, + "2": { + "name": "getRevision", + "line": 33, + "loc": {"start": {"line": 33, "column": 2}, "end": {"line": 35, "column": 2}} + }, + "3": { + "name": "balanceOf", + "line": 41, + "loc": {"start": {"line": 41, "column": 2}, "end": {"line": 49, "column": 2}} + }, + "4": { + "name": "mint", + "line": 61, + "loc": {"start": {"line": 57, "column": 2}, "end": {"line": 67, "column": 2}} + }, + "5": { + "name": "burn", + "line": 78, + "loc": {"start": {"line": 74, "column": 2}, "end": {"line": 83, "column": 2}} + }, + "6": { + "name": "scaledBalanceOf", + "line": 89, + "loc": {"start": {"line": 89, "column": 2}, "end": {"line": 91, "column": 2}} + }, + "7": { + "name": "totalSupply", + "line": 97, + "loc": {"start": {"line": 97, "column": 2}, "end": {"line": 99, "column": 2}} + }, + "8": { + "name": "scaledTotalSupply", + "line": 105, + "loc": {"start": {"line": 105, "column": 2}, "end": {"line": 107, "column": 2}} + }, + "9": { + "name": "getScaledUserBalanceAndSupply", + "line": 115, + "loc": {"start": {"line": 115, "column": 2}, "end": {"line": 117, "column": 2}} + } + }, + "statementMap": { + "1": {"start": {"line": 34, "column": 4}, "end": {"line": 34, "column": 30}}, + "2": {"start": {"line": 42, "column": 4}, "end": {"line": 42, "column": 49}}, + "3": {"start": {"line": 44, "column": 4}, "end": {"line": 44, "column": 1484}}, + "4": {"start": {"line": 45, "column": 6}, "end": {"line": 45, "column": 14}}, + "5": {"start": {"line": 48, "column": 4}, "end": {"line": 48, "column": 88}}, + "6": {"start": {"line": 63, "column": 4}, "end": {"line": 63, "column": 36}}, + "7": {"start": {"line": 65, "column": 4}, "end": {"line": 65, "column": 43}}, + "8": {"start": {"line": 66, "column": 4}, "end": {"line": 66, "column": 34}}, + "9": {"start": {"line": 79, "column": 4}, "end": {"line": 79, "column": 36}}, + "10": {"start": {"line": 81, "column": 4}, "end": {"line": 81, "column": 43}}, + "11": {"start": {"line": 82, "column": 4}, "end": {"line": 82, "column": 34}}, + "12": {"start": {"line": 90, "column": 4}, "end": {"line": 90, "column": 32}}, + "13": {"start": {"line": 98, "column": 4}, "end": {"line": 98, "column": 94}}, + "14": {"start": {"line": 106, "column": 4}, "end": {"line": 106, "column": 30}}, + "15": {"start": {"line": 116, "column": 4}, "end": {"line": 116, "column": 55}} + }, + "branchMap": { + "1": { + "line": 44, + "type": "if", + "locations": [ + {"start": {"line": 44, "column": 4}, "end": {"line": 44, "column": 4}}, + {"start": {"line": 44, "column": 4}, "end": {"line": 44, "column": 4}} + ] + } + } + } +} diff --git a/deployed-contracts.json b/deployed-contracts.json index e5bb640f..549935bb 100644 --- a/deployed-contracts.json +++ b/deployed-contracts.json @@ -5,17 +5,25 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x9Dc554694756dC303a087e04bA6918C333Bc26a7", + "address": "0x58F132FBB86E21545A4Bace3C19f1C05d86d7A22", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x58F132FBB86E21545A4Bace3C19f1C05d86d7A22", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, "LendingPoolAddressesProvider": { "buidlerevm": { - "address": "0x7c2C195CD6D34B8F845992d380aADB2730bB9C6F", + "address": "0xa4bcDF64Cdd5451b6ac3743B414124A6299B65FF", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xAfC307938C1c0035942c141c31524504c89Aaa8B", + "address": "0xa4bcDF64Cdd5451b6ac3743B414124A6299B65FF", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0xa4bcDF64Cdd5451b6ac3743B414124A6299B65FF", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "kovan": { @@ -25,11 +33,15 @@ }, "LendingPoolAddressesProviderRegistry": { "buidlerevm": { - "address": "0x0078371BDeDE8aAc7DeBfFf451B74c5EDB385Af7", + "address": "0x5A0773Ff307Bf7C71a832dBB5312237fD3437f9F", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x73DE1e0ab6A5C221258703bc546E0CAAcCc6EC87", + "address": "0x5A0773Ff307Bf7C71a832dBB5312237fD3437f9F", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x5A0773Ff307Bf7C71a832dBB5312237fD3437f9F", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "kovan": { @@ -58,7 +70,7 @@ }, "LendingPoolConfigurator": { "buidlerevm": { - "address": "0x1b88b3E43526cB076931AD76cB2eC0CC93382FAc" + "address": "0x6642B57e4265BAD868C17Fc1d1F4F88DBBA04Aa8" }, "localhost": { "address": "0x65e0Cd5B8904A02f2e00BC6f58bf881998D54BDe" @@ -74,7 +86,7 @@ }, "LendingPool": { "buidlerevm": { - "address": "0xdA71454D2a71D63116cd67099e4a0fdd3a8Dfb47" + "address": "0xD9273d497eDBC967F39d419461CfcF382a0A822e" }, "localhost": { "address": "0x5d12dDe3286D94E0d85F9D3B01B7099cfA0aBCf1" @@ -89,7 +101,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xbeA90474c2F3C7c43bC7c36CaAf5272c927Af5a1", + "address": "0x1750499D05Ed1674d822430FB960d5F6731fDf64", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x1750499D05Ed1674d822430FB960d5F6731fDf64", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -99,7 +115,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x19E42cA990cF697D3dda0e59131215C43bB6989F", + "address": "0xEC1C93A9f6a9e18E97784c76aC52053587FcDB89", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0xEC1C93A9f6a9e18E97784c76aC52053587FcDB89", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -109,7 +129,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xE30c3983E51bC9d6baE3E9437710a1459e21e81F", + "address": "0x7B6C3e5486D9e6959441ab554A889099eed76290", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x7B6C3e5486D9e6959441ab554A889099eed76290", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "kovan": { @@ -123,7 +147,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xDf69898e844197a24C658CcF9fD53dF15948dc8b", + "address": "0xD83D2773a7873ae2b5f8Fb92097e20a8C64F691E", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0xD83D2773a7873ae2b5f8Fb92097e20a8C64F691E", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "kovan": { @@ -133,11 +161,15 @@ }, "DefaultReserveInterestRateStrategy": { "buidlerevm": { - "address": "0xA0AB1cB92A4AF81f84dCd258155B5c25D247b54E", + "address": "0x626FdE749F9d499d3777320CAf29484B624ab84a", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xBe6d8642382C241c9B4B50c89574DbF3f4181E7D", + "address": "0x626FdE749F9d499d3777320CAf29484B624ab84a", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x626FdE749F9d499d3777320CAf29484B624ab84a", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -188,19 +220,26 @@ }, "MockFlashLoanReceiver": { "buidlerevm": { - "address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4" + "address": "0x2B681757d757fbB80cc51c6094cEF5eE75bF55aA" }, "localhost": { - "address": "0xAd49512dFBaD6fc13D67d3935283c0606812E962" + "address": "0x2B681757d757fbB80cc51c6094cEF5eE75bF55aA" + }, + "coverage": { + "address": "0x2B681757d757fbB80cc51c6094cEF5eE75bF55aA" } }, "WalletBalanceProvider": { "buidlerevm": { - "address": "0xC6bA6049F86d528698B5924B8fC2FE7289D38578", + "address": "0xDf73fC454FA018051D4a1509e63D11530A59DE10", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xA29C2A7e59aa49C71aF084695337E3AA5e820758", + "address": "0xDf73fC454FA018051D4a1509e63D11530A59DE10", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0xDf73fC454FA018051D4a1509e63D11530A59DE10", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -210,7 +249,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xbe66dC9DFEe580ED968403e35dF7b5159f873df8", + "address": "0x7c2C195CD6D34B8F845992d380aADB2730bB9C6F", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x7c2C195CD6D34B8F845992d380aADB2730bB9C6F", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -220,7 +263,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x93AfC6Df4bB8F62F2493B19e577f8382c0BA9EBC", + "address": "0x8858eeB3DfffA017D4BCE9801D340D36Cf895CCf", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x8858eeB3DfffA017D4BCE9801D340D36Cf895CCf", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -230,7 +277,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x75Ded61646B5945BdDd0CD9a9Db7c8288DA6F810", + "address": "0x0078371BDeDE8aAc7DeBfFf451B74c5EDB385Af7", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x0078371BDeDE8aAc7DeBfFf451B74c5EDB385Af7", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -240,7 +291,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xdE7c40e675bF1aA45c18cCbaEb9662B16b0Ddf7E", + "address": "0xf4e77E5Da47AC3125140c470c71cBca77B5c638c", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0xf4e77E5Da47AC3125140c470c71cBca77B5c638c", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -250,7 +305,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xDFbeeed692AA81E7f86E72F7ACbEA2A1C4d63544", + "address": "0x3619DbE27d7c1e7E91aA738697Ae7Bc5FC3eACA5", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x3619DbE27d7c1e7E91aA738697Ae7Bc5FC3eACA5", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -260,7 +319,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x5191aA68c7dB195181Dd2441dBE23A48EA24b040", + "address": "0x038B86d9d8FAFdd0a02ebd1A476432877b0107C8", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x038B86d9d8FAFdd0a02ebd1A476432877b0107C8", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -270,7 +333,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x8F9422aa37215c8b3D1Ea1674138107F84D68F26", + "address": "0x1A1FEe7EeD918BD762173e4dc5EfDB8a78C924A8", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x1A1FEe7EeD918BD762173e4dc5EfDB8a78C924A8", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -280,7 +347,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xa89E20284Bd638F31b0011D0fC754Fc9d2fa73e3", + "address": "0x500D1d6A4c7D8Ae28240b47c8FCde034D827fD5e", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x500D1d6A4c7D8Ae28240b47c8FCde034D827fD5e", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -290,7 +361,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xaA935993065F2dDB1d13623B1941C7AEE3A60F23", + "address": "0xc4905364b78a742ccce7B890A89514061E47068D", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0xc4905364b78a742ccce7B890A89514061E47068D", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -300,7 +375,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x35A2624888e207e4B3434E9a9E250bF6Ee68FeA3", + "address": "0xD6C850aeBFDC46D7F4c207e445cC0d6B0919BDBe", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0xD6C850aeBFDC46D7F4c207e445cC0d6B0919BDBe", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -310,7 +389,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x1f569c307949a908A4b8Ff7453a88Ca0b8D8df13", + "address": "0x8B5B7a6055E54a36fF574bbE40cf2eA68d5554b3", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x8B5B7a6055E54a36fF574bbE40cf2eA68d5554b3", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -320,7 +403,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x4301cb254CCc126B9eb9cbBE030C6FDA2FA16D4a", + "address": "0xEcc0a6dbC0bb4D51E4F84A315a9e5B0438cAD4f0", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0xEcc0a6dbC0bb4D51E4F84A315a9e5B0438cAD4f0", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -330,7 +417,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x0766c9592a8686CAB0081b4f35449462c6e82F11", + "address": "0x20Ce94F404343aD2752A2D01b43fa407db9E0D00", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x20Ce94F404343aD2752A2D01b43fa407db9E0D00", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -340,7 +431,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xaF6D34adD35E1A565be4539E4d1069c48A49C953", + "address": "0x1d80315fac6aBd3EfeEbE97dEc44461ba7556160", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x1d80315fac6aBd3EfeEbE97dEc44461ba7556160", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -350,7 +445,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x48bb3E35D2D6994374db457a6Bf61de2d9cC8E49", + "address": "0x2D8553F9ddA85A9B3259F6Bf26911364B85556F5", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x2D8553F9ddA85A9B3259F6Bf26911364B85556F5", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -360,7 +459,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x1E59BA56B1F61c3Ee946D8c7e2994B4A9b0cA45C", + "address": "0x52d3b94181f8654db2530b0fEe1B19173f519C52", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x52d3b94181f8654db2530b0fEe1B19173f519C52", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -370,7 +473,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x53813198c75959DDB604462831d8989C29152164", + "address": "0xd15468525c35BDBC1eD8F2e09A00F8a173437f2f", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0xd15468525c35BDBC1eD8F2e09A00F8a173437f2f", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -380,7 +487,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x0eD6115873ce6B807a03FE0df1f940387779b729", + "address": "0x7e35Eaf7e8FBd7887ad538D4A38Df5BbD073814a", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x7e35Eaf7e8FBd7887ad538D4A38Df5BbD073814a", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -390,7 +501,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xFFfDa24e7E3d5F89a24278f53d6f0F81B3bE0d6B", + "address": "0x5bcb88A0d20426e451332eE6C4324b0e663c50E0", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x5bcb88A0d20426e451332eE6C4324b0e663c50E0", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -400,7 +515,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x5889354f21A1C8D8D2f82669d778f6Dab778B519", + "address": "0x3521eF8AaB0323004A6dD8b03CE890F4Ea3A13f5", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x3521eF8AaB0323004A6dD8b03CE890F4Ea3A13f5", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -410,7 +529,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x09F7bF33B3F8922268B34103af3a8AF83148C9B1", + "address": "0x53369fd4680FfE3DfF39Fc6DDa9CfbfD43daeA2E", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x53369fd4680FfE3DfF39Fc6DDa9CfbfD43daeA2E", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -420,7 +543,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x8f3966F7d53Fd5f12b701C8835e1e32541613869", + "address": "0xB00cC45B4a7d3e1FEE684cFc4417998A1c183e6d", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0xB00cC45B4a7d3e1FEE684cFc4417998A1c183e6d", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -430,45 +557,64 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x9Dc554694756dC303a087e04bA6918C333Bc26a7", + "address": "0x58F132FBB86E21545A4Bace3C19f1C05d86d7A22", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x58F132FBB86E21545A4Bace3C19f1C05d86d7A22", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, "AaveProtocolTestHelpers": { "buidlerevm": { - "address": "0xde9595927B00361Ed7987a181Fb09EC6f31b451c" + "address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4" }, "localhost": { - "address": "0x9305d862ee95a899b83906Cd9CB666aC269E5f66" + "address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4" + }, + "coverage": { + "address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4" } }, "StableDebtToken": { "buidlerevm": { - "address": "0x5f7134cd38C826a7649f9Cc47dda24d834DD2967", + "address": "0xB660Fdd109a95718cB9d20E3A89EE6cE342aDcB6", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x02BB514187B830d6A2111197cd7D8cb60650B970", + "address": "0xB660Fdd109a95718cB9d20E3A89EE6cE342aDcB6", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0xB660Fdd109a95718cB9d20E3A89EE6cE342aDcB6", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, "VariableDebtToken": { "buidlerevm": { - "address": "0xE91bBe8ee03560E3dda2786f95335F5399813Ca0", + "address": "0x830bceA96E56DBC1F8578f75fBaC0AF16B32A07d", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x6774Ce86Abf5EBB22E9F45b5f55daCbB4170aD7f", + "address": "0x830bceA96E56DBC1F8578f75fBaC0AF16B32A07d", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x830bceA96E56DBC1F8578f75fBaC0AF16B32A07d", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, "AToken": { "localhost": { - "address": "0x007C1a44e85bDa8F562F916685A9DC8BdC6542bF", + "address": "0xA0AB1cB92A4AF81f84dCd258155B5c25D247b54E", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "buidlerevm": { - "address": "0x3870a14c5057f596e385ea21537792fE4fF4C1BE", + "address": "0xA0AB1cB92A4AF81f84dCd258155B5c25D247b54E", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0xA0AB1cB92A4AF81f84dCd258155B5c25D247b54E", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -478,7 +624,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xFBdF1E93D0D88145e3CcA63bf8d513F83FB0903b", + "address": "0xa89E20284Bd638F31b0011D0fC754Fc9d2fa73e3", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x392E5355a0e88Bd394F717227c752670fb3a8020", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -488,7 +638,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xEcb928A3c079a1696Aa5244779eEc3dE1717fACd", + "address": "0xf784709d2317D872237C4bC22f867d1BAe2913AB", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0xf784709d2317D872237C4bC22f867d1BAe2913AB", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -498,7 +652,11 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0xE45fF4A0A8D0E9734C73874c034E03594E15ba28", + "address": "0xaA935993065F2dDB1d13623B1941C7AEE3A60F23", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0x3b050AFb4ac4ACE646b31fF3639C1CD43aC31460", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, @@ -508,13 +666,23 @@ "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" }, "localhost": { - "address": "0x5cCC6Abc4c9F7262B9485797a848Ec6CC28A11dF", + "address": "0x35A2624888e207e4B3434E9a9E250bF6Ee68FeA3", + "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" + }, + "coverage": { + "address": "0xEBAB67ee3ef604D5c250A53b4b8fcbBC6ec3007C", "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6" } }, "MockSwapAdapter": { "buidlerevm": { "address": "0xBEF0d4b9c089a5883741fC14cbA352055f35DDA2" + }, + "coverage": { + "address": "0xBEF0d4b9c089a5883741fC14cbA352055f35DDA2" + }, + "localhost": { + "address": "0xBEF0d4b9c089a5883741fC14cbA352055f35DDA2" } } } diff --git a/helpers/contracts-helpers.ts b/helpers/contracts-helpers.ts index 163e62f7..ef9f4892 100644 --- a/helpers/contracts-helpers.ts +++ b/helpers/contracts-helpers.ts @@ -46,6 +46,7 @@ const { } = CommonsConfig; export type MockTokenMap = {[symbol: string]: MintableERC20}; +import {ZERO_ADDRESS} from './constants'; import {MockSwapAdapter} from '../types/MockSwapAdapter'; import {signTypedData_v4, TypedData} from 'eth-sig-util'; import {fromRpcSig, ECDSASignature} from 'ethereumjs-util'; @@ -421,7 +422,14 @@ export const deployGenericAToken = async ( verify: boolean ) => { const id = eContractid.AToken; - const args = [poolAddress, underlyingAssetAddress, name, symbol, incentivesController]; + const args = [ + poolAddress, + underlyingAssetAddress, + ZERO_ADDRESS, + name, + symbol, + incentivesController, + ]; const instance = await deployContract(id, args); if (verify) { @@ -478,7 +486,23 @@ export const getAToken = async (address?: tEthereumAddress) => { ); }; -export const getMintableERC20 = async (address: tEthereumAddress) => { +export const getStableDebtToken = async (address?: tEthereumAddress) => { + return await getContract( + eContractid.StableDebtToken, + address || + (await getDb().get(`${eContractid.StableDebtToken}.${BRE.network.name}`).value()).address + ); +}; + +export const getVariableDebtToken = async (address?: tEthereumAddress) => { + return await getContract( + eContractid.VariableDebtToken, + address || + (await getDb().get(`${eContractid.VariableDebtToken}.${BRE.network.name}`).value()).address + ); +}; + +export const getMintableErc20 = async (address: tEthereumAddress) => { return await getContract( eContractid.MintableERC20, address || diff --git a/package-lock.json b/package-lock.json index 2fd43fa5..e0d0567e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5264,13 +5264,13 @@ "dependencies": { "ansi-regex": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "resolved": false, "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, "ansi-styles": { "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "resolved": false, "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { @@ -5279,7 +5279,7 @@ }, "bindings": { "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "resolved": false, "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", "dev": true, "requires": { @@ -5288,7 +5288,7 @@ }, "bip66": { "version": "1.1.5", - "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", + "resolved": false, "integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=", "dev": true, "requires": { @@ -5297,19 +5297,19 @@ }, "bn.js": { "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "resolved": false, "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", "dev": true }, "brorand": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "resolved": false, "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", "dev": true }, "browserify-aes": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "resolved": false, "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "dev": true, "requires": { @@ -5323,25 +5323,25 @@ }, "buffer-from": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "resolved": false, "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, "buffer-xor": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "resolved": false, "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", "dev": true }, "camelcase": { "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "resolved": false, "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true }, "cipher-base": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "resolved": false, "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", "dev": true, "requires": { @@ -5351,7 +5351,7 @@ }, "cliui": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "resolved": false, "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", "dev": true, "requires": { @@ -5362,7 +5362,7 @@ }, "color-convert": { "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "resolved": false, "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, "requires": { @@ -5371,13 +5371,13 @@ }, "color-name": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "resolved": false, "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, "create-hash": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "resolved": false, "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "dev": true, "requires": { @@ -5390,7 +5390,7 @@ }, "create-hmac": { "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "resolved": false, "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "dev": true, "requires": { @@ -5404,7 +5404,7 @@ }, "cross-spawn": { "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "resolved": false, "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "dev": true, "requires": { @@ -5417,13 +5417,13 @@ }, "decamelize": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "resolved": false, "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, "drbg.js": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", + "resolved": false, "integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs=", "dev": true, "requires": { @@ -5434,7 +5434,7 @@ }, "elliptic": { "version": "6.5.0", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.0.tgz", + "resolved": false, "integrity": "sha512-eFOJTMyCYb7xtE/caJ6JJu+bhi67WCYNbkGSknu20pmM8Ke/bqOfdnZWxyoGN26JgfxTbXrsCkEw4KheCT/KGg==", "dev": true, "requires": { @@ -5449,13 +5449,13 @@ }, "emoji-regex": { "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "resolved": false, "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, "end-of-stream": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "resolved": false, "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "dev": true, "requires": { @@ -5464,7 +5464,7 @@ }, "ethereumjs-util": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz", + "resolved": false, "integrity": "sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q==", "dev": true, "requires": { @@ -5479,7 +5479,7 @@ }, "ethjs-util": { "version": "0.1.6", - "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", + "resolved": false, "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", "dev": true, "requires": { @@ -5489,7 +5489,7 @@ }, "evp_bytestokey": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "resolved": false, "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", "dev": true, "requires": { @@ -5499,7 +5499,7 @@ }, "execa": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "resolved": false, "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", "dev": true, "requires": { @@ -5514,13 +5514,13 @@ }, "file-uri-to-path": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "resolved": false, "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", "dev": true }, "find-up": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "resolved": false, "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "dev": true, "requires": { @@ -5529,13 +5529,13 @@ }, "get-caller-file": { "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "resolved": false, "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, "get-stream": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "resolved": false, "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "dev": true, "requires": { @@ -5544,7 +5544,7 @@ }, "hash-base": { "version": "3.0.4", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "resolved": false, "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", "dev": true, "requires": { @@ -5554,7 +5554,7 @@ }, "hash.js": { "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "resolved": false, "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", "dev": true, "requires": { @@ -5564,7 +5564,7 @@ }, "hmac-drbg": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "resolved": false, "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "dev": true, "requires": { @@ -5575,43 +5575,43 @@ }, "inherits": { "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "resolved": false, "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "invert-kv": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "resolved": false, "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", "dev": true }, "is-fullwidth-code-point": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "resolved": false, "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "is-hex-prefixed": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "resolved": false, "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=", "dev": true }, "is-stream": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "resolved": false, "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, "isexe": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "resolved": false, "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, "keccak": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", + "resolved": false, "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", "dev": true, "requires": { @@ -5623,7 +5623,7 @@ }, "lcid": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "resolved": false, "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", "dev": true, "requires": { @@ -5632,7 +5632,7 @@ }, "locate-path": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "resolved": false, "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { @@ -5642,7 +5642,7 @@ }, "map-age-cleaner": { "version": "0.1.3", - "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "resolved": false, "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", "dev": true, "requires": { @@ -5651,7 +5651,7 @@ }, "md5.js": { "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "resolved": false, "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", "dev": true, "requires": { @@ -5662,7 +5662,7 @@ }, "mem": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", + "resolved": false, "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", "dev": true, "requires": { @@ -5673,37 +5673,37 @@ }, "mimic-fn": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "resolved": false, "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, "minimalistic-assert": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "resolved": false, "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", "dev": true }, "minimalistic-crypto-utils": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "resolved": false, "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", "dev": true }, "nan": { "version": "2.14.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "resolved": false, "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", "dev": true }, "nice-try": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "resolved": false, "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, "npm-run-path": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "resolved": false, "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, "requires": { @@ -5712,7 +5712,7 @@ }, "once": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "resolved": false, "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { @@ -5721,7 +5721,7 @@ }, "os-locale": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", + "resolved": false, "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", "dev": true, "requires": { @@ -5732,25 +5732,25 @@ }, "p-defer": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "resolved": false, "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", "dev": true }, "p-finally": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "resolved": false, "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, "p-is-promise": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", + "resolved": false, "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", "dev": true }, "p-limit": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", + "resolved": false, "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", "dev": true, "requires": { @@ -5759,7 +5759,7 @@ }, "p-locate": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "resolved": false, "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "dev": true, "requires": { @@ -5768,25 +5768,25 @@ }, "p-try": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "resolved": false, "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, "path-exists": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "resolved": false, "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true }, "path-key": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "resolved": false, "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, "pump": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "resolved": false, "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "dev": true, "requires": { @@ -5796,19 +5796,19 @@ }, "require-directory": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "resolved": false, "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, "require-main-filename": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "resolved": false, "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, "ripemd160": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "resolved": false, "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", "dev": true, "requires": { @@ -5818,7 +5818,7 @@ }, "rlp": { "version": "2.2.3", - "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.3.tgz", + "resolved": false, "integrity": "sha512-l6YVrI7+d2vpW6D6rS05x2Xrmq8oW7v3pieZOJKBEdjuTF4Kz/iwk55Zyh1Zaz+KOB2kC8+2jZlp2u9L4tTzCQ==", "dev": true, "requires": { @@ -5828,13 +5828,13 @@ }, "safe-buffer": { "version": "5.2.0", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "resolved": false, "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", "dev": true }, "secp256k1": { "version": "3.7.1", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.7.1.tgz", + "resolved": false, "integrity": "sha512-1cf8sbnRreXrQFdH6qsg2H71Xw91fCCS9Yp021GnUNJzWJS/py96fS4lHbnTnouLp08Xj6jBoBB6V78Tdbdu5g==", "dev": true, "requires": { @@ -5850,19 +5850,19 @@ }, "semver": { "version": "5.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "resolved": false, "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", "dev": true }, "set-blocking": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "resolved": false, "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, "sha.js": { "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "resolved": false, "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, "requires": { @@ -5872,7 +5872,7 @@ }, "shebang-command": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "resolved": false, "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { @@ -5881,25 +5881,25 @@ }, "shebang-regex": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "resolved": false, "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, "signal-exit": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "resolved": false, "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, "source-map": { "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "resolved": false, "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, "source-map-support": { "version": "0.5.12", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz", + "resolved": false, "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", "dev": true, "requires": { @@ -5909,7 +5909,7 @@ }, "string-width": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "resolved": false, "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { @@ -5920,7 +5920,7 @@ }, "strip-ansi": { "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "resolved": false, "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { @@ -5929,13 +5929,13 @@ }, "strip-eof": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "resolved": false, "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, "strip-hex-prefix": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "resolved": false, "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", "dev": true, "requires": { @@ -5944,7 +5944,7 @@ }, "which": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "resolved": false, "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "requires": { @@ -5953,13 +5953,13 @@ }, "which-module": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "resolved": false, "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, "wrap-ansi": { "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "resolved": false, "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", "dev": true, "requires": { @@ -5970,19 +5970,19 @@ }, "wrappy": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "resolved": false, "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, "y18n": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "resolved": false, "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", "dev": true }, "yargs": { "version": "13.2.4", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.4.tgz", + "resolved": false, "integrity": "sha512-HG/DWAJa1PAnHT9JAhNa8AbAv3FPaiLzioSjCcmuXXhP8MlpHO5vwls4g4j6n30Z74GVQj8Xa62dWVx1QCGklg==", "dev": true, "requires": { @@ -6001,7 +6001,7 @@ }, "yargs-parser": { "version": "13.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", + "resolved": false, "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", "dev": true, "requires": { diff --git a/test/__setup.spec.ts b/test/__setup.spec.ts index d87280a1..616fecf4 100644 --- a/test/__setup.spec.ts +++ b/test/__setup.spec.ts @@ -85,7 +85,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => { const addressesProviderRegistry = await deployLendingPoolAddressesProviderRegistry(); await waitForTx( - await addressesProviderRegistry.registerAddressesProvider(addressesProvider.address, 0) + await addressesProviderRegistry.registerAddressesProvider(addressesProvider.address, 1) ); const lendingPoolImpl = await deployLendingPool(); diff --git a/test/addresses-provider-registry.spec.ts b/test/addresses-provider-registry.spec.ts new file mode 100644 index 00000000..457514e4 --- /dev/null +++ b/test/addresses-provider-registry.spec.ts @@ -0,0 +1,93 @@ +import {TestEnv, makeSuite} from './helpers/make-suite'; +import {RAY, APPROVAL_AMOUNT_LENDING_POOL, ZERO_ADDRESS} from '../helpers/constants'; +import {convertToCurrencyDecimals} from '../helpers/contracts-helpers'; +import {ProtocolErrors} from '../helpers/types'; + +const {expect} = require('chai'); + +makeSuite('AddressesProviderRegistry', (testEnv: TestEnv) => { + it('Checks the addresses provider is added to the registry', async () => { + const {addressesProvider, registry} = testEnv; + + const providers = await registry.getAddressesProvidersList(); + + expect(providers.length).to.be.equal(1, 'Invalid length of the addresses providers list'); + expect(providers[0].toString()).to.be.equal( + addressesProvider.address, + ' Invalid addresses provider added to the list' + ); + }); + + it('Registers a new mock addresses provider', async () => { + const {users, registry} = testEnv; + + //simulating an addresses provider using the users[1] wallet address + await registry.registerAddressesProvider(users[1].address, '2'); + + const providers = await registry.getAddressesProvidersList(); + + expect(providers.length).to.be.equal(2, 'Invalid length of the addresses providers list'); + expect(providers[1].toString()).to.be.equal( + users[1].address, + ' Invalid addresses provider added to the list' + ); + }); + + it('Removes the mock addresses provider', async () => { + const {users, registry, addressesProvider} = testEnv; + + //checking the isAddressesProviderRegistered function + const id = await registry.isAddressesProviderRegistered(users[1].address); + + expect(id).to.be.equal('2', 'Invalid isRegistered return value'); + + await registry.unregisterAddressesProvider(users[1].address); + + const providers = await registry.getAddressesProvidersList(); + + expect(providers.length).to.be.equal(2, 'Invalid length of the addresses providers list'); + expect(providers[0].toString()).to.be.equal( + addressesProvider.address, + ' Invalid addresses provider added to the list' + ); + expect(providers[1].toString()).to.be.equal(ZERO_ADDRESS, ' Invalid addresses'); + }); + + it('Tries to remove a unregistered addressesProvider', async () => { + const {PROVIDER_NOT_REGISTERED} = ProtocolErrors; + + const {users, registry} = testEnv; + + await expect(registry.unregisterAddressesProvider(users[2].address)).to.be.revertedWith( + PROVIDER_NOT_REGISTERED + ); + }); + + it('Tries to remove a unregistered addressesProvider', async () => { + const {PROVIDER_NOT_REGISTERED} = ProtocolErrors; + + const {users, registry} = testEnv; + + await expect(registry.unregisterAddressesProvider(users[2].address)).to.be.revertedWith( + PROVIDER_NOT_REGISTERED + ); + }); + + it('Tries to add an already added addressesProvider with a different id. Should overwrite the previous id', async () => { + const {users, registry, addressesProvider} = testEnv; + + await registry.registerAddressesProvider(addressesProvider.address, '2'); + + const providers = await registry.getAddressesProvidersList(); + + const id = await registry.isAddressesProviderRegistered(addressesProvider.address); + + expect(providers.length).to.be.equal(2, 'Invalid length of the addresses providers list'); + + expect(providers[0].toString()).to.be.equal( + addressesProvider.address, + ' Invalid addresses provider added to the list' + ); + expect(providers[1].toString()).to.be.equal(ZERO_ADDRESS, ' Invalid addresses'); + }); +}); diff --git a/test/configurator.spec.ts b/test/configurator.spec.ts index 95c48e66..5056eb8a 100644 --- a/test/configurator.spec.ts +++ b/test/configurator.spec.ts @@ -46,16 +46,54 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => { it('Freezes the ETH reserve', async () => { const {configurator, pool, weth} = testEnv; await configurator.freezeReserve(weth.address); - const {isFreezed} = await pool.getReserveConfigurationData(weth.address); + const { + decimals, + ltv, + liquidationBonus, + liquidationThreshold, + reserveFactor, + stableBorrowRateEnabled, + borrowingEnabled, + isActive, + isFreezed, + } = await pool.getReserveConfigurationData(weth.address); + + expect(borrowingEnabled).to.be.equal(true); + expect(isActive).to.be.equal(true); expect(isFreezed).to.be.equal(true); + expect(decimals).to.be.equal(18); + expect(ltv).to.be.equal(7500); + expect(liquidationThreshold).to.be.equal(8000); + expect(liquidationBonus).to.be.equal(10500); + expect(stableBorrowRateEnabled).to.be.equal(true); + expect(reserveFactor).to.be.equal(0); }); it('Unfreezes the ETH reserve', async () => { const {configurator, pool, weth} = testEnv; await configurator.unfreezeReserve(weth.address); - const {isFreezed} = await pool.getReserveConfigurationData(weth.address); + const { + decimals, + ltv, + liquidationBonus, + liquidationThreshold, + reserveFactor, + stableBorrowRateEnabled, + borrowingEnabled, + isActive, + isFreezed, + } = await pool.getReserveConfigurationData(weth.address); + + expect(borrowingEnabled).to.be.equal(true); + expect(isActive).to.be.equal(true); expect(isFreezed).to.be.equal(false); + expect(decimals).to.be.equal(18); + expect(ltv).to.be.equal(7500); + expect(liquidationThreshold).to.be.equal(8000); + expect(liquidationBonus).to.be.equal(10500); + expect(stableBorrowRateEnabled).to.be.equal(true); + expect(reserveFactor).to.be.equal(0); }); it('Check the onlyAaveAdmin on freezeReserve ', async () => { @@ -77,16 +115,56 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => { it('Deactivates the ETH reserve for borrowing', async () => { const {configurator, pool, weth} = testEnv; await configurator.disableBorrowingOnReserve(weth.address); - const {borrowingEnabled} = await pool.getReserveConfigurationData(weth.address); + const { + decimals, + ltv, + liquidationBonus, + liquidationThreshold, + reserveFactor, + stableBorrowRateEnabled, + borrowingEnabled, + isActive, + isFreezed, + } = await pool.getReserveConfigurationData(weth.address); + expect(borrowingEnabled).to.be.equal(false); + expect(isActive).to.be.equal(true); + expect(isFreezed).to.be.equal(false); + expect(decimals).to.be.equal(18); + expect(ltv).to.be.equal(7500); + expect(liquidationThreshold).to.be.equal(8000); + expect(liquidationBonus).to.be.equal(10500); + expect(stableBorrowRateEnabled).to.be.equal(true); + expect(reserveFactor).to.be.equal(0); }); it('Activates the ETH reserve for borrowing', async () => { const {configurator, pool, weth} = testEnv; await configurator.enableBorrowingOnReserve(weth.address, true); - const {borrowingEnabled} = await pool.getReserveConfigurationData(weth.address); const {variableBorrowIndex} = await pool.getReserveData(weth.address); + + const { + decimals, + ltv, + liquidationBonus, + liquidationThreshold, + reserveFactor, + stableBorrowRateEnabled, + borrowingEnabled, + isActive, + isFreezed, + } = await pool.getReserveConfigurationData(weth.address); + expect(borrowingEnabled).to.be.equal(true); + expect(isActive).to.be.equal(true); + expect(isFreezed).to.be.equal(false); + expect(decimals).to.be.equal(18); + expect(ltv).to.be.equal(7500); + expect(liquidationThreshold).to.be.equal(8000); + expect(liquidationBonus).to.be.equal(10500); + expect(stableBorrowRateEnabled).to.be.equal(true); + expect(reserveFactor).to.be.equal(0); + expect(variableBorrowIndex.toString()).to.be.equal(RAY); }); @@ -109,16 +187,54 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => { it('Deactivates the ETH reserve as collateral', async () => { const {configurator, pool, weth} = testEnv; await configurator.disableReserveAsCollateral(weth.address); - const {usageAsCollateralEnabled} = await pool.getReserveConfigurationData(weth.address); - expect(usageAsCollateralEnabled).to.be.equal(false); + const { + decimals, + ltv, + liquidationBonus, + liquidationThreshold, + reserveFactor, + stableBorrowRateEnabled, + borrowingEnabled, + isActive, + isFreezed, + } = await pool.getReserveConfigurationData(weth.address); + + expect(borrowingEnabled).to.be.equal(true); + expect(isActive).to.be.equal(true); + expect(isFreezed).to.be.equal(false); + expect(decimals).to.be.equal(18); + expect(ltv).to.be.equal(0); + expect(liquidationThreshold).to.be.equal(8000); + expect(liquidationBonus).to.be.equal(10500); + expect(stableBorrowRateEnabled).to.be.equal(true); + expect(reserveFactor).to.be.equal(0); }); it('Activates the ETH reserve as collateral', async () => { const {configurator, pool, weth} = testEnv; - await configurator.enableReserveAsCollateral(weth.address, '75', '80', '105'); + await configurator.enableReserveAsCollateral(weth.address, '7500', '8000', '10500'); - const {usageAsCollateralEnabled} = await pool.getReserveConfigurationData(weth.address); - expect(usageAsCollateralEnabled).to.be.equal(true); + const { + decimals, + ltv, + liquidationBonus, + liquidationThreshold, + reserveFactor, + stableBorrowRateEnabled, + borrowingEnabled, + isActive, + isFreezed, + } = await pool.getReserveConfigurationData(weth.address); + + expect(borrowingEnabled).to.be.equal(true); + expect(isActive).to.be.equal(true); + expect(isFreezed).to.be.equal(false); + expect(decimals).to.be.equal(18); + expect(ltv).to.be.equal(7500); + expect(liquidationThreshold).to.be.equal(8000); + expect(liquidationBonus).to.be.equal(10500); + expect(stableBorrowRateEnabled).to.be.equal(true); + expect(reserveFactor).to.be.equal(0); }); it('Check the onlyAaveAdmin on disableReserveAsCollateral ', async () => { @@ -142,15 +258,53 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => { it('Disable stable borrow rate on the ETH reserve', async () => { const {configurator, pool, weth} = testEnv; await configurator.disableReserveStableRate(weth.address); - const {stableBorrowRateEnabled} = await pool.getReserveConfigurationData(weth.address); + const { + decimals, + ltv, + liquidationBonus, + liquidationThreshold, + reserveFactor, + stableBorrowRateEnabled, + borrowingEnabled, + isActive, + isFreezed, + } = await pool.getReserveConfigurationData(weth.address); + + expect(borrowingEnabled).to.be.equal(true); + expect(isActive).to.be.equal(true); + expect(isFreezed).to.be.equal(false); + expect(decimals).to.be.equal(18); + expect(ltv).to.be.equal(7500); + expect(liquidationThreshold).to.be.equal(8000); + expect(liquidationBonus).to.be.equal(10500); expect(stableBorrowRateEnabled).to.be.equal(false); + expect(reserveFactor).to.be.equal(0); }); it('Enables stable borrow rate on the ETH reserve', async () => { const {configurator, pool, weth} = testEnv; await configurator.enableReserveStableRate(weth.address); - const {stableBorrowRateEnabled} = await pool.getReserveConfigurationData(weth.address); + const { + decimals, + ltv, + liquidationBonus, + liquidationThreshold, + reserveFactor, + stableBorrowRateEnabled, + borrowingEnabled, + isActive, + isFreezed, + } = await pool.getReserveConfigurationData(weth.address); + + expect(borrowingEnabled).to.be.equal(true); + expect(isActive).to.be.equal(true); + expect(isFreezed).to.be.equal(false); + expect(decimals).to.be.equal(18); + expect(ltv).to.be.equal(7500); + expect(liquidationThreshold).to.be.equal(8000); + expect(liquidationBonus).to.be.equal(10500); expect(stableBorrowRateEnabled).to.be.equal(true); + expect(reserveFactor).to.be.equal(0); }); it('Check the onlyAaveAdmin on disableReserveStableRate', async () => { @@ -171,9 +325,28 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => { it('Changes LTV of the reserve', async () => { const {configurator, pool, weth} = testEnv; - await configurator.setLtv(weth.address, '60'); - const {ltv} = await pool.getReserveConfigurationData(weth.address); - expect(ltv.toString()).to.be.bignumber.equal('60', 'Invalid LTV'); + await configurator.setLtv(weth.address, '6000'); + const { + decimals, + ltv, + liquidationBonus, + liquidationThreshold, + reserveFactor, + stableBorrowRateEnabled, + borrowingEnabled, + isActive, + isFreezed, + } = await pool.getReserveConfigurationData(weth.address); + + expect(borrowingEnabled).to.be.equal(true); + expect(isActive).to.be.equal(true); + expect(isFreezed).to.be.equal(false); + expect(decimals).to.be.equal(18); + expect(ltv).to.be.equal(6000); + expect(liquidationThreshold).to.be.equal(8000); + expect(liquidationBonus).to.be.equal(10500); + expect(stableBorrowRateEnabled).to.be.equal(true); + expect(reserveFactor).to.be.equal(0); }); it('Check the onlyAaveAdmin on setLtv', async () => { @@ -184,14 +357,64 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => { ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN); }); + it('Changes the reserve factor of the reserve', async () => { + const {configurator, pool, weth} = testEnv; + await configurator.setReserveFactor(weth.address, '1000'); + const { + decimals, + ltv, + liquidationBonus, + liquidationThreshold, + reserveFactor, + stableBorrowRateEnabled, + borrowingEnabled, + isActive, + isFreezed, + } = await pool.getReserveConfigurationData(weth.address); + + expect(borrowingEnabled).to.be.equal(true); + expect(isActive).to.be.equal(true); + expect(isFreezed).to.be.equal(false); + expect(decimals).to.be.equal(18); + expect(ltv).to.be.equal(6000); + expect(liquidationThreshold).to.be.equal(8000); + expect(liquidationBonus).to.be.equal(10500); + expect(stableBorrowRateEnabled).to.be.equal(true); + expect(reserveFactor).to.be.equal(1000); + }); + + it('Check the onlyLendingPoolManager on setReserveFactor', async () => { + const {configurator, users, weth} = testEnv; + await expect( + configurator.connect(users[2].signer).setReserveFactor(weth.address, '2000'), + CALLER_NOT_AAVE_ADMIN + ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN); + }); + it('Changes liquidation threshold of the reserve', async () => { const {configurator, pool, weth} = testEnv; - await configurator.setLiquidationThreshold(weth.address, '75'); - const {liquidationThreshold} = await pool.getReserveConfigurationData(weth.address); - expect(liquidationThreshold.toString()).to.be.bignumber.equal( - '75', - 'Invalid Liquidation threshold' - ); + await configurator.setLiquidationThreshold(weth.address, '7500'); + const { + decimals, + ltv, + liquidationBonus, + liquidationThreshold, + reserveFactor, + stableBorrowRateEnabled, + borrowingEnabled, + isActive, + isFreezed, + } = await pool.getReserveConfigurationData(weth.address); + + expect(borrowingEnabled).to.be.equal(true); + expect(isActive).to.be.equal(true); + expect(isFreezed).to.be.equal(false); + expect(decimals).to.be.equal(18); + expect(ltv).to.be.equal(6000); + expect(liquidationThreshold).to.be.equal(7500); + expect(liquidationBonus).to.be.equal(10500); + expect(stableBorrowRateEnabled).to.be.equal(true); + expect(reserveFactor).to.be.equal(1000); }); it('Check the onlyAaveAdmin on setLiquidationThreshold', async () => { @@ -204,12 +427,28 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => { it('Changes liquidation bonus of the reserve', async () => { const {configurator, pool, weth} = testEnv; - await configurator.setLiquidationBonus(weth.address, '110'); - const {liquidationBonus} = await pool.getReserveConfigurationData(weth.address); - expect(liquidationBonus.toString()).to.be.bignumber.equal( - '110', - 'Invalid Liquidation discount' - ); + await configurator.setLiquidationBonus(weth.address, '11000'); + const { + decimals, + ltv, + liquidationBonus, + liquidationThreshold, + reserveFactor, + stableBorrowRateEnabled, + borrowingEnabled, + isActive, + isFreezed, + } = await pool.getReserveConfigurationData(weth.address); + + expect(borrowingEnabled).to.be.equal(true); + expect(isActive).to.be.equal(true); + expect(isFreezed).to.be.equal(false); + expect(decimals).to.be.equal(18); + expect(ltv).to.be.equal(6000); + expect(liquidationThreshold).to.be.equal(7500); + expect(liquidationBonus).to.be.equal(11000); + expect(stableBorrowRateEnabled).to.be.equal(true); + expect(reserveFactor).to.be.equal(1000); }); it('Check the onlyAaveAdmin on setLiquidationBonus', async () => { diff --git a/test/flash-liquidation-with-collateral.spec.ts b/test/flash-liquidation-with-collateral.spec.ts index 839f999e..fd157282 100644 --- a/test/flash-liquidation-with-collateral.spec.ts +++ b/test/flash-liquidation-with-collateral.spec.ts @@ -124,7 +124,9 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn ).minus(usdcUserDataBefore.currentVariableDebt); const expectedStableDebtIncrease = calcExpectedStableDebtTokenBalance( - usdcUserDataBefore, + usdcUserDataBefore.principalStableDebt, + usdcUserDataBefore.stableBorrowRate, + usdcUserDataBefore.stableRateLastUpdated, new BigNumber(repayWithCollateralTimestamp) ).minus(usdcUserDataBefore.currentStableDebt); @@ -232,7 +234,7 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn userData: usdcUserDataBefore, } = await getContractsData(usdc.address, user.address, testEnv); - const amountToRepay = usdcReserveDataBefore.totalBorrowsVariable.dividedBy(2).toFixed(0); + const amountToRepay = usdcReserveDataBefore.totalVariableDebt.dividedBy(2).toFixed(0); await mockSwapAdapter.setAmountToReturn(amountToRepay); await waitForTx( @@ -294,7 +296,7 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn 'INVALID_DEBT_POSITION' ); - expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.equal( + expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.almostEqual( new BigNumber(wethUserDataBefore.currentATokenBalance).minus( expectedCollateralLiquidated.toString() ), @@ -367,7 +369,7 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn userData: usdcUserDataBefore, } = await getContractsData(usdc.address, user.address, testEnv); - const amountToRepay = usdcReserveDataBefore.totalBorrowsVariable.toFixed(0); + const amountToRepay = usdcReserveDataBefore.totalVariableDebt.toFixed(0); await mockSwapAdapter.setAmountToReturn(amountToRepay); await waitForTx( @@ -485,7 +487,7 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn testEnv ); - const amountToRepay = daiReserveDataBefore.totalBorrowsVariable.toString(); + const amountToRepay = daiReserveDataBefore.totalVariableDebt.toString(); await waitForTx(await mockSwapAdapter.setTryReentrancy(true)); @@ -521,7 +523,7 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn ); // First half - const amountToRepay = daiReserveDataBefore.totalBorrowsVariable.dividedBy(2).toString(); + const amountToRepay = daiReserveDataBefore.totalVariableDebt.dividedBy(2).toString(); await mockSwapAdapter.setAmountToReturn(amountToRepay); await expect( @@ -567,7 +569,10 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn ); // First half - const amountToRepay = daiReserveDataBefore.totalBorrowsVariable.multipliedBy(0.6).toString(); + const amountToRepay = daiReserveDataBefore.totalVariableDebt + .multipliedBy(0.6) + .toFixed(0) + .toString(); await mockSwapAdapter.setAmountToReturn(amountToRepay); await waitForTx( @@ -653,7 +658,7 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn await increaseTime(1000); // Repay the remaining DAI - const amountToRepay = daiReserveDataBefore.totalBorrowsVariable.toString(); + const amountToRepay = daiReserveDataBefore.totalVariableDebt.toString(); await mockSwapAdapter.setAmountToReturn(amountToRepay); const receipt = await waitForTx( @@ -815,7 +820,7 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn new BigNumber(repayWithCollateralTimestamp) ).minus(usdcUserDataBefore.currentVariableDebt); - expect(usdcUserDataAfter.currentVariableDebt).to.be.bignumber.equal( + expect(usdcUserDataAfter.currentVariableDebt).to.be.bignumber.almostEqual( new BigNumber(usdcUserDataBefore.currentVariableDebt) .minus(expectedDebtCovered.toString()) .plus(expectedVariableDebtIncrease), @@ -830,12 +835,13 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn await oracle.setAssetPrice(dai.address, daiPrice); }); - it('User 5 deposits WETH and DAI, then borrows USDC at Variable, then disables WETH as collateral', async () => { + it('User 4 deposits WETH, LEND and DAI, then borrows USDC at Variable, then disables WETH as collateral', async () => { const {pool, weth, dai, usdc, users} = testEnv; const user = users[4]; const amountWETHToDeposit = parseEther('10'); - const amountDAIToDeposit = parseEther('60'); - const amountToBorrow = parseUnits('65', 6); + const amountDAIToDeposit = parseEther('100'); + + const amountToBorrow = parseUnits('75', 6); await weth.connect(user.signer).mint(amountWETHToDeposit); await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL); @@ -848,8 +854,8 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn await pool.connect(user.signer).borrow(usdc.address, amountToBorrow, 2, 0, user.address); }); - it('Liquidator tries to liquidates User 5 USDC loan by swapping his WETH collateral, should revert due WETH collateral disabled', async () => { - const {pool, weth, usdc, users, mockSwapAdapter, oracle} = testEnv; + it('Liquidator tries to liquidate User 5 USDC loan by swapping his WETH collateral, should revert due WETH collateral disabled', async () => { + const {pool, weth, dai, usdc, users, mockSwapAdapter, oracle} = testEnv; const user = users[4]; const liquidator = users[5]; @@ -871,6 +877,14 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn expect(wethUserDataBefore.usageAsCollateralEnabled).to.be.false; + //drop the price to set the HF below 1 + const daiPrice = await oracle.getAssetPrice(dai.address); + + await oracle.setAssetPrice( + dai.address, + new BigNumber(daiPrice.toString()).multipliedBy(0.9).toFixed(0) + ); + // Liquidator should NOT be able to liquidate himself with WETH, even if is disabled await mockSwapAdapter.setAmountToReturn(amountToRepay); await expect( @@ -885,6 +899,7 @@ makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEn '0x' ) ).to.be.revertedWith(COLLATERAL_CANNOT_BE_LIQUIDATED); + const repayWithCollateralTimestamp = await timeLatest(); const {userData: wethUserDataAfter} = await getContractsData( diff --git a/test/flashloan.spec.ts b/test/flashloan.spec.ts index 036a30fd..c2be90ed 100644 --- a/test/flashloan.spec.ts +++ b/test/flashloan.spec.ts @@ -62,8 +62,8 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => { const currentLiquidityIndex = reserveData.liquidityIndex; const totalLiquidity = new BigNumber(reserveData.availableLiquidity.toString()) - .plus(reserveData.totalBorrowsStable.toString()) - .plus(reserveData.totalBorrowsVariable.toString()); + .plus(reserveData.totalStableDebt.toString()) + .plus(reserveData.totalVariableDebt.toString()); expect(totalLiquidity.toString()).to.be.equal('1000720000000000000'); expect(currentLiquidityRate.toString()).to.be.equal('0'); @@ -89,8 +89,8 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => { const currentLiquidityIndex = reserveData.liquidityIndex; const totalLiquidity = new BigNumber(reserveData.availableLiquidity.toString()) - .plus(reserveData.totalBorrowsStable.toString()) - .plus(reserveData.totalBorrowsVariable.toString()); + .plus(reserveData.totalStableDebt.toString()) + .plus(reserveData.totalVariableDebt.toString()); expect(totalLiquidity.toString()).to.be.equal('1001620648000000000'); expect(currentLiqudityRate.toString()).to.be.equal('0'); @@ -244,8 +244,8 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => { const userData = await pool.getUserReserveData(usdc.address, depositor.address); const totalLiquidity = reserveData.availableLiquidity - .add(reserveData.totalBorrowsStable) - .add(reserveData.totalBorrowsVariable) + .add(reserveData.totalStableDebt) + .add(reserveData.totalVariableDebt) .toString(); const currentLiqudityRate = reserveData.liquidityRate.toString(); const currentLiquidityIndex = reserveData.liquidityIndex.toString(); diff --git a/test/helpers/actions.ts b/test/helpers/actions.ts index 990effd5..72ea65cc 100644 --- a/test/helpers/actions.ts +++ b/test/helpers/actions.ts @@ -20,7 +20,7 @@ import {getReserveAddressFromSymbol, getReserveData, getUserData} from './utils/ import { convertToCurrencyDecimals, getAToken, - getMintableERC20, + getMintableErc20, } from '../../helpers/contracts-helpers'; import {MAX_UINT_AMOUNT, ONE_YEAR} from '../../helpers/constants'; import {SignerWithAddress, TestEnv} from './make-suite'; @@ -31,6 +31,7 @@ import {ReserveData, UserReserveData} from './utils/interfaces'; import {ContractReceipt} from 'ethers'; import {AToken} from '../../types/AToken'; import {RateMode, tEthereumAddress} from '../../helpers/types'; +import {time} from 'console'; const {expect} = chai; @@ -47,7 +48,8 @@ const almostEqualOrEqual = function ( key === 'marketStableRate' || key === 'symbol' || key === 'aTokenAddress' || - key === 'decimals' + key === 'decimals' || + key === 'totalStableDebtLastUpdated' ) { // skipping consistency check on accessory data return; @@ -112,7 +114,7 @@ export const configuration: ActionsConfig = {}; export const mint = async (reserveSymbol: string, amount: string, user: SignerWithAddress) => { const reserve = await getReserveAddressFromSymbol(reserveSymbol); - const token = await getMintableERC20(reserve); + const token = await getMintableErc20(reserve); await waitForTx( await token.connect(user.signer).mint(await convertToCurrencyDecimals(reserve, amount)) @@ -123,7 +125,7 @@ export const approve = async (reserveSymbol: string, user: SignerWithAddress, te const {pool} = testEnv; const reserve = await getReserveAddressFromSymbol(reserveSymbol); - const token = await getMintableERC20(reserve); + const token = await getMintableErc20(reserve); await token.connect(user.signer).approve(pool.address, '100000000000000000000000000000'); }; @@ -261,10 +263,6 @@ export const withdraw = async ( txCost ); - const actualAmountWithdrawn = userDataBefore.currentATokenBalance.minus( - expectedUserData.currentATokenBalance - ); - expectEqual(reserveDataAfter, expectedReserveData); expectEqual(userDataAfter, expectedUserData); @@ -370,8 +368,7 @@ export const borrow = async ( expectedReserveData, userDataBefore, txTimestamp, - timestamp, - txCost + timestamp ); expectEqual(reserveDataAfter, expectedReserveData); @@ -474,8 +471,7 @@ export const repay = async ( user.address, onBehalfOf.address, txTimestamp, - timestamp, - txCost + timestamp ); expectEqual(reserveDataAfter, expectedReserveData); @@ -740,9 +736,12 @@ export const getContractsData = async ( sender?: string ) => { const {pool} = testEnv; - const reserveData = await getReserveData(pool, reserve); - const userData = await getUserData(pool, reserve, user, sender || user); - const timestamp = await timeLatest(); + + const [userData, reserveData, timestamp] = await Promise.all([ + getUserData(pool, reserve, user, sender || user), + getReserveData(pool, reserve), + timeLatest(), + ]); return { reserveData, diff --git a/test/helpers/make-suite.ts b/test/helpers/make-suite.ts index 4a89cf04..5eb8788f 100644 --- a/test/helpers/make-suite.ts +++ b/test/helpers/make-suite.ts @@ -6,10 +6,11 @@ import { getLendingPoolAddressesProvider, getAaveProtocolTestHelpers, getAToken, - getMintableERC20, + getMintableErc20, getLendingPoolConfiguratorProxy, getPriceOracle, getMockSwapAdapter, + getLendingPoolAddressesProviderRegistry, } from '../../helpers/contracts-helpers'; import {tEthereumAddress} from '../../helpers/types'; import {LendingPool} from '../../types/LendingPool'; @@ -25,6 +26,7 @@ import {almostEqual} from './almost-equal'; import {PriceOracle} from '../../types/PriceOracle'; import {LendingPoolAddressesProvider} from '../../types/LendingPoolAddressesProvider'; import {MockSwapAdapter} from '../../types/MockSwapAdapter'; +import {LendingPoolAddressesProviderRegistry} from '../../types/LendingPoolAddressesProviderRegistry'; chai.use(bignumberChai()); chai.use(almostEqual()); @@ -47,6 +49,7 @@ export interface TestEnv { lend: MintableERC20; addressesProvider: LendingPoolAddressesProvider; mockSwapAdapter: MockSwapAdapter; + registry: LendingPoolAddressesProviderRegistry; } let buidlerevmSnapshotId: string = '0x1'; @@ -71,6 +74,7 @@ const testEnv: TestEnv = { lend: {} as MintableERC20, addressesProvider: {} as LendingPoolAddressesProvider, mockSwapAdapter: {} as MockSwapAdapter, + registry: {} as LendingPoolAddressesProviderRegistry, } as TestEnv; export async function initializeMakeSuite() { @@ -95,6 +99,7 @@ export async function initializeMakeSuite() { testEnv.oracle = await getPriceOracle(); testEnv.addressesProvider = await getLendingPoolAddressesProvider(); + testEnv.registry = await getLendingPoolAddressesProviderRegistry(); testEnv.helpersContract = await getAaveProtocolTestHelpers(); @@ -125,10 +130,10 @@ export async function initializeMakeSuite() { testEnv.aDai = await getAToken(aDaiAddress); testEnv.aEth = await getAToken(aEthAddress); - testEnv.dai = await getMintableERC20(daiAddress); - testEnv.usdc = await getMintableERC20(usdcAddress); - testEnv.lend = await getMintableERC20(lendAddress); - testEnv.weth = await getMintableERC20(wethAddress); + testEnv.dai = await getMintableErc20(daiAddress); + testEnv.usdc = await getMintableErc20(usdcAddress); + testEnv.lend = await getMintableErc20(lendAddress); + testEnv.weth = await getMintableErc20(wethAddress); testEnv.mockSwapAdapter = await getMockSwapAdapter(); } diff --git a/test/helpers/scenarios/borrow-repay-stable.json b/test/helpers/scenarios/borrow-repay-stable.json index 9d2348e9..87e7de0b 100644 --- a/test/helpers/scenarios/borrow-repay-stable.json +++ b/test/helpers/scenarios/borrow-repay-stable.json @@ -626,6 +626,17 @@ }, "expected": "success" }, + { + "name": "repay", + "args": { + "reserve": "DAI", + "amount": "-1", + "user": "1", + "onBehalfOf": "1", + "borrowRateMode": "variable" + }, + "expected": "success" + }, { "name": "withdraw", "args": { diff --git a/test/helpers/scenarios/rebalance-stable-rate.json b/test/helpers/scenarios/rebalance-stable-rate.json index 1200ff3e..70ea820a 100644 --- a/test/helpers/scenarios/rebalance-stable-rate.json +++ b/test/helpers/scenarios/rebalance-stable-rate.json @@ -19,7 +19,7 @@ ] }, { - "description": "User 0 deposits 1000 DAI, user 1 deposits 1 ETH, borrows 100 DAI at a variable rate, user 0 rebalances user 1 (revert expected)", + "description": "User 0 deposits 1000 DAI, user 1 deposits 5 ETH, borrows 600 DAI at a variable rate, user 0 rebalances user 1 (revert expected)", "actions": [ { "name": "mint", @@ -51,7 +51,7 @@ "name": "mint", "args": { "reserve": "WETH", - "amount": "1", + "amount": "5", "user": "1" }, "expected": "success" @@ -69,7 +69,7 @@ "args": { "reserve": "WETH", - "amount": "1", + "amount": "5", "user": "1" }, "expected": "success" @@ -78,8 +78,8 @@ "name": "borrow", "args": { "reserve": "DAI", - "amount": "100", - "borrowRateMode": "variable", + "amount": "250", + "borrowRateMode": "stable", "user": "1", "timeTravel": "365" }, @@ -98,14 +98,16 @@ ] }, { - "description": "User 1 swaps to stable, user 0 tries to rebalance but the conditions are not met (revert expected)", + "description": "User 1 borrows another 200 at stable, user 0 tries to rebalance but the conditions are not met (revert expected)", "actions": [ { - "name": "swapBorrowRateMode", + "name": "borrow", "args": { "reserve": "DAI", + "amount": "200", + "borrowRateMode": "stable", "user": "1", - "borrowRateMode": "variable" + "timeTravel": "365" }, "expected": "success" }, @@ -122,7 +124,59 @@ ] }, { - "description": "User 2 deposits ETH and borrows the remaining DAI, causing the stable rates to rise (liquidity rate < user 1 borrow rate). User 0 tries to rebalance user 1 (revert expected)", + "description": "User 1 borrows another 200 at stable, user 0 tries to rebalance but the conditions are not met (revert expected)", + "actions": [ + { + "name": "borrow", + "args": { + "reserve": "DAI", + "amount": "200", + "borrowRateMode": "stable", + "user": "1", + "timeTravel": "365" + }, + "expected": "success" + }, + { + "name": "rebalanceStableBorrowRate", + "args": { + "reserve": "DAI", + "user": "0", + "target": "1" + }, + "expected": "revert", + "revertMessage": "Interest rate rebalance conditions were not met" + } + ] + }, + { + "description": "User 1 borrows another 100 at stable, user 0 tries to rebalance but the conditions are not met (revert expected)", + "actions": [ + { + "name": "borrow", + "args": { + "reserve": "DAI", + "amount": "100", + "borrowRateMode": "stable", + "user": "1", + "timeTravel": "365" + }, + "expected": "success" + }, + { + "name": "rebalanceStableBorrowRate", + "args": { + "reserve": "DAI", + "user": "0", + "target": "1" + }, + "expected": "revert", + "revertMessage": "Interest rate rebalance conditions were not met" + } + ] + }, + { + "description": "User 2 deposits ETH and borrows the remaining DAI, causing the stable rates to rise (usage ratio = 94%). User 0 tries to rebalance user 1 (revert expected)", "actions": [ { "name": "mint", @@ -155,7 +209,7 @@ "name": "borrow", "args": { "reserve": "DAI", - "amount": "100", + "amount": "190", "borrowRateMode": "variable", "user": "2" }, @@ -174,40 +228,13 @@ ] }, { - "description": "User 2 borrows more DAI, causing the liquidity rate to rise above user 1 stable borrow rate User 0 rebalances user 1", + "description": "User 2 borrows the remaining DAI (usage ratio = 100%). User 0 rebalances user 1", "actions": [ - { - "name": "mint", - "args": { - "reserve": "WETH", - "amount": "3", - "user": "2" - }, - "expected": "success" - }, - { - "name": "approve", - "args": { - "reserve": "WETH", - "user": "2" - }, - "expected": "success" - }, - { - "name": "deposit", - "args": { - "reserve": "WETH", - - "amount": "3", - "user": "2" - }, - "expected": "success" - }, { "name": "borrow", "args": { "reserve": "DAI", - "amount": "700", + "amount": "60", "borrowRateMode": "variable", "user": "2" }, diff --git a/test/helpers/scenarios/set-use-as-collateral.json b/test/helpers/scenarios/set-use-as-collateral.json index 614c8ddb..871a78b9 100644 --- a/test/helpers/scenarios/set-use-as-collateral.json +++ b/test/helpers/scenarios/set-use-as-collateral.json @@ -43,7 +43,7 @@ ] }, { - "description": "User 1 Deposits 2 ETH, disables ETH as collateral, borrows 400 DAI (revert expected)", + "description": "User 1 Deposits 2 WETH, disables WETH as collateral, borrows 400 DAI (revert expected)", "actions": [ { "name": "mint", @@ -96,7 +96,7 @@ ] }, { - "description": "User 1 enables ETH as collateral, borrows 400 DAI", + "description": "User 1 enables WETH as collateral, borrows 400 DAI", "actions": [ { "name": "setUseAsCollateral", @@ -120,7 +120,7 @@ ] }, { - "description": "User 1 disables ETH as collateral (revert expected)", + "description": "User 1 disables WETH as collateral (revert expected)", "actions": [ { "name": "setUseAsCollateral", @@ -134,6 +134,97 @@ "revertMessage": "User deposit is already being used as collateral" } ] + }, + { + "description": "User 1 Deposits 1000 LEND, disables WETH as collateral. Should revert as 1000 LEND are not enough to cover the debt (revert expected)", + "actions": [ + { + "name": "mint", + "args": { + "reserve": "LEND", + "amount": "1000", + "user": "1" + }, + "expected": "success" + }, + { + "name": "approve", + "args": { + "reserve": "LEND", + "user": "1" + }, + "expected": "success" + }, + { + "name": "deposit", + "args": { + "reserve": "LEND", + + "amount": "1000", + "user": "1" + }, + "expected": "success" + }, + { + "name": "setUseAsCollateral", + "args": { + "reserve": "WETH", + + "user": "1", + "useAsCollateral": "false" + }, + "expected": "revert" + } + ] + }, + { + "description": "User 1 Deposits 64000 more LEND (enough to cover the DAI debt), disables WETH as collateral", + "actions": [ + { + "name": "mint", + "args": { + "reserve": "LEND", + "amount": "64000", + "user": "1" + }, + "expected": "success" + }, + { + "name": "deposit", + "args": { + "reserve": "LEND", + + "amount": "64000", + "user": "1" + }, + "expected": "success" + }, + { + "name": "setUseAsCollateral", + "args": { + "reserve": "WETH", + + "user": "1", + "useAsCollateral": "false" + }, + "expected": "success" + } + ] + }, + { + "description": "User 1 disables LEND as collateral (revert expected)", + "actions": [ + { + "name": "setUseAsCollateral", + "args": { + "reserve": "LEND", + + "user": "1", + "useAsCollateral": "false" + }, + "expected": "User deposit is already being used as collateral" + } + ] } ] } diff --git a/test/helpers/utils/calculations.ts b/test/helpers/utils/calculations.ts index 98431d36..46623a62 100644 --- a/test/helpers/utils/calculations.ts +++ b/test/helpers/utils/calculations.ts @@ -7,7 +7,7 @@ import { EXCESS_UTILIZATION_RATE, ZERO_ADDRESS, } from '../../../helpers/constants'; -import {IReserveParams, iAavePoolAssets, RateMode} from '../../../helpers/types'; +import {IReserveParams, iAavePoolAssets, RateMode, tEthereumAddress} from '../../../helpers/types'; import './math'; import {ReserveData, UserReserveData} from './interfaces'; @@ -30,19 +30,21 @@ export const calcExpectedUserDataAfterDeposit = ( ): UserReserveData => { const expectedUserData = {}; - expectedUserData.currentStableDebt = expectedUserData.principalStableDebt = calcExpectedStableDebtTokenBalance( - userDataBeforeAction, + expectedUserData.currentStableDebt = calcExpectedStableDebtTokenBalance( + userDataBeforeAction.principalStableDebt, + userDataBeforeAction.stableBorrowRate, + userDataBeforeAction.stableRateLastUpdated, txTimestamp ); - expectedUserData.currentVariableDebt = expectedUserData.principalStableDebt = calcExpectedVariableDebtTokenBalance( + expectedUserData.currentVariableDebt = calcExpectedVariableDebtTokenBalance( reserveDataBeforeAction, userDataBeforeAction, txTimestamp ); expectedUserData.principalStableDebt = userDataBeforeAction.principalStableDebt; - expectedUserData.principalVariableDebt = userDataBeforeAction.principalVariableDebt; + expectedUserData.scaledVariableDebt = userDataBeforeAction.scaledVariableDebt; expectedUserData.variableBorrowIndex = userDataBeforeAction.variableBorrowIndex; expectedUserData.stableBorrowRate = userDataBeforeAction.stableBorrowRate; expectedUserData.stableRateLastUpdated = userDataBeforeAction.stableRateLastUpdated; @@ -71,7 +73,9 @@ export const calcExpectedUserDataAfterDeposit = ( expectedUserData.walletBalance = userDataBeforeAction.walletBalance.minus(amountDeposited); expectedUserData.currentStableDebt = expectedUserData.principalStableDebt = calcExpectedStableDebtTokenBalance( - userDataBeforeAction, + userDataBeforeAction.principalStableDebt, + userDataBeforeAction.stableBorrowRate, + userDataBeforeAction.stableRateLastUpdated, txTimestamp ); @@ -115,10 +119,12 @@ export const calcExpectedUserDataAfterWithdraw = ( expectedUserData.currentATokenBalance = aTokenBalance.minus(amountWithdrawn); expectedUserData.principalStableDebt = userDataBeforeAction.principalStableDebt; - expectedUserData.principalVariableDebt = userDataBeforeAction.principalVariableDebt; + expectedUserData.scaledVariableDebt = userDataBeforeAction.scaledVariableDebt; expectedUserData.currentStableDebt = calcExpectedStableDebtTokenBalance( - userDataBeforeAction, + userDataBeforeAction.principalStableDebt, + userDataBeforeAction.stableBorrowRate, + userDataBeforeAction.stableRateLastUpdated, txTimestamp ); @@ -166,27 +172,6 @@ export const calcExpectedReserveDataAfterDeposit = ( reserveDataBeforeAction.availableLiquidity ).plus(amountDeposited); - expectedReserveData.totalBorrowsStable = reserveDataBeforeAction.totalBorrowsStable; - expectedReserveData.totalBorrowsVariable = reserveDataBeforeAction.totalBorrowsVariable; - expectedReserveData.averageStableBorrowRate = reserveDataBeforeAction.averageStableBorrowRate; - - expectedReserveData.utilizationRate = calcExpectedUtilizationRate( - expectedReserveData.totalBorrowsStable, - expectedReserveData.totalBorrowsVariable, - expectedReserveData.totalLiquidity - ); - const rates = calcExpectedInterestRates( - reserveDataBeforeAction.symbol, - reserveDataBeforeAction.marketStableRate, - expectedReserveData.utilizationRate, - expectedReserveData.totalBorrowsStable, - expectedReserveData.totalBorrowsVariable, - expectedReserveData.averageStableBorrowRate - ); - expectedReserveData.liquidityRate = rates[0]; - expectedReserveData.stableBorrowRate = rates[1]; - expectedReserveData.variableBorrowRate = rates[2]; - expectedReserveData.averageStableBorrowRate = reserveDataBeforeAction.averageStableBorrowRate; expectedReserveData.liquidityIndex = calcExpectedLiquidityIndex( reserveDataBeforeAction, @@ -197,6 +182,37 @@ export const calcExpectedReserveDataAfterDeposit = ( txTimestamp ); + expectedReserveData.totalStableDebt = calcExpectedTotalStableDebt( + reserveDataBeforeAction.principalStableDebt, + reserveDataBeforeAction.averageStableBorrowRate, + reserveDataBeforeAction.totalStableDebtLastUpdated, + txTimestamp + ); + expectedReserveData.totalVariableDebt = calcExpectedTotalVariableDebt( + reserveDataBeforeAction, + expectedReserveData.variableBorrowIndex + ); + + expectedReserveData.scaledVariableDebt = reserveDataBeforeAction.scaledVariableDebt; + expectedReserveData.principalStableDebt = reserveDataBeforeAction.principalStableDebt; + + expectedReserveData.utilizationRate = calcExpectedUtilizationRate( + expectedReserveData.totalStableDebt, + expectedReserveData.totalVariableDebt, + expectedReserveData.totalLiquidity + ); + const rates = calcExpectedInterestRates( + reserveDataBeforeAction.symbol, + reserveDataBeforeAction.marketStableRate, + expectedReserveData.utilizationRate, + expectedReserveData.totalStableDebt, + expectedReserveData.totalVariableDebt, + expectedReserveData.averageStableBorrowRate + ); + expectedReserveData.liquidityRate = rates[0]; + expectedReserveData.stableBorrowRate = rates[1]; + expectedReserveData.variableBorrowRate = rates[2]; + return expectedReserveData; }; @@ -218,35 +234,13 @@ export const calcExpectedReserveDataAfterWithdraw = ( ).toFixed(); } - expectedReserveData.totalLiquidity = new BigNumber(reserveDataBeforeAction.totalLiquidity).minus( - amountWithdrawn - ); expectedReserveData.availableLiquidity = new BigNumber( reserveDataBeforeAction.availableLiquidity ).minus(amountWithdrawn); - expectedReserveData.totalBorrowsStable = reserveDataBeforeAction.totalBorrowsStable; - expectedReserveData.totalBorrowsVariable = reserveDataBeforeAction.totalBorrowsVariable; - expectedReserveData.averageStableBorrowRate = reserveDataBeforeAction.averageStableBorrowRate; + expectedReserveData.principalStableDebt = reserveDataBeforeAction.principalStableDebt; + expectedReserveData.scaledVariableDebt = reserveDataBeforeAction.scaledVariableDebt; - expectedReserveData.utilizationRate = calcExpectedUtilizationRate( - expectedReserveData.totalBorrowsStable, - expectedReserveData.totalBorrowsVariable, - expectedReserveData.totalLiquidity - ); - const rates = calcExpectedInterestRates( - reserveDataBeforeAction.symbol, - reserveDataBeforeAction.marketStableRate, - expectedReserveData.utilizationRate, - expectedReserveData.totalBorrowsStable, - expectedReserveData.totalBorrowsVariable, - expectedReserveData.averageStableBorrowRate - ); - expectedReserveData.liquidityRate = rates[0]; - expectedReserveData.stableBorrowRate = rates[1]; - expectedReserveData.variableBorrowRate = rates[2]; - - expectedReserveData.averageStableBorrowRate = reserveDataBeforeAction.averageStableBorrowRate; expectedReserveData.liquidityIndex = calcExpectedLiquidityIndex( reserveDataBeforeAction, txTimestamp @@ -256,6 +250,40 @@ export const calcExpectedReserveDataAfterWithdraw = ( txTimestamp ); + expectedReserveData.totalStableDebt = calcExpectedTotalStableDebt( + reserveDataBeforeAction.principalStableDebt, + reserveDataBeforeAction.averageStableBorrowRate, + reserveDataBeforeAction.totalStableDebtLastUpdated, + txTimestamp + ); + expectedReserveData.totalVariableDebt = expectedReserveData.scaledVariableDebt.rayMul( + expectedReserveData.variableBorrowIndex + ); + + expectedReserveData.averageStableBorrowRate = reserveDataBeforeAction.averageStableBorrowRate; + + expectedReserveData.totalLiquidity = new BigNumber(reserveDataBeforeAction.availableLiquidity) + .minus(amountWithdrawn) + .plus(expectedReserveData.totalVariableDebt) + .plus(expectedReserveData.totalStableDebt); + + expectedReserveData.utilizationRate = calcExpectedUtilizationRate( + expectedReserveData.totalStableDebt, + expectedReserveData.totalVariableDebt, + expectedReserveData.totalLiquidity + ); + const rates = calcExpectedInterestRates( + reserveDataBeforeAction.symbol, + reserveDataBeforeAction.marketStableRate, + expectedReserveData.utilizationRate, + expectedReserveData.totalStableDebt, + expectedReserveData.totalVariableDebt, + expectedReserveData.averageStableBorrowRate + ); + expectedReserveData.liquidityRate = rates[0]; + expectedReserveData.stableBorrowRate = rates[1]; + expectedReserveData.variableBorrowRate = rates[2]; + return expectedReserveData; }; @@ -273,78 +301,165 @@ export const calcExpectedReserveDataAfterBorrow = ( const amountBorrowedBN = new BigNumber(amountBorrowed); - const userStableBorrowBalance = calcExpectedStableDebtTokenBalance( - userDataBeforeAction, - txTimestamp - ); - - const userVariableBorrowBalance = calcExpectedVariableDebtTokenBalance( - reserveDataBeforeAction, - userDataBeforeAction, - txTimestamp - ); - - if (borrowRateMode == RateMode.Stable) { - const debtAccrued = userStableBorrowBalance.minus(userDataBeforeAction.principalStableDebt); - - expectedReserveData.totalLiquidity = reserveDataBeforeAction.totalLiquidity.plus(debtAccrued); - - expectedReserveData.totalBorrowsStable = reserveDataBeforeAction.totalBorrowsStable - .plus(amountBorrowedBN) - .plus(debtAccrued); - - expectedReserveData.averageStableBorrowRate = calcExpectedAverageStableBorrowRate( - reserveDataBeforeAction.averageStableBorrowRate, - reserveDataBeforeAction.totalBorrowsStable.plus(debtAccrued), - amountBorrowedBN, - reserveDataBeforeAction.stableBorrowRate - ); - expectedReserveData.totalBorrowsVariable = reserveDataBeforeAction.totalBorrowsVariable; - } else { - const debtAccrued = userVariableBorrowBalance.minus(userDataBeforeAction.principalVariableDebt); - expectedReserveData.totalLiquidity = reserveDataBeforeAction.totalLiquidity.plus(debtAccrued); - expectedReserveData.totalBorrowsVariable = reserveDataBeforeAction.totalBorrowsVariable - .plus(amountBorrowedBN) - .plus(debtAccrued); - expectedReserveData.totalBorrowsStable = reserveDataBeforeAction.totalBorrowsStable; - expectedReserveData.averageStableBorrowRate = reserveDataBeforeAction.averageStableBorrowRate; - } - - expectedReserveData.availableLiquidity = reserveDataBeforeAction.availableLiquidity.minus( - amountBorrowedBN - ); - - expectedReserveData.utilizationRate = calcExpectedUtilizationRate( - expectedReserveData.totalBorrowsStable, - expectedReserveData.totalBorrowsVariable, - expectedReserveData.totalLiquidity - ); - - const rates = calcExpectedInterestRates( - reserveDataBeforeAction.symbol, - reserveDataBeforeAction.marketStableRate, - expectedReserveData.utilizationRate, - expectedReserveData.totalBorrowsStable, - expectedReserveData.totalBorrowsVariable, - expectedReserveData.averageStableBorrowRate - ); - expectedReserveData.liquidityRate = rates[0]; - - expectedReserveData.stableBorrowRate = rates[1]; - - expectedReserveData.variableBorrowRate = rates[2]; - expectedReserveData.liquidityIndex = calcExpectedLiquidityIndex( reserveDataBeforeAction, txTimestamp ); + expectedReserveData.variableBorrowIndex = calcExpectedVariableBorrowIndex( reserveDataBeforeAction, txTimestamp ); + expectedReserveData.availableLiquidity = reserveDataBeforeAction.availableLiquidity.minus( + amountBorrowedBN + ); + expectedReserveData.lastUpdateTimestamp = txTimestamp; + if (borrowRateMode == RateMode.Stable) { + expectedReserveData.scaledVariableDebt = reserveDataBeforeAction.scaledVariableDebt; + + const expectedVariableDebtAfterTx = expectedReserveData.scaledVariableDebt.rayMul( + expectedReserveData.variableBorrowIndex + ); + + const expectedStableDebtUntilTx = calcExpectedTotalStableDebt( + reserveDataBeforeAction.principalStableDebt, + reserveDataBeforeAction.averageStableBorrowRate, + reserveDataBeforeAction.totalStableDebtLastUpdated, + txTimestamp + ); + + expectedReserveData.principalStableDebt = expectedStableDebtUntilTx.plus(amountBorrowedBN); + + expectedReserveData.averageStableBorrowRate = calcExpectedAverageStableBorrowRate( + reserveDataBeforeAction.averageStableBorrowRate, + expectedStableDebtUntilTx, + amountBorrowedBN, + reserveDataBeforeAction.stableBorrowRate + ); + + const totalLiquidityAfterTx = expectedReserveData.availableLiquidity + .plus(expectedReserveData.principalStableDebt) + .plus(expectedVariableDebtAfterTx); + + const utilizationRateAfterTx = calcExpectedUtilizationRate( + expectedReserveData.principalStableDebt, //the expected principal debt is the total debt immediately after the tx + expectedVariableDebtAfterTx, + totalLiquidityAfterTx + ); + + const ratesAfterTx = calcExpectedInterestRates( + reserveDataBeforeAction.symbol, + reserveDataBeforeAction.marketStableRate, + utilizationRateAfterTx, + expectedReserveData.principalStableDebt, + expectedVariableDebtAfterTx, + expectedReserveData.averageStableBorrowRate + ); + + expectedReserveData.liquidityRate = ratesAfterTx[0]; + + expectedReserveData.stableBorrowRate = ratesAfterTx[1]; + + expectedReserveData.variableBorrowRate = ratesAfterTx[2]; + + expectedReserveData.totalStableDebt = calcExpectedTotalStableDebt( + expectedReserveData.principalStableDebt, + expectedReserveData.averageStableBorrowRate, + txTimestamp, + currentTimestamp + ); + + expectedReserveData.totalVariableDebt = reserveDataBeforeAction.scaledVariableDebt.rayMul( + calcExpectedReserveNormalizedDebt( + expectedReserveData.variableBorrowRate, + expectedReserveData.variableBorrowIndex, + txTimestamp, + currentTimestamp + ) + ); + + expectedReserveData.totalLiquidity = expectedReserveData.availableLiquidity + .plus(expectedReserveData.totalVariableDebt) + .plus(expectedReserveData.totalStableDebt); + + expectedReserveData.utilizationRate = calcExpectedUtilizationRate( + expectedReserveData.totalStableDebt, + expectedReserveData.totalVariableDebt, + expectedReserveData.totalLiquidity + ); + } else { + expectedReserveData.principalStableDebt = reserveDataBeforeAction.principalStableDebt; + + const totalStableDebtAfterTx = calcExpectedStableDebtTokenBalance( + reserveDataBeforeAction.principalStableDebt, + reserveDataBeforeAction.averageStableBorrowRate, + reserveDataBeforeAction.totalStableDebtLastUpdated, + txTimestamp + ); + + expectedReserveData.totalStableDebt = calcExpectedTotalStableDebt( + reserveDataBeforeAction.principalStableDebt, + reserveDataBeforeAction.averageStableBorrowRate, + reserveDataBeforeAction.totalStableDebtLastUpdated, + currentTimestamp + ); + + expectedReserveData.averageStableBorrowRate = reserveDataBeforeAction.averageStableBorrowRate; + + expectedReserveData.scaledVariableDebt = reserveDataBeforeAction.scaledVariableDebt.plus( + amountBorrowedBN.rayDiv(expectedReserveData.variableBorrowIndex) + ); + + const totalVariableDebtAfterTx = expectedReserveData.scaledVariableDebt.rayMul( + expectedReserveData.variableBorrowIndex + ); + + const utilizationRateAfterTx = calcExpectedUtilizationRate( + totalStableDebtAfterTx, + totalVariableDebtAfterTx, + expectedReserveData.availableLiquidity + .plus(totalStableDebtAfterTx) + .plus(totalVariableDebtAfterTx) + ); + + const rates = calcExpectedInterestRates( + reserveDataBeforeAction.symbol, + reserveDataBeforeAction.marketStableRate, + utilizationRateAfterTx, + totalStableDebtAfterTx, + totalVariableDebtAfterTx, + expectedReserveData.averageStableBorrowRate + ); + + expectedReserveData.liquidityRate = rates[0]; + + expectedReserveData.stableBorrowRate = rates[1]; + + expectedReserveData.variableBorrowRate = rates[2]; + + expectedReserveData.totalVariableDebt = expectedReserveData.scaledVariableDebt.rayMul( + calcExpectedReserveNormalizedDebt( + expectedReserveData.variableBorrowRate, + expectedReserveData.variableBorrowIndex, + txTimestamp, + currentTimestamp + ) + ); + + expectedReserveData.totalLiquidity = expectedReserveData.availableLiquidity + .plus(expectedReserveData.totalStableDebt) + .plus(expectedReserveData.totalVariableDebt); + + expectedReserveData.utilizationRate = calcExpectedUtilizationRate( + expectedReserveData.totalStableDebt, + expectedReserveData.totalVariableDebt, + expectedReserveData.totalLiquidity + ); + } + return expectedReserveData; }; @@ -362,83 +477,28 @@ export const calcExpectedReserveDataAfterRepay = ( let amountRepaidBN = new BigNumber(amountRepaid); - const userStableBorrowBalance = calcExpectedStableDebtTokenBalance( - userDataBeforeAction, + const userStableDebt = calcExpectedStableDebtTokenBalance( + userDataBeforeAction.principalStableDebt, + userDataBeforeAction.stableBorrowRate, + userDataBeforeAction.stableRateLastUpdated, txTimestamp ); - const userVariableBorrowBalance = calcExpectedVariableDebtTokenBalance( + const userVariableDebt = calcExpectedVariableDebtTokenBalance( reserveDataBeforeAction, userDataBeforeAction, txTimestamp ); - //if amount repaid = MAX_UINT_AMOUNT, user is repaying everything + //if amount repaid == MAX_UINT_AMOUNT, user is repaying everything if (amountRepaidBN.abs().eq(MAX_UINT_AMOUNT)) { if (borrowRateMode == RateMode.Stable) { - amountRepaidBN = userStableBorrowBalance; + amountRepaidBN = userStableDebt; } else { - amountRepaidBN = userVariableBorrowBalance; + amountRepaidBN = userVariableDebt; } } - if (borrowRateMode == RateMode.Stable) { - const debtAccrued = userStableBorrowBalance.minus(userDataBeforeAction.principalStableDebt); - - expectedReserveData.totalLiquidity = reserveDataBeforeAction.totalLiquidity.plus(debtAccrued); - - expectedReserveData.totalBorrowsStable = reserveDataBeforeAction.totalBorrowsStable - .minus(amountRepaidBN) - .plus(debtAccrued); - - expectedReserveData.averageStableBorrowRate = calcExpectedAverageStableBorrowRate( - reserveDataBeforeAction.averageStableBorrowRate, - reserveDataBeforeAction.totalBorrowsStable.plus(debtAccrued), - amountRepaidBN.negated(), - userDataBeforeAction.stableBorrowRate - ); - expectedReserveData.totalBorrowsVariable = reserveDataBeforeAction.totalBorrowsVariable; - } else { - const debtAccrued = userVariableBorrowBalance.minus(userDataBeforeAction.principalVariableDebt); - - expectedReserveData.totalLiquidity = reserveDataBeforeAction.totalLiquidity.plus(debtAccrued); - - expectedReserveData.totalBorrowsVariable = reserveDataBeforeAction.totalBorrowsVariable - .plus(debtAccrued) - .minus(amountRepaidBN); - - expectedReserveData.totalBorrowsStable = reserveDataBeforeAction.totalBorrowsStable; - expectedReserveData.averageStableBorrowRate = reserveDataBeforeAction.averageStableBorrowRate; - } - - expectedReserveData.availableLiquidity = reserveDataBeforeAction.availableLiquidity.plus( - amountRepaidBN - ); - - expectedReserveData.availableLiquidity = reserveDataBeforeAction.availableLiquidity.plus( - amountRepaidBN - ); - - expectedReserveData.utilizationRate = calcExpectedUtilizationRate( - expectedReserveData.totalBorrowsStable, - expectedReserveData.totalBorrowsVariable, - expectedReserveData.totalLiquidity - ); - - const rates = calcExpectedInterestRates( - reserveDataBeforeAction.symbol, - reserveDataBeforeAction.marketStableRate, - expectedReserveData.utilizationRate, - expectedReserveData.totalBorrowsStable, - expectedReserveData.totalBorrowsVariable, - expectedReserveData.averageStableBorrowRate - ); - expectedReserveData.liquidityRate = rates[0]; - - expectedReserveData.stableBorrowRate = rates[1]; - - expectedReserveData.variableBorrowRate = rates[2]; - expectedReserveData.liquidityIndex = calcExpectedLiquidityIndex( reserveDataBeforeAction, txTimestamp @@ -448,6 +508,82 @@ export const calcExpectedReserveDataAfterRepay = ( txTimestamp ); + if (borrowRateMode == RateMode.Stable) { + const expectedDebt = calcExpectedTotalStableDebt( + reserveDataBeforeAction.principalStableDebt, + reserveDataBeforeAction.averageStableBorrowRate, + reserveDataBeforeAction.totalStableDebtLastUpdated, + txTimestamp + ); + + expectedReserveData.principalStableDebt = expectedReserveData.totalStableDebt = expectedDebt.minus( + amountRepaidBN + ); + + //due to accumulation errors, the total stable debt might be smaller than the last user debt. + //in this case we simply set the total supply and avg stable rate to 0. + if (expectedReserveData.principalStableDebt.lt(0)) { + expectedReserveData.principalStableDebt = expectedReserveData.totalStableDebt = new BigNumber( + 0 + ); + expectedReserveData.averageStableBorrowRate = new BigNumber(0); + } else { + expectedReserveData.averageStableBorrowRate = calcExpectedAverageStableBorrowRate( + reserveDataBeforeAction.averageStableBorrowRate, + expectedDebt, + amountRepaidBN.negated(), + userDataBeforeAction.stableBorrowRate + ); + } + + expectedReserveData.scaledVariableDebt = reserveDataBeforeAction.scaledVariableDebt; + + expectedReserveData.totalVariableDebt = expectedReserveData.scaledVariableDebt.rayMul( + expectedReserveData.variableBorrowIndex + ); + } else { + expectedReserveData.scaledVariableDebt = reserveDataBeforeAction.scaledVariableDebt.minus( + amountRepaidBN.rayDiv(expectedReserveData.variableBorrowIndex) + ); + + expectedReserveData.totalVariableDebt = expectedReserveData.scaledVariableDebt.rayMul( + expectedReserveData.variableBorrowIndex + ); + + expectedReserveData.principalStableDebt = reserveDataBeforeAction.principalStableDebt; + expectedReserveData.totalStableDebt = reserveDataBeforeAction.totalStableDebt; + + expectedReserveData.averageStableBorrowRate = reserveDataBeforeAction.averageStableBorrowRate; + } + + expectedReserveData.availableLiquidity = reserveDataBeforeAction.availableLiquidity.plus( + amountRepaidBN + ); + + expectedReserveData.totalLiquidity = expectedReserveData.availableLiquidity + .plus(expectedReserveData.totalStableDebt) + .plus(expectedReserveData.totalVariableDebt); + + expectedReserveData.utilizationRate = calcExpectedUtilizationRate( + expectedReserveData.totalStableDebt, + expectedReserveData.totalVariableDebt, + expectedReserveData.totalLiquidity + ); + + const rates = calcExpectedInterestRates( + reserveDataBeforeAction.symbol, + reserveDataBeforeAction.marketStableRate, + expectedReserveData.utilizationRate, + expectedReserveData.totalStableDebt, + expectedReserveData.totalVariableDebt, + expectedReserveData.averageStableBorrowRate + ); + expectedReserveData.liquidityRate = rates[0]; + + expectedReserveData.stableBorrowRate = rates[1]; + + expectedReserveData.variableBorrowRate = rates[2]; + expectedReserveData.lastUpdateTimestamp = txTimestamp; return expectedReserveData; @@ -460,75 +596,63 @@ export const calcExpectedUserDataAfterBorrow = ( expectedDataAfterAction: ReserveData, userDataBeforeAction: UserReserveData, txTimestamp: BigNumber, - currentTimestamp: BigNumber, - txCost: BigNumber + currentTimestamp: BigNumber ): UserReserveData => { const expectedUserData = {}; - const currentStableDebt = calcExpectedStableDebtTokenBalance(userDataBeforeAction, txTimestamp); - - const currentVariableDebt = calcExpectedVariableDebtTokenBalance( - reserveDataBeforeAction, - userDataBeforeAction, - txTimestamp - ); + const amountBorrowedBN = new BigNumber(amountBorrowed); if (interestRateMode == RateMode.Stable) { - const debtAccrued = currentStableDebt.minus(userDataBeforeAction.principalStableDebt); + const stableDebtUntilTx = calcExpectedStableDebtTokenBalance( + userDataBeforeAction.principalStableDebt, + userDataBeforeAction.stableBorrowRate, + userDataBeforeAction.stableRateLastUpdated, + txTimestamp + ); - expectedUserData.principalStableDebt = currentStableDebt.plus(amountBorrowed); - expectedUserData.principalVariableDebt = userDataBeforeAction.principalVariableDebt; + expectedUserData.principalStableDebt = stableDebtUntilTx.plus(amountBorrowed); + expectedUserData.stableRateLastUpdated = txTimestamp; expectedUserData.stableBorrowRate = calcExpectedUserStableRate( - userDataBeforeAction.principalStableDebt.plus(debtAccrued), + stableDebtUntilTx, userDataBeforeAction.stableBorrowRate, - new BigNumber(amountBorrowed), + amountBorrowedBN, reserveDataBeforeAction.stableBorrowRate ); - expectedUserData.stableRateLastUpdated = txTimestamp; + + expectedUserData.currentStableDebt = calcExpectedStableDebtTokenBalance( + expectedUserData.principalStableDebt, + expectedUserData.stableBorrowRate, + txTimestamp, + currentTimestamp + ); + + expectedUserData.scaledVariableDebt = userDataBeforeAction.scaledVariableDebt; } else { - expectedUserData.principalVariableDebt = currentVariableDebt.plus(amountBorrowed); + expectedUserData.scaledVariableDebt = reserveDataBeforeAction.scaledVariableDebt.plus( + amountBorrowedBN.rayDiv(expectedDataAfterAction.variableBorrowIndex) + ); + expectedUserData.principalStableDebt = userDataBeforeAction.principalStableDebt; expectedUserData.stableBorrowRate = userDataBeforeAction.stableBorrowRate; expectedUserData.stableRateLastUpdated = userDataBeforeAction.stableRateLastUpdated; - } - expectedUserData.currentStableDebt = calcExpectedStableDebtTokenBalance( - { - ...userDataBeforeAction, - currentStableDebt: expectedUserData.principalStableDebt, - principalStableDebt: expectedUserData.principalStableDebt, - stableBorrowRate: expectedUserData.stableBorrowRate, - stableRateLastUpdated: expectedUserData.stableRateLastUpdated, - }, - currentTimestamp - ); + expectedUserData.currentStableDebt = calcExpectedStableDebtTokenBalance( + userDataBeforeAction.principalStableDebt, + userDataBeforeAction.stableBorrowRate, + userDataBeforeAction.stableRateLastUpdated, + currentTimestamp + ); + } expectedUserData.currentVariableDebt = calcExpectedVariableDebtTokenBalance( expectedDataAfterAction, - { - ...userDataBeforeAction, - currentVariableDebt: expectedUserData.principalVariableDebt, - principalVariableDebt: expectedUserData.principalVariableDebt, - variableBorrowIndex: - interestRateMode == RateMode.Variable - ? expectedDataAfterAction.variableBorrowIndex - : userDataBeforeAction.variableBorrowIndex, - }, + expectedUserData, currentTimestamp ); - if (expectedUserData.principalVariableDebt.eq(0)) { - expectedUserData.variableBorrowIndex = new BigNumber(0); - } else { - expectedUserData.variableBorrowIndex = - interestRateMode == RateMode.Variable - ? expectedDataAfterAction.variableBorrowIndex - : userDataBeforeAction.variableBorrowIndex; - } - expectedUserData.liquidityRate = expectedDataAfterAction.liquidityRate; expectedUserData.usageAsCollateralEnabled = userDataBeforeAction.usageAsCollateralEnabled; @@ -538,6 +662,7 @@ export const calcExpectedUserDataAfterBorrow = ( userDataBeforeAction, currentTimestamp ); + expectedUserData.scaledATokenBalance = userDataBeforeAction.scaledATokenBalance; expectedUserData.walletBalance = userDataBeforeAction.walletBalance.plus(amountBorrowed); @@ -554,36 +679,34 @@ export const calcExpectedUserDataAfterRepay = ( user: string, onBehalfOf: string, txTimestamp: BigNumber, - currentTimestamp: BigNumber, - txCost: BigNumber + currentTimestamp: BigNumber ): UserReserveData => { const expectedUserData = {}; - const variableBorrowBalance = calcExpectedVariableDebtTokenBalance( + const variableDebt = calcExpectedVariableDebtTokenBalance( reserveDataBeforeAction, userDataBeforeAction, currentTimestamp ); - const stableBorrowBalance = calcExpectedStableDebtTokenBalance( - userDataBeforeAction, + const stableDebt = calcExpectedStableDebtTokenBalance( + userDataBeforeAction.principalStableDebt, + userDataBeforeAction.stableBorrowRate, + userDataBeforeAction.stableRateLastUpdated, currentTimestamp ); - if (new BigNumber(totalRepaid).abs().eq(MAX_UINT_AMOUNT)) { - totalRepaid = - rateMode == RateMode.Stable - ? stableBorrowBalance.toFixed(0) - : variableBorrowBalance.toFixed(); + let totalRepaidBN = new BigNumber(totalRepaid); + if (totalRepaidBN.abs().eq(MAX_UINT_AMOUNT)) { + totalRepaidBN = rateMode == RateMode.Stable ? stableDebt : variableDebt; } if (rateMode == RateMode.Stable) { - expectedUserData.principalVariableDebt = userDataBeforeAction.principalVariableDebt; - expectedUserData.currentVariableDebt = variableBorrowBalance; - expectedUserData.variableBorrowIndex = userDataBeforeAction.variableBorrowIndex; + expectedUserData.scaledVariableDebt = userDataBeforeAction.scaledVariableDebt; + expectedUserData.currentVariableDebt = variableDebt; - expectedUserData.currentStableDebt = expectedUserData.principalStableDebt = stableBorrowBalance.minus( - totalRepaid + expectedUserData.principalStableDebt = expectedUserData.currentStableDebt = stableDebt.minus( + totalRepaidBN ); if (expectedUserData.currentStableDebt.eq('0')) { @@ -596,21 +719,17 @@ export const calcExpectedUserDataAfterRepay = ( expectedUserData.stableRateLastUpdated = txTimestamp; } } else { - expectedUserData.currentStableDebt = stableBorrowBalance; - expectedUserData.principalStableDebt = userDataBeforeAction.principalStableDebt; + expectedUserData.currentStableDebt = userDataBeforeAction.principalStableDebt; + expectedUserData.principalStableDebt = stableDebt; expectedUserData.stableBorrowRate = userDataBeforeAction.stableBorrowRate; expectedUserData.stableRateLastUpdated = userDataBeforeAction.stableRateLastUpdated; - expectedUserData.currentVariableDebt = expectedUserData.principalVariableDebt = variableBorrowBalance.minus( - totalRepaid + expectedUserData.scaledVariableDebt = userDataBeforeAction.scaledVariableDebt.minus( + totalRepaidBN.rayDiv(expectedDataAfterAction.variableBorrowIndex) + ); + expectedUserData.currentVariableDebt = expectedUserData.scaledVariableDebt.rayMul( + expectedDataAfterAction.variableBorrowIndex ); - - if (expectedUserData.currentVariableDebt.eq('0')) { - //user repaid everything - expectedUserData.variableBorrowIndex = new BigNumber('0'); - } else { - expectedUserData.variableBorrowIndex = expectedDataAfterAction.variableBorrowIndex; - } } expectedUserData.liquidityRate = expectedDataAfterAction.liquidityRate; @@ -625,7 +744,7 @@ export const calcExpectedUserDataAfterRepay = ( expectedUserData.scaledATokenBalance = userDataBeforeAction.scaledATokenBalance; if (user === onBehalfOf) { - expectedUserData.walletBalance = userDataBeforeAction.walletBalance.minus(totalRepaid); + expectedUserData.walletBalance = userDataBeforeAction.walletBalance.minus(totalRepaidBN); } else { //wallet balance didn't change expectedUserData.walletBalance = userDataBeforeAction.walletBalance; @@ -657,58 +776,88 @@ export const calcExpectedReserveDataAfterSwapRateMode = ( expectedReserveData.address = reserveDataBeforeAction.address; - const variableBorrowBalance = calcExpectedVariableDebtTokenBalance( + const variableDebt = calcExpectedVariableDebtTokenBalance( reserveDataBeforeAction, userDataBeforeAction, txTimestamp ); - const stableBorrowBalance = calcExpectedStableDebtTokenBalance(userDataBeforeAction, txTimestamp); + const stableDebt = calcExpectedStableDebtTokenBalance( + userDataBeforeAction.principalStableDebt, + userDataBeforeAction.stableBorrowRate, + userDataBeforeAction.stableRateLastUpdated, + txTimestamp + ); + + expectedReserveData.liquidityIndex = calcExpectedLiquidityIndex( + reserveDataBeforeAction, + txTimestamp + ); + + expectedReserveData.variableBorrowIndex = calcExpectedVariableBorrowIndex( + reserveDataBeforeAction, + txTimestamp + ); expectedReserveData.availableLiquidity = reserveDataBeforeAction.availableLiquidity; + const totalStableDebtUntilTx = calcExpectedTotalStableDebt( + reserveDataBeforeAction.principalStableDebt, + reserveDataBeforeAction.averageStableBorrowRate, + reserveDataBeforeAction.totalStableDebtLastUpdated, + txTimestamp + ); + if (rateMode === RateMode.Stable) { //swap user stable debt to variable - const debtAccrued = stableBorrowBalance.minus(userDataBeforeAction.principalStableDebt); + expectedReserveData.scaledVariableDebt = reserveDataBeforeAction.scaledVariableDebt.plus( + stableDebt.rayDiv(expectedReserveData.variableBorrowIndex) + ); - expectedReserveData.totalLiquidity = reserveDataBeforeAction.totalLiquidity.plus(debtAccrued); + expectedReserveData.totalVariableDebt = expectedReserveData.scaledVariableDebt.rayMul( + expectedReserveData.variableBorrowIndex + ); + + expectedReserveData.principalStableDebt = expectedReserveData.totalStableDebt = totalStableDebtUntilTx.minus( + stableDebt + ); expectedReserveData.averageStableBorrowRate = calcExpectedAverageStableBorrowRate( reserveDataBeforeAction.averageStableBorrowRate, - reserveDataBeforeAction.totalBorrowsStable.plus(debtAccrued), - stableBorrowBalance.negated(), + expectedReserveData.principalStableDebt.plus(stableDebt), + stableDebt.negated(), userDataBeforeAction.stableBorrowRate ); - - expectedReserveData.totalBorrowsVariable = reserveDataBeforeAction.totalBorrowsVariable.plus( - stableBorrowBalance - ); - - expectedReserveData.totalBorrowsStable = reserveDataBeforeAction.totalBorrowsStable.minus( - userDataBeforeAction.principalStableDebt - ); } else { - const debtAccrued = variableBorrowBalance.minus(userDataBeforeAction.principalVariableDebt); + //swap variable to stable - expectedReserveData.totalLiquidity = reserveDataBeforeAction.totalLiquidity.plus(debtAccrued); - expectedReserveData.totalBorrowsVariable = reserveDataBeforeAction.totalBorrowsVariable.minus( - userDataBeforeAction.principalVariableDebt + expectedReserveData.principalStableDebt = expectedReserveData.totalStableDebt = totalStableDebtUntilTx.plus( + variableDebt ); - expectedReserveData.totalBorrowsStable = reserveDataBeforeAction.totalBorrowsStable.plus( - variableBorrowBalance + expectedReserveData.scaledVariableDebt = reserveDataBeforeAction.scaledVariableDebt.minus( + variableDebt.rayDiv(expectedReserveData.variableBorrowIndex) ); + + expectedReserveData.totalVariableDebt = expectedReserveData.scaledVariableDebt.rayMul( + expectedReserveData.variableBorrowIndex + ); + expectedReserveData.averageStableBorrowRate = calcExpectedAverageStableBorrowRate( reserveDataBeforeAction.averageStableBorrowRate, - reserveDataBeforeAction.totalBorrowsStable, - variableBorrowBalance, + reserveDataBeforeAction.totalStableDebt, + variableDebt, reserveDataBeforeAction.stableBorrowRate ); } + expectedReserveData.totalLiquidity = reserveDataBeforeAction.availableLiquidity + .plus(expectedReserveData.totalStableDebt) + .plus(expectedReserveData.totalVariableDebt); + expectedReserveData.utilizationRate = calcExpectedUtilizationRate( - expectedReserveData.totalBorrowsStable, - expectedReserveData.totalBorrowsVariable, + expectedReserveData.totalStableDebt, + expectedReserveData.totalVariableDebt, expectedReserveData.totalLiquidity ); @@ -716,8 +865,8 @@ export const calcExpectedReserveDataAfterSwapRateMode = ( reserveDataBeforeAction.symbol, reserveDataBeforeAction.marketStableRate, expectedReserveData.utilizationRate, - expectedReserveData.totalBorrowsStable, - expectedReserveData.totalBorrowsVariable, + expectedReserveData.totalStableDebt, + expectedReserveData.totalVariableDebt, expectedReserveData.averageStableBorrowRate ); expectedReserveData.liquidityRate = rates[0]; @@ -726,15 +875,6 @@ export const calcExpectedReserveDataAfterSwapRateMode = ( expectedReserveData.variableBorrowRate = rates[2]; - expectedReserveData.liquidityIndex = calcExpectedLiquidityIndex( - reserveDataBeforeAction, - txTimestamp - ); - expectedReserveData.variableBorrowIndex = calcExpectedVariableBorrowIndex( - reserveDataBeforeAction, - txTimestamp - ); - return expectedReserveData; }; @@ -748,14 +888,19 @@ export const calcExpectedUserDataAfterSwapRateMode = ( ): UserReserveData => { const expectedUserData = {...userDataBeforeAction}; - const variableBorrowBalance = calcExpectedVariableDebtTokenBalance( + const stableDebtBalance = calcExpectedStableDebtTokenBalance( + userDataBeforeAction.principalStableDebt, + userDataBeforeAction.stableBorrowRate, + userDataBeforeAction.stableRateLastUpdated, + txTimestamp + ); + + const variableDebtBalance = calcExpectedVariableDebtTokenBalance( reserveDataBeforeAction, userDataBeforeAction, txTimestamp ); - const stableBorrowBalance = calcExpectedStableDebtTokenBalance(userDataBeforeAction, txTimestamp); - expectedUserData.currentATokenBalance = calcExpectedATokenBalance( reserveDataBeforeAction, userDataBeforeAction, @@ -768,31 +913,30 @@ export const calcExpectedUserDataAfterSwapRateMode = ( expectedUserData.stableBorrowRate = new BigNumber(0); - expectedUserData.principalVariableDebt = expectedUserData.currentVariableDebt = userDataBeforeAction.currentVariableDebt.plus( - stableBorrowBalance + expectedUserData.scaledVariableDebt = userDataBeforeAction.scaledVariableDebt.plus( + stableDebtBalance.rayDiv(expectedDataAfterAction.variableBorrowIndex) ); - expectedUserData.variableBorrowIndex = expectedDataAfterAction.variableBorrowIndex; + expectedUserData.currentVariableDebt = expectedUserData.scaledVariableDebt.rayMul( + expectedDataAfterAction.variableBorrowIndex + ); + expectedUserData.stableRateLastUpdated = new BigNumber(0); } else { expectedUserData.principalStableDebt = expectedUserData.currentStableDebt = userDataBeforeAction.currentStableDebt.plus( - variableBorrowBalance + variableDebtBalance ); //weighted average of the previous and the current expectedUserData.stableBorrowRate = calcExpectedUserStableRate( - userDataBeforeAction.principalStableDebt, + stableDebtBalance, userDataBeforeAction.stableBorrowRate, - variableBorrowBalance, + variableDebtBalance, reserveDataBeforeAction.stableBorrowRate ); expectedUserData.stableRateLastUpdated = txTimestamp; - expectedUserData.currentVariableDebt = expectedUserData.principalVariableDebt = new BigNumber( - 0 - ); - - expectedUserData.variableBorrowIndex = new BigNumber(0); + expectedUserData.currentVariableDebt = expectedUserData.scaledVariableDebt = new BigNumber(0); } expectedUserData.liquidityRate = expectedDataAfterAction.liquidityRate; @@ -809,39 +953,61 @@ export const calcExpectedReserveDataAfterStableRateRebalance = ( expectedReserveData.address = reserveDataBeforeAction.address; - const stableBorrowBalance = calcExpectedStableDebtTokenBalance(userDataBeforeAction, txTimestamp); + const userStableDebt = calcExpectedStableDebtTokenBalance( + userDataBeforeAction.principalStableDebt, + userDataBeforeAction.stableBorrowRate, + userDataBeforeAction.stableRateLastUpdated, + txTimestamp + ); - const debtAccrued = stableBorrowBalance.minus(userDataBeforeAction.principalStableDebt); + expectedReserveData.liquidityIndex = calcExpectedLiquidityIndex( + reserveDataBeforeAction, + txTimestamp + ); - expectedReserveData.totalLiquidity = reserveDataBeforeAction.totalLiquidity.plus(debtAccrued); + expectedReserveData.variableBorrowIndex = calcExpectedVariableBorrowIndex( + reserveDataBeforeAction, + txTimestamp + ); + + expectedReserveData.scaledVariableDebt = reserveDataBeforeAction.scaledVariableDebt; + expectedReserveData.totalVariableDebt = expectedReserveData.scaledVariableDebt.rayMul( + expectedReserveData.variableBorrowIndex + ); + + expectedReserveData.principalStableDebt = expectedReserveData.totalStableDebt = calcExpectedTotalStableDebt( + reserveDataBeforeAction.principalStableDebt, + reserveDataBeforeAction.averageStableBorrowRate, + reserveDataBeforeAction.totalStableDebtLastUpdated, + txTimestamp + ); expectedReserveData.availableLiquidity = reserveDataBeforeAction.availableLiquidity; + expectedReserveData.totalLiquidity = expectedReserveData.availableLiquidity + .plus(expectedReserveData.totalStableDebt) + .plus(expectedReserveData.totalVariableDebt); + //removing the stable liquidity at the old rate const avgRateBefore = calcExpectedAverageStableBorrowRate( reserveDataBeforeAction.averageStableBorrowRate, - reserveDataBeforeAction.totalBorrowsStable.plus(debtAccrued), - stableBorrowBalance.negated(), + expectedReserveData.totalStableDebt, + userStableDebt.negated(), userDataBeforeAction.stableBorrowRate ); // adding it again at the new rate expectedReserveData.averageStableBorrowRate = calcExpectedAverageStableBorrowRate( avgRateBefore, - reserveDataBeforeAction.totalBorrowsStable.minus(userDataBeforeAction.principalStableDebt), - stableBorrowBalance, + expectedReserveData.totalStableDebt.minus(userStableDebt), + userStableDebt, reserveDataBeforeAction.stableBorrowRate ); - expectedReserveData.totalBorrowsVariable = reserveDataBeforeAction.totalBorrowsVariable; - expectedReserveData.totalBorrowsStable = reserveDataBeforeAction.totalBorrowsStable.plus( - debtAccrued - ); - expectedReserveData.utilizationRate = calcExpectedUtilizationRate( - expectedReserveData.totalBorrowsStable, - expectedReserveData.totalBorrowsVariable, + expectedReserveData.totalStableDebt, + expectedReserveData.totalVariableDebt, expectedReserveData.totalLiquidity ); @@ -849,8 +1015,8 @@ export const calcExpectedReserveDataAfterStableRateRebalance = ( reserveDataBeforeAction.symbol, reserveDataBeforeAction.marketStableRate, expectedReserveData.utilizationRate, - expectedReserveData.totalBorrowsStable, - expectedReserveData.totalBorrowsVariable, + expectedReserveData.totalStableDebt, + expectedReserveData.totalVariableDebt, expectedReserveData.averageStableBorrowRate ); @@ -860,15 +1026,6 @@ export const calcExpectedReserveDataAfterStableRateRebalance = ( expectedReserveData.variableBorrowRate = rates[2]; - expectedReserveData.liquidityIndex = calcExpectedLiquidityIndex( - reserveDataBeforeAction, - txTimestamp - ); - expectedReserveData.variableBorrowIndex = calcExpectedVariableBorrowIndex( - reserveDataBeforeAction, - txTimestamp - ); - return expectedReserveData; }; @@ -887,7 +1044,9 @@ export const calcExpectedUserDataAfterStableRateRebalance = ( txTimestamp ); expectedUserData.currentStableDebt = expectedUserData.principalStableDebt = calcExpectedStableDebtTokenBalance( - userDataBeforeAction, + userDataBeforeAction.principalStableDebt, + userDataBeforeAction.stableBorrowRate, + userDataBeforeAction.stableRateLastUpdated, txTimestamp ); @@ -920,26 +1079,26 @@ const calcExpectedScaledATokenBalance = ( }; export const calcExpectedATokenBalance = ( - reserveDataBeforeAction: ReserveData, - userDataBeforeAction: UserReserveData, + reserveData: ReserveData, + userData: UserReserveData, currentTimestamp: BigNumber ) => { - const index = calcExpectedReserveNormalizedIncome(reserveDataBeforeAction, currentTimestamp); + const index = calcExpectedReserveNormalizedIncome(reserveData, currentTimestamp); - const {scaledATokenBalance: scaledBalanceBeforeAction} = userDataBeforeAction; + const {scaledATokenBalance: scaledBalanceBeforeAction} = userData; return scaledBalanceBeforeAction.rayMul(index); }; const calcExpectedAverageStableBorrowRate = ( avgStableRateBefore: BigNumber, - totalBorrowsStableBefore: BigNumber, + totalStableDebtBefore: BigNumber, amountChanged: string | BigNumber, rate: BigNumber ) => { - const weightedTotalBorrows = avgStableRateBefore.multipliedBy(totalBorrowsStableBefore); + const weightedTotalBorrows = avgStableRateBefore.multipliedBy(totalStableDebtBefore); const weightedAmountBorrowed = rate.multipliedBy(amountChanged); - const totalBorrowedStable = totalBorrowsStableBefore.plus(new BigNumber(amountChanged)); + const totalBorrowedStable = totalStableDebtBefore.plus(new BigNumber(amountChanged)); if (totalBorrowedStable.eq(0)) return new BigNumber('0'); @@ -949,39 +1108,29 @@ const calcExpectedAverageStableBorrowRate = ( .decimalPlaces(0, BigNumber.ROUND_DOWN); }; -const calcExpectedVariableDebtUserIndex = ( - reserveDataBeforeAction: ReserveData, - expectedUserBalanceAfterAction: BigNumber, - currentTimestamp: BigNumber -) => { - if (expectedUserBalanceAfterAction.eq(0)) { - return new BigNumber(0); - } - return calcExpectedReserveNormalizedDebt(reserveDataBeforeAction, currentTimestamp); -}; - export const calcExpectedVariableDebtTokenBalance = ( - reserveDataBeforeAction: ReserveData, - userDataBeforeAction: UserReserveData, + reserveData: ReserveData, + userData: UserReserveData, currentTimestamp: BigNumber ) => { - const debt = calcExpectedReserveNormalizedDebt(reserveDataBeforeAction, currentTimestamp); + const normalizedDebt = calcExpectedReserveNormalizedDebt( + reserveData.variableBorrowRate, + reserveData.variableBorrowIndex, + reserveData.lastUpdateTimestamp, + currentTimestamp + ); - const {principalVariableDebt, variableBorrowIndex} = userDataBeforeAction; + const {scaledVariableDebt} = userData; - if (variableBorrowIndex.eq(0)) { - return principalVariableDebt; - } - - return principalVariableDebt.wadToRay().rayMul(debt).rayDiv(variableBorrowIndex).rayToWad(); + return scaledVariableDebt.rayMul(normalizedDebt); }; export const calcExpectedStableDebtTokenBalance = ( - userDataBeforeAction: UserReserveData, + principalStableDebt: BigNumber, + stableBorrowRate: BigNumber, + stableRateLastUpdated: BigNumber, currentTimestamp: BigNumber ) => { - const {principalStableDebt, stableBorrowRate, stableRateLastUpdated} = userDataBeforeAction; - if ( stableBorrowRate.eq(0) || currentTimestamp.eq(stableRateLastUpdated) || @@ -996,7 +1145,7 @@ export const calcExpectedStableDebtTokenBalance = ( stableRateLastUpdated ); - return principalStableDebt.wadToRay().rayMul(cumulatedInterest).rayToWad(); + return principalStableDebt.rayMul(cumulatedInterest); }; const calcLinearInterest = ( @@ -1049,8 +1198,8 @@ const calcExpectedInterestRates = ( reserveSymbol: string, marketStableRate: BigNumber, utilizationRate: BigNumber, - totalBorrowsStable: BigNumber, - totalBorrowsVariable: BigNumber, + totalStableDebt: BigNumber, + totalVariableDebt: BigNumber, averageStableBorrowRate: BigNumber ): BigNumber[] => { const {reservesParams} = configuration; @@ -1094,8 +1243,8 @@ const calcExpectedInterestRates = ( } const expectedOverallRate = calcExpectedOverallBorrowRate( - totalBorrowsStable, - totalBorrowsVariable, + totalStableDebt, + totalVariableDebt, variableBorrowRate, averageStableBorrowRate ); @@ -1105,18 +1254,18 @@ const calcExpectedInterestRates = ( }; const calcExpectedOverallBorrowRate = ( - totalBorrowsStable: BigNumber, - totalBorrowsVariable: BigNumber, + totalStableDebt: BigNumber, + totalVariableDebt: BigNumber, currentVariableBorrowRate: BigNumber, currentAverageStableBorrowRate: BigNumber ): BigNumber => { - const totalBorrows = totalBorrowsStable.plus(totalBorrowsVariable); + const totalBorrows = totalStableDebt.plus(totalVariableDebt); if (totalBorrows.eq(0)) return strToBN('0'); - const weightedVariableRate = totalBorrowsVariable.wadToRay().rayMul(currentVariableBorrowRate); + const weightedVariableRate = totalVariableDebt.wadToRay().rayMul(currentVariableBorrowRate); - const weightedStableRate = totalBorrowsStable.wadToRay().rayMul(currentAverageStableBorrowRate); + const weightedStableRate = totalStableDebt.wadToRay().rayMul(currentAverageStableBorrowRate); const overallBorrowRate = weightedVariableRate .plus(weightedStableRate) @@ -1126,15 +1275,15 @@ const calcExpectedOverallBorrowRate = ( }; const calcExpectedUtilizationRate = ( - totalBorrowsStable: BigNumber, - totalBorrowsVariable: BigNumber, + totalStableDebt: BigNumber, + totalVariableDebt: BigNumber, totalLiquidity: BigNumber ): BigNumber => { - if (totalBorrowsStable.eq('0') && totalBorrowsVariable.eq('0')) { + if (totalStableDebt.eq('0') && totalVariableDebt.eq('0')) { return strToBN('0'); } - const utilization = totalBorrowsStable.plus(totalBorrowsVariable).rayDiv(totalLiquidity); + const utilization = totalStableDebt.plus(totalVariableDebt).rayDiv(totalLiquidity); return utilization; }; @@ -1162,11 +1311,11 @@ const calcExpectedReserveNormalizedIncome = ( }; const calcExpectedReserveNormalizedDebt = ( - reserveData: ReserveData, + variableBorrowRate: BigNumber, + variableBorrowIndex: BigNumber, + lastUpdateTimestamp: BigNumber, currentTimestamp: BigNumber ) => { - const {variableBorrowRate, variableBorrowIndex, lastUpdateTimestamp} = reserveData; - //if utilization rate is 0, nothing to compound if (variableBorrowRate.eq('0')) { return variableBorrowIndex; @@ -1211,8 +1360,8 @@ const calcExpectedLiquidityIndex = (reserveData: ReserveData, timestamp: BigNumb }; const calcExpectedVariableBorrowIndex = (reserveData: ReserveData, timestamp: BigNumber) => { - //if totalBorrowsVariable is 0, nothing to compound - if (reserveData.totalBorrowsVariable.eq('0')) { + //if totalVariableDebt is 0, nothing to compound + if (reserveData.totalVariableDebt.eq('0')) { return reserveData.variableBorrowIndex; } @@ -1224,3 +1373,25 @@ const calcExpectedVariableBorrowIndex = (reserveData: ReserveData, timestamp: Bi return cumulatedInterest.rayMul(reserveData.variableBorrowIndex); }; + +const calcExpectedTotalStableDebt = ( + principalStableDebt: BigNumber, + averageStableBorrowRate: BigNumber, + lastUpdateTimestamp: BigNumber, + currentTimestamp: BigNumber +) => { + const cumulatedInterest = calcCompoundedInterest( + averageStableBorrowRate, + currentTimestamp, + lastUpdateTimestamp + ); + + return cumulatedInterest.rayMul(principalStableDebt); +}; + +const calcExpectedTotalVariableDebt = ( + reserveData: ReserveData, + expectedVariableDebtIndex: BigNumber +) => { + return reserveData.scaledVariableDebt.rayMul(expectedVariableDebtIndex); +}; diff --git a/test/helpers/utils/helpers.ts b/test/helpers/utils/helpers.ts index 6aec4e48..a0269824 100644 --- a/test/helpers/utils/helpers.ts +++ b/test/helpers/utils/helpers.ts @@ -3,10 +3,11 @@ import {ReserveData, UserReserveData} from './interfaces'; import { getLendingRateOracle, getIErc20Detailed, - getMintableERC20, + getMintableErc20, getAToken, + getStableDebtToken, + getVariableDebtToken, } from '../../../helpers/contracts-helpers'; -import {ZERO_ADDRESS} from '../../../helpers/constants'; import {tEthereumAddress} from '../../../helpers/types'; import BigNumber from 'bignumber.js'; import {getDb, BRE} from '../../../helpers/misc-utils'; @@ -15,41 +16,53 @@ export const getReserveData = async ( pool: LendingPool, reserve: tEthereumAddress ): Promise => { - const data = await pool.getReserveData(reserve); - const tokenAddresses = await pool.getReserveTokensAddresses(reserve); - const rateOracle = await getLendingRateOracle(); + const [reserveData, tokenAddresses, rateOracle, token] = await Promise.all([ + pool.getReserveData(reserve), + pool.getReserveTokensAddresses(reserve), + getLendingRateOracle(), + getIErc20Detailed(reserve), + ]); + + const stableDebtToken = await getStableDebtToken(tokenAddresses.stableDebtTokenAddress); + const variableDebtToken = await getVariableDebtToken(tokenAddresses.variableDebtTokenAddress); + + const [principalStableDebt] = await stableDebtToken.getSupplyData(); + const totalStableDebtLastUpdated = await stableDebtToken.getTotalSupplyLastUpdated(); + + const scaledVariableDebt = await variableDebtToken.scaledTotalSupply(); const rate = (await rateOracle.getMarketBorrowRate(reserve)).toString(); - - const token = await getIErc20Detailed(reserve); const symbol = await token.symbol(); const decimals = new BigNumber(await token.decimals()); - const totalLiquidity = new BigNumber(data.availableLiquidity.toString()) - .plus(data.totalBorrowsStable.toString()) - .plus(data.totalBorrowsVariable.toString()); + const totalLiquidity = new BigNumber(reserveData.availableLiquidity.toString()) + .plus(reserveData.totalStableDebt.toString()) + .plus(reserveData.totalVariableDebt.toString()); const utilizationRate = new BigNumber( totalLiquidity.eq(0) ? 0 - : new BigNumber(data.totalBorrowsStable.toString()) - .plus(data.totalBorrowsVariable.toString()) + : new BigNumber(reserveData.totalStableDebt.toString()) + .plus(reserveData.totalVariableDebt.toString()) .rayDiv(totalLiquidity) ); return { totalLiquidity, utilizationRate, - availableLiquidity: new BigNumber(data.availableLiquidity.toString()), - totalBorrowsStable: new BigNumber(data.totalBorrowsStable.toString()), - totalBorrowsVariable: new BigNumber(data.totalBorrowsVariable.toString()), - liquidityRate: new BigNumber(data.liquidityRate.toString()), - variableBorrowRate: new BigNumber(data.variableBorrowRate.toString()), - stableBorrowRate: new BigNumber(data.stableBorrowRate.toString()), - averageStableBorrowRate: new BigNumber(data.averageStableBorrowRate.toString()), - liquidityIndex: new BigNumber(data.liquidityIndex.toString()), - variableBorrowIndex: new BigNumber(data.variableBorrowIndex.toString()), - lastUpdateTimestamp: new BigNumber(data.lastUpdateTimestamp), + availableLiquidity: new BigNumber(reserveData.availableLiquidity.toString()), + totalStableDebt: new BigNumber(reserveData.totalStableDebt.toString()), + totalVariableDebt: new BigNumber(reserveData.totalVariableDebt.toString()), + liquidityRate: new BigNumber(reserveData.liquidityRate.toString()), + variableBorrowRate: new BigNumber(reserveData.variableBorrowRate.toString()), + stableBorrowRate: new BigNumber(reserveData.stableBorrowRate.toString()), + averageStableBorrowRate: new BigNumber(reserveData.averageStableBorrowRate.toString()), + liquidityIndex: new BigNumber(reserveData.liquidityIndex.toString()), + variableBorrowIndex: new BigNumber(reserveData.variableBorrowIndex.toString()), + lastUpdateTimestamp: new BigNumber(reserveData.lastUpdateTimestamp), + totalStableDebtLastUpdated: new BigNumber(totalStableDebtLastUpdated), + principalStableDebt: new BigNumber(principalStableDebt.toString()), + scaledVariableDebt: new BigNumber(scaledVariableDebt.toString()), address: reserve, aTokenAddress: tokenAddresses.aTokenAddress, symbol, @@ -69,7 +82,7 @@ export const getUserData = async ( getATokenUserData(reserve, user, pool), ]); - const token = await getMintableERC20(reserve); + const token = await getMintableErc20(reserve); const walletBalance = new BigNumber((await token.balanceOf(sender || user)).toString()); return { @@ -78,8 +91,7 @@ export const getUserData = async ( currentStableDebt: new BigNumber(userData.currentStableDebt.toString()), currentVariableDebt: new BigNumber(userData.currentVariableDebt.toString()), principalStableDebt: new BigNumber(userData.principalStableDebt.toString()), - principalVariableDebt: new BigNumber(userData.principalVariableDebt.toString()), - variableBorrowIndex: new BigNumber(userData.variableBorrowIndex.toString()), + scaledVariableDebt: new BigNumber(userData.scaledVariableDebt.toString()), stableBorrowRate: new BigNumber(userData.stableBorrowRate.toString()), liquidityRate: new BigNumber(userData.liquidityRate.toString()), usageAsCollateralEnabled: userData.usageAsCollateralEnabled, @@ -89,7 +101,7 @@ export const getUserData = async ( }; export const getReserveAddressFromSymbol = async (symbol: string) => { - const token = await getMintableERC20( + const token = await getMintableErc20( (await getDb().get(`${symbol}.${BRE.network.name}`).value()).address ); diff --git a/test/helpers/utils/interfaces/index.ts b/test/helpers/utils/interfaces/index.ts index 7042bbea..17660fcc 100644 --- a/test/helpers/utils/interfaces/index.ts +++ b/test/helpers/utils/interfaces/index.ts @@ -6,8 +6,7 @@ export interface UserReserveData { currentStableDebt: BigNumber; currentVariableDebt: BigNumber; principalStableDebt: BigNumber; - principalVariableDebt: BigNumber; - variableBorrowIndex: BigNumber; + scaledVariableDebt: BigNumber; liquidityRate: BigNumber; stableBorrowRate: BigNumber; stableRateLastUpdated: BigNumber; @@ -22,8 +21,10 @@ export interface ReserveData { decimals: BigNumber; totalLiquidity: BigNumber; availableLiquidity: BigNumber; - totalBorrowsStable: BigNumber; - totalBorrowsVariable: BigNumber; + totalStableDebt: BigNumber; + totalVariableDebt: BigNumber; + principalStableDebt: BigNumber; + scaledVariableDebt: BigNumber; averageStableBorrowRate: BigNumber; variableBorrowRate: BigNumber; stableBorrowRate: BigNumber; @@ -33,6 +34,7 @@ export interface ReserveData { aTokenAddress: string; marketStableRate: BigNumber; lastUpdateTimestamp: BigNumber; + totalStableDebtLastUpdated: BigNumber; liquidityRate: BigNumber; [key: string]: BigNumber | string; } diff --git a/test/lending-pool-addresses-provider.spec.ts b/test/lending-pool-addresses-provider.spec.ts index 5721ff97..ed283c46 100644 --- a/test/lending-pool-addresses-provider.spec.ts +++ b/test/lending-pool-addresses-provider.spec.ts @@ -2,6 +2,12 @@ import {expect} from 'chai'; import {createRandomAddress} from '../helpers/misc-utils'; import {makeSuite, TestEnv} from './helpers/make-suite'; import {ProtocolErrors} from '../helpers/types'; +import {ethers} from 'ethers'; +import {ZERO_ADDRESS} from '../helpers/constants'; +import {waitForTx} from '../helpers/misc-utils'; +import {deployLendingPool} from '../helpers/contracts-helpers'; + +const {utils} = ethers; makeSuite('LendingPoolAddressesProvider', (testEnv: TestEnv) => { it('Test the accessibility of the LendingPoolAddressesProvider', async () => { @@ -21,5 +27,65 @@ makeSuite('LendingPoolAddressesProvider', (testEnv: TestEnv) => { ]) { await expect(contractFunction(mockAddress)).to.be.revertedWith(INVALID_OWNER_REVERT_MSG); } + + await expect( + addressesProvider.setAddress( + utils.keccak256(utils.toUtf8Bytes('RANDOM_ID')), + mockAddress, + ZERO_ADDRESS + ) + ).to.be.revertedWith(INVALID_OWNER_REVERT_MSG); + }); + + it('Tests adding both a proxied and non-proxied addres with `setAddress()`', async () => { + const {addressesProvider, users} = testEnv; + const {INVALID_OWNER_REVERT_MSG} = ProtocolErrors; + + const currentAddressesProviderOwner = users[1]; + + const mockNonProxiedAddress = createRandomAddress(); + const nonProxiedAddressId = utils.keccak256(utils.toUtf8Bytes('RANDOM_NON_PROXIED')); + + const mockLendingPool = await deployLendingPool(); + const proxiedAddressId = utils.keccak256(utils.toUtf8Bytes('RANDOM_PROXIED')); + + const nonProxiedAddressSetReceipt = await waitForTx( + await addressesProvider + .connect(currentAddressesProviderOwner.signer) + .setAddress(nonProxiedAddressId, mockNonProxiedAddress, ZERO_ADDRESS) + ); + + expect(mockNonProxiedAddress.toLowerCase()).to.be.equal( + (await addressesProvider.getAddress(nonProxiedAddressId)).toLowerCase() + ); + + if (!nonProxiedAddressSetReceipt.events || nonProxiedAddressSetReceipt.events?.length < 1) { + throw new Error('INVALID_EVENT_EMMITED'); + } + + expect(nonProxiedAddressSetReceipt.events[0].event).to.be.equal('AddressSet'); + expect(nonProxiedAddressSetReceipt.events[0].args?.id).to.be.equal(nonProxiedAddressId); + expect(nonProxiedAddressSetReceipt.events[0].args?.newAddress).to.be.equal( + mockNonProxiedAddress + ); + expect(nonProxiedAddressSetReceipt.events[0].args?.hasProxy).to.be.equal(false); + + const proxiedAddressSetReceipt = await waitForTx( + await addressesProvider + .connect(currentAddressesProviderOwner.signer) + .setAddress(proxiedAddressId, ZERO_ADDRESS, mockLendingPool.address) + ); + + if (!proxiedAddressSetReceipt.events || proxiedAddressSetReceipt.events?.length < 2) { + throw new Error('INVALID_EVENT_EMMITED'); + } + + expect(proxiedAddressSetReceipt.events[0].event).to.be.equal('ProxyCreated'); + expect(proxiedAddressSetReceipt.events[1].event).to.be.equal('AddressSet'); + expect(proxiedAddressSetReceipt.events[1].args?.id).to.be.equal(proxiedAddressId); + expect(proxiedAddressSetReceipt.events[1].args?.newAddress).to.be.equal( + mockLendingPool.address + ); + expect(proxiedAddressSetReceipt.events[1].args?.hasProxy).to.be.equal(true); }); }); diff --git a/test/liquidation-underlying.spec.ts b/test/liquidation-underlying.spec.ts index 79fcfb7e..62b72fe2 100644 --- a/test/liquidation-underlying.spec.ts +++ b/test/liquidation-underlying.spec.ts @@ -179,7 +179,9 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset', ); const stableDebtBeforeTx = calcExpectedStableDebtTokenBalance( - userReserveDataBefore, + userReserveDataBefore.principalStableDebt, + userReserveDataBefore.stableBorrowRate, + userReserveDataBefore.stableRateLastUpdated, txTimestamp ); diff --git a/test/repay-with-collateral.spec.ts b/test/repay-with-collateral.spec.ts index 4f68924e..a6df9f99 100644 --- a/test/repay-with-collateral.spec.ts +++ b/test/repay-with-collateral.spec.ts @@ -418,7 +418,9 @@ makeSuite('LendingPool. repayWithCollateral()', (testEnv: TestEnv) => { ).minus(usdcUserDataBefore.currentVariableDebt); const expectedStableDebtIncrease = calcExpectedStableDebtTokenBalance( - usdcUserDataBefore, + usdcUserDataBefore.principalStableDebt, + usdcUserDataBefore.stableBorrowRate, + usdcUserDataBefore.stableRateLastUpdated, new BigNumber(repayWithCollateralTimestamp) ).minus(usdcUserDataBefore.currentStableDebt); @@ -554,14 +556,14 @@ makeSuite('LendingPool. repayWithCollateral()', (testEnv: TestEnv) => { new BigNumber(repayWithCollateralTimestamp) ).minus(daiUserDataBefore.currentVariableDebt); - expect(daiUserDataAfter.currentVariableDebt).to.be.bignumber.equal( + expect(daiUserDataAfter.currentVariableDebt).to.be.bignumber.almostEqual( new BigNumber(daiUserDataBefore.currentVariableDebt) .minus(expectedDebtCovered.toString()) .plus(expectedVariableDebtIncrease), 'INVALID_VARIABLE_DEBT_POSITION' ); - expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.equal(0); + expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.almostEqual(0); expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.false; }); diff --git a/test/upgradeability.spec.ts b/test/upgradeability.spec.ts index 47c452bf..11680124 100644 --- a/test/upgradeability.spec.ts +++ b/test/upgradeability.spec.ts @@ -23,6 +23,7 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => { const aTokenInstance = await deployContract(eContractid.MockAToken, [ pool.address, dai.address, + ZERO_ADDRESS, 'Aave Interest bearing DAI updated', 'aDAI', ZERO_ADDRESS, diff --git a/test/variable-debt-token.spec.ts b/test/variable-debt-token.spec.ts index 89bb1acc..a79bdde2 100644 --- a/test/variable-debt-token.spec.ts +++ b/test/variable-debt-token.spec.ts @@ -18,7 +18,7 @@ makeSuite('Variable debt token tests', (testEnv: TestEnv) => { daiVariableDebtTokenAddress ); - await expect(variableDebtContract.mint(deployer.address, '1')).to.be.revertedWith( + await expect(variableDebtContract.mint(deployer.address, '1', '1')).to.be.revertedWith( CALLER_MUST_BE_LENDING_POOL ); }); @@ -34,7 +34,7 @@ makeSuite('Variable debt token tests', (testEnv: TestEnv) => { daiVariableDebtTokenAddress ); - await expect(variableDebtContract.burn(deployer.address, '1')).to.be.revertedWith( + await expect(variableDebtContract.burn(deployer.address, '1', '1')).to.be.revertedWith( CALLER_MUST_BE_LENDING_POOL ); });