1

I want to set limit on erc20 token that owner will not transfer after the set limit.

Lets totallSupply =1000 tokens But transfer function could not be able to transfer more than 500 tokens.

Please suggest!!.

1
  • 3
    Simply add require(amount <= limit); in the transfer function. Commented Nov 18, 2018 at 21:18

1 Answer 1

0

If you want to limit the transfer amount per transfer then the what @shane suggests at the comment will be enough. If however, you want to limit the number of tokens each user can transfer you need to keep track of their activity. You can do that by using a mapping with the address as the key and increase the value each time someone transfers token. You will need to have a check in the transfer function to check if each transfer is within the limits of the users allowed transfers, something like that: require(_amount <= limit - limits[msg.sender]).

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.