arkadiko-automation-trait-v1trait and its functions.
arkadiko-automation-trait-v1. You can refer to the Arkadiko Contracts on GitHub to find the trait interface.
check-jobfunction that contains the logic that will be executed off-chain to see if
run-jobshould be executed. The
run-jobfunction can use on-chain data from any other Clarity smart contract, including use of the
at-blockfunction to access historical data.
run-jobfunction that will be executed on-chain when
check-jobread-only function off-chain during every block to determine if the job needs to run. When
(ok true), the Keepers Network calls
run-jobon-chain and charges 10 DIKO plus the STX gas fee from your account. This cycle repeats until the job is cancelled or runs out of funding.
end-epoch-block. Or in other words, we get the block height at which we should add new DIKO to the liquidation rewards. Alternatively, we could have also written custom logic in this smart contract to keep the last block execution and execute it every 1008 blocks. When the current
block-heightis greater or equal to the
end-epoch-blockheight, we should return
(ok true). Otherwise, we return
IMPORTANT: Your check-job function should never return an error (e.g. (err false)), since that would make the whole execution process fail. Simply return (ok true) or (ok false)
run-jobas well to ensure that state change occurs only when necessary.
check-job. These checks validate the conditions before doing the work.
check-jobthat is designed to start a transfer at a specific time, validate the condition to ensure third-party calls to your
run-jobfunction do not start the transfer at a different block height.
run-jobfunction is allowed before execution.
run-jobthat funds a wallet, ensure you have a list of permissable addresses to compare against to prevent third-party calling your function to send money to their address.
run-jobmight not be required, but it can still be a good practice to short circuit expensive and unnecessary on-chain processing when it is not required.
check-jobconditions haven't yet been tested by Arkadiko Keepers, so any specific checks that you perform are entirely use case specific.