We are providing a Gnosis multisig wallets to our users and a market place where users can purchase/sell/transfer ERC721 tokens with other users. The ERC721 contract will also have a Blacklist registry in which all the addresses will be put, who were trying to be nostalgic. New addresses can only be added/removed by an Admin multisig wallet.

We want to limit our users to possess, lets say only 10 tokens at a time. We have come up with two possible solutions but couldn't decide which is the best for this problem.

1 .We monitor every transfer/mint/burn event on our contract and maintain cumulative balances offchain. These cumulative balances will be updated with every transaction and the admin will put an address in the Blacklist if this address was trying to breach the imposed limit.

2 .Make use of balanceOf mapping in ERC721 standard. Every transfer will check this mapping and refuse to execute a new transaction if the token limit is breached. Will this change the ERC721 standard?. This will also not take account of cumulative ERC721 tokens, A user purchases and then transfers his/her token to some other dummy addresses repetitively to avoid the token limit.

1 Answer 1


First thing is when you say a user can not have more than n tokens, that should essentially mean an address can not hold more than n tokens in smart contract world. So talking about the solutions. For simplicity let max no of tokens a user can hold is 10.

Solution 1: This is very much dependent on taking steps after the requirement is violated. SO say a user had 10 tokens and he purchased 11th token, an admin will blacklist this address but the user already has 11 tokens. Either admin had to revert that which will require your contract to overpower admin and admin can revert any tx. Also when admin sends a tx to blacklist, and other transfers are made it will cause a race condition, so I could send a high gas price and send 10 more tokens to the address before the admin's blacklist tx is included in a block. Also since someone else can send tokens to your address, anyone else can send you tokens knowingly or unknowingly and make you blacklisted, which is a bad design. So IMO I don't think solution 1, is good enough.

Solution 2: This seems a more accurate solution as in this case, you won't allow users to have more than 10 tokens at any cost when user purchased the 11th token, the transaction will fail. So this mitigates the issue and not blacklisting defaulters. Also no manual action is involved from the admin's end for blacklisting.

And about a user can have multiple addresses to hold more than 10 token is possible with both the solutions.

  • And this approach will not violate the ERC721 address? Commented May 25, 2020 at 9:27
  • No, this doesn't violate the ERC-721 standard. But this limitation can cause other platforms might have to code some extra bit of change in their platform to support your ERC-721. Commented May 25, 2020 at 9:31
  • You mean, limitation that some transfers will fail ? Other platforms would have to make provision for this exception? Commented May 25, 2020 at 9:37
  • Limitation that transfer will fail. Like I have a platform that provides trading of 721 assets via smart contract, Now If I had to integarte you coin, I will have to make sure no user can place 3 buy txs, because they will fail and no one wants to spend money on txs that will likely to fail. Like these there are other cases. But if that is your business requirement, you can do that. Commented May 25, 2020 at 9:41
  • Can a new mapping be kept in a storage to keep track of token limit of addresses? The token limit of different addresses is different and will be updated by admin.. Commented May 25, 2020 at 9:53

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.