3

Using the non-modified OpenZeppelin code to create a mintable and burnable ERC20 token and a crowdsale contract, once ownership of the token is transferred to the crowdsale contract, is it possible to transfer ownership of the token again? If not, will it be possible to ever mint new tokens in the future? I want to ensure that once token ownership is transferred to the crowdsale contract and the crowdsale ends, it will never be possible to mint new tokens. I looked through the related questions, but could not find a definite answer relating to a non-modified implementation of the OpenZeppelin code.

2 Answers 2

0

In Mintable.sol - https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/ERC20Mintable.sol

contract ERC20Mintable is ERC20, MinterRole

In MinterRole.sol - https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/access/roles/MinterRole.sol

near line 30, function renounceMinter() public {

You can pursue that further. You will see that Role.sol only allows a Minter to renounce it's own Minter role.

Using the "unmodified" CrowdSale, you would deploy a token and the Minter role would be assigned to the address that deployed the contract. Then, you would mint some tokens to yourself, deploy a CrowdSale and transfer some of your tokens to the CrowdSale. There is initially nothing stopping you from creating more tokens (and everyone can see that).

When the sale is over or you're finished Minting and you want to demonstrate that you can no longer issue new tokens, you would sign a transaction to the renounceMinter() function in the Mintable token.

Hope it helps.

2
  • Thanks for the great answer. Elaborating on the demonstration that new coins cannot be minted, is it correct that individuals will view the transaction sequence on Etherscan for the token contract and see that I did not add additional minters between creating the contract and renouncing my own right to mint, and this will therefore show that more tokens can never be minted?
    – Sven
    Jan 3, 2019 at 23:33
  • Correct. In practice, you would probably publicize your intention to renounce the minter role. Skeptics would be able to examine the contract and the history to confirm you have nothing up your sleeve. The RoleBasedAccessControl allows for more than one Minter, for example, but it would be trivial to see that no minters remain (or they do). Thanks for accepting the answer. Jan 4, 2019 at 0:07
0

Once ownership of the token is transferred to the crowdsale contract, is it possible to transfer ownership of the token again?

Depends on how you code your crowdsale contract. If there is no such function defined to change ownership back a contract or any EOAs, you can not change ownership.

If not, will it be possible to ever mint new tokens in the future?

Since you are transferring ownership to the crowdsale contract. Only that contract should be able to mint tokens. You can impose a condition on when you want to stop minting.

I want to ensure that once token ownership is transferred to the crowdsale contract and the crowdsale ends, it will never be possible to mint new tokens.

You can have modiefied conditions as per you requirement. OpenZepplin is a standard implement, if you want to have custom features, you can alway modify the smart contracts to fullfill your need. For eg, in you case you can have a function that mints token to users account

bool isICOClosed; // can be when hard cap is reached or ICO end time is over

function mintTokenToUser(address user, uint value) internal {
  // add a condition that mint in not possible if ICO is conpleted
  require( !isICOClosed);
  _token.mint(user, value);
}

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.