{"id":50750498,"url":"https://github.com/dvilelaf/riskguard-adapter","last_synced_at":"2026-06-11T01:01:37.172Z","repository":{"id":362103301,"uuid":"1257291339","full_name":"dvilelaf/riskguard-adapter","owner":"dvilelaf","description":"DeFi policy verdict receipts for BNB Chain agents and ERC-8183-style jobs.","archived":false,"fork":false,"pushed_at":"2026-06-02T15:40:58.000Z","size":378,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-02T16:25:21.772Z","etag":null,"topics":["ai-agents","bnb-chain","bnb-hack","defai","erc8183","hackathon"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dvilelaf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-02T14:39:08.000Z","updated_at":"2026-06-02T15:45:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dvilelaf/riskguard-adapter","commit_stats":null,"previous_names":["dvilelaf/riskguard-adapter"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dvilelaf/riskguard-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvilelaf%2Friskguard-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvilelaf%2Friskguard-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvilelaf%2Friskguard-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvilelaf%2Friskguard-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvilelaf","download_url":"https://codeload.github.com/dvilelaf/riskguard-adapter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvilelaf%2Friskguard-adapter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34177444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agents","bnb-chain","bnb-hack","defai","erc8183","hackathon"],"created_at":"2026-06-11T01:01:20.327Z","updated_at":"2026-06-11T01:01:37.144Z","avatar_url":"https://github.com/dvilelaf.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RiskGuard Adapter\n\n[![CI](https://github.com/dvilelaf/riskguard-adapter/actions/workflows/ci.yml/badge.svg)](https://github.com/dvilelaf/riskguard-adapter/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)\n\nDeFi policy verdict receipts for BNB Chain agents and ERC-8183-style jobs.\n\nRiskGuard Adapter checks proposed autonomous DeFi actions against declared risk\npolicies before execution and emits deterministic allow/block Policy Verdict\nReceipts. The prototype includes a local agent demo, manifest-compatible\nERC-8183 evidence metadata, EVM-signed demo receipts, a verified BSC testnet\nreceipt registry, and two anchored testnet receipt transactions.\n\nThe prototype anchors two demo receipts on BSC testnet: one `allow` verdict and\none `block` verdict.\n\nPublic release: https://github.com/dvilelaf/riskguard-adapter/releases/tag/v0.1.0\n\nSubmission page: https://dvilelaf.github.io/riskguard-adapter/\n\nReceipt hash checker: https://dvilelaf.github.io/riskguard-adapter/verifier.html\n\nLicense: MIT\n\nDemo video:\nhttps://github.com/dvilelaf/riskguard-adapter/releases/download/v0.1.0/riskguard-demo.mp4\n\n## 30-second pitch\n\nBNBAgent and ERC-8004/8183 give agents identity, job rails, escrow and evidence\nflows. RiskGuard answers a narrower DeFi-specific question before execution or\nsettlement:\n\n\u003e Did this proposed autonomous financial action comply with the declared risk\n\u003e policy?\n\nRiskGuard does not replace wallets, agents, registries or escrow. It adds a\nsmall policy-verdict adapter that can be composed with agent jobs, wallet\nworkflows or BSC testnet anchoring contracts today.\n\n```text\nAgent intent / job\n  -\u003e RiskGuard policy check\n  -\u003e Policy Verdict Receipt\n  -\u003e ERC-8183 manifest metadata\n  -\u003e BSC testnet receipt registry demo anchoring today\n```\n\n## BSC testnet demo anchoring\n\nNetwork: BSC testnet, chain id `97`.\n\n- Contract: `0x10932358609f911B5cA1a131298C91a327ACAdC1`\n- Deploy tx:\n  `0xbd47d87313653322da71522637fbe8aa296477ed603cb0d7eed8f69464c8c5cd`\n- Allow receipt tx:\n  `0x4d14e3b02ff6bbb66a43340237bbf0aad1ad3413865925554bf7f16bddf5cfd5`\n- Block receipt tx:\n  `0xb36948eb76e13f02210c163441eeb456133dbb96dfeb7289789a27c5be772cbd`\n- On-chain receipt count: `2`\n- BscScan source verification: verified.\n  Source: `contracts/PolicyReceiptRegistry.sol`.\n\nThis registry is intentionally minimal: it records receipt hashes on BSC\ntestnet for hackathon demo evidence. It does not authenticate callers, validate\nreceipt preimages, or prove that a receipt came from a production RiskGuard\ndeployment.\n\nExplorer links:\n\n- Contract:\n  https://testnet.bscscan.com/address/0x10932358609f911B5cA1a131298C91a327ACAdC1\n- Deploy tx:\n  https://testnet.bscscan.com/tx/0xbd47d87313653322da71522637fbe8aa296477ed603cb0d7eed8f69464c8c5cd\n- Allow tx:\n  https://testnet.bscscan.com/tx/0x4d14e3b02ff6bbb66a43340237bbf0aad1ad3413865925554bf7f16bddf5cfd5\n- Block tx:\n  https://testnet.bscscan.com/tx/0xb36948eb76e13f02210c163441eeb456133dbb96dfeb7289789a27c5be772cbd\n\nFull run details: `docs/testnet-results.md`.\n\n## What works today\n\n- Policy JSON and action-plan JSON inputs.\n- Deterministic allow/block evaluation.\n- Deterministic receipt fields:\n  - `agent_id`;\n  - `policy_id`;\n  - `decision`;\n  - `reason`.\n- Stable receipt hashes:\n  - `proposal_hash`;\n  - `policy_hash`;\n  - `simulation_hash`;\n  - `evidence_hash`.\n- Persisted evidence and simulation preimages for the demo receipts.\n- EVM-signed demo receipts and local signature verification.\n- Local `StrategyAgent` and `RiskGuardAgent` demo.\n- Manifest-only BNBAgent/ERC-8183 `DeliverableManifest.metadata` payload.\n- Foundry/cast environment output for receipt transactions.\n- Solidity `PolicyReceiptRegistry` contract.\n- Local Anvil end-to-end deployment and two receipt transactions.\n- Real BSC testnet deployment and two receipt transactions.\n- Python tests, Ruff checks, Python package build and Solidity tests.\n\n## What is intentionally not claimed\n\nRiskGuard is an early prototype. It does not claim to:\n\n- prevent hacks;\n- guarantee transaction safety;\n- be audited;\n- be production-ready for mainnet funds;\n- execute trades;\n- custody funds;\n- replace BNBAgent, ERC-8004, ERC-8183, Safe or wallets;\n- implement a new escrow, registry, reputation system or trust standard.\n\n## Try it in 5 minutes\n\nThis repo uses `uv` for Python package management and `just` for repeatable\ncommands.\n\n```bash\njust install\njust demo\njust sign-demo\njust verify-demo\njust foundry-env\nuv run riskguard manifest --receipt examples/evidence/safe-receipt.json --job-id 42 --chain-id 97 --registry-address 0x10932358609f911B5cA1a131298C91a327ACAdC1\njust test\njust check\n```\n\nRun a single safe plan:\n\n```bash\nuv run riskguard validate \\\n  --policy examples/policies/default-policy.json \\\n  --plan examples/plans/safe-action.json\n```\n\nRun a single unsafe plan:\n\n```bash\nuv run riskguard validate \\\n  --policy examples/policies/default-policy.json \\\n  --plan examples/plans/unsafe-action.json\n```\n\nGenerate a clean evidence bundle:\n\n```bash\nuv run riskguard demo --evidence-dir /tmp/riskguard-evidence\nls /tmp/riskguard-evidence\n```\n\nExpected files:\n\n```text\nsafe-receipt.json\nsafe-evidence.json\nsafe-simulation.json\nunsafe-receipt.json\nunsafe-evidence.json\nunsafe-simulation.json\n```\n\nRun the broad local verification suite:\n\n```bash\njust full-ci\n```\n\n`just full-ci` runs Ruff, Python tests, package build, Solidity tests and a\nlocal Anvil deployment with two receipt transactions.\n\nBuild a manifest-only ERC-8183-compatible evidence payload:\n\n```bash\nuv run riskguard manifest \\\n  --receipt examples/evidence/safe-receipt.json \\\n  --job-id 42 \\\n  --chain-id 97 \\\n  --registry-address 0x10932358609f911B5cA1a131298C91a327ACAdC1\n```\n\nThis does not submit or settle a real ERC-8183 job. It shows how a RiskGuard\nreceipt hash can be carried in `DeliverableManifest.metadata`.\n\nVerify a signed receipt bundle:\n\n```bash\njust sign-demo\njust verify-demo\n```\n\n`just sign-demo` expects `RISKGUARD_SIGNER_PRIVATE_KEY` in the environment.\nThe committed signed receipts are deterministic demo fixtures. `just\nverify-demo` recomputes the evidence and simulation hashes, recovers the EVM\nsignature, and checks it against the published demo signer address. This is not\nthe funded BSC deployer key and is not a production identity claim.\n\n## Receipt format\n\nExample shape:\n\n```json\n{\n  \"agent_id\": \"strategy-agent-demo\",\n  \"decision\": \"allow\",\n  \"evidence_hash\": \"sha256:85bb8312f359bd2ff666bbfc367ae51e1ed0508b758efaca79553ecf86c05d68\",\n  \"policy_hash\": \"sha256:1e15d7d1874bc88d87c5a6c8896e9947e63a01e267798a83ce69f9c15faa3695\",\n  \"policy_id\": \"default-bnb-testnet-demo\",\n  \"proposal_hash\": \"sha256:347dd403e5ddc6abe42e1439493eb20bcec08ee61591fbcee8b71f7a2377ae5a\",\n  \"reason\": \"plan satisfies policy\",\n  \"simulation_hash\": \"sha256:0c35068a9211e991fd9c18f4e6391df0883467095b0ee70353700ac219fcd47a\"\n}\n```\n\nThe receipt is deterministic: the same policy and proposed action produce the\nsame hashes. In this prototype, `simulation_hash` commits to a non-executing\ndemo simulation record; no external DeFi simulator or transaction execution is\nclaimed.\n\n## Repository layout\n\n```text\nriskguard-adapter/\n  contracts/                 Minimal Solidity receipt registry\n  src/riskguard_adapter/      Python package and CLI\n  examples/                   Sample policies and action plans\n  docs/                       Submission, validation and runbook notes\n  scripts/                    Local and BSC testnet scripts\n  tests/                      Python tests\n```\n\n## Useful commands\n\n- `just install`: create/update the `.venv` with dev dependencies.\n- `just demo`: run safe and unsafe local demo flows.\n- `just sign-demo`: sign the demo receipts with `RISKGUARD_SIGNER_PRIVATE_KEY`.\n- `just verify-demo`: verify signed receipts against evidence and simulation\n  preimages.\n- `just foundry-env`: print contract-ready receipt hash exports.\n- `just test`: run the Python test suite.\n- `just check`: run Ruff lint checks.\n- `just build`: build the Python package.\n- `just forge-test`: run receipt registry Solidity tests.\n- `just local-e2e`: run local Anvil deploy plus two receipt transactions.\n- `just full-ci`: run all local Python, Solidity and EVM checks.\n- `just testnet-chain`: verify the configured BSC testnet RPC.\n- `just submit-testnet`: deploy and record both receipts on BSC testnet after\n  faucet funding.\n- `just receipt-count`: verify on-chain receipt count for a deployed registry.\n\nFor the submitted BSC testnet registry:\n\n```bash\nPOLICY_RECEIPT_REGISTRY_ADDRESS=0x10932358609f911B5cA1a131298C91a327ACAdC1 just receipt-count\n```\n\n## Public Artifacts\n\n- Submission page: https://dvilelaf.github.io/riskguard-adapter/\n- Receipt hash checker: https://dvilelaf.github.io/riskguard-adapter/verifier.html\n- Deck: https://github.com/dvilelaf/riskguard-adapter/releases/download/v0.1.0/deck.pdf\n- Demo video: https://github.com/dvilelaf/riskguard-adapter/releases/download/v0.1.0/riskguard-demo.mp4\n- BSC testnet results: `docs/testnet-results.md`\n\n## Roadmap\n\n- Static receipt hash checker.\n- Real ERC-8183 job submission.\n- opBNB deployment.\n- Policy templates for agentic treasury and DeFAI workflows.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvilelaf%2Friskguard-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvilelaf%2Friskguard-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvilelaf%2Friskguard-adapter/lists"}