* make StandardToken state variables private
* simplify mocks
* document new internal functions
* fix link to ERC20 document
* revert order of Transfer and Mint events
* Revert "simplify mocks"
This reverts commit 371fe3e567.
* add tests for new internal functions
* add check for null account
* add checks for balances and allowance
* add inline docs to BurnableToken._burn
* remove redundant checks and clarify why
34 lines
888 B
Solidity
34 lines
888 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 {
|
|
_mint(_initialAccount, _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;
|
|
}
|
|
}
|