Skip to main content

Module bond

Module bond 

Source
Expand description

taskfast bond post <task_id> — auction-task operator posts the on-chain performance bond in one step (gh#95).

taskfast stake is HA-direct-only (auction tasks reject with not_high_assurance); the working bond flow for an auction task had to be hand-run with raw cast. This command drives it end to end:

  1. GET /tasks/:id/stake/quote → required_amount (bond base units).
  2. Resolve the bond ERC-20 token, chain, and TaskBond contract from GET /config/network (default_stablecoin, task_bond_contract).
  3. Derive taskRef (16 zero bytes ++ task UUID) + a random salt.
  4. ERC-20 allowance preflight; approve the TaskBond contract if short.
  5. TaskBond.post(token, amount, taskRef, salt) — broadcast + wait receipt.
  6. POST /tasks/:id/stake/report {tx_hash} — a claim, not proof.
  7. Poll the quote until bond_status=posted (server verifies BondPosted asynchronously).

Token and TaskBond contract both come from the deployment’s network config (--token/--task-bond override for custom-endpoint development). The quote does not yet return task_ref/salt, so taskRef is derived locally per the verifier’s layout. The verifier matches contract/token/taskRef/amount and does not pin salt, so a random salt is accepted.

Error mapping delegates to map_api_error (401|403→Auth, 409|422→ Validation). Keystore / signing failures surface as Wallet (exit 5).

Structs§

PostArgs

Enums§

BondStakeSource
clap-friendly mirror of the generated stake-source enums (kept local, like stake::StakeSource, so codegen needn’t grow clap derives). kebab-case renders operator-self / external-backer.
Command

Functions§

run