* Update to ganache-cli v6.1.0 and truffle v4.1.0 * Update to stable version of ganache-cli * fix: update event emission warning - Fix event emission warnings for solidity 4.21 after truffle has been updated to use this version * fix pr review comments * update to truffle v4.1.5 * update package-lock * add additional emit keywords * update solidity-coverage to 0.4.15 * update to solium 1.1.6 * fix MerkleProof coverage analysis by testing through wrapper * change version pragma to ^0.4.21 * fix solium linting errors
96 lines
1.9 KiB
Solidity
96 lines
1.9 KiB
Solidity
pragma solidity ^0.4.21;
|
|
|
|
import "../token/ERC20/ERC20.sol";
|
|
import "../token/ERC20/SafeERC20.sol";
|
|
|
|
|
|
contract ERC20FailingMock is ERC20 {
|
|
function totalSupply() public view returns (uint256) {
|
|
return 0;
|
|
}
|
|
|
|
function transfer(address, uint256) public returns (bool) {
|
|
return false;
|
|
}
|
|
|
|
function transferFrom(address, address, uint256) public returns (bool) {
|
|
return false;
|
|
}
|
|
|
|
function approve(address, uint256) public returns (bool) {
|
|
return false;
|
|
}
|
|
|
|
function balanceOf(address) public constant returns (uint256) {
|
|
return 0;
|
|
}
|
|
|
|
function allowance(address, address) public constant returns (uint256) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
contract ERC20SucceedingMock is ERC20 {
|
|
function totalSupply() public view returns (uint256) {
|
|
return 0;
|
|
}
|
|
|
|
function transfer(address, uint256) public returns (bool) {
|
|
return true;
|
|
}
|
|
|
|
function transferFrom(address, address, uint256) public returns (bool) {
|
|
return true;
|
|
}
|
|
|
|
function approve(address, uint256) public returns (bool) {
|
|
return true;
|
|
}
|
|
|
|
function balanceOf(address) public constant returns (uint256) {
|
|
return 0;
|
|
}
|
|
|
|
function allowance(address, address) public constant returns (uint256) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
contract SafeERC20Helper {
|
|
using SafeERC20 for ERC20;
|
|
|
|
ERC20 failing;
|
|
ERC20 succeeding;
|
|
|
|
function SafeERC20Helper() public {
|
|
failing = new ERC20FailingMock();
|
|
succeeding = new ERC20SucceedingMock();
|
|
}
|
|
|
|
function doFailingTransfer() public {
|
|
failing.safeTransfer(0, 0);
|
|
}
|
|
|
|
function doFailingTransferFrom() public {
|
|
failing.safeTransferFrom(0, 0, 0);
|
|
}
|
|
|
|
function doFailingApprove() public {
|
|
failing.safeApprove(0, 0);
|
|
}
|
|
|
|
function doSucceedingTransfer() public {
|
|
succeeding.safeTransfer(0, 0);
|
|
}
|
|
|
|
function doSucceedingTransferFrom() public {
|
|
succeeding.safeTransferFrom(0, 0, 0);
|
|
}
|
|
|
|
function doSucceedingApprove() public {
|
|
succeeding.safeApprove(0, 0);
|
|
}
|
|
}
|