Commit 8d16fac8 authored by Chuck LeDuc Díaz's avatar Chuck LeDuc Díaz
Browse files

Add the right token contract

parent 7e03f192
pragma solidity ^0.5.4;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/access/roles/MinterRole.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol";
/**
* @title ERC20Mintable
* @dev ERC20 minting logic
* @title ERC-20 Mintable Token
* @dev Implements a currency in the Caelum network
*/
contract Token is ERC20, MinterRole {
contract Token is ERC20Mintable {
string public symbol = "";
uint8 public decimals = 0;
/**
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
* @param value The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
* @dev Constructor
* @param _to The address that will receive the minted tokens.
* @param _supply The number of tokens to mint.
* @param _symbol The token symbol.
* @param _decimals The number of decimal points
*/
function mint(address to, uint256 value) public onlyMinter returns (bool) {
_mint(to, value);
return true;
constructor(address _to, uint _supply, string memory _symbol, uint8 _decimals) public {
symbol = _symbol;
decimals = _decimals;
mint(_to, _supply);
}
}
const Token = artifacts.require('./contracts/Token.sol')
const expect = require('chai').expect
contract('Token', (accounts) => {
let token
it('constructor', async () => {
token = await Token.new(accounts[1], '1000000', 'XYZ', '18', { from: accounts[0] })
})
it('mint', async () => {
await token.mint(accounts[2], '10000', { from: accounts[0] })
})
})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment