Skip to content

Commit

Permalink
Create detailed ERC20 interface
Browse files Browse the repository at this point in the history
  • Loading branch information
facuspagnuolo committed Nov 13, 2017
1 parent feef666 commit cde7f44
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 7 additions & 1 deletion contracts/token/DetailedERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@ import './ERC20.sol';
contract DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint256 public decimals;
uint8 public decimals;

function DetailedERC20(string _name, string _symbol, uint8 _decimals) {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
8 changes: 4 additions & 4 deletions test/DetailedERC20.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ contract('DetailedERC20', accounts => {
const _decimals = 18;

beforeEach(async function() {
detailedERC20 = await DetailedERC20Mock.new(_decimals, _symbol, _name, { from: accounts[0] });
detailedERC20 = await DetailedERC20Mock.new(_name, _symbol, _decimals);
});

it('has a name', async function () {
const name = await detailedERC20.name();
name.should.be.equal('My Detailed ERC20');
name.should.be.equal(_name);
});

it('has a symbol', async function () {
const symbol = await detailedERC20.symbol();
symbol.should.be.equal('MDT');
symbol.should.be.equal(_symbol);
});

it('has an amount of decimals', async function () {
const decimals = await detailedERC20.decimals();
decimals.should.be.bignumber.equal(18)
decimals.should.be.bignumber.equal(_decimals)
});
});
8 changes: 1 addition & 7 deletions test/helpers/DetailedERC20Mock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,5 @@ import '../../contracts/token/StandardToken.sol';
import '../../contracts/token/DetailedERC20.sol';

contract DetailedERC20Mock is StandardToken, DetailedERC20 {
function DetailedERC20Mock(uint256 _decimals, string _symbol, string _name) {
require(_decimals > 0);

decimals = _decimals;
symbol = _symbol;
name = _name;
}
function DetailedERC20Mock(string _name, string _symbol, uint8 _decimals) DetailedERC20(_name, _symbol, _decimals) {}
}

0 comments on commit cde7f44

Please sign in to comment.