Skip to content

Commit

Permalink
feat(ERC20Mintable): add onlyOwner to mint and burn
Browse files Browse the repository at this point in the history
  • Loading branch information
PierrickGT committed Jun 6, 2022
1 parent ac24259 commit d5370ae
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions contracts/test/ERC20Mintable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
pragma solidity 0.8.6;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@pooltogether/owner-manager-contracts/contracts/Ownable.sol";

/**
* @dev Extension of {ERC20} that adds a set of accounts with the {MinterRole},
* which have permission to mint (create) new tokens as they see fit.
*
* At construction, the deployer of the contract is the only minter.
*/
contract ERC20Mintable is ERC20 {
constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) {}
contract ERC20Mintable is ERC20, Ownable {
constructor(string memory _name, string memory _symbol)
ERC20(_name, _symbol)
Ownable(msg.sender)
{}

/**
* @dev See {ERC20-_mint}.
Expand All @@ -20,11 +24,11 @@ contract ERC20Mintable is ERC20 {
*
* - the caller must have the {MinterRole}.
*/
function mint(address account, uint256 amount) public {
function mint(address account, uint256 amount) public onlyOwner {
_mint(account, amount);
}

function burn(address account, uint256 amount) public returns (bool) {
function burn(address account, uint256 amount) public onlyOwner returns (bool) {
_burn(account, amount);
return true;
}
Expand Down

0 comments on commit d5370ae

Please sign in to comment.