You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
847 B
33 lines
847 B
pragma solidity ^0.4.8;
|
|
|
|
|
|
import '../../contracts/token/BasicToken.sol';
|
|
|
|
|
|
contract ERC23ContractInterface {
|
|
function tokenFallback(address _from, uint _value, bytes _data) external;
|
|
}
|
|
|
|
contract ERC23TokenMock is BasicToken {
|
|
|
|
function ERC23TokenMock(address initialAccount, uint initialBalance) {
|
|
balances[initialAccount] = initialBalance;
|
|
totalSupply = initialBalance;
|
|
}
|
|
|
|
// ERC23 compatible transfer function (except the name)
|
|
function transferERC23(address _to, uint _value, bytes _data)
|
|
returns (bool success)
|
|
{
|
|
transfer(_to, _value);
|
|
bool is_contract = false;
|
|
assembly {
|
|
is_contract := not(iszero(extcodesize(_to)))
|
|
}
|
|
if(is_contract) {
|
|
ERC23ContractInterface receiver = ERC23ContractInterface(_to);
|
|
receiver.tokenFallback(msg.sender, _value, _data);
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|