pub fn handle_incoming_task(
querier: &QuerierWrapper<'_>,
env: Env,
info: MessageInfo,
croncat_factory_address: Addr,
custom_validation: Option<HandleIncomingTaskParams>,
) -> Result<TaskExecutionInfo, CronCatContractError>
Expand description
Handles and validates an incoming CronCat task Specifically, it checks:
- Sender is a sanctioned CronCat manager contract (CronCat factory knows the manager contract addresses and versions.)
- We’re in the same block and transaction index as the latest executed transaction. In other words, this task is happening in an atomic, synchronous transaction, and this invocation is the result of a cross-contract call (message or submessage) from a manager contract. (Note: you can disable this check via the
disable_sync_check
field ofcustom_validation
if, for instance, you’re doing IBC calls where the execution is asynchronous, spanning blocks.) - The owner of the task that just called is the calling contract (Note: this can be changed by setting the
expected_owner
field incustom_validation
. If unset, it will default to this contract.) For contracts storing task hashes, you can take theTaskExecutionInfo
returned and check it against state.