11 Commits

Author SHA1 Message Date
25ed718ad0 feat: p10 service verticals (per-vertical underwriting profiles)
ServiceVerticals makes each x402 family a first-class credit vertical with its
own underwriting profile: advance rate, revenue-volatility haircut, settlement
horizon, minimum track record, and required attestations. profileFor() resolves
a service type to its vertical; qualify() gates eligibility; sizeAdvance()
fronts revenue × advance_rate × (1 − volatility); register() lets governance
tune profiles. Seeded for all p1 category families (coverage-checked).

7 new tests, full suite 233 green. Completes roadmap p3–p10.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:45:42 +03:00
55012ad463 feat: p9 Enterprise RealFi GA (tenants, entitlements, audit trail)
EnterpriseRealFi adds the production access-control layer in front of the
oracle / data commons / attestation surfaces: named tenants on plans
(developer/growth/enterprise) with entitlement gating, a rolling 30-day quota,
a trailing 60s rate limit, suspend/resume, and a sequential, exportable audit
trail recording every allow/deny decision. guard() wraps authorize-then-run.

8 new tests, full suite 226 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:43:56 +03:00
19d6549230 feat: p8 zk receipt proofs (selective disclosure + Merkle anchoring)
ReceiptProofSystem lets an agent prove a receipt is anchored on-chain and
disclose only chosen fields while hiding the rest. Each attribute is a
secret-salted hiding commitment H(key=value|salt); receipt leaves form a
Merkle tree whose root is the on-chain anchor; a DisclosureProof opens the
revealed fields, ships opaque commitments for the rest, and a Merkle path.
verify() needs no prover secret — anyone can check inclusion from the root.

Honest scope: commitment-based selective-disclosure + membership (the
dependency-free, Casper-verifiable Stage-4 primitive), not a full zk-SNARK.

6 new tests, full suite 218 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:42:03 +03:00
295f975d5a feat: p7 ML risk-engine v2 (learned probability-of-default model)
RiskEngineV2 adds a logistic-regression PD model over a normalized agent
feature vector (reputation, accuracy, dispute rate, experience, revenue,
stake, category risk). train() fits weights by deterministic, L2-regularized
batch gradient descent on realized default/repay outcomes; score() returns
pd + ml_score + rules_score + a convex blended_score, so v2 augments the v1
rules policy rather than replacing it. A domain-calibrated prior makes it
useful before any training data.

5 new tests, full suite 212 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:39:55 +03:00
8696d265ad feat: p6 decentralization & data moat (dispute jury + credit-data commons)
DisputeJury: a deterministic, dispute-id-rooted panel of staked/reputable
agents votes the verdict; the plurality decision is issued on the DisputeCourt
with the median proposed slash, consensus jurors earn reputation and
dissenters/no-shows lose it. Decentralizes verdict authority off the single
judge agent.

CreditDataCommons: anonymized, k-anonymous public snapshot of protocol credit
performance (per-category + per-tier aggregates, dispute slash rate, no agent
ids, thin categories folded into 'other') — the data moat as a citable public
benchmark.

DAO parameter governance already shipped via GovernanceProposals.

9 new tests, full suite 207 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:37:39 +03:00
a59d2bfe5d feat: p5 omnichain credit reconciliation (satellites ↔ Casper exposure)
CrossChainReconciler ties satellite-reported draws/repayments back to the
Casper-rooted GlobalExposureManager (single source of truth for global
exposure across all chains). reconcile() flags the over-borrow failure mode,
Casper-vs-satellite divergence, and unauthorized draws (no issuing CAN);
globalHeadroom() is the per-agent over-borrow guard satellites must respect.

7 new tests, full suite 198 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:33:33 +03:00
81a0e533ed feat(p4): mainnet-beta market risk — exposure caps + insurance loss absorption
lib/services/market_risk.ts: MarketRiskManager gates every draw (per-agent +
per-category + pool-utilization caps, approved-category allowlist for the beta)
and absorbs default losses from the insurance reserve with honest shortfall
reporting + coverage ratio. test/market_risk.test.ts (5). Suite green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:29:19 +03:00
deed9725d7 feat(p3): Credit Oracle — Cred402 Inside (credit-as-a-service)
lib/services/credit_oracle.ts: read-only creditCheck (policy-stamped), what-if
simulate, and batch checks so any third-party x402 platform queries Cred402 for
agent creditworthiness and gets the same Casper-rooted answer — works for non-RWA
services. test/credit_oracle.test.ts (5). 186 tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:26:49 +03:00
afed64e4bd feat(p2): x402 Gateway middleware — any API becomes x402-payable + receipt-generating
Roadmap p2 shipped. The adoption wedge: drop one middleware in front of any route
and it issues 402 challenges, verifies EIP-712/ed25519 payments (replay-protected),
emits a receipt commitment to a sink, and proceeds — feeding the Cred402 credit moat.

- lib/x402/gateway.ts: framework-agnostic X402Gateway + Express and Web (Fetch)
  adapters, pluggable nonce store (replay guard), per-route analytics, receipt sink.
- Works for ANY p1 service category (inference/data/compute/…), not just RWA.
- Fix: eip712 uint256 now padded to 32 bytes (odd-length amounts no longer break signing).
- test/x402_gateway.test.ts (5 cases, real buyer→gateway round-trips), examples/paid-api-x402.ts,
  npm run demo:gateway, docs/roadmap (p2 ✅). 181 tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:20:46 +03:00
0813724602 feat(p1): universal x402 receipts — credit for any service, not just RWA
Roadmap p1 shipped. Cred402 now underwrites ANY x402 service category, not just
RWA:
- lib/core/service_categories.ts: canonical category taxonomy + per-family
  credit-risk weights (rwa/data/compute/inference/storage/api/defi/compliance…),
  with legacy-type aliasing.
- ServiceCategoryRegistry (lib/ledger/contracts) — on-chain-style, governance-tunable
  weights, seeded defaults, wired into the Ledger.
- ServiceType generalized to an open category string (was a 6-value RWA union).
- Risk policy v1/v2 scale the credit line by the category risk weight; rationale
  records it. RWA evidence is now an optional boost, not a gate.
- test/universal_credit.test.ts (5 cases) + npm run demo:x402: a non-RWA
  inference.llm agent builds a credit line from x402 receipts alone.
- docs/risk_model.md + docs/roadmap (p1 ✅).

176 tests green; main demo unchanged (legacy RWA types keep the rwa weight).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:09:02 +03:00
c93c35f07c docs(roadmap): reframe as the credit protocol for the x402 economy + phase plan
Cred402 is the credit & reputation layer for ALL x402 services — RWA verification
is the first wedge, not the whole product. Add docs/roadmap/ with the forward
phase plan (p1–p6): universal x402 receipts, the x402 Gateway wedge,
credit-as-a-service, mainnet-beta credit market, omnichain credit, and
decentralization + the data moat. Broaden README positioning + link the roadmap.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 03:00:14 +03:00