Calculate task-expiry-time & task-automation-fee
View the command
supra move automation register --helpUnderstand parameters
supra move automation register \
--task-max-gas-amount XXXX \
--task-gas-price-cap XXX \
--task-expiry-time-secs XXXXXXXXXX \
--task-automation-fee-cap XXXXXXXXXX \
--function-id "0xYourAddress::your_module::function_name" \
--rpc-url <TESTNET or MAINNET>Check Network Details for RPC URL.
How to Calculate--task-expiry-time-secs
Supra tasks only run after the next epoch. Here’s how to calculate it.
Get the last epoch start
curl -X 'GET' \
'https://rpc-testnet.supra.com/rpc/v2/accounts/1/resources/0x1%3A%3Areconfiguration%3A%3AConfiguration' \
-H 'accept: application/json'Look for Something like:
"last_reconfiguration_time": "1747163851854115"Above Number is in microseconds, you have to convert it into Seconds before calculating the task expiry time via the formula given.
Example: 1747163851854115 Microseconds -> 1747163851 Seconds
Get the epoch interval (epoch duration)
curl -X 'GET' \
'https://rpc-testnet.supra.com/rpc/v2/accounts/1/resources/0x1%3A%3Ablock%3A%3ABlockResource' \
-H 'accept: application/json'Look for Something like:
"epoch_interval": "7200000000"Final Formula to Calculate Task Expiry Time: (Add a buffer of 300 = 5 mins or 120 = 2 mins)
buffer is the duration that you wish to set the automation task to run for. Please note that the max duration that
your task may be registered for is 7 days from the time of registration.
task-expiry-time-secs =
(last_reconfiguration_time/1000000) + (epoch_interval/1000000) + bufferExample:
task-expiry-time-secs = 1748027985 + 7200 + 300 = 1748035485Use:
--task-expiry-time-secs 1748035485
How to Estimate the--task-automation-fee-cap
Input your max gas: The input argument should be the maximum gas you expect your task to use. Let’s represent this as <max-gas>.
curl --request POST \
--url https://rpc-testnet.supra.com/rpc/v2/view \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"function": "0x1::automation_registry::estimate_automation_fee",
"type_arguments": [],
"arguments": ["<max-gas>"]
}'This represents the expected --task-automation-fee-cap based on the currently registered task.
You may set a slightly higher automation fee cap to allow for buffering.
Example calculation:
If your task’s max gas is 100:
"arguments": ["100"]Output:
{"result":["720000000"]}
Your fee cap is 720,000,000 quants - (7.2 supra per epoch)
Example calculation:
If your task’s max gas is 50,000:
"arguments": ["50000"]Output:
{"result":["393872320800"]}
Your fee cap is 393,872,320,800 quant - (393.87 supra per epoch)
The value you input (max gas) should reflect how much gas you expect your task to use. It’s not fixed; adjust as needed based on your task complexity.
Parameter Guide
--task-max-gas-amount | Max gas your function can use |
--task-gas-price-cap | Max gas price per unit to avoid spikes |
--task-expiry-time-secs | Deadline for task (UNIX time) |
--task-automation-fee-cap | Max fee (in microSUPRA) for automation |
--function-id | Target public entry function to trigger |
--args (optional, per target function) | Arguments to pass to the function |
--task-max-gas-amount | Run a dry run to check for success |
task_duration_cap_in_secs | Maximum allowable duration (in seconds) from the registration time that an automation task can run, If the expiration time exceeds this duration, the task registration will fail. |
registry_max_gas_cap | Maximum gas allocation for automation tasks per epoch, exceeding this limit during task registration will cause failure and is used in fee calculation. |
automation_base_fee_in_quants_per_sec | Base fee per second for the full capacity of the automation registry, measured in quants/sec. The capacity is considered full if the total committed gas of all registered tasks equals registry_max_gas_cap. |
flat_registration_fee_in_quants | Flat registration fee charged by default for each task. |
congestion_threshold_percentage | Relative to registry_max_gas_cap. Beyond this threshold, congestion fees apply. |
congestion_base_fee_in_quants_per_sec | Base fee per second for the full capacity of the automation registry when the congestion threshold is exceeded. |
congestion_exponent | The congestion fee increases exponentially based on this value, ensuring higher fees as the registry approaches full capacity |
task_capacity | Maximum number of tasks that registry can hold |