Is it possible to set a limit for the number of transaction each token can have in solidity? for example, a token can only transfer 10 times.

2 Answers 2


Of course you can do it with simple variable:

uint8 public txMax = 10;
uint8 public txPerformed;

then in method:

function someFunc() {
    require(txPerformed < txMax, "no more transactions");
    //   ur code here
    txPerformed = txPerformed.add(1);

ERC20 tokens are fungible. Any one unit (or sub unit) of an ERC20 token is identical to others.

Due to this, it isn't possible to limit transfers on a token-bases. You could limit the ability of addresses to transfer the token, but limiting the token itself is not possible, since you cannot tell which unit of a token has been transferred before.

ERC721 tokens would support this, however, since they are non-fungible. You could include an attribute in the ERC721 token that counts the number of times it has been transferred.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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