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.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
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]).