LogoLogo
GithubDiscordTwitter
  • Welcome
    • What is Clockwork?
    • Quickstart
    • Installation
  • Guides
    • 1. Scheduling an SPL transfer
    • 2. Auto-incrementing counter
  • Reference
    • Threads
      • Account
      • Address
      • Authority
      • Fees
      • Payers
      • Triggers
    • Localnet
    • SDK
    • Support
  • Node operators
    • Deploy a worker
Powered by GitBook
On this page
  • Account
  • Cron
  • Now
  • Slot
  • Epoch
  • Timestamp
  • Pyth

Was this helpful?

Edit on GitHub
  1. Reference
  2. Threads

Triggers

PreviousPayersNextLocalnet

Last updated 2 years ago

Was this helpful?

Clockwork provides 5 different trigger conditions for scheduling a thread's execution. These trigger conditions support a wide variety of use-cases and allow you to subscribe to time-based as well as event-based changes. If none of the trigger conditions currently provided support your team's use-case, please reach out in the to propose a new one.

Account

Allows a thread to begin execution whenever an account's data changes. This can be useful for listening to account updates, process realtime events, or subscribing to an oracle data stream. This trigger type requires 3 arguments.

  • address – The address of the account to listen to.

  • offset – The byte offset of the account data to monitor.

  • size – The size of the byte slice to monitor (must be less than 1kb).

Cron

  • schedule – A schedule in cron syntax.

  • skippable – Boolean value indicating whether an scheduled invocation can be skipped if the Solana network is unavailable. If false, any missed invocations will be executed as soon as the Solana network is online.

Now

Allows a thread to begin execution immediately. This can be useful when a new calculation needs to be immediately kicked off. This trigger condition takes no arguments.

Slot

Allows a thread to begin executing when a specified slot has passed. This can be useful for scheduling processes related to staking an Solana epoch transitions. This trigger condition requires 1 argument.

  • slot – The slot to begin execution on.

Epoch

Allows a thread to begin executing when a specified epoch becomes active. This can be useful for scheduling processes related to staking and Solana epoch transitions. This trigger condition requires 1 argument.

  • epoch – The epoch to begin execution on.

Timestamp

Allows a thread to begin executing when a specified unix timestamp has passed. This can be useful for scenarios where you have an exact date in the future when you want a program to begin running.

  • unix_ts – The unix timestamp to begin execution on.

Pyth

Allows a thread to begin executing when a price threshold has been crossed. This can be useful for scheduling actions that are driven by price movements such as automated stop-loss and take-profit orders.

  • equality – The equality operator (≥ or ≤) used to compare the the price feed to the limit price.

  • limit – The limit price to compare the price feed to. When this threshold has been crossed, the thread will execute.

Allows a thread to begin execution whenever a is valid. This can be useful for scheduling one-off or periodically recurring actions. This trigger type requires 2 arguments.

price_feed – The Pyth price feed account to monitor. Please refer to the for these addresses.

cron schedule
Pyth website
Clockwork Discord
clockwork/thread.rs at 781b42fd06f2926899597ce5ea1f19b8ecd3d2e4 · clockwork-xyz/clockworkGitHub
enum Trigger
Logo