|
@@ -67,7 +67,7 @@ contract MyToken is ERC20, AccessControl {
|
|
|
// Create a new role identifier for the minter role
|
|
|
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
|
|
|
|
|
|
- constructor(address minter) public {
|
|
|
+ constructor(address minter) public ERC20("MyToken", "TKN") {
|
|
|
// Grant the minter role to a specified account
|
|
|
_setupRole(MINTER_ROLE, minter);
|
|
|
}
|
|
@@ -97,7 +97,7 @@ contract MyToken is ERC20, AccessControl {
|
|
|
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
|
|
|
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
|
|
|
|
|
|
- constructor(address minter, address burner) public {
|
|
|
+ constructor(address minter, address burner) public ERC20("MyToken", "TKN") {
|
|
|
_setupRole(MINTER_ROLE, minter);
|
|
|
_setupRole(BURNER_ROLE, burner);
|
|
|
}
|
|
@@ -109,7 +109,7 @@ contract MyToken is ERC20, AccessControl {
|
|
|
|
|
|
function burn(address from, uint256 amount) public {
|
|
|
require(hasRole(BURNER_ROLE, msg.sender), "Caller is not a burner");
|
|
|
- _burn(from, amount);
|
|
|
+ _burn(from, amount);
|
|
|
}
|
|
|
}
|
|
|
----
|
|
@@ -140,7 +140,7 @@ contract MyToken is ERC20, AccessControl {
|
|
|
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
|
|
|
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
|
|
|
|
|
|
- constructor() ERC20("MyToken", "TKN") public {
|
|
|
+ constructor() public ERC20("MyToken", "TKN") {
|
|
|
// Grant the contract deployer the default admin role: it will be able
|
|
|
// to grant and revoke any roles
|
|
|
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
|
|
@@ -153,7 +153,7 @@ contract MyToken is ERC20, AccessControl {
|
|
|
|
|
|
function burn(address from, uint256 amount) public {
|
|
|
require(hasRole(BURNER_ROLE, msg.sender), "Caller is not a burner");
|
|
|
- _burn(from, amount);
|
|
|
+ _burn(from, amount);
|
|
|
}
|
|
|
}
|
|
|
----
|