I found out that function is Solidity cannot invoke themselves automatically :(

Dear friends

I wanted to invoke a function “send money” automatically after a certain period (number or blocks) is passed but I found out that this is not possibile.

Although I am afraid that the guys in the forum above are right, maybe Gods @filip @ivan and other people in this forum that I did not have the pleasure to meet yet have other ideas?

Basically, I want that some money stored in my contract are sent to an address when a date expires. It’s easy to set the date but I cannot trigger the “auto send” function apparently :confused:

No you can’t do auto send. It’s actually a bad idea because your contract could run out of gas and the tx getting stuck.

All projects where money is “sent out” requires the user to execute some sort of withdrawal transaction.

So you could simply have a function called withdrawMoney which the recipient need to execute in order to get his/her payout. Then you check so that the correct amount of time has passed in that function using a require statement, so that no one can cheat.

We cover some of this in the smart contract security course. I can recommend it.

1 Like