Upgradeable ERC20 token contract with fix cap

I am looking for upgradeable ERC20 Token with fix cap. Token should be burnable, pausable as well. I have created a simple contract using OpenZeppelin. What I want to avoid is that once the contract is deployed, future upgrade should not allow mint more than fix cap (when token burned then [total - burned] tokens).

There are two possibilities:

  1. Either mint only required token until total cap - burned
  2. Mint all tokens during initialization and not allow mint anymore.

What would be the best possible way and how can I make sure that token 1. Can’t exceed (total cap - burned) and 2. Not possible to mint anymore via new contract.

Do I need to look for Eternal Storage?

Any example for the above scenario would be appreciated.

Thank you.

Is there anything I am missing here?
Haven’t seen any comment so far. Any hint would be appreciated.

Hi, welcome! :wave:

I think you can have a look at here:
openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions | OpenZeppelin/openzeppelin-contracts-upgradeable

@Skyge thanks for the link.

1 Like