0

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.

Question

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 ?

Code

SampleCrowdsale

contract SampleCrowdsale is FinalizableCrowdsale, MintedCrowdsale

MintedCrowdsale

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

ERC20Mintable

contract ERC20Mintable is ERC20, MinterRole

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 {
    _addMinter(msg.sender);
  }

  modifier onlyMinter() {
    require(isMinter(msg.sender));
    _;
  }

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

  function addMinter(address account) public onlyMinter {
    _addMinter(account);
  }

  function renounceMinter() public {
    _removeMinter(msg.sender);
  }

  function _addMinter(address account) internal {
    minters.add(account);
    emit MinterAdded(account);
  }

  function _removeMinter(address account) internal {
    minters.remove(account);
    emit MinterRemoved(account);
  }
}
iappmaker
  • 2,945
  • 9
  • 35
  • 76
  • Its so weird, maybe they thought that minters start arguing with each other and do damage. However, you assume to add something like BossMinter to add/delete minters. Actually code like you want, don't repeat OpenZeppelin) – Yegor Dec 27 '18 at 06:07
  • yes, But I thought as they are the team of experts, they may have a valid reason. – iappmaker Dec 28 '18 at 04:16

0 Answers0