0

From my understanding, waiting in a solidity smart contract would create a total disaster for the whole Ethereum's blockchain.

I can see in some circumstances that solidity offers block.timestamp and keywords such as "now + 1 day".

My specific scenario is the following:

A smart contract sends an ERC20 Token from 3 different addresses. However, those tokens shall not be sent at the same time, but eventually wait between 1 minutes and 1 hour between each transaction.

Is that achievable using smart contracts?

marked as duplicate by Richard Horrocks, shane, Ismael, Achala Dissanayake, Nicolas Massart Jun 10 at 10:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • would that require to call the transaction 3 different times? – Sophie259 Jun 6 at 22:19
2

Most use-cases can be solved by inverting control. Rather than having the contract run something at a certain time, interested parties claim entitlements when appropriate. The contract decides if the requests are permissible.

So, a delayed entitlement would go:

  1. Buyers sends ETH. Contract records future entitlement to tokens. When (not before) and how much.
  2. Buyers claims token. Contract checks entitlement and performs a little accounting to prevent double-claims.

Other patterns can solve for large batch jobs such as calculating dividend entitlements without resorting to scheduled tasks.

Hope it helps.

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