Commit 9687be45 authored by Chuck LeDuc Díaz's avatar Chuck LeDuc Díaz
Browse files

Merge branch 'token' into 'master'

Token contract

See merge request caelum-tech/caelum-identity!14
parents 7e03f192 ffdbe9f0
Pipeline #68824855 passed with stage
in 3 minutes and 47 seconds
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);
}
}
{
"name": "@caelum-tech/identity",
"version": "1.0.0",
"version": "1.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "@caelum-tech/identity",
"version": "1.0.0",
"version": "1.1.0",
"description": "Caelum Identity library",
"main": "index.js",
"scripts": {
"build": "truffle build",
"coverage": "npm run start; npx solidity-coverage; npm run stop",
"coverage": "npm run start; npm run stop; npx solidity-coverage",
"eslint": "npx eslint .",
"lint": "npm run eslint; npm run solium",
"npm:publish": "npm publish --access public",
......
......@@ -20,7 +20,6 @@ contract('1.1. Identity', (accounts) => {
})
it('Should send gas to the wallet', () => {
expect(parity.isBlockchainRunning()).to.not.be.equal(null)
web3.eth.sendTransaction({ from: accounts[0], to: walletAddress, value: web3.utils.toWei('10', 'ether') })
})
......@@ -38,6 +37,16 @@ contract('1.1. Identity', (accounts) => {
})
})
it('Should test the Identity contract payable function', async () => {
web3.eth.sendTransaction({ from: accounts[1], to: identityContract.address, value: web3.utils.toWei('1', 'ether') })
})
xit('Should change the owner', async () => {
})
xit('Should change the owner back', async () => {
})
it('Should work as expected : setData and getData', (done) => {
identityContract.setData(key, value)
.then(async (tx) => {
......@@ -80,4 +89,7 @@ contract('1.1. Identity', (accounts) => {
done()
})
})
xit('Should act as a proxy for OPERATION_CREATE', (done) => {
})
})
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