Skip to content

Commit 2cc1080

Browse files
authored
Merge pull request #1703 from keep-network/detailed-token
KeepToken is ERC20Detailed with name and symbol
2 parents 07e800c + b408270 commit 2cc1080

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

solidity/contracts/KeepToken.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
pragma solidity 0.5.17;
22

33
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol";
4+
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";
45

56

67
/// @dev Interface of recipient contract for approveAndCall pattern.
78
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; }
89

910
/// @title KEEP Token
1011
/// @dev Standard ERC20Burnable token
11-
contract KeepToken is ERC20Burnable {
12+
contract KeepToken is ERC20Burnable, ERC20Detailed {
1213
string public constant NAME = "KEEP Token";
1314
string public constant SYMBOL = "KEEP";
1415
uint8 public constant DECIMALS = 18; // The number of digits after the decimal place when displaying token values on-screen.
1516
uint256 public constant INITIAL_SUPPLY = 10**27; // 1 billion tokens, 18 decimal places.
1617

1718
/// @dev Gives msg.sender all of existing tokens.
18-
constructor() public {
19+
constructor() public ERC20Detailed(NAME, SYMBOL, DECIMALS) {
1920
_mint(msg.sender, INITIAL_SUPPLY);
2021
}
2122

solidity/test/TestToken.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ describe('TestToken', function() {
99
account_two = accounts[1];
1010

1111
before(async () => {
12-
token = await KeepToken.new({from: account_one});
12+
token = await KeepToken.new({ from: account_one });
13+
});
14+
15+
it("sets token details", async function () {
16+
await token.name.call();
17+
18+
assert.equal(await token.name.call(), "KEEP Token", "unexpected token name");
19+
assert.equal(await token.symbol.call(), "KEEP", "unexpected token symbol");
20+
assert.equal(await token.decimals.call(), 18, "unexpected decimals");
1321
});
1422

1523
it("should send tokens correctly", async function() {

0 commit comments

Comments
 (0)