Voltar para Documentação

Docs Técnicas

Operation Kind Catalog

Every posting emitted by a TREA contract carries an operation kind that identifies the economic nature of the entry. Wallets, dashboards, and audit tools use this to classify movements without re-parsing contract source.

O conteúdo abaixo vem das fontes técnicas do repositório e é prerenderizado no site para leitura direta por pessoas, crawlers e agentes.

Every posting emitted by a TREA contract carries an operation kind that identifies the economic nature of the entry. Wallets, dashboards, and audit tools use this to classify movements without re-parsing contract source.

Endpoint

GET /api/contracts/operation-kinds

No authentication required. Returns a static JSON document.

Response

json
{
  "total": 24,
  "kinds": [
    {
      "kind": "generic",
      "description": "General-purpose value transfer with no specific economic classification.",
      "debit_bucket": "available",
      "credit_bucket": "available",
      "intrinsic": "send"
    },
    {
      "kind": "loan_origination",
      "description": "Loan disbursement: lender available decreases, borrower available increases, receivable and payable obligations opened.",
      "debit_bucket": "available (lender)",
      "credit_bucket": "A1_2_1 / L2_2_1",
      "intrinsic": "loan.origination_lines"
    }
  ]
}

Fields

| Field | Type | Description | | ----- | ---- | ----------- | | kind | string | Unquoted symbolic identifier passed as the second argument to lines_generator in TREA source. | | description | string | Human-readable economic meaning. Use this in wallet UIs and audit reports. | | debit_bucket | string | Typical bucket on the debit side (informational; actual bucket depends on the contract). | | credit_bucket | string | Typical bucket on the credit side (informational). | | intrinsic | string \| null | TREA built-in function that emits this kind automatically, if any. null for kinds produced only via explicit lines_generator. |

Using the Kind in TREA Source

Pass the kind as an unquoted identifier — never as a quoted string:

python
# Correct — unquoted identifier
post(lines_generator(ctx.asset, loan_origination,
    line_generator(self.lender, available, dec, amount),
    line_generator(self.borrower, available, inc, amount)))

# Wrong — quoted string is rejected by the verifier
post(lines_generator(ctx.asset, "loan_origination", ...))

All arguments to lines_generator and line_generator must appear on a single line.

Full Catalog

See Accounting Effects for the complete table of all 24 kinds with typical bucket routes.

Standard Library Templates

The TREA standard library ships three credit contract templates that use canonical operation kinds:

| Module | Path | Kinds used | | ------ | ---- | ---------- | | LoanContract | std.credit.LoanContract | loan_origination, loan_accrual, loan_repayment | | TradeSettlement | std.credit.TradeSettlement | generic (via send) | | ReceivableContract | std.credit.ReceivableContract | generic (via explicit lines_generator) |

Import them with compile_contract_with_stdlib or reference them in contract Foo impl LoanContract:.