Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
9
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
caelum-tech
TTT
caelum-identity
Commits
8d16fac8
Commit
8d16fac8
authored
Jul 01, 2019
by
Chuck LeDuc Díaz
Browse files
Add the right token contract
parent
7e03f192
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
12 deletions
+29
-12
contracts/Token.sol
contracts/Token.sol
+16
-12
test/Token.js
test/Token.js
+13
-0
No files found.
contracts/Token.sol
View file @
8d16fac8
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
);
}
}
test/Token.js
0 → 100644
View file @
8d16fac8
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
]
})
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment