forked from hoprnet/hoprnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHoprToken.sol
executable file
·33 lines (29 loc) · 954 Bytes
/
HoprToken.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "./openzeppelin-contracts/ERC777.sol";
import "./ERC777/ERC777Snapshot.sol";
contract HoprToken is AccessControl, ERC777Snapshot {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
constructor() public ERC777("HOPR Token", "HOPR", new address[](0)) {
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
/**
* @dev Creates `amount` new tokens for `to`.
*
* See {ERC20-_mint}.
*
* Requirements:
*
* - the caller must have the `MINTER_ROLE`.
*/
function mint(
address account,
uint256 amount,
bytes memory userData,
bytes memory operatorData
) public {
require(hasRole(MINTER_ROLE, msg.sender), "HoprToken: caller does not have minter role");
_mint(account, amount, userData, operatorData);
}
}