Files
openzeppelin-contracts/contracts/mocks/ERC223TokenMock.sol
Doug Crescenzi ef347ffccc Consolidated ERC20 Interface and Implementation Files (#1125)
* Consolidted ERC20 Interface and Implementation Files

* Fixed CanReclaimToken's tests to use StandardTokenMock instead of BasicTokenMock

* Changed token's variable type in TokenTimelock to ERC20

* Merged the StandardBurnableToken with BurnableToken since it now inherits from StandardToken; Fixed TokenTimelock so it uses SafeERC20 for ERC20

* Fixed variable type for _token in TokenTimelock constructor

* Fixed linting warning in BurnableToken

* Added back burnFrom tests.
2018-08-02 23:12:31 -03:00

35 lines
928 B
Solidity

pragma solidity ^0.4.24;
import "../token/ERC20/StandardToken.sol";
contract ERC223ContractInterface {
function tokenFallback(address _from, uint256 _value, bytes _data) external;
}
contract ERC223TokenMock is StandardToken {
constructor(address _initialAccount, uint256 _initialBalance) public {
balances[_initialAccount] = _initialBalance;
totalSupply_ = _initialBalance;
}
// ERC223 compatible transfer function (except the name)
function transferERC223(address _to, uint256 _value, bytes _data) public
returns (bool success)
{
transfer(_to, _value);
bool isContract = false;
// solium-disable-next-line security/no-inline-assembly
assembly {
isContract := not(iszero(extcodesize(_to)))
}
if (isContract) {
ERC223ContractInterface receiver = ERC223ContractInterface(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
return true;
}
}