mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Merge branch 'feat/rm-unused-imports' into 'master'
Resolve "Remove unused imports" Closes #65 See merge request aave-tech/protocol-v2!73
This commit is contained in:
commit
81df469a3e
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
|
import {Ownable} from '../dependencies/openzeppelin/contracts/Ownable.sol';
|
||||||
import {
|
import {
|
||||||
InitializableImmutableAdminUpgradeabilityProxy
|
InitializableImmutableAdminUpgradeabilityProxy
|
||||||
} from '../libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
|
} from '../libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
|
||||||
|
@ -153,9 +153,9 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider
|
||||||
function _updateImpl(bytes32 id, address newAddress) internal {
|
function _updateImpl(bytes32 id, address newAddress) internal {
|
||||||
address payable proxyAddress = payable(_addresses[id]);
|
address payable proxyAddress = payable(_addresses[id]);
|
||||||
|
|
||||||
InitializableImmutableAdminUpgradeabilityProxy proxy = InitializableImmutableAdminUpgradeabilityProxy(
|
|
||||||
proxyAddress
|
InitializableImmutableAdminUpgradeabilityProxy proxy
|
||||||
);
|
= InitializableImmutableAdminUpgradeabilityProxy(proxyAddress);
|
||||||
bytes memory params = abi.encodeWithSignature('initialize(address)', address(this));
|
bytes memory params = abi.encodeWithSignature('initialize(address)', address(this));
|
||||||
|
|
||||||
if (proxyAddress == address(0)) {
|
if (proxyAddress == address(0)) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
|
import {Ownable} from '../dependencies/openzeppelin/contracts/Ownable.sol';
|
||||||
import {
|
import {
|
||||||
ILendingPoolAddressesProviderRegistry
|
ILendingPoolAddressesProviderRegistry
|
||||||
} from '../interfaces/ILendingPoolAddressesProviderRegistry.sol';
|
} from '../interfaces/ILendingPoolAddressesProviderRegistry.sol';
|
||||||
|
|
344
contracts/dependencies/openzeppelin/contracts/ERC20.sol
Normal file
344
contracts/dependencies/openzeppelin/contracts/ERC20.sol
Normal file
|
@ -0,0 +1,344 @@
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
pragma solidity ^0.6.0;
|
||||||
|
|
||||||
|
import './Context.sol';
|
||||||
|
import './IERC20.sol';
|
||||||
|
import './SafeMath.sol';
|
||||||
|
import './Address.sol';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Implementation of the {IERC20} interface.
|
||||||
|
*
|
||||||
|
* This implementation is agnostic to the way tokens are created. This means
|
||||||
|
* that a supply mechanism has to be added in a derived contract using {_mint}.
|
||||||
|
* For a generic mechanism see {ERC20PresetMinterPauser}.
|
||||||
|
*
|
||||||
|
* TIP: For a detailed writeup see our guide
|
||||||
|
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
|
||||||
|
* to implement supply mechanisms].
|
||||||
|
*
|
||||||
|
* We have followed general OpenZeppelin guidelines: functions revert instead
|
||||||
|
* of returning `false` on failure. This behavior is nonetheless conventional
|
||||||
|
* and does not conflict with the expectations of ERC20 applications.
|
||||||
|
*
|
||||||
|
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
|
||||||
|
* This allows applications to reconstruct the allowance for all accounts just
|
||||||
|
* by listening to said events. Other implementations of the EIP may not emit
|
||||||
|
* these events, as it isn't required by the specification.
|
||||||
|
*
|
||||||
|
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
|
||||||
|
* functions have been added to mitigate the well-known issues around setting
|
||||||
|
* allowances. See {IERC20-approve}.
|
||||||
|
*/
|
||||||
|
contract ERC20 is Context, IERC20 {
|
||||||
|
using SafeMath for uint256;
|
||||||
|
using Address for address;
|
||||||
|
|
||||||
|
mapping(address => uint256) private _balances;
|
||||||
|
|
||||||
|
mapping(address => mapping(address => uint256)) private _allowances;
|
||||||
|
|
||||||
|
uint256 private _totalSupply;
|
||||||
|
|
||||||
|
string private _name;
|
||||||
|
string private _symbol;
|
||||||
|
uint8 private _decimals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
|
||||||
|
* a default value of 18.
|
||||||
|
*
|
||||||
|
* To select a different value for {decimals}, use {_setupDecimals}.
|
||||||
|
*
|
||||||
|
* All three of these values are immutable: they can only be set once during
|
||||||
|
* construction.
|
||||||
|
*/
|
||||||
|
constructor(string memory name, string memory symbol) public {
|
||||||
|
_name = name;
|
||||||
|
_symbol = symbol;
|
||||||
|
_decimals = 18;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Returns the name of the token.
|
||||||
|
*/
|
||||||
|
function name() public view returns (string memory) {
|
||||||
|
return _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Returns the symbol of the token, usually a shorter version of the
|
||||||
|
* name.
|
||||||
|
*/
|
||||||
|
function symbol() public view returns (string memory) {
|
||||||
|
return _symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Returns the number of decimals used to get its user representation.
|
||||||
|
* For example, if `decimals` equals `2`, a balance of `505` tokens should
|
||||||
|
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
|
||||||
|
*
|
||||||
|
* Tokens usually opt for a value of 18, imitating the relationship between
|
||||||
|
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
|
||||||
|
* called.
|
||||||
|
*
|
||||||
|
* NOTE: This information is only used for _display_ purposes: it in
|
||||||
|
* no way affects any of the arithmetic of the contract, including
|
||||||
|
* {IERC20-balanceOf} and {IERC20-transfer}.
|
||||||
|
*/
|
||||||
|
function decimals() public view returns (uint8) {
|
||||||
|
return _decimals;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev See {IERC20-totalSupply}.
|
||||||
|
*/
|
||||||
|
function totalSupply() public override view returns (uint256) {
|
||||||
|
return _totalSupply;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev See {IERC20-balanceOf}.
|
||||||
|
*/
|
||||||
|
function balanceOf(address account) public override view returns (uint256) {
|
||||||
|
return _balances[account];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev See {IERC20-transfer}.
|
||||||
|
*
|
||||||
|
* Requirements:
|
||||||
|
*
|
||||||
|
* - `recipient` cannot be the zero address.
|
||||||
|
* - the caller must have a balance of at least `amount`.
|
||||||
|
*/
|
||||||
|
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
|
||||||
|
_transfer(_msgSender(), recipient, amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev See {IERC20-allowance}.
|
||||||
|
*/
|
||||||
|
function allowance(address owner, address spender)
|
||||||
|
public
|
||||||
|
virtual
|
||||||
|
override
|
||||||
|
view
|
||||||
|
returns (uint256)
|
||||||
|
{
|
||||||
|
return _allowances[owner][spender];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev See {IERC20-approve}.
|
||||||
|
*
|
||||||
|
* Requirements:
|
||||||
|
*
|
||||||
|
* - `spender` cannot be the zero address.
|
||||||
|
*/
|
||||||
|
function approve(address spender, uint256 amount) public virtual override returns (bool) {
|
||||||
|
_approve(_msgSender(), spender, amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev See {IERC20-transferFrom}.
|
||||||
|
*
|
||||||
|
* Emits an {Approval} event indicating the updated allowance. This is not
|
||||||
|
* required by the EIP. See the note at the beginning of {ERC20};
|
||||||
|
*
|
||||||
|
* Requirements:
|
||||||
|
* - `sender` and `recipient` cannot be the zero address.
|
||||||
|
* - `sender` must have a balance of at least `amount`.
|
||||||
|
* - the caller must have allowance for ``sender``'s tokens of at least
|
||||||
|
* `amount`.
|
||||||
|
*/
|
||||||
|
function transferFrom(
|
||||||
|
address sender,
|
||||||
|
address recipient,
|
||||||
|
uint256 amount
|
||||||
|
) public virtual override returns (bool) {
|
||||||
|
_transfer(sender, recipient, amount);
|
||||||
|
_approve(
|
||||||
|
sender,
|
||||||
|
_msgSender(),
|
||||||
|
_allowances[sender][_msgSender()].sub(amount, 'ERC20: transfer amount exceeds allowance')
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Atomically increases the allowance granted to `spender` by the caller.
|
||||||
|
*
|
||||||
|
* This is an alternative to {approve} that can be used as a mitigation for
|
||||||
|
* problems described in {IERC20-approve}.
|
||||||
|
*
|
||||||
|
* Emits an {Approval} event indicating the updated allowance.
|
||||||
|
*
|
||||||
|
* Requirements:
|
||||||
|
*
|
||||||
|
* - `spender` cannot be the zero address.
|
||||||
|
*/
|
||||||
|
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
|
||||||
|
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Atomically decreases the allowance granted to `spender` by the caller.
|
||||||
|
*
|
||||||
|
* This is an alternative to {approve} that can be used as a mitigation for
|
||||||
|
* problems described in {IERC20-approve}.
|
||||||
|
*
|
||||||
|
* Emits an {Approval} event indicating the updated allowance.
|
||||||
|
*
|
||||||
|
* Requirements:
|
||||||
|
*
|
||||||
|
* - `spender` cannot be the zero address.
|
||||||
|
* - `spender` must have allowance for the caller of at least
|
||||||
|
* `subtractedValue`.
|
||||||
|
*/
|
||||||
|
function decreaseAllowance(address spender, uint256 subtractedValue)
|
||||||
|
public
|
||||||
|
virtual
|
||||||
|
returns (bool)
|
||||||
|
{
|
||||||
|
_approve(
|
||||||
|
_msgSender(),
|
||||||
|
spender,
|
||||||
|
_allowances[_msgSender()][spender].sub(
|
||||||
|
subtractedValue,
|
||||||
|
'ERC20: decreased allowance below zero'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Moves tokens `amount` from `sender` to `recipient`.
|
||||||
|
*
|
||||||
|
* This is internal function is equivalent to {transfer}, and can be used to
|
||||||
|
* e.g. implement automatic token fees, slashing mechanisms, etc.
|
||||||
|
*
|
||||||
|
* Emits a {Transfer} event.
|
||||||
|
*
|
||||||
|
* Requirements:
|
||||||
|
*
|
||||||
|
* - `sender` cannot be the zero address.
|
||||||
|
* - `recipient` cannot be the zero address.
|
||||||
|
* - `sender` must have a balance of at least `amount`.
|
||||||
|
*/
|
||||||
|
function _transfer(
|
||||||
|
address sender,
|
||||||
|
address recipient,
|
||||||
|
uint256 amount
|
||||||
|
) internal virtual {
|
||||||
|
require(sender != address(0), 'ERC20: transfer from the zero address');
|
||||||
|
require(recipient != address(0), 'ERC20: transfer to the zero address');
|
||||||
|
|
||||||
|
_beforeTokenTransfer(sender, recipient, amount);
|
||||||
|
|
||||||
|
_balances[sender] = _balances[sender].sub(amount, 'ERC20: transfer amount exceeds balance');
|
||||||
|
_balances[recipient] = _balances[recipient].add(amount);
|
||||||
|
emit Transfer(sender, recipient, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
|
||||||
|
* the total supply.
|
||||||
|
*
|
||||||
|
* Emits a {Transfer} event with `from` set to the zero address.
|
||||||
|
*
|
||||||
|
* Requirements
|
||||||
|
*
|
||||||
|
* - `to` cannot be the zero address.
|
||||||
|
*/
|
||||||
|
function _mint(address account, uint256 amount) internal virtual {
|
||||||
|
require(account != address(0), 'ERC20: mint to the zero address');
|
||||||
|
|
||||||
|
_beforeTokenTransfer(address(0), account, amount);
|
||||||
|
|
||||||
|
_totalSupply = _totalSupply.add(amount);
|
||||||
|
_balances[account] = _balances[account].add(amount);
|
||||||
|
emit Transfer(address(0), account, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Destroys `amount` tokens from `account`, reducing the
|
||||||
|
* total supply.
|
||||||
|
*
|
||||||
|
* Emits a {Transfer} event with `to` set to the zero address.
|
||||||
|
*
|
||||||
|
* Requirements
|
||||||
|
*
|
||||||
|
* - `account` cannot be the zero address.
|
||||||
|
* - `account` must have at least `amount` tokens.
|
||||||
|
*/
|
||||||
|
function _burn(address account, uint256 amount) internal virtual {
|
||||||
|
require(account != address(0), 'ERC20: burn from the zero address');
|
||||||
|
|
||||||
|
_beforeTokenTransfer(account, address(0), amount);
|
||||||
|
|
||||||
|
_balances[account] = _balances[account].sub(amount, 'ERC20: burn amount exceeds balance');
|
||||||
|
_totalSupply = _totalSupply.sub(amount);
|
||||||
|
emit Transfer(account, address(0), amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
|
||||||
|
*
|
||||||
|
* This is internal function is equivalent to `approve`, and can be used to
|
||||||
|
* e.g. set automatic allowances for certain subsystems, etc.
|
||||||
|
*
|
||||||
|
* Emits an {Approval} event.
|
||||||
|
*
|
||||||
|
* Requirements:
|
||||||
|
*
|
||||||
|
* - `owner` cannot be the zero address.
|
||||||
|
* - `spender` cannot be the zero address.
|
||||||
|
*/
|
||||||
|
function _approve(
|
||||||
|
address owner,
|
||||||
|
address spender,
|
||||||
|
uint256 amount
|
||||||
|
) internal virtual {
|
||||||
|
require(owner != address(0), 'ERC20: approve from the zero address');
|
||||||
|
require(spender != address(0), 'ERC20: approve to the zero address');
|
||||||
|
|
||||||
|
_allowances[owner][spender] = amount;
|
||||||
|
emit Approval(owner, spender, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Sets {decimals} to a value other than the default one of 18.
|
||||||
|
*
|
||||||
|
* WARNING: This function should only be called from the constructor. Most
|
||||||
|
* applications that interact with token contracts will not expect
|
||||||
|
* {decimals} to ever change, and may work incorrectly if it does.
|
||||||
|
*/
|
||||||
|
function _setupDecimals(uint8 decimals_) internal {
|
||||||
|
_decimals = decimals_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Hook that is called before any transfer of tokens. This includes
|
||||||
|
* minting and burning.
|
||||||
|
*
|
||||||
|
* Calling conditions:
|
||||||
|
*
|
||||||
|
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
|
||||||
|
* will be to transferred to `to`.
|
||||||
|
* - when `from` is zero, `amount` tokens will be minted for `to`.
|
||||||
|
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
|
||||||
|
* - `from` and `to` are never both zero.
|
||||||
|
*
|
||||||
|
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
|
||||||
|
*/
|
||||||
|
function _beforeTokenTransfer(
|
||||||
|
address from,
|
||||||
|
address to,
|
||||||
|
uint256 amount
|
||||||
|
) internal virtual {}
|
||||||
|
}
|
69
contracts/dependencies/openzeppelin/contracts/Ownable.sol
Normal file
69
contracts/dependencies/openzeppelin/contracts/Ownable.sol
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
pragma solidity ^0.6.0;
|
||||||
|
|
||||||
|
import './Context.sol';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Contract module which provides a basic access control mechanism, where
|
||||||
|
* there is an account (an owner) that can be granted exclusive access to
|
||||||
|
* specific functions.
|
||||||
|
*
|
||||||
|
* By default, the owner account will be the one that deploys the contract. This
|
||||||
|
* can later be changed with {transferOwnership}.
|
||||||
|
*
|
||||||
|
* This module is used through inheritance. It will make available the modifier
|
||||||
|
* `onlyOwner`, which can be applied to your functions to restrict their use to
|
||||||
|
* the owner.
|
||||||
|
*/
|
||||||
|
contract Ownable is Context {
|
||||||
|
address private _owner;
|
||||||
|
|
||||||
|
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Initializes the contract setting the deployer as the initial owner.
|
||||||
|
*/
|
||||||
|
constructor() internal {
|
||||||
|
address msgSender = _msgSender();
|
||||||
|
_owner = msgSender;
|
||||||
|
emit OwnershipTransferred(address(0), msgSender);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Returns the address of the current owner.
|
||||||
|
*/
|
||||||
|
function owner() public view returns (address) {
|
||||||
|
return _owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Throws if called by any account other than the owner.
|
||||||
|
*/
|
||||||
|
modifier onlyOwner() {
|
||||||
|
require(_owner == _msgSender(), 'Ownable: caller is not the owner');
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Leaves the contract without owner. It will not be possible to call
|
||||||
|
* `onlyOwner` functions anymore. Can only be called by the current owner.
|
||||||
|
*
|
||||||
|
* NOTE: Renouncing ownership will leave the contract without an owner,
|
||||||
|
* thereby removing any functionality that is only available to the owner.
|
||||||
|
*/
|
||||||
|
function renounceOwnership() public virtual onlyOwner {
|
||||||
|
emit OwnershipTransferred(_owner, address(0));
|
||||||
|
_owner = address(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Transfers ownership of the contract to a new account (`newOwner`).
|
||||||
|
* Can only be called by the current owner.
|
||||||
|
*/
|
||||||
|
function transferOwnership(address newOwner) public virtual onlyOwner {
|
||||||
|
require(newOwner != address(0), 'Ownable: new owner is the zero address');
|
||||||
|
emit OwnershipTransferred(_owner, newOwner);
|
||||||
|
_owner = newOwner;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
pragma solidity 0.6.8;
|
pragma solidity 0.6.8;
|
||||||
|
|
||||||
import {IERC20} from '../interfaces/IERC20.sol';
|
import {IERC20} from './IERC20.sol';
|
||||||
import {SafeMath} from '../libraries/math/SafeMath.sol';
|
import {SafeMath} from './SafeMath.sol';
|
||||||
import {Address} from './Address.sol';
|
import {Address} from './Address.sol';
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -2,7 +2,7 @@
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import './Proxy.sol';
|
import './Proxy.sol';
|
||||||
import '@openzeppelin/contracts/utils/Address.sol';
|
import '../contracts/Address.sol';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title BaseUpgradeabilityProxy
|
* @title BaseUpgradeabilityProxy
|
|
@ -1,12 +1,11 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||||
import {IFlashLoanReceiver} from '../interfaces/IFlashLoanReceiver.sol';
|
import {IFlashLoanReceiver} from '../interfaces/IFlashLoanReceiver.sol';
|
||||||
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
|
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
|
||||||
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
|
import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
|
||||||
import '@nomiclabs/buidler/console.sol';
|
|
||||||
|
|
||||||
abstract contract FlashLoanReceiverBase is IFlashLoanReceiver {
|
abstract contract FlashLoanReceiverBase is IFlashLoanReceiver {
|
||||||
using SafeERC20 for IERC20;
|
using SafeERC20 for IERC20;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||||
|
|
||||||
interface IExchangeAdapter {
|
interface IExchangeAdapter {
|
||||||
event Exchange(
|
event Exchange(
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {LendingPoolAddressesProvider} from '../configuration/LendingPoolAddressesProvider.sol';
|
|
||||||
import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
|
import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
|
||||||
import {UserConfiguration} from '../libraries/configuration/UserConfiguration.sol';
|
import {UserConfiguration} from '../libraries/configuration/UserConfiguration.sol';
|
||||||
import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol';
|
import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol';
|
||||||
import {IReserveInterestRateStrategy} from '../interfaces/IReserveInterestRateStrategy.sol';
|
import {IReserveInterestRateStrategy} from '../interfaces/IReserveInterestRateStrategy.sol';
|
||||||
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
|
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
|
||||||
import {PercentageMath} from '../libraries/math/PercentageMath.sol';
|
import {PercentageMath} from '../libraries/math/PercentageMath.sol';
|
||||||
|
|
|
@ -2,11 +2,9 @@
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol';
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||||
import {
|
import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
|
||||||
VersionedInitializable
|
|
||||||
} from '../libraries/openzeppelin-upgradeability/VersionedInitializable.sol';
|
|
||||||
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
||||||
import {IAToken} from '../tokenization/interfaces/IAToken.sol';
|
import {IAToken} from '../tokenization/interfaces/IAToken.sol';
|
||||||
import {Helpers} from '../libraries/helpers/Helpers.sol';
|
import {Helpers} from '../libraries/helpers/Helpers.sol';
|
||||||
|
@ -25,7 +23,7 @@ import {IFlashLoanReceiver} from '../flashloan/interfaces/IFlashLoanReceiver.sol
|
||||||
import {ISwapAdapter} from '../interfaces/ISwapAdapter.sol';
|
import {ISwapAdapter} from '../interfaces/ISwapAdapter.sol';
|
||||||
import {LendingPoolCollateralManager} from './LendingPoolCollateralManager.sol';
|
import {LendingPoolCollateralManager} from './LendingPoolCollateralManager.sol';
|
||||||
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
||||||
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
|
import {SafeERC20} from '../dependencies/openzeppelin/contracts/SafeERC20.sol';
|
||||||
import {ILendingPool} from '../interfaces/ILendingPool.sol';
|
import {ILendingPool} from '../interfaces/ILendingPool.sol';
|
||||||
import {LendingPoolStorage} from './LendingPoolStorage.sol';
|
import {LendingPoolStorage} from './LendingPoolStorage.sol';
|
||||||
import {IReserveInterestRateStrategy} from '../interfaces/IReserveInterestRateStrategy.sol';
|
import {IReserveInterestRateStrategy} from '../interfaces/IReserveInterestRateStrategy.sol';
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
import {SafeMath} from '../dependencies/openzeppelin/contracts//SafeMath.sol';
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
import {IERC20} from '../dependencies/openzeppelin/contracts//IERC20.sol';
|
||||||
import {
|
import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
|
||||||
VersionedInitializable
|
|
||||||
} from '../libraries/openzeppelin-upgradeability/VersionedInitializable.sol';
|
|
||||||
import {IAToken} from '../tokenization/interfaces/IAToken.sol';
|
import {IAToken} from '../tokenization/interfaces/IAToken.sol';
|
||||||
import {IStableDebtToken} from '../tokenization/interfaces/IStableDebtToken.sol';
|
import {IStableDebtToken} from '../tokenization/interfaces/IStableDebtToken.sol';
|
||||||
import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol';
|
import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol';
|
||||||
import {DebtTokenBase} from '../tokenization/base/DebtTokenBase.sol';
|
|
||||||
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
||||||
import {GenericLogic} from '../libraries/logic/GenericLogic.sol';
|
import {GenericLogic} from '../libraries/logic/GenericLogic.sol';
|
||||||
import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol';
|
import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol';
|
||||||
|
@ -17,7 +14,7 @@ import {UserConfiguration} from '../libraries/configuration/UserConfiguration.so
|
||||||
import {Helpers} from '../libraries/helpers/Helpers.sol';
|
import {Helpers} from '../libraries/helpers/Helpers.sol';
|
||||||
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
|
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
|
||||||
import {PercentageMath} from '../libraries/math/PercentageMath.sol';
|
import {PercentageMath} from '../libraries/math/PercentageMath.sol';
|
||||||
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
|
import {SafeERC20} from '../dependencies/openzeppelin/contracts/SafeERC20.sol';
|
||||||
import {ISwapAdapter} from '../interfaces/ISwapAdapter.sol';
|
import {ISwapAdapter} from '../interfaces/ISwapAdapter.sol';
|
||||||
import {Errors} from '../libraries/helpers/Errors.sol';
|
import {Errors} from '../libraries/helpers/Errors.sol';
|
||||||
import {ValidationLogic} from '../libraries/logic/ValidationLogic.sol';
|
import {ValidationLogic} from '../libraries/logic/ValidationLogic.sol';
|
||||||
|
|
|
@ -2,17 +2,15 @@
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol';
|
||||||
import {
|
import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
|
||||||
VersionedInitializable
|
|
||||||
} from '../libraries/openzeppelin-upgradeability/VersionedInitializable.sol';
|
|
||||||
import {
|
import {
|
||||||
InitializableImmutableAdminUpgradeabilityProxy
|
InitializableImmutableAdminUpgradeabilityProxy
|
||||||
} from '../libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
|
} from '../libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
|
||||||
import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
|
import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
|
||||||
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
||||||
import {ILendingPool} from '../interfaces/ILendingPool.sol';
|
import {ILendingPool} from '../interfaces/ILendingPool.sol';
|
||||||
import {IERC20Detailed} from '../interfaces/IERC20Detailed.sol';
|
import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
|
||||||
import {Errors} from '../libraries/helpers/Errors.sol';
|
import {Errors} from '../libraries/helpers/Errors.sol';
|
||||||
import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol';
|
import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import '../openzeppelin-upgradeability/BaseUpgradeabilityProxy.sol';
|
import '../../dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title BaseImmutableAdminUpgradeabilityProxy
|
* @title BaseImmutableAdminUpgradeabilityProxy
|
||||||
|
@ -14,7 +14,6 @@ import '../openzeppelin-upgradeability/BaseUpgradeabilityProxy.sol';
|
||||||
* feature proposal that would enable this to be done automatically.
|
* feature proposal that would enable this to be done automatically.
|
||||||
*/
|
*/
|
||||||
contract BaseImmutableAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
|
contract BaseImmutableAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
|
||||||
|
|
||||||
address immutable ADMIN;
|
address immutable ADMIN;
|
||||||
|
|
||||||
constructor(address admin) public {
|
constructor(address admin) public {
|
||||||
|
@ -71,7 +70,6 @@ contract BaseImmutableAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
|
||||||
require(success);
|
require(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Only fall back when the sender is not the admin.
|
* @dev Only fall back when the sender is not the admin.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import './BaseImmutableAdminUpgradeabilityProxy.sol';
|
import './BaseImmutableAdminUpgradeabilityProxy.sol';
|
||||||
import '../openzeppelin-upgradeability/InitializableUpgradeabilityProxy.sol';
|
import '../../dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title InitializableAdminUpgradeabilityProxy
|
* @title InitializableAdminUpgradeabilityProxy
|
||||||
|
@ -13,9 +13,7 @@ contract InitializableImmutableAdminUpgradeabilityProxy is
|
||||||
BaseImmutableAdminUpgradeabilityProxy,
|
BaseImmutableAdminUpgradeabilityProxy,
|
||||||
InitializableUpgradeabilityProxy
|
InitializableUpgradeabilityProxy
|
||||||
{
|
{
|
||||||
|
constructor(address admin) public BaseImmutableAdminUpgradeabilityProxy(admin) {}
|
||||||
constructor(address admin) public BaseImmutableAdminUpgradeabilityProxy(admin) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Only fall back when the sender is not the admin.
|
* @dev Only fall back when the sender is not the admin.
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
|
||||||
import {ReserveLogic} from '../logic/ReserveLogic.sol';
|
|
||||||
import {WadRayMath} from '../math/WadRayMath.sol';
|
|
||||||
import {IPriceOracleGetter} from '../../interfaces/IPriceOracleGetter.sol';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title ReserveConfiguration library
|
* @title ReserveConfiguration library
|
||||||
* @author Aave
|
* @author Aave
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
|
||||||
import {WadRayMath} from '../math/WadRayMath.sol';
|
|
||||||
import {IPriceOracleGetter} from '../../interfaces/IPriceOracleGetter.sol';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title UserConfiguration library
|
* @title UserConfiguration library
|
||||||
* @author Aave
|
* @author Aave
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||||
import {ReserveLogic} from './ReserveLogic.sol';
|
import {ReserveLogic} from './ReserveLogic.sol';
|
||||||
import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
|
import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
|
||||||
import {UserConfiguration} from '../configuration/UserConfiguration.sol';
|
import {UserConfiguration} from '../configuration/UserConfiguration.sol';
|
||||||
|
@ -68,7 +68,9 @@ library GenericLogic {
|
||||||
|
|
||||||
balanceDecreaseAllowedLocalVars memory vars;
|
balanceDecreaseAllowedLocalVars memory vars;
|
||||||
|
|
||||||
(, vars.liquidationThreshold, , vars.decimals, ) = reservesData[asset].configuration.getParams();
|
(, vars.liquidationThreshold, , vars.decimals, ) = reservesData[asset]
|
||||||
|
.configuration
|
||||||
|
.getParams();
|
||||||
|
|
||||||
if (vars.liquidationThreshold == 0) {
|
if (vars.liquidationThreshold == 0) {
|
||||||
return true; //if reserve is not used as collateral, no reasons to block the transfer
|
return true; //if reserve is not used as collateral, no reasons to block the transfer
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||||
import {MathUtils} from '../math/MathUtils.sol';
|
import {MathUtils} from '../math/MathUtils.sol';
|
||||||
import {IPriceOracleGetter} from '../../interfaces/IPriceOracleGetter.sol';
|
import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
|
||||||
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
|
|
||||||
import {IAToken} from '../../tokenization/interfaces/IAToken.sol';
|
import {IAToken} from '../../tokenization/interfaces/IAToken.sol';
|
||||||
import {IStableDebtToken} from '../../tokenization/interfaces/IStableDebtToken.sol';
|
import {IStableDebtToken} from '../../tokenization/interfaces/IStableDebtToken.sol';
|
||||||
import {IVariableDebtToken} from '../../tokenization/interfaces/IVariableDebtToken.sol';
|
import {IVariableDebtToken} from '../../tokenization/interfaces/IVariableDebtToken.sol';
|
||||||
|
|
|
@ -2,16 +2,15 @@
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||||
import {ReserveLogic} from './ReserveLogic.sol';
|
import {ReserveLogic} from './ReserveLogic.sol';
|
||||||
import {GenericLogic} from './GenericLogic.sol';
|
import {GenericLogic} from './GenericLogic.sol';
|
||||||
import {WadRayMath} from '../math/WadRayMath.sol';
|
import {WadRayMath} from '../math/WadRayMath.sol';
|
||||||
import {PercentageMath} from '../math/PercentageMath.sol';
|
import {PercentageMath} from '../math/PercentageMath.sol';
|
||||||
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
|
import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
|
||||||
import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
|
import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
|
||||||
import {UserConfiguration} from '../configuration/UserConfiguration.sol';
|
import {UserConfiguration} from '../configuration/UserConfiguration.sol';
|
||||||
import {IPriceOracleGetter} from '../../interfaces/IPriceOracleGetter.sol';
|
|
||||||
import {Errors} from '../helpers/Errors.sol';
|
import {Errors} from '../helpers/Errors.sol';
|
||||||
import {Helpers} from '../helpers/Helpers.sol';
|
import {Helpers} from '../helpers/Helpers.sol';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
|
||||||
import {WadRayMath} from './WadRayMath.sol';
|
import {WadRayMath} from './WadRayMath.sol';
|
||||||
|
|
||||||
library MathUtils {
|
library MathUtils {
|
||||||
|
|
|
@ -3,7 +3,7 @@ pragma solidity ^0.6.8;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
||||||
import {IERC20Detailed} from '../interfaces/IERC20Detailed.sol';
|
import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
|
||||||
import {ILendingPool} from '../interfaces/ILendingPool.sol';
|
import {ILendingPool} from '../interfaces/ILendingPool.sol';
|
||||||
import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol';
|
import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol';
|
||||||
import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
|
import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
|
import {Ownable} from '../dependencies/openzeppelin/contracts/Ownable.sol';
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||||
|
|
||||||
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
||||||
import {IChainlinkAggregator} from '../interfaces/IChainlinkAggregator.sol';
|
import {IChainlinkAggregator} from '../interfaces/IChainlinkAggregator.sol';
|
||||||
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
|
import {SafeERC20} from '../dependencies/openzeppelin/contracts/SafeERC20.sol';
|
||||||
|
|
||||||
/// @title ChainlinkProxyPriceProvider
|
/// @title ChainlinkProxyPriceProvider
|
||||||
/// @author Aave
|
/// @author Aave
|
||||||
|
|
|
@ -3,12 +3,12 @@ pragma solidity ^0.6.8;
|
||||||
|
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import {Address} from '@openzeppelin/contracts/utils/Address.sol';
|
import {Address} from '../dependencies/openzeppelin/contracts/Address.sol';
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||||
|
|
||||||
import {LendingPoolAddressesProvider} from '../configuration/LendingPoolAddressesProvider.sol';
|
import {LendingPoolAddressesProvider} from '../configuration/LendingPoolAddressesProvider.sol';
|
||||||
import {ILendingPool} from '../interfaces/ILendingPool.sol';
|
import {ILendingPool} from '../interfaces/ILendingPool.sol';
|
||||||
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
|
import {SafeERC20} from '../dependencies/openzeppelin/contracts/SafeERC20.sol';
|
||||||
import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
|
import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||||
|
|
||||||
import {FlashLoanReceiverBase} from '../../flashloan/base/FlashLoanReceiverBase.sol';
|
import {FlashLoanReceiverBase} from '../../flashloan/base/FlashLoanReceiverBase.sol';
|
||||||
import {MintableERC20} from '../tokens/MintableERC20.sol';
|
import {MintableERC20} from '../tokens/MintableERC20.sol';
|
||||||
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
|
import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
|
||||||
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
|
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
|
||||||
|
|
||||||
contract MockFlashLoanReceiver is FlashLoanReceiverBase {
|
contract MockFlashLoanReceiver is FlashLoanReceiverBase {
|
||||||
using SafeMath for uint256;
|
|
||||||
using SafeERC20 for IERC20;
|
using SafeERC20 for IERC20;
|
||||||
|
|
||||||
ILendingPoolAddressesProvider internal _provider;
|
ILendingPoolAddressesProvider internal _provider;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {MintableERC20} from '../tokens/MintableERC20.sol';
|
||||||
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
|
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
|
||||||
import {ISwapAdapter} from '../../interfaces/ISwapAdapter.sol';
|
import {ISwapAdapter} from '../../interfaces/ISwapAdapter.sol';
|
||||||
import {ILendingPool} from '../../interfaces/ILendingPool.sol';
|
import {ILendingPool} from '../../interfaces/ILendingPool.sol';
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||||
|
|
||||||
contract MockSwapAdapter is ISwapAdapter {
|
contract MockSwapAdapter is ISwapAdapter {
|
||||||
uint256 internal _amountToReturn;
|
uint256 internal _amountToReturn;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {ILendingRateOracle} from '../../interfaces/ILendingRateOracle.sol';
|
import {ILendingRateOracle} from '../../interfaces/ILendingRateOracle.sol';
|
||||||
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
|
import {Ownable} from '../../dependencies/openzeppelin/contracts/Ownable.sol';
|
||||||
|
|
||||||
contract LendingRateOracle is ILendingRateOracle, Ownable {
|
contract LendingRateOracle is ILendingRateOracle, Ownable {
|
||||||
mapping(address => uint256) borrowRates;
|
mapping(address => uint256) borrowRates;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {ERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol';
|
import {ERC20} from '../../dependencies/openzeppelin/contracts/ERC20.sol';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title ERC20Mintable
|
* @title ERC20Mintable
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {StableDebtToken} from '../../tokenization/StableDebtToken.sol';
|
import {StableDebtToken} from '../../tokenization/StableDebtToken.sol';
|
||||||
import {LendingPool} from '../../lendingpool/LendingPool.sol';
|
|
||||||
|
|
||||||
contract MockStableDebtToken is StableDebtToken {
|
contract MockStableDebtToken is StableDebtToken {
|
||||||
constructor(
|
constructor(
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {VariableDebtToken} from '../../tokenization/VariableDebtToken.sol';
|
import {VariableDebtToken} from '../../tokenization/VariableDebtToken.sol';
|
||||||
import {LendingPool} from '../../lendingpool/LendingPool.sol';
|
|
||||||
|
|
||||||
contract MockVariableDebtToken is VariableDebtToken {
|
contract MockVariableDebtToken is VariableDebtToken {
|
||||||
constructor(
|
constructor(
|
||||||
|
|
|
@ -5,12 +5,10 @@ import {IncentivizedERC20} from './IncentivizedERC20.sol';
|
||||||
import {LendingPool} from '../lendingpool/LendingPool.sol';
|
import {LendingPool} from '../lendingpool/LendingPool.sol';
|
||||||
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
|
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
|
||||||
import {Errors} from '../libraries/helpers/Errors.sol';
|
import {Errors} from '../libraries/helpers/Errors.sol';
|
||||||
import {
|
import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
|
||||||
VersionedInitializable
|
|
||||||
} from '../libraries/openzeppelin-upgradeability/VersionedInitializable.sol';
|
|
||||||
import {IAToken} from './interfaces/IAToken.sol';
|
import {IAToken} from './interfaces/IAToken.sol';
|
||||||
import {IERC20} from '../interfaces/IERC20.sol';
|
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||||
import {SafeERC20} from '../misc/SafeERC20.sol';
|
import {SafeERC20} from '../dependencies/openzeppelin/contracts/SafeERC20.sol';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Aave ERC20 AToken
|
* @title Aave ERC20 AToken
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity 0.6.8;
|
pragma solidity 0.6.8;
|
||||||
|
|
||||||
import {Context} from '../misc/Context.sol';
|
import {Context} from '../dependencies/openzeppelin/contracts/Context.sol';
|
||||||
import {IERC20} from '../interfaces/IERC20.sol';
|
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||||
import {IERC20Detailed} from '../interfaces/IERC20Detailed.sol';
|
import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
|
||||||
import {SafeMath} from '../libraries/math/SafeMath.sol';
|
import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol';
|
||||||
import {IAaveIncentivesController} from '../interfaces/IAaveIncentivesController.sol';
|
import {IAaveIncentivesController} from '../interfaces/IAaveIncentivesController.sol';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {Context} from '@openzeppelin/contracts/GSN/Context.sol';
|
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
|
||||||
import {DebtTokenBase} from './base/DebtTokenBase.sol';
|
import {DebtTokenBase} from './base/DebtTokenBase.sol';
|
||||||
import {MathUtils} from '../libraries/math/MathUtils.sol';
|
import {MathUtils} from '../libraries/math/MathUtils.sol';
|
||||||
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
|
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {Context} from '@openzeppelin/contracts/GSN/Context.sol';
|
|
||||||
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
|
||||||
import {DebtTokenBase} from './base/DebtTokenBase.sol';
|
import {DebtTokenBase} from './base/DebtTokenBase.sol';
|
||||||
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
|
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
|
||||||
import {IVariableDebtToken} from './interfaces/IVariableDebtToken.sol';
|
import {IVariableDebtToken} from './interfaces/IVariableDebtToken.sol';
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {Context} from '@openzeppelin/contracts/GSN/Context.sol';
|
|
||||||
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
|
|
||||||
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
|
|
||||||
import {ILendingPool} from '../../interfaces/ILendingPool.sol';
|
import {ILendingPool} from '../../interfaces/ILendingPool.sol';
|
||||||
import {
|
import {
|
||||||
VersionedInitializable
|
VersionedInitializable
|
||||||
} from '../../libraries/openzeppelin-upgradeability/VersionedInitializable.sol';
|
} from '../../libraries/aave-upgradeability/VersionedInitializable.sol';
|
||||||
import {IncentivizedERC20} from '../IncentivizedERC20.sol';
|
import {IncentivizedERC20} from '../IncentivizedERC20.sol';
|
||||||
import {Errors} from '../../libraries/helpers/Errors.sol';
|
import {Errors} from '../../libraries/helpers/Errors.sol';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-License-Identifier: agpl-3.0
|
// SPDX-License-Identifier: agpl-3.0
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
import {IERC20} from '../../interfaces/IERC20.sol';
|
import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
|
||||||
import {IScaledBalanceToken} from './IScaledBalanceToken.sol';
|
import {IScaledBalanceToken} from './IScaledBalanceToken.sol';
|
||||||
|
|
||||||
interface IAToken is IERC20, IScaledBalanceToken {
|
interface IAToken is IERC20, IScaledBalanceToken {
|
||||||
|
|
|
@ -114,7 +114,7 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => {
|
||||||
'0x10',
|
'0x10',
|
||||||
'0'
|
'0'
|
||||||
)
|
)
|
||||||
).to.be.revertedWith(TRANSFER_AMOUNT_EXCEEDS_BALANCE);
|
).to.be.revertedWith(SAFEERC20_LOWLEVEL_CALL);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Takes WETH flashloan, simulating a receiver as EOA (revert expected)', async () => {
|
it('Takes WETH flashloan, simulating a receiver as EOA (revert expected)', async () => {
|
||||||
|
@ -356,7 +356,7 @@ makeSuite('LendingPool FlashLoan function', (testEnv: TestEnv) => {
|
||||||
pool
|
pool
|
||||||
.connect(caller.signer)
|
.connect(caller.signer)
|
||||||
.flashLoan(_mockFlashLoanReceiver.address, weth.address, flashAmount, 0, '0x10', '0')
|
.flashLoan(_mockFlashLoanReceiver.address, weth.address, flashAmount, 0, '0x10', '0')
|
||||||
).to.be.revertedWith('ERC20: transfer amount exceeds allowance');
|
).to.be.revertedWith(SAFEERC20_LOWLEVEL_CALL);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Caller takes a WETH flashloan with mode = 1', async () => {
|
it('Caller takes a WETH flashloan with mode = 1', async () => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user