Two hackathon integrations spanning the whole credit stack, sim-first (green with no keys) with real integrations behind env flags. KeeperHub — the on-chain execution & reliability layer (lib/keeperhub/): - OnchainExecutor: pay-per-execution (x402/MPP) -> simulate -> smart gas with exponential backoff -> MEV-protected private routing -> audit trail; real MCP client to app.keeperhub.com; deterministic sim fallback. - Autonomous Credit Keeper: FTSO position health -> check->execute deleverage. - Credit Automations: declarative price/health/schedule rules as workflows. - Autonomous Scheduler: KeeperHub-cron loop running keeper + automations. Flare — interoperable + confidential primitives (packages/.../flare, lib/flare): - FXRP credit satellite: CAN-gated, FTSO-priced, FDC-attested; Coston2 Solidity vault (contracts/flare/). - Confidential Compute credit scoring (TEE-attested, private inputs). - FTSO-priced multi-asset collateral; FAssets mint->collateralize lifecycle. x402 Credit-Service Marketplace: sells cred402's intelligence pay-per-call over x402 (402->pay->200); paid receipts feed the revenue->reputation loop. Wiring: 78 MCP tools, /v1 + /api routes, console Flare + x402 tabs, 11 demo CLIs, 8 feature docs + docs/SUBMISSIONS.md, recorded demo video (media/). 346 tests pass; 7 adversarial verification workflows caught + fixed ~37 correctness/security issues. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cred402 smart contracts (Odra / Casper)
Five small, focused contracts written with Odra, the Rust smart contract framework for Casper.
| Crate | Responsibility |
|---|---|
agent_registry |
Agent identity, stake, reputation, credit score; slashing. |
x402_receipt_registry |
Commitments for x402 payment receipts (the cash-flow proofs). |
rwa_evidence_registry |
Hashed RWA evidence, linked to the paying receipt. |
agent_credit_pool |
The DeFi pool: deposit / open line / draw / repay / liquidate. |
risk_policy_manager |
Upgradable underwriting policy (v1 → v2). |
dispute_court |
Challenges, dispute lifecycle, on-chain verdicts (p2 §6.9). |
slashing_vault |
Slashed-stake custody + distribution (p2 §6.10). |
governance |
Protocol parameters, fees, emergency pause (p2 §6.11). |
The TypeScript ledger additionally mirrors
RWAAssetRegistry,ReputationEngineandAgentPassport(p2 §6.2–6.6); those follow the same Odra patterns and can be promoted to crates identically.
Each contract mirrors a TypeScript module under ../lib/ledger/contracts/ with the
same state, methods and events — so the off-chain agent runtime and dashboard work
against either the live contracts or the in-memory simulation unchanged.
Build
# install the Odra toolchain once
cargo install cargo-odra
# from this directory
cargo odra build # produces wasm under target/.../release/*.wasm
cargo odra test # runs Odra's in-memory + casper VM tests
Building requires the
wasm32-unknown-unknowntarget and the Odra dependency graph from crates.io. If you only want to run the full agent economy, you do not need to build these —npm run demouses the faithful simulation in../lib/ledger.
Deploy to Testnet
See ../scripts/deploy_testnet.ts for the deploy plan. With a funded key:
export CRED402_NODE=https://rpc.testnet.casperlabs.io
export CRED402_SECRET_KEY=/path/to/secret_key.pem
npm run deploy:testnet # prints casper-client commands + writes deploys.testnet.json
Then wire the deployed contract hashes into the API by replacing the simulation
calls in ../lib/ledger with casper-js-sdk contract calls (the method surface is
identical).
Design notes
- All value is
U512motes (1 CSPR = 1e9 motes). - Privileged methods (
slash,update_reputation,open_credit_line,freeze,liquidate,upgrade) are admin-gated to the deploying protocol account. risk_policy_managerkeeps the policy version in storage;upgrade(version)hot-swaps the active formula — the upgradable-contract story Casper highlights for autonomous systems.- Events mirror the streaming-events the WatchdogAgent and dashboard consume.