Skip to Content
AutomationYour First Automation TaskRegister your Automation Task

Register your Automation Task

Make sure the contract is published before registering automation — otherwise, the system won’t be able to find your function.

Before registering for real, test the task using --simulate:

supra move automation register --simulate \ --task-max-gas-amount <MAX_GAS> \ --task-gas-price-cap <GAS_PRICE_CAP> \ --task-expiry-time-secs <EXPIRY> \ --task-automation-fee-cap <FEE_CAP> \ --function-id "<ADDRESS>::auto_incr::auto_increment" \ --rpc-url <RPC_URL>

Replace <ADDRESS> with the address that published the module. Derive the other placeholders as described in Calculate task-expiry-time & task-automation-fee:

  • <MAX_GAS>: the gas one execution of auto_increment needs, within the registry’s remaining gas capacity. To find it, simulate a direct call of the function from the account that published it and read gas_used in the output:

    supra move tool run --simulate \ --function-id "<ADDRESS>::auto_incr::auto_increment" \ --rpc-url <RPC_URL>

    Use that value or a larger one. An execution that needs more gas than <MAX_GAS> fails.

  • <GAS_PRICE_CAP>: at or above max_gas_price from <RPC_URL>/rpc/v3/transactions/estimate_gas_price.

  • <EXPIRY>: start_time + duration_secs + buffer, from get_cycle_info.

  • <FEE_CAP>: at or above the result of estimate_automation_fee for <MAX_GAS>.

Registering takes flat_registration_fee_in_quants and a deposit equal to <FEE_CAP> from the account.

Each cycle’s fee is charged from the account’s balance, not from the deposit. If the balance cannot cover the fee at the start of a cycle, the task is removed and its deposit is not refunded. Keep the balance above the fee for every cycle until the task expires.

If you see:

"vm_status": "Executed successfully"
✅

You’re good to go, remove --simulate and run the command again to register the automation task.

Post-Deployment: Sanity Check

Once you’ve registered your automation task, you’ll want to confirm it’s actually working.

  • Use SupraScan
    • Visit SupraScan 
    • Search your deployer address
    • Check Tasks Tab.
    • Confirm your task is executing at the expected intervals

Register Automation Task

Task will not become active until the next cycle starts.
Users may not be able to confirm the task is executing right away.

  • Read the task from the registry

The task index is assigned at registration. List the tasks of the registry and read one by its index:

supra move tool view \ --function-id 0x1::automation_registry::get_task_ids \ --rpc-url <RPC_URL> supra move tool view \ --function-id 0x1::automation_registry::get_task_details \ --args u64:<TASK_INDEX> \ --rpc-url <RPC_URL>

In the response, state is 0 for a pending task, 1 for an active task and 2 for a cancelled task.

  • Run the View Function

To check your counter value, run this CLI command:

supra move tool view \ --function-id '<ADDRESS>::auto_incr::get_counter_value' \ --args address:<ADDRESS> \ --rpc-url <RPC_URL>

Before the automation task starts:

{ "result": [ "0" ] }

After the automation task starts, the task runs once per block while it is active, and the value increases by 1 each time. The value you read depends on how many blocks have passed since the task became active:

{ "result": [ "<VALUE>" ] }
✅

Check again after automation runs — if the value increases, your automation task is working perfectly.

Last updated on