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!!.

  • 3
    Simply add require(amount <= limit); in the transfer function. – shane Nov 18 '18 at 21:18
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, privacy policy and cookie policy

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