0

I'm a newbie in ethereum programming and is playing with an ICO smart contract. I want to know if it is possible to put the below restrictions in the smart contract:

  1. Can I set a maximum amount for ether that can be send to the contract address over a 24-hour period? I want to make sure that a single user doesn't buy all my tokens.

  2. Can I set a maximum amount of ether to be sent to the contract address over a 24-hour period? I want to make sure that only certain amount of my tokens are sold everyday.

0

You can not prohibit people from sending Ether to a contract, but you can track the contrcact Ether-/Token -balance and send received Ether back once a cap is reached. You should read a few contracts from open Zepplin, its a great project to get a feeling for writing Smart Contracts. They have ressources in place, for use cases like yours.

To define Time intervals and check against them, there are two ways: I) You can use blocknumbers with "block.number". II) You can use timestamps with "block.timestamp" which returns a unix epoch

see here for details

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.