An on-chain dead-man's switch for ERC-20 assets. An owner deposits into a plan and periodically
checks in. While they keep checking in, only they control the funds. If they go silent past their
chosen interval, the named beneficiary can claim the whole plan. Non-custodial: no admin, no third
party can ever take the funds — only the owner (any time) or the beneficiary (after a lapse). MIT.
createPlan(token, amount, beneficiary, interval)— fund a plan; credits the actual amount received (fee-on-transfer-safe). Returns aplanId.checkIn(id)— the owner's heartbeat: resets the silence clock.topUpandownerWithdrawalso reset it.ownerWithdraw(id, amount)— the owner pulls their own funds out at any time.changeBeneficiary/changeInterval— owner-only; changing the interval also resets the clock (so a shortened interval can't cause an instant lapse).claim(id)— the beneficiary takes the whole plan, but only onceblock.timestamp > lastCheckIn + interval(strictly past the deadline). Terminal: a plan can be claimed once.
- Solvency — the vault always holds at least the sum of every plan's recorded balance, across any
sequence of create / check-in / owner-withdraw / top-up / time-warp / beneficiary-claim (12,800 calls,
0 reverts). No plan's funds can ever be paid to the wrong party or double-claimed. Mutation-checked
(relaxing the lapse boundary from
>to>=fails a test).
- The only actors who can move a plan's funds are its owner (always) and its beneficiary (only after the owner is silent past the interval). There is no contract owner/admin and no path to another plan's funds.
- Standard ERC-20 assumed; fee-on-transfer is handled on deposit (actual-received) — a rebasing token is out of scope.
- Liveness is on the owner: they must check in to retain exclusive control. Unaudited reference impl.
forge test # 17 tests: heartbeat/lapse gating, owner powers, beneficiary change, reentrancy, solvency invariant