0

I am trying to override the _mint function of the ERC20.sol as i want. Unfortunately, i am getting an error which I will attach below.

Does anybody know how can I overcome this issue?

Here is my function which is intended to add some rules to the original _mint function of the ERC20.sol

function _mint(address _owner, uint _amount) override public pure{
    
    if (_amount > 0 && isContained[_owner] == false) {
        tokenHolders.push(_owner);
        isContained[_owner] = true;
    }
    
    _mint(_owner, _amount);
}

And this is the error i am given

enter image description here

1 Answer 1

2

The error is self explanatory.

You want to override the following function :

function _mint(address account, uint256 amount) internal virtual
{...}

But your definition is :

function _mint(address _owner, uint256 _amount) override public pure
{...}

Your function needs to be internal too (matching the signature and visibility of the function it overrides)

Try like this :

function _mint(address _owner, uint256 _amount) internal virtual override
{...}
0

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.