DocsDevelopersTask Hooks
A hook manifest is a JSON document that describes a deployed hook: who wrote it, where it is deployed, what callbacks it implements, who controls it and what evidence backs its claims. The hook registry lists hooks by manifest.
https://termix.space/schemas/taskmarket-hook/2.0.0/schema.json (JSON Schema 2020-12). The canonical source is packages/contracts/evm/schemas/taskmarket-hook.schema.json; the hosted copy is kept byte-identical by make hook-manifest-schema-drift.1.0.0 schema stays published at its old URL so existing links resolve, but a 1.0.0 manifest is rejected with an error naming 2.0.0. To migrate one, set manifestVersion to 2.0.0 and add "hookVersion": 1; nothing else changes for a V1 hook.Every top-level field is required, except the V2 fields (capabilities, minDiamondVersion and configSchema, plus hookCallRoles when bit 30 is set), which a V2 manifest must declare and a V1 manifest must leave out.
| Field | What it declares |
|---|---|
manifestVersion | Schema version, 2.0.0. |
hookVersion | The hook interface: 2 for ITMPHookV2 (the before* and after* callbacks, from Diamond revision 28). 1 (ITMPHook, the check* and on* callbacks) is retired: the schema still accepts it so the delisted manifests of V1 hooks stay valid, but the diamond no longer calls or attaches a V1 hook. |
capabilities | V2 only. The uint32 value the hook returns from hookCapabilities(), as a JSON integer. See V2 capabilities. |
minDiamondVersion | V2 only. The value the hook returns from minDiamondVersion(): the lowest diamondVersion() it attaches to, 28 or later. |
hookCallRoles | V2 only, and required exactly when capability bit 30 is set. The value the hook returns from hookCallRoles(): the caller roles it accepts on onCall (1 requester, 2 project, 4 worker, 8 submitter, 16 evaluator, 2147483648 stranger). |
configSchema | V2 only. The ABI parameters of the tuple the hook decodes from its configuration bytes, as a list of { "name", "type", "components" } in the shape of Solidity ABI JSON (for example [{ "name": "gatingTaskId", "type": "bytes32" }]). components is required for a tuple type and not allowed otherwise; tuples nest at most three levels. Use [] for a hook that takes no configuration. |
identity | name, slug, semver version and description. |
author | Publisher name and HTTPS url. |
source | Source repository, the git commit and the contract path. |
license | SPDX license identifier. |
deployments | One entry per chain: chainId, network, hook address, termixDiamond, the deployment transactionHash and blockNumber, runtimeCodehash, proxy metadata (kind, upgradeability, implementation, admin, a description of the upgrade authority) and gas.estimates per callback (typical, maximum and methodology). |
callbacks | Which callbacks the hook implements, and what each does. For a Task Hook V2 these match the capabilities it declares in hookCapabilities(); for a legacy V1 hook, which of the ten ITMPHook callbacks. |
callbacks | The callbacks the hook implements. A V1 manifest names ITMPHook callbacks (checkFund, checkClaim, checkSelectWorker, checkSubmit, checkEvaluate, checkComplete, onComplete, onForfeit, onCancel, onExpire). A V2 manifest names ITMPHookV2 callbacks (beforeCreate to beforeRate, afterComplete, afterCancel, afterExpire, afterForfeit, afterAction), and they must match its capabilities exactly. |
taskModes | The task modes the hook supports. |
hookData | The wire format of the hook's configuration bytes (its per-hook configuration under Task Hook V2, the shared hookData for a legacy V1 hook) (encoding, ABI parameters, an encoded example and a decoded example). Publisher-attested: validation does not prove the encoded bytes match the ABI. |
sourceVerification | Source-verifier records, each keyed by a declared chainId, with HTTPS verifier URLs. |
privilegedRoles | Roles (owner, upgrader, pauser and so on) with every holder bound to a declared deployment chain. |
externalDependencies | Contracts and services the hook calls, with addresses and URLs grouped per declared chain. |
liveness | Requirements for the hook to keep working, its failure mode and the recovery procedure. |
security | Notes and audit status (unaudited, in-progress or audited), scope and report URL. |
listing | The publisher's listing status and evidence URL. A publisher assertion only. |
conformance | Claimed interface and test conformance, with evidence. Not an audit. |
protocolDefault | Whether the hook is a protocol default on a chain, with evidence. Independent of listing, conformance and audit. |
For a complete real example, read any file under hook-registry/manifests/, such as the TaskTokenRewardHook entry for Base Sepolia.
Gas figures should come from a reproducible measurement, such as forge test --gas-report at the manifest's source.commit, and say so in methodology. Keep every maximum below the 1,000,000 gas stipend.
capabilities is a bitmap; each set bit declares one thing the hook does:
| Bits | Meaning |
|---|---|
| 0-15 | One before-callback per vetoable action: 0 beforeCreate, 1 beforeAssignEvaluator, 2 beforeUpdate, 3 beforeClaim, 4 beforeSubmitPitch, 5 beforeSelectWorker, 6 beforeSubmitProof, 7 beforeSubmitBid, 8 beforeAcceptAuction, 9 beforeSubmitWork, 10 beforeRejectSubmission, 11 beforeEvaluate, 12 beforeAppeal, 13 beforeAccept, 14 beforeCancel, 15 beforeRate |
| 21-24 | afterComplete, afterCancel, afterExpire, afterForfeit |
| 25 | afterAction, for every other action |
| 26 | Result power: reduce or reallocate awards among eligible workers |
| 27 | Result power: take a hook fee |
| 30 | onCall: the hook receives calls through the diamond's callTaskHook, from the roles hookCallRoles declares |
| 16-20, 28-29, 31 | Reserved; must be zero |
The validator checks that every callback bit that is set has its callback listed in callbacks, and the reverse. For example, a payout gate that checks its configuration at creation and gates acceptance declares "capabilities": 8193 (bits 0 and 13), "callbacks": ["beforeCreate", "beforeAccept"] and a gas estimate for each.
/hooks/buildThe hook builder at termix.space/hooks/build is for Task Hook V2 hooks. You choose what the hook does, and it writes a manifest and a Solidity starting point that agree with each other:
hookCallRoles).configSchema. The hook reads them in the Create callback.It produces two files you can copy or download:
taskmarket-hook.json: a schema 2.0.0 manifest with hookVersion: 2, the capabilities mask, minDiamondVersion: 28, hookCallRoles when bit 30 is set, configSchema, and a gas estimate for each callback.MyTermixHook.sol: a scaffold on BaseTMPHookV2 that declares the same mask in hookCapabilities() and overrides only the chosen callbacks, each restricted to the diamond. Veto stubs revert until you implement them, so a scaffold fails closed.The scaffold matches the project create-taskmarket-hook generates, and imports @taskmarket/contracts/src/... from the evm/ folder of the Termix contracts repository. The builder lists every field still missing.
termix hooks build does the same from the command line, with the same rules: choose actions with --veto, --observe, --reduce, --fee and --on-call, parameters with --config-params, modes with --mode, or pass everything in an --input <file.json>. It prints one JSON envelope with manifest, solidity, ready and problems, and --out-dir also writes the two files. See the CLI reference.
Until every evidence field is complete, the builder emits the manifest with an x-draft object containing a warning and the list of missing fields. x-draft marks a schema-shaped file that is never publishable: validators treat any manifest with x-draft set to true or an object as a draft, and the registry rejects it. Remove x-draft only when the manifest is complete and you have independently checked every declaration.
From a checkout of this repository:
make contract evm hook-manifest