Timelock, erc20Wrapper and erc20FlashMint verification

This commit is contained in:
Aleksander Kryukov
2022-03-20 22:36:48 +00:00
parent 7caa9bbb2c
commit 62d60a5890
17 changed files with 400 additions and 13 deletions

View File

@ -277,7 +277,7 @@ contract ERC20 is Context, IERC20, IERC20Metadata {
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
function _burn(address account, uint256 amount) public virtual returns (bool) { // HARNESS: internal -> public
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
@ -292,6 +292,8 @@ contract ERC20 is Context, IERC20, IERC20Metadata {
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
return true;
}
/**

View File

@ -40,9 +40,11 @@ abstract contract ERC20FlashMint is ERC20, IERC3156FlashLender {
require(token == address(this), "ERC20FlashMint: wrong token");
// silence warning about unused variable without the addition of bytecode.
amount;
return 0;
return fee; // HARNESS: made "return" nonzero
}
uint256 public fee; // HARNESS: added it to simulate random fee amount
/**
* @dev Performs a flash loan. New tokens are minted and sent to the
* `receiver`, who is required to implement the {IERC3156FlashBorrower}
@ -70,7 +72,7 @@ abstract contract ERC20FlashMint is ERC20, IERC3156FlashLender {
uint256 fee = flashFee(token, amount);
_mint(address(receiver), amount);
require(
receiver.onFlashLoan(msg.sender, token, amount, fee, data) == _RETURN_VALUE,
receiver.onFlashLoan(msg.sender, token, amount, fee, data) == _RETURN_VALUE, // HAVOC_ALL
"ERC20FlashMint: invalid return value"
);
uint256 currentAllowance = allowance(address(receiver), address(this));

View File

@ -44,7 +44,7 @@ abstract contract ERC20Wrapper is ERC20 {
* @dev Mint wrapped token to cover any underlyingTokens that would have been transferred by mistake. Internal
* function that can be exposed with access control if desired.
*/
function _recover(address account) internal virtual returns (uint256) {
function _recover(address account) public virtual returns (uint256) { // HARNESS: internal -> public
uint256 value = underlying.balanceOf(address(this)) - totalSupply();
_mint(account, value);
return value;