How to use _mintConsecutive?

Removed by initial requestor

What's this?:

And this?:

And there are a bunch of other compilation errors in your code, so please provide a working example.

In any case, you probably need to execute all base (super) constructors before executing that function, as stated in the description of ERC721Consecutive:

IMPORTANT: When overriding {_mintConsecutive}, be careful about call ordering. {ownerOf} may return invalid values during the {_mintConsecutive} execution if the super call is not called first. To be safe, execute the super call before your custom logic.

When trying to deploy your contract, the revert-message is ERC721EnumerableForbiddenBatchMint.

Googling this revert-message leads to only one contract - ERC721Enumerable:

function _increaseBalance(address account, uint128 amount) internal virtual override {
    if (amount > 0) {
        revert ERC721EnumerableForbiddenBatchMint();
    }
    super._increaseBalance(account, amount);
}

Looking into your question, it seems that you have overridden this function as follows:

function _increaseBalance(address account, uint128 amount) internal virtual override (ERC721, ERC721Enumerable) {
    super._increaseBalance(account, amount);
}

The fact that this revert-message is used only in ERC721Enumerable, implies that super._increaseBalance in your function, calls ERC721Enumerable._increaseBalance rather than ERC721._increaseBalance.

In order to resolve that, you can simply replace the implicit super with a explicit ERC721.

As a side-note, I would point out that ERC721Enumerable already inherits ERC721, so your decision to inherit both ERC721Enumerable and ERC721 (rather than ERC721Enumerable only) seems weird.

Thanks a lot.
Thanks a million.
You saved my week.

1 Like