How to add minimum and maximum purchase amounts to Allowance Crowdsale

@abcoathup I’m confused how to add minimum and maximum amount like users need to send more then 0.1 ether and maximum 1 ether ! How to add this function on this above AllowanceCrowdsale ??? Please help me on this !

1 Like

Hi @Rahaman,

You can add some validation by overriding _preValidatePurchase. I suggest looking at IndividuallyCappedCrowdsale for the concept.

For a minimum purchase you could check the weiAmount. For a maximum, you could check against a contract set cap, but participants could participate multiple times to get around the cap, so you would ideally add participants to a white list/allow list or use IndividuallyCappedCrowdsale and set a cap per address of those who are allowed to participate, so that one person didn’t participate using multiple addresses.

1 Like

@abcoathup Thank you sir !

1 Like