Onshift

Expiring ENSv2 names as shift passes: staff and AI agents act for an org until the shift ends.

Onshift

Created At

ETHGlobal Mumbai

Project Description

Organisations hand out temporary power all the time: event cashiers, on-call responders, contract support, and now AI agents that issue refunds. That power is either a shared admin key, or a role someone has to remember to remove. A customer has it worse. Nothing lets them check whether the support agent in their DMs acts for the company right now, and fake agents use that gap.

OnShift is that check, built as ENSv2 names on Sepolia. A shift lead gives a staff wallet or an AI agent a name like shift-0412.ops.onshift.eth, with a role, a spending cap and an end time, in one transaction. The pass can't be transferred, and an approved operator inherits nothing. The holder can refund an order only back to the wallet that paid, only up to the remaining cap, and only for actions the org allowed. They cannot choose a recipient. When the shift ends, the name stops working by itself. Nobody sends a revoke.

Anyone can type the name into Public Check, with no account, and see On shift or Not on shift, the role and the time left. Look-alike organisations such as onshlft.eth are flagged.

If something goes wrong, one break-glass transaction re-points the ops registry at an empty one so every pass fails, and quarantines the till so new payments stop. Refunds for orders already paid still return to the original payer. Recovery uses a fresh registry, so old passes stay dead.

Playground lets any wallet issue a demo pass under demo.onshift.eth: Demo cashier or Demo agent, at most $5 and one hour. Demo passes use a separate gate and float and cannot refund production orders.

It's live against the real ENSv2 contracts, with an admin console, a wallet-style staff app, a customer pay page, Playground and Public Check.

How it's Made

OnShift is a set of Solidity contracts plus a React app that turn ENSv2 names into expiring shift passes. It calls the real ENSv2 contracts ENS deployed on Sepolia (UserRegistry, Permissioned Resolver, VerifiableFactory, ETHRegistrar and UniversalResolverV2). We wrote PassIssuer, PassResolverLib, ShiftGate, IncidentSwitch, Playground, the tests and the app for this hackathon. contracts/src/ensv2-local is an ABI-compatible test double so the suite can run offline; Sepolia does not use it.

Each ENSv2 feature does real work:

  • Hierarchical registries. Passes live in the ops UserRegistry under onshift.eth. IncidentSwitch.breakGlass re-points that subregistry at an empty registry, so every pass fails getState in one transaction. restore() deploys a fresh registry through VerifiableFactory, so old passes never come back.
  • Record aliasing. The same switch aliases till.onshift.eth onto a pre-registered quarantine name with setAlias and writes till.status. ShiftGate.pay refuses while the till is not live. A watchtower can flip only to that quarantine name, never to an address of its choosing. Turning the till back on takes the org plus an auditor who has attested the gate's codehash.
  • Expiring names. PassIssuer registers each pass with an expiry. ShiftGate treats a pass as live only when getState says REGISTERED and the expiry is still in the future. There is no cron and no required revoke. The issuer holds no renew role, and the scope record is bound to the same expiry, so a revived name fails with ScopeMismatch.
  • Enhanced Access Control. Passes are registered with roleBitmap 0: no transfer, no resolver change, and nothing for an approved operator to inherit. The holder may write exactly one text record of that one name, shift.status.
  • Permissioned Resolver, one proxy per pass. PassResolverLib deploys it through VerifiableFactory, writes the issuer-only records (treasury address, pass.scope, org, role, and agent-context on a production AI-agent pass), and grants the holder that single record. A fresh resolver is required because ENSv2 grants are keyed by namehash, so on a shared resolver a re-issued label would keep the previous holder's grant.
  • ENSIP-26. A production AI-agent pass publishes agent-context. Playground calls issueDemo, which forces that record empty, mints only under demo.onshift.eth with the roles Demo cashier and Demo agent, and caps the pass at $5 and one hour. A second ShiftGate holds the demo float, so a demo pass cannot refund a production order.

ShiftGate re-derives authority on every refund and check-in: follow the live ops or demo pointer, read getState, require the caller to be latestOwner, then read scope from that pass's own resolver. Spend is tracked per registry, label and expiry, so a re-issued label starts at zero. Order ids are derived on chain, and USDC can only go back to the wallet that paid, never for more than that order.

Testing and tooling: npm test runs 88 Foundry tests on the local layer, including five Playground audit regressions. npm run test:fork runs the same suite against the real ENSv2 contracts on a Sepolia fork. npm run smoke:sepolia runs the live path (pay, issue, resolve, refund to the payer) and the blocked cases: redirect, raise the cap, transfer, unknown order, over-refund, over-cap, and refund after expiry. sdk/gate.mjs lets another agent repeat the liveness check with no key and refuse a name that is not live or whose till is quarantined.

The app is React, Vite and viem. The console, staff app, customer pay page, Playground and Public Check all read the committed Sepolia deployment, and nothing in the UI is a fixture. A staff or agent device keeps a burner key in the browser, funded by a gas allowance sent with the pass and capped at 0.05 ETH. On Sepolia the org is one wallet; transferOrg moves that role to a Safe without redeploying.

Hacky but notable: Sepolia prices deployed code at about 1,700 gas per byte, and EIP-7825 caps a transaction at 16.78M gas, so our first PassIssuer (about 10.4 KB) could not be deployed. Moving per-pass resolver setup into PassResolverLib, which runs by DELEGATECALL in the issuer's context, brought it to about 8.4 KB with the same permissions.

AI tools: Cursor drafted and edited the contracts, tests, app and deploy scripts. We directed the design: a resolver per pass, getState as liveness, refunds bound to the paying wallet, and a demo namespace that cannot touch production. There are no spec-kit, OpenSpec or Kiro files and no prompt archive.

background image mobile

Join the mailing list

Get the latest news and updates