0

I have an ERC721 that implements a public maxSupply value, so I cannot mint more than a certain amount of tokens.

Thanks to the public modifier, this exposes a method I can call to see what the maxSupply is.

I can then perform maxSupply - totalSupply (considering that my ERC721 implements ERC721Enumerable extension as well) to know how many tokens are left to mint.

But, as I understand, the maxSupply function is not part of the IERC721 nor the IERC721Enumerable interfaces.

Does this mean that if I want to call this method from another smart contract I should create my own interface?

1
  • create my own interface? yes Apr 17, 2023 at 14:16

1 Answer 1

1

Yes, If you want to interact with the maxSupply function from another smart contract, you should create your own custom interface. Here's an example:

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";

interface ICustomERC721 is IERC721Enumerable {
    function maxSupply() external view returns (uint256);
}

Your Answer

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

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