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 from GET /config/network (default_stablecoin), and the TaskBond contract from --task-bond.
  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).

The server exposes neither the bond token address (beyond the deployment default_stablecoin) nor the TaskBond contract address, and the quote does not yet return task_ref/salt — so token defaults to default_stablecoin (override with --token) and the TaskBond address is a required flag. 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