Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;

/**
* @title FailingReceiver
*/
contract FailingReceiver {
/**
* @notice Receiver that always reverts upon receiving ether.
*/
receive() external payable {
require(false, "FailingReceiver");
}
Expand Down
60 changes: 4 additions & 56 deletions packages/contracts/contracts/test-helpers/TestERC20.sol
Original file line number Diff line number Diff line change
@@ -1,64 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

// a test ERC20 token with an open mint function
contract TestERC20 {
string public constant name = "Test";
string public constant symbol = "TST";
uint8 public constant decimals = 18;
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);

constructor() {}
contract TestERC20 is ERC20 {
constructor() ERC20("TEST", "TST") {}

function mint(address to, uint256 value) public {
totalSupply = totalSupply + value;
balanceOf[to] = balanceOf[to] + value;
emit Transfer(address(0), to, value);
}

function _approve(
address owner,
address spender,
uint256 value
) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}

function _transfer(
address from,
address to,
uint256 value
) private {
balanceOf[from] = balanceOf[from] - value;
balanceOf[to] = balanceOf[to] + value;
emit Transfer(from, to, value);
}

function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}

function transfer(address to, uint256 value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}

function transferFrom(
address from,
address to,
uint256 value
) external returns (bool) {
if (allowance[from][msg.sender] != type(uint256).max) {
allowance[from][msg.sender] = allowance[from][msg.sender] - value;
}
_transfer(from, to, value);
return true;
_mint(to, value);
}
}