2020-11-20 10:45:20 +00:00
|
|
|
pragma solidity 0.6.12;
|
2020-10-28 23:20:38 +00:00
|
|
|
pragma experimental ABIEncoderV2;
|
|
|
|
|
|
|
|
import {ILendingPool} from '../../contracts/interfaces/ILendingPool.sol';
|
|
|
|
import {LendingPool} from '../../contracts/lendingpool/LendingPool.sol';
|
2020-11-05 13:43:39 +00:00
|
|
|
import {
|
|
|
|
ILendingPoolAddressesProvider
|
|
|
|
} from '../../contracts/interfaces/ILendingPoolAddressesProvider.sol';
|
2020-11-24 13:53:34 +00:00
|
|
|
import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
|
2020-10-28 23:20:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Certora: Harness that delegates calls to the original LendingPool.
|
|
|
|
Used for the verification of the VariableDebtToken contract.
|
|
|
|
*/
|
|
|
|
contract LendingPoolHarnessForVariableDebtToken is ILendingPool {
|
|
|
|
LendingPool private originalPool;
|
|
|
|
|
|
|
|
function deposit(
|
|
|
|
address asset,
|
|
|
|
uint256 amount,
|
|
|
|
address onBehalfOf,
|
|
|
|
uint16 referralCode
|
|
|
|
) external override {
|
|
|
|
originalPool.deposit(asset, amount, onBehalfOf, referralCode);
|
|
|
|
}
|
|
|
|
|
2020-11-05 13:43:39 +00:00
|
|
|
function withdraw(
|
2020-10-28 23:20:38 +00:00
|
|
|
address asset,
|
2020-11-05 13:43:39 +00:00
|
|
|
uint256 amount,
|
|
|
|
address to
|
2020-10-28 23:20:38 +00:00
|
|
|
) external override {
|
2020-11-05 13:43:39 +00:00
|
|
|
originalPool.withdraw(asset, amount, to);
|
2020-10-28 23:20:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function borrow(
|
|
|
|
address asset,
|
|
|
|
uint256 amount,
|
|
|
|
uint256 interestRateMode,
|
|
|
|
uint16 referralCode,
|
|
|
|
address onBehalfOf
|
|
|
|
) external override {
|
|
|
|
originalPool.borrow(asset, amount, interestRateMode, referralCode, onBehalfOf);
|
|
|
|
}
|
|
|
|
|
|
|
|
function repay(
|
|
|
|
address asset,
|
|
|
|
uint256 amount,
|
|
|
|
uint256 rateMode,
|
|
|
|
address onBehalfOf
|
|
|
|
) external override {
|
|
|
|
originalPool.repay(asset, amount, rateMode, onBehalfOf);
|
|
|
|
}
|
|
|
|
|
|
|
|
function swapBorrowRateMode(address asset, uint256 rateMode) external override {
|
|
|
|
originalPool.swapBorrowRateMode(asset, rateMode);
|
|
|
|
}
|
|
|
|
|
|
|
|
function rebalanceStableBorrowRate(address asset, address user) external override {
|
|
|
|
originalPool.rebalanceStableBorrowRate(asset, user);
|
|
|
|
}
|
|
|
|
|
|
|
|
function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external override {
|
|
|
|
originalPool.setUserUseReserveAsCollateral(asset, useAsCollateral);
|
|
|
|
}
|
|
|
|
|
|
|
|
function liquidationCall(
|
|
|
|
address collateral,
|
|
|
|
address asset,
|
|
|
|
address user,
|
2020-11-23 09:58:04 +00:00
|
|
|
uint256 debtToCover,
|
2020-10-28 23:20:38 +00:00
|
|
|
bool receiveAToken
|
|
|
|
) external override {
|
2020-11-23 09:58:04 +00:00
|
|
|
originalPool.liquidationCall(collateral, asset, user, debtToCover, receiveAToken);
|
2020-10-28 23:20:38 +00:00
|
|
|
}
|
|
|
|
|
2020-11-24 13:53:34 +00:00
|
|
|
function getReservesList() external view override returns (address[] memory) {
|
2020-10-28 23:20:38 +00:00
|
|
|
return originalPool.getReservesList();
|
|
|
|
}
|
|
|
|
|
2020-10-30 15:04:31 +00:00
|
|
|
function getReserveData(address asset)
|
|
|
|
external
|
|
|
|
view
|
2020-11-24 13:53:34 +00:00
|
|
|
override
|
|
|
|
returns (DataTypes.ReserveData memory)
|
2020-10-30 15:04:31 +00:00
|
|
|
{
|
2020-10-28 23:20:38 +00:00
|
|
|
return originalPool.getReserveData(asset);
|
|
|
|
}
|
|
|
|
|
2020-10-30 15:04:31 +00:00
|
|
|
function getUserConfiguration(address user)
|
|
|
|
external
|
|
|
|
view
|
2020-11-24 13:53:34 +00:00
|
|
|
override
|
|
|
|
returns (DataTypes.UserBitmap memory)
|
2020-10-30 15:04:31 +00:00
|
|
|
{
|
2020-10-28 23:20:38 +00:00
|
|
|
return originalPool.getUserConfiguration(user);
|
|
|
|
}
|
|
|
|
|
|
|
|
function getUserAccountData(address user)
|
2020-10-30 15:04:31 +00:00
|
|
|
external
|
|
|
|
view
|
2020-11-24 13:53:34 +00:00
|
|
|
override
|
2020-10-30 15:04:31 +00:00
|
|
|
returns (
|
|
|
|
uint256 totalCollateralETH,
|
|
|
|
uint256 totalBorrowsETH,
|
|
|
|
uint256 availableBorrowsETH,
|
|
|
|
uint256 currentLiquidationThreshold,
|
|
|
|
uint256 ltv,
|
|
|
|
uint256 healthFactor
|
|
|
|
)
|
2020-10-28 23:20:38 +00:00
|
|
|
{
|
|
|
|
return originalPool.getUserAccountData(user);
|
|
|
|
}
|
|
|
|
|
|
|
|
function initReserve(
|
|
|
|
address asset,
|
|
|
|
address aTokenAddress,
|
|
|
|
address stableDebtAddress,
|
|
|
|
address variableDebtAddress,
|
|
|
|
address interestRateStrategyAddress
|
|
|
|
) external override {
|
2020-10-30 15:04:31 +00:00
|
|
|
originalPool.initReserve(
|
|
|
|
asset,
|
|
|
|
aTokenAddress,
|
|
|
|
stableDebtAddress,
|
|
|
|
variableDebtAddress,
|
|
|
|
interestRateStrategyAddress
|
|
|
|
);
|
2020-10-28 23:20:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function setReserveInterestRateStrategyAddress(address asset, address rateStrategyAddress)
|
2020-10-30 15:04:31 +00:00
|
|
|
external
|
|
|
|
override
|
2020-10-28 23:20:38 +00:00
|
|
|
{
|
|
|
|
originalPool.setReserveInterestRateStrategyAddress(asset, rateStrategyAddress);
|
|
|
|
}
|
|
|
|
|
|
|
|
function setConfiguration(address asset, uint256 configuration) external override {
|
|
|
|
originalPool.setConfiguration(asset, configuration);
|
|
|
|
}
|
|
|
|
|
|
|
|
function getConfiguration(address asset)
|
2020-10-30 15:04:31 +00:00
|
|
|
external
|
|
|
|
view
|
2020-11-24 13:53:34 +00:00
|
|
|
override
|
|
|
|
returns (DataTypes.ReserveBitmap memory)
|
2020-10-28 23:20:38 +00:00
|
|
|
{
|
|
|
|
return originalPool.getConfiguration(asset);
|
|
|
|
}
|
|
|
|
|
|
|
|
mapping(uint256 => uint256) private reserveNormalizedIncome;
|
|
|
|
|
2020-11-24 13:53:34 +00:00
|
|
|
function getReserveNormalizedIncome(address asset) external view override returns (uint256) {
|
2020-10-28 23:20:38 +00:00
|
|
|
require(reserveNormalizedIncome[block.timestamp] == 1e27);
|
|
|
|
return reserveNormalizedIncome[block.timestamp];
|
|
|
|
}
|
|
|
|
|
|
|
|
mapping(uint256 => uint256) private reserveNormalizedVariableDebt;
|
|
|
|
|
|
|
|
function getReserveNormalizedVariableDebt(address asset)
|
2020-10-30 15:04:31 +00:00
|
|
|
external
|
|
|
|
view
|
2020-11-24 13:53:34 +00:00
|
|
|
override
|
2020-10-30 15:04:31 +00:00
|
|
|
returns (uint256)
|
2020-10-28 23:20:38 +00:00
|
|
|
{
|
|
|
|
require(reserveNormalizedVariableDebt[block.timestamp] == 1e27);
|
|
|
|
return reserveNormalizedVariableDebt[block.timestamp];
|
|
|
|
}
|
|
|
|
|
|
|
|
function setPause(bool val) external override {
|
|
|
|
originalPool.setPause(val);
|
|
|
|
}
|
|
|
|
|
2020-11-24 13:53:34 +00:00
|
|
|
function paused() external view override returns (bool) {
|
2020-10-28 23:20:38 +00:00
|
|
|
return originalPool.paused();
|
|
|
|
}
|
2020-10-29 23:07:30 +00:00
|
|
|
|
|
|
|
function flashLoan(
|
|
|
|
address receiver,
|
|
|
|
address[] calldata assets,
|
|
|
|
uint256[] calldata amounts,
|
2020-11-05 13:43:39 +00:00
|
|
|
uint256[] calldata modes,
|
2020-10-29 23:07:30 +00:00
|
|
|
address onBehalfOf,
|
|
|
|
bytes calldata params,
|
|
|
|
uint16 referralCode
|
|
|
|
) external override {
|
2020-11-05 13:43:39 +00:00
|
|
|
originalPool.flashLoan(receiver, assets, amounts, modes, onBehalfOf, params, referralCode);
|
2020-10-29 23:07:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function finalizeTransfer(
|
|
|
|
address asset,
|
|
|
|
address from,
|
|
|
|
address to,
|
|
|
|
uint256 amount,
|
|
|
|
uint256 balanceFromAfter,
|
|
|
|
uint256 balanceToBefore
|
|
|
|
) external override {
|
|
|
|
originalPool.finalizeTransfer(asset, from, to, amount, balanceFromAfter, balanceToBefore);
|
|
|
|
}
|
2020-11-05 13:43:39 +00:00
|
|
|
|
2020-11-24 13:53:34 +00:00
|
|
|
function getAddressesProvider() external view override returns (ILendingPoolAddressesProvider) {
|
2020-11-05 13:43:39 +00:00
|
|
|
return originalPool.getAddressesProvider();
|
|
|
|
}
|
2020-10-28 23:20:38 +00:00
|
|
|
}
|