Hello everyone, I'm trying to have a function that is called regularly based on a scheduled timeframe. Since the CA is passive in nature, is there a way to schedule regular calls for a specific function in specified intervals? I heard about ethereum alarm clock, but also that it was discontinued. Is there a safer alternative?
Jul 12, 2023, 2:57 AM
Gelato or Chainlink, or make your own script it’s not hard
Jul 12, 2023, 3:02 AM
How would this solution go? In solidity I couldn't think of anything, through python I could, but that would require making an external call from a wallet regularly
Jul 12, 2023, 3:03 AM
In gelato or Chainlink you fund an account and slicing which function to call and how often. You will need to make sure you always have funds. Sometimes a minimum is required
With your own script you would use your own wallet to call the function every X amount of time
With your own script you would use your own wallet to call the function every X amount of time
Jul 12, 2023, 3:07 AM
It is just to change the state of a variable based on a set number of rules that it has to obey, shouldn't it be possible to be called without the need for gas, in a simple returns view mode?
Jul 12, 2023, 3:08 AM
If you wanna change state, you must pay gas
Jul 12, 2023, 3:12 AM
This is the way
Crontab+python script or 3rd party services like oz defender
Jul 12, 2023, 3:34 AM
If I add this change of state into the transfer function, can I pass on the gas of the change to the seller? The best scenario is to have no external calls
Jul 12, 2023, 3:35 AM
To alter the state of the chain an external owned account must do an action
The Blockchain itself is static and isolated
Jul 12, 2023, 3:36 AM
so if I add this update of variable as a requirement for the transfer function, shouldn't it be triggered and updated everytime the function is called by holders?
Jul 12, 2023, 3:37 AM
Yep
The user will pay the gas for that update
Jul 12, 2023, 3:37 AM
yeah, but since he is already paying for the transfer, the cost should be negligible compared to what he is already paying, right»
Jul 12, 2023, 3:38 AM
Correct :)
Jul 12, 2023, 3:38 AM
perfect, will try it this way here and see if I can make it work in an independent and automated way
Jul 12, 2023, 3:39 AM
There is hardhat gas reporter as plugin to track it
Remember once you automate a contract with an external script, depending on the project itself, you may centralize it
Centralization isn't bad if well handled, just to let you know
Jul 12, 2023, 3:40 AM
yes, that is why I want to avoid the external call option and input the update of the variable inside the transfer function
This way it will be updated only when it is required and avoid the need for external sources that could be copromised in the future
will look it up, thanks brother
Jul 12, 2023, 3:41 AM