0

We would like to enforce a certain limit on total amount of tokens held. Note: Tokens issued from our contract. not any erc721 tokens

Lets say, the absolute amount of tokens held cannot exceed 4.

What is the best way to implement this?

I would propose implementing a require(balanceOf(address)<4) into the following parts of the ERC721 parent contract:

  1. into _mint(address to, uint256 tokenId)
  2. into _transfer (address from, address to, uint256 tokenId)

is there a better (eg safer or more gas efficient) way to solve this ?

1 Answer 1

0

You can do a request in any of the functions that are part of mint. And for gas efficient, do it in mint's first external function

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.