Open kailust opened 2 years ago
cosmwasm implementation allows contracts to access some verified data produced at call-time. For more information, please see here.
In most cosmos-based chains (such as Terra), this is produced by the median block time of the validator set.
I understand the contracts can access verified data produced at call-time.. my question is how does the smart contract automatically perform "call-time" itself without a third party or someone else running a command. Smart contracts are not self running, so does this contract need an outside cron job or bot to send messages to the smart contract for example every minute or every hour and retieve verfied data from such as block height and time, and compare it to user dca order configuration, then run execution. Or does this contract have the ability to self run and do call-time verifications itself?
It does not. An external user has to call ExecuteMsg::PerformDcaPurchase
in order to invoke purchases.
ok thats what I thought, so a bot needs to run, and check for example every hour and check each users configurations with
QueryMsg::UserDcaOrders
then if the users orders are valid based on time and balance, then it needs to execute
ExecuteMsg::PerformDcaPurchase
Is this correct?
Yep!
Also can you update the https://github.com/kaimen-sano/astroport-dca/tree/master/contracts/dca#create_dca_order to use Luna and another cw20 token because UST is not on Terra 2.0
Thanks
The underlying process is still the same, so there is no need to update it
https://github.com/kaimen-sano/astroport-dca/tree/master/contracts/dca#instantiatemsg
"contract_ddr should be "contract_addr"
also it missing "whitelisted_fee_assets" attributes
If you create a DCA order https://github.com/kaimen-sano/astroport-dca/tree/master/contracts/dca#create_dca_order for example "Example: Purchase 5 UST worth of Luna each day, with 15 UST."
How does the contract check the time and execute the order automatically? Don't we need an outside message sent via bot to the smart contract to "check and execute" for example check if its time to to run the DCA function https://github.com/kaimen-sano/astroport-dca/tree/master/contracts/dca#perform_dca_purchase