Skip to content

Commit

Permalink
rename and reorganize ERC223 examples
Browse files Browse the repository at this point in the history
move token/examples/* into mocks/*
  • Loading branch information
coin-monster committed Aug 8, 2017
1 parent 02fae19 commit aa7bfd8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
pragma solidity ^0.4.11;


import "../Standard223Token.sol";
import "../token/Standard223Token.sol";


contract Standard223TokenExample is Standard223Token {
contract Token223 is Standard223Token {
string public constant name = "Example ERC223 Token";
string public constant symbol = "ERC223";
uint8 public constant decimals = 18;
uint256 public totalSupply;

function Standard223TokenExample(uint _initialBalance)
function Token223(uint _initialBalance)
{
balances[msg.sender] = _initialBalance;
totalSupply = _initialBalance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pragma solidity ^0.4.11;


import "../Standard223Receiver.sol";
import "../token/Standard223Receiver.sol";


contract Standard223TokenReceiverExample is Standard223Receiver {
contract Token223Receiver is Standard223Receiver {
event LogFallbackParameters(address from, uint value, bytes data);

function tokenFallback(address from, uint value, bytes data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.4.8;
import "../token/Standard223Receiver.sol";


contract Standard223TokenReceiverMock is Standard223Receiver {
contract Token223ReceiverMock is Standard223Receiver {
address public tokenSender;
uint public sentValue;
bytes public tokenData;
Expand Down
12 changes: 6 additions & 6 deletions test/Standard223TokenReceiverTest.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
pragma solidity ^0.4.8;

import "truffle/Assert.sol";
import "../contracts/token/examples/Standard223TokenExample.sol";
import "../contracts/mocks/Standard223TokenReceiverMock.sol";
import "../contracts/mocks/Token223.sol";
import "../contracts/mocks/Token223ReceiverMock.sol";

contract Standard223TokenReceiverTest {
Standard223TokenExample token;
Standard223TokenReceiverMock receiver;
Token223 token;
Token223ReceiverMock receiver;

function beforeEach() {
token = new Standard223TokenExample(100);
receiver = new Standard223TokenReceiverMock();
token = new Token223(100);
receiver = new Token223ReceiverMock();
}

function testFallbackIsCalledOnTransfer() {
Expand Down
8 changes: 4 additions & 4 deletions test/Standard223Token_spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
require('./support/helpers.js')

contract('Standard223Token', (accounts) => {
let Standard223TokenExample = artifacts.require("../contracts/token/examples/Standard223TokenExample.sol");
let Standard223TokenReceiver = artifacts.require("../contracts/mocks/Standard223TokenReceiverMock.sol");
let Token223 = artifacts.require("../contracts/mocks/Token223.sol");
let Token223ReceiverMock = artifacts.require("../contracts/mocks/Token223ReceiverMock.sol");

let receiver, token;

beforeEach(async function() {
receiver = await Standard223TokenReceiver.new();
token = await Standard223TokenExample.new(1000);
receiver = await Token223ReceiverMock.new();
token = await Token223.new(1000);
assert.equal(await receiver.sentValue(), 0);
});

Expand Down

0 comments on commit aa7bfd8

Please sign in to comment.