Skip to Content
DevelopersQuickstart: Delay

Quickstart: add a Delay Modifier

Goal — In about 15 minutes, you put a review period between a role and your Safe. Queued transactions wait for one day. During that day, the Safe owners can cancel them.

You need:

Step 1: add the Delay to your constellation

In constellation/index.ts, define the Delay Modifier and route the Roles Modifier through it:

export const treasuryDelay = eth.delay['Treasury Delay']({ nonce: 0n, owner: treasury, avatar: treasury, target: treasury, cooldown: 86_400n, // 1 day, in seconds expiration: 604_800n, // 7 days, in seconds }) export const opsRoles = eth.roles['Ops Roles']({ nonce: 0n, owner: treasury, avatar: treasury, target: treasuryDelay, // checked transactions go into the queue roles: { ops }, })

One day is a floor, not a recommendation. Pick a cooldown in which your owners really notice and cancel a bad transaction, on a weekend too. The expiration must be 0 (never expires) or at least 60 seconds; see the guide for the trade-offs.

Step 2: review and apply

bun push

The browser opens the Zodiac App with the change set: the Delay deployment, the enableModule calls, and the new target of the Roles Modifier. Review it, then sign with the Safe.

The path is now: member → Roles Modifier (permission check) → Delay Modifier (queue) → Safe.

Step 3: test the queue

  1. As a role member, execute a small allowed transaction. It does not run — it lands in the queue. The Delay Modifier emits TransactionAdded.
  2. Call executeNextTx with the same to, value, data, and operation. It reverts: “Transaction is still in cooldown”. Good.
  3. After the cooldown, call executeNextTx again. The Safe executes the transaction. Anyone can make this call — it needs no permission.

Step 4: prepare the cancel path

Cancellation is the point of the Delay Modifier, so rehearse it once:

  1. Queue another test transaction.
  2. As the Safe, call setTxNonce(queueNonce) on the Delay Modifier. The queue is empty; the transaction never executes.

Set up an alert on the TransactionAdded event, so the owners see every queued transaction in time. See watch the queue.

Where to go next

Last updated on