I am using the openzeppelin for creating the ICO contract. I am concerned about the MinterRole here. After I develop Token contract, I added the sale contract as a minter using "addMinter" function.


After the sale is over

  1. I do not see a way to remove the contract address as a minter. I see that "renounceMinter" will remove only the person's who is calling this method. I understand even If I remove (or) not remove the contract address as a minter at that point (i.e., after the sale is over) the Sale contract will b defined in such a way that it will not work at all. is it safe even if we leave the contract address in the minter list ?

  2. Why openzeppelin has designed the "MinterRole" contract with the "renounceMinter" function that can remove only the person who is calling that contract but the function "addMinter" can do this for others also ?



contract SampleCrowdsale is FinalizableCrowdsale, MintedCrowdsale


contract MintedCrowdsale is Crowdsale {
  constructor() internal {} 
  function _deliverTokens(
    address beneficiary,
    uint256 tokenAmount
    // Potentially dangerous assumption about the type of the token.
      ERC20Mintable(address(token())).mint(beneficiary, tokenAmount));


contract ERC20Mintable is ERC20, MinterRole


pragma solidity ^0.4.24;

import "../Roles.sol";

contract MinterRole {
  using Roles for Roles.Role;

  event MinterAdded(address indexed account);
  event MinterRemoved(address indexed account);

  Roles.Role private minters;

  constructor() internal {

  modifier onlyMinter() {

  function isMinter(address account) public view returns (bool) {
    return minters.has(account);

  function addMinter(address account) public onlyMinter {

  function renounceMinter() public {

  function _addMinter(address account) internal {
    emit MinterAdded(account);

  function _removeMinter(address account) internal {
    emit MinterRemoved(account);


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.