var img = document.createElement('img'); img.src = "https://terradocs.matomo.cloud//piwik.php?idsite=3&rec=1&url=https://docs.warp.money" + location.pathname; img.style = "border:0"; img.alt = "tracker"; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(img,s);
Skip to main content

Overview

The following section is a basic overview of how Warp works. For a more in-depth look at Warp smart contracts, visit the Contracts section. To learn how to use Warp, visit the Get started tutorial.

Jobs

Jobs are the main feature of Warp. Users submit WASM messages along with specified conditions and a reward. When the conditions are met, keepers send the message and receive the reward. Jobs can contain any valid WASM messages, including other create_job transactions, allowing jobs to be chained together and executed from the same context.

When a job is created, users must specify a job name, a reward amount, an execute message, and a contract address for the message. The job message is signed by the owner at the time of job creation, to be executed later by keepers.

Any tokens sent as part of a job's message must be present in the user's Warp account balance at the moment of execution.


_18
pub struct Job {
_18
// unique identifier for each Job
_18
pub id: Uint64,
_18
// job creator address
_18
pub owner: Addr,
_18
// UTC timestamp for when the job was submitted
_18
pub last_update_time: Uint64,
_18
// name given to the Job
_18
pub name: String,
_18
// status of the job (pending, executed, failed, canceled)
_18
pub status: JobStatus,
_18
// condition set dictating when the Job should be executed
_18
pub condition: Condition,
_18
// message to execute when conditions resolve to true
_18
pub msg: Vec<CosmosMsg>,
_18
// reward to distribute to the keeper when the Job has been executed
_18
pub reward: Uint128,
_18
}

To learn more about the workflow of jobs, visit the Job state page. To learn about creating a job template, visit the Template tutorial.

Conditions

Each job must be submitted with conditions, which are a set of circumstances under which the job should be executed. Conditions are made up of expressions which can be simple, such as specifying a blockheight, or complex, in which multiple conditions are nested and joined using boolean operators. Query responses can also be used in expressions to specify a condition. When all the expressions in a condition evaluate to true, the condition is met, and the job can be completed.

To learn more about how conditions work, visit the Conditions page.

Templates and variables

Templates and variables allow Warp users to create reusable, looping jobs. Templates create a job structure, and they contain variables that can be updated by a user. They can also be specified to update automatically through looping. To learn how to create variables and job templates, follow the Template tutorial.

Warp accounts

In order to transact funds, a job must have access to a wallet. Warp accounts are smart contract wallets that allow users to transact with Warp. Warp accounts function similarly to a Cosmos wallet account. For example, users can use their accounts to send, deposit, delegate, undelegate, or receive funds by interacting with their accounts as a smart contract. Using the Warp app, users can deposit or withdraw funds from their Warp accounts. Any transactions using jobs are executed through a user's account. Warp accounts can only be controlled by a user's wallet and the jobs that they create.

Keepers

A keeper is any party that maintains the automation functions of a smart contract. Keepers are incentivized by Warp users to execute smart contract functions on their behalf, in exchange for a reward. Keepers query the chain and evaluate a job's condition. Once the conditions for a job are met, a keeper can submit the execute message contained in the job. To learn how to run a keeper, visit the Keeper guide.

Rewards

Rewards are given by job owners to keepers in exchange for executing their jobs. Because Warp is a decentralized event handler, rewards are an incentive for unknown keepers to execute jobs, without the need for a centralized intermediary. The minimum reward value is 0.02 Luna. Rewards are provided in Luna and are priced organically, based on computing power costs and incentives for the keeper.

The queue

Jobs that have been successfully created by a user are added to a queue, where they will remain until their conditions are met and they are executed by a keeper.


_7
pub enum JobStatus {
_7
Pending,
_7
Executed,
_7
Failed,
_7
Cancelled,
_7
Evicted,
_7
}

For more on Job state, the queue, and a basic workflow, visit the Job state page.

Eviction

In order to keep a job active, 0.01 Luna will be withdrawn from the job creator's Warp account every 24 hours. Keepers called "Evictors" will check each job in the queue daily, and collect the 0.01 Luna as a reward. When the Job creator's account no longer holds enough Luna, the job will be evicted and removed from the queue. The Evictor will receive 0.01 Luna from the Job's reward, and the Creator will be refunded the Job reward amount, minus the eviction fee.

Example

The following illustration demonstrates how a job is executed.