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:

1 Like

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.


is that like a frozen function then?


Not sure what you mean with “frozen function”.

However the idea is that, if a customer has an amount to withdraw, you should let them pull it instead of push it automatically.

Read this: https://medium.com/noblocknoparty/a-smartcontract-best-practice-push-pull-or-give-b2e8428e032a

Like the Kick tokens, Some of the Tokens are locked with freeze,.

I know what you mean make them Withdrawl Like HEX or this one SFT but SFT moves erc20 differently

yes the reason is gas and the ability to run a time checker as well to keep up with the current time,
would be good to have a push though if one could work it properly, Hmmmmm?