ERC20 metadata and ERC20Detailed

Dear Andrew (@abcoathup),

Thanks so much for taking your time to answer my questions and for correcting my New Contract Proposal ; I am now conviced that it is the right time to call/import OpenZeppelin Contracts for my projects.

After reading Mr. Hadrien (@Amxx )´s comments within ERC20Capped: Immutable Variables cannot be read during contract creation time - #4 by abcoathup I learned that using when using ERC20capped it is better to do the minting after deployment, so I removed the mint command.

Therefore, the New Contract now looks like this :point_down:t2::

// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

import "@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Capped.sol";

contract FilmVaultToken is ERC20PresetMinterPauser, ERC20Capped {
    constructor (uint256 cap) ERC20PresetMinterPauser("FilmVault", "FilmVault") ERC20Capped(cap) {
        _setupDecimals(9);
    }

function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override(ERC20PresetMinterPauser, ERC20Capped) {
        super._beforeTokenTransfer(from, to, amount);
    }
}

However, while it compiled without errors, it did give me errors during deployment :point_down:t2:

I believe the issue has to do with setting the cap value. Would you or Mr. Hadrien @Amxx be so kind by helping me fix the script by setting the cap at 1.000.000 appropiately?

Thanks a lot for your support!

g.a.

1 Like