Yeah so I'm creating a eth token and I need to find a way that buyer have a purchasable maximum limit. Can anybody help me with that ? Can't find answer thanks a lot.

  • You can store how much each account has bought in a mapping, and revert any purchase above the limit. But having limits doesn't work very well, anyone can have as many accounts as they want a buy with each some more. For that to work you have to implement a whitelist or KYC policy. – Ismael Apr 6 at 16:15

In the function that allows purchasing tokens (probably mint()), simply include a require check along those lines:

require((balanceOf(msg.sender) + _mintAmount) <= maximumLimit, "Cannot exceed limit");

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.