Merge pull request #678 from ernestas2k/fix/rename-erc23-occurrences-to-erc223Mock#675
Rename ERC23 occurrences to ERC223
This commit is contained in:
@ -4,20 +4,19 @@ pragma solidity ^0.4.18;
|
||||
import "../token/BasicToken.sol";
|
||||
|
||||
|
||||
contract ERC23ContractInterface {
|
||||
contract ERC223ContractInterface {
|
||||
function tokenFallback(address _from, uint256 _value, bytes _data) external;
|
||||
}
|
||||
|
||||
contract ERC223TokenMock is BasicToken {
|
||||
|
||||
contract ERC23TokenMock is BasicToken {
|
||||
|
||||
function ERC23TokenMock(address initialAccount, uint256 initialBalance) public {
|
||||
function ERC223TokenMock(address initialAccount, uint256 initialBalance) public {
|
||||
balances[initialAccount] = initialBalance;
|
||||
totalSupply = initialBalance;
|
||||
}
|
||||
|
||||
// ERC23 compatible transfer function (except the name)
|
||||
function transferERC23(address _to, uint256 _value, bytes _data) public
|
||||
// ERC223 compatible transfer function (except the name)
|
||||
function transferERC223(address _to, uint256 _value, bytes _data) public
|
||||
returns (bool success)
|
||||
{
|
||||
transfer(_to, _value);
|
||||
@ -26,7 +25,7 @@ contract ERC23TokenMock is BasicToken {
|
||||
is_contract := not(iszero(extcodesize(_to)))
|
||||
}
|
||||
if (is_contract) {
|
||||
ERC23ContractInterface receiver = ERC23ContractInterface(_to);
|
||||
ERC223ContractInterface receiver = ERC223ContractInterface(_to);
|
||||
receiver.tokenFallback(msg.sender, _value, _data);
|
||||
}
|
||||
return true;
|
||||
@ -6,14 +6,14 @@ import "./CanReclaimToken.sol";
|
||||
/**
|
||||
* @title Contracts that should not own Tokens
|
||||
* @author Remco Bloemen <remco@2π.com>
|
||||
* @dev This blocks incoming ERC23 tokens to prevent accidental loss of tokens.
|
||||
* @dev This blocks incoming ERC223 tokens to prevent accidental loss of tokens.
|
||||
* Should tokens (any ERC20Basic compatible) end up in the contract, it allows the
|
||||
* owner to reclaim the tokens.
|
||||
*/
|
||||
contract HasNoTokens is CanReclaimToken {
|
||||
|
||||
/**
|
||||
* @dev Reject all ERC23 compatible tokens
|
||||
* @dev Reject all ERC223 compatible tokens
|
||||
* @param from_ address The address that is transferring the tokens
|
||||
* @param value_ uint256 the amount of the specified token
|
||||
* @param data_ Bytes The data passed from the caller.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import expectThrow from '../helpers/expectThrow';
|
||||
|
||||
const HasNoTokens = artifacts.require('../contracts/lifecycle/HasNoTokens.sol');
|
||||
const ERC23TokenMock = artifacts.require('mocks/ERC23TokenMock.sol');
|
||||
const ERC223TokenMock = artifacts.require('mocks/ERC223TokenMock.sol');
|
||||
|
||||
contract('HasNoTokens', function (accounts) {
|
||||
let hasNoTokens = null;
|
||||
@ -11,7 +11,7 @@ contract('HasNoTokens', function (accounts) {
|
||||
beforeEach(async () => {
|
||||
// Create contract and token
|
||||
hasNoTokens = await HasNoTokens.new();
|
||||
token = await ERC23TokenMock.new(accounts[0], 100);
|
||||
token = await ERC223TokenMock.new(accounts[0], 100);
|
||||
|
||||
// Force token into contract
|
||||
await token.transfer(hasNoTokens.address, 10);
|
||||
@ -19,8 +19,8 @@ contract('HasNoTokens', function (accounts) {
|
||||
assert.equal(startBalance, 10);
|
||||
});
|
||||
|
||||
it('should not accept ERC23 tokens', async function () {
|
||||
await expectThrow(token.transferERC23(hasNoTokens.address, 10, ''));
|
||||
it('should not accept ERC223 tokens', async function () {
|
||||
await expectThrow(token.transferERC223(hasNoTokens.address, 10, ''));
|
||||
});
|
||||
|
||||
it('should allow owner to reclaim tokens', async function () {
|
||||
|
||||
Reference in New Issue
Block a user