Docs/Examples/Vault Dead Switch

VaultDeadSwitch (Dead Man's Trigger)

Transfers a vault to a beneficiary if the owner misses a check-in window — no VRF required.


Overview

VaultDeadSwitch is a dead man's switch for on-chain assets. If the designated owner fails to check in within the required interval, AutoLoop autonomously transfers the vault balance to the beneficiary. No human trigger is needed — and nobody should hold one.

PropertyValue
Base contractAutoLoopCompatible (no VRF)
VRF usageNone
Gas per tick~55k
Sourceautoloop/src/agents/VaultDeadSwitch.sol
Tests28 passing (unit + fuzz)

Why AutoLoop Is Structurally Required

Nobody should control a dead man's trigger. If the owner holds the trigger, they could delay their own death indefinitely. If the beneficiary holds it, they're incentivised to fire it as soon as the interval passes. Both scenarios break the contract's neutrality. AutoLoop provides a cryptographically neutral third-party keeper with no economic interest in the outcome.

Mechanics

  • Check-in: the owner calls checkIn() to reset the countdown
  • Trigger: when block.timestamp - lastCheckIn >= checkInInterval and the switch hasn't already fired, AutoLoop calls progressLoop(), which transfers the balance minus a 2% protocol fee to the beneficiary and sets triggered = true
  • One-shot: once triggered, the switch is permanently fired — no re-arming

Revenue Model

  • 2% protocol fee taken from vault balance on trigger
  • AutoLoop gas fee on trigger tick

Deploy

forge create src/agents/VaultDeadSwitch.sol:VaultDeadSwitch \
  --constructor-args 0xOWNER 0xBENEFICIARY 604800 \
  --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast

Args: owner, beneficiary, checkInInterval (seconds). A 7-day interval (604800) is typical.

Dashboard

View VaultDeadSwitch on the AutoLoop Dashboard.