DocsSponsored Tasks
This page follows one sponsored reward from an empty vault to tokens in a worker's wallet. For the
commands at each step see the CLI reference.
| Step | Who | Onchain call | Result |
|---|---|---|---|
| 1 | Sponsor | SponsoredTaskFactory.createVault | One-time creation fee paid; vault clone deployed, registered in the registry, epoch 1, status active. |
| 2 | Anyone | SponsoredTasksVault.fund | Project tokens move into the vault and become available. |
| 3 | Owner | SponsoredTasksVault.configureManager | Manager gets a spend cap and is active. |
| 4 | Manager | Termix task creation with the Sponsored Task hook | Tokens reserved for the task; no fee. |
| 5 | Requester, evaluator or protocol | Termix verdict | The hook commits the awards. |
| 6 | Keeper (or anyone) | SponsoredTaskHookV2.reconcile, finalizeSettlement or finalizeRelease | Merkle root installed in the vault, or reservation released. |
| 7 | Worker, via a gasless relay | SponsoredTasksVault.claimTo | Net tokens sent to the worker's withdrawal address. |
termix sponsored-task create calls the factory's createVault(token, vaultOwner, userSalt)
with a random salt. The factory deploys a minimal clone of the vault implementation, derives thevaultId, initializes the vault with the hook as its controller and the fee policy, and registers
the vault in the SponsoredTaskRegistry in the same transaction. In that same transaction it takes
the one-time creation fee (US$1) from the creator and sends it straight to the fee recipient; the
fee is never refunded. Vault creation is otherwise permissionless: any address can create a vault
for any token. The token must be a deployed contract. See Fees.
fund(amount) pulls exactly amount tokens from the caller. Anyone can fund an active vault. The
vault checks that the sender's balance fell by exactly amount and its own balance rose by exactlyamount, so fee-on-transfer tokens are rejected at funding time.
The owner calls configureManager(manager, cap, active). The cap is a lifetime token allowance in
base units, not a per-task limit. See Managing a vault.
The manager runs termix task create ... --sponsored-task <vaultId> --sponsored-task-tokens <amount>. The CLI previews the funding, asks the backend to build the hook's funding request, and
attaches the Sponsored Task hook to the task. Inside the task-creation transaction the hook:
reserveTask, which checks the manager is active, the spend cap and theIf any check fails, the whole task creation reverts, including the task's reward payment. The reward appears
on the task with state reserved. Details are in
Creating sponsored tasks.
When the task completes, the hook records the verdict type, the awards and the USDC payout pool
(the reward less any evaluator fee). It does not move tokens at this point. Three outcomes skip the
split entirely:
award_count_exceeded instead of reverting, so the USDC settlement is never blocked.Nothing in the contracts pays a worker or returns tokens automatically. The Termix backend
settles a sponsored task at three points:
completed, cancelled or expired task still reserved, andFor a verdict Termix stored (an evaluator or dispute verdict, or a single winner), and for a
cancelled or expired task, the backend calls the hook's permissionless reconcile, which reads the
task's onchain status and verdict and either installs the settlement or releases the reservation.
A manual split-award verdict is not stored onchain, so reconcile cannot rebuild it; the backend
calls finalizeSettlement with the awards it recorded from the task's payouts, in onchain order.
The hook checks them against the commitment it stored at the verdict and rejects any other list.
Settling a task that is already settled does nothing.
Installing a settlement computes each winner's gross, fee and net amounts, builds a Merkle tree of
the net entitlements (one leaf per winner with a non-zero net amount), and calls the vault'sinstallSettlement. The vault moves the reserved amount out of the manager's reservation, counts
the distributed amount as spent against the manager's cap, makes the distributed amount
claimable, and returns any undistributed remainder to the available balance. The reward's state
becomes credited (or released if nothing was distributed).
Every installed settlement is listed on the vault's page and throughGET /api/sponsored-task-vaults/<vaultId>/settlements,
newest first, with its Merkle root, transaction and amounts.
finalizeSettlement, finalizeRelease, reconcile and refreshOwnerDefault are all
permissionless, so anyone can settle a task the backend has not.
For a vault on another chain, the task chain's RemoteSponsoredTaskHookV2 records the funding and
the verdict instead, and Termix's settler on the vault's chain reserves, settles or releases
from outcomes Termix signs. A settlement there becomes claimable after the settler's claim
delay (one hour by default). See Chains and
Trust and safety.
The worker runs termix sponsored-task claim <vaultId>. The CLI fetches the worker's unclaimed
entitlements with their Merkle proofs, signs an EIP-712 ClaimTo authorization naming the worker's
registered withdrawal address, and posts it to the backend, which relays claimTo onchain. The
worker pays no gas. See Claiming rewards.
The fee portion is claimed separately by the snapshotted fee recipient with the vault'sclaimFee.
Settlement uses the verdict's award weights (the USDC amount each winner was awarded):
| Verdict | Gross distributed |
|---|---|
APPROVE | The whole reserved amount, split pro rata by award weight. |
PARTIAL | The reserved amount scaled by min(total awards, payout pool) / payout pool, then split pro rata. The rest returns to the vault. |
REJECT, or no non-zero award | Nothing. The full reservation returns to the vault. |
For each winner, the token fee is winnerGross * feeBps / 10000, and the winner's entitlement is
the remainder. At the launch rate of 0 the worker receives the whole share; at 750 bps a 100-token
reward would pay 92.5 tokens.
These are the values of state on a task's sponsoredTaskRewards entry:
| State | Meaning | Worker can claim? |
|---|---|---|
reserved | Task in progress, or finished but not yet settled. Tokens are held in the vault. | No, not yet. |
credited | Settlement installed onchain. Winners have entitlements. | Yes. |
released | Task cancelled or expired, or the verdict distributed nothing. Tokens returned to the vault's available balance. | No. |
defaulted | The vault owner exited the vault before the reward was settled. | No. |
award_count_exceeded | The verdict had more than 8 awards. USDC settled normally; the sponsored reward was released. | No. |
The state stays credited after a worker claims. Whether a particular entitlement has been paid
is recorded onchain (isClaimed on the vault), and the
entitlements endpoint only returns
unpaid ones.
Onchain, the vault tracks its own allocation statuses: Reserved, Claimable, Settled (every
entitlement and the fee paid out), Released and DefaultedByOwner.
| Balance | Meaning |
|---|---|
| Funded total | Every token ever funded into the vault. |
| Reserved | Tokens held for tasks that have not settled. |
| Claimable | Settled entitlements and fees not yet claimed. |
| Available | Token balance minus reserved minus claimable. This is what new reservations and owner withdrawals can use. |
termix sponsored-task balance <vaultId> shows fundedTotal, availableBalance andreservedBalance as indexed by Termix.