sriram1983007 commited on
Commit
83f00e5
·
verified ·
1 Parent(s): 13a705a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +33 -15
README.md CHANGED
@@ -34,7 +34,7 @@ tags:
34
 
35
  [![PyPI Version](https://img.shields.io/pypi/v/sra-riskgate?style=for-the-badge&logo=pypi&color=blue)](https://pypi.org/project/sra-riskgate/)
36
  [![PyPI Downloads](https://img.shields.io/pypi/dm/sra-riskgate?style=for-the-badge&logo=orange)](https://pypi.org/project/sra-riskgate/)
37
- [![Interactive Demo](https://img.shields.io/badge/Demo-Interactive%20Space-blue?style=for-the-badge&logo=huggingface)](https://sriram1983007-sra-riskgate-demo.static.hf.space/index.html)
38
  [![Dataset](https://img.shields.io/badge/Dataset-Risk%20Bench-green?style=for-the-badge&logo=huggingface)](https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench)
39
  [![GGUF Quantized](https://img.shields.io/badge/GGUF-Q4__K__M-yellow?style=for-the-badge&logo=huggingface)](https://huggingface.co/sriram1983007/SRA-RiskGate-4B-Q4_K_M-GGUF)
40
  [![LoRA Adapter](https://img.shields.io/badge/Adapter-LoRA-red?style=for-the-badge&logo=huggingface)](https://huggingface.co/sriram1983007/SRA-RiskGate-4B-LoRA)
@@ -64,17 +64,36 @@ pip install "sra-riskgate[agentkit]>=0.3.5"
64
  Register `RiskGateActionProvider` as the payment provider on your AgentKit instance. It checks chain support, policies, and peg deviations, executing safe ERC-20 transfers only after approval:
65
 
66
  ```python
67
- from coinbase_agentkit import AgentKit, AgentKitConfig, CdpEvmWalletProvider, CdpEvmWalletProviderConfig
68
- from sra_riskgate.integrations.agentkit import RiskGateActionProvider
69
-
70
- wallet_provider = CdpEvmWalletProvider(CdpEvmWalletProviderConfig(
71
- api_key_id="...", api_key_secret="...", wallet_secret="...", network_id="base-mainnet",
72
- ))
73
- firewall = RiskGateActionProvider(
74
- max_amount=1000.0, depeg_hold_pct=1.0, depeg_reject_pct=5.0,
75
- peg_feed=my_usdc_peg_feed, # callable(chain_id) -> deviation %. Without it, depeg checks are off.
76
- )
77
- agent_kit = AgentKit(AgentKitConfig(wallet_provider=wallet_provider, action_providers=[firewall]))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  ```
79
 
80
  > **Security Guardrail:** To ensure the firewall cannot be bypassed by an autonomous agent, register `RiskGateActionProvider` as the **sole** payment action provider. Do not register generic native transfer or unconstrained ERC-20 providers alongside it.
@@ -86,8 +105,7 @@ Register `RiskGateActionProvider` as the payment provider on your AgentKit insta
86
  | **Invalid / Zero Address** | Hard Reject | Aborts `0x0...0` burner or malformed hex executions |
87
  | **Self-Transfer** | Hard Reject | Blocks recursive or hallucinated self-loops that waste gas |
88
  | **Exceeds Amount Ceiling** | Paused (`HOLD`) | Intercepts rogue agent spending beyond allocated policy |
89
- | **Severe Depeg ($\ge 5\%$)** | Critical Abort (`REJECT`) | Prevents clearing payments in collapsing or depegged assets |
90
-
91
  ---
92
 
93
  ## 🚀 Transformers Quickstart
@@ -157,7 +175,7 @@ user_payload = {
157
  "payee": "0x5e8E36575Ebf9841e54b8641E4Eb1EA38136A3d7",
158
  "amount_usdc": "0.674731",
159
  "valid_after": 1793063857,
160
- "validBefore": 1793066322
161
  },
162
  "payment_signature": {"checked": True, "valid": True},
163
  "attestations": {
 
34
 
35
  [![PyPI Version](https://img.shields.io/pypi/v/sra-riskgate?style=for-the-badge&logo=pypi&color=blue)](https://pypi.org/project/sra-riskgate/)
36
  [![PyPI Downloads](https://img.shields.io/pypi/dm/sra-riskgate?style=for-the-badge&logo=orange)](https://pypi.org/project/sra-riskgate/)
37
+ [![Interactive Demo](https://img.shields.io/badge/Demo-Interactive%20Space-blue?style=for-the-badge&logo=huggingface)](https://huggingface.co/spaces/sriram1983007/sra-riskgate-demo)
38
  [![Dataset](https://img.shields.io/badge/Dataset-Risk%20Bench-green?style=for-the-badge&logo=huggingface)](https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench)
39
  [![GGUF Quantized](https://img.shields.io/badge/GGUF-Q4__K__M-yellow?style=for-the-badge&logo=huggingface)](https://huggingface.co/sriram1983007/SRA-RiskGate-4B-Q4_K_M-GGUF)
40
  [![LoRA Adapter](https://img.shields.io/badge/Adapter-LoRA-red?style=for-the-badge&logo=huggingface)](https://huggingface.co/sriram1983007/SRA-RiskGate-4B-LoRA)
 
64
  Register `RiskGateActionProvider` as the payment provider on your AgentKit instance. It checks chain support, policies, and peg deviations, executing safe ERC-20 transfers only after approval:
65
 
66
  ```python
67
+ from coinbase_agentkit import AgentKit, AgentKitConfig, CdpEvmWalletProvider, CdpEvmWalletProviderConfig
68
+ from sra_riskgate.integrations.agentkit import RiskGateActionProvider
69
+
70
+ # 1. CDP EVM wallet (credentials from the Coinbase Developer Platform)
71
+ wallet_provider = CdpEvmWalletProvider(CdpEvmWalletProviderConfig(
72
+ api_key_id="YOUR_CDP_API_KEY_ID",
73
+ api_key_secret="YOUR_CDP_API_KEY_SECRET",
74
+ wallet_secret="YOUR_CDP_WALLET_SECRET",
75
+ network_id="base-mainnet",
76
+ ))
77
+
78
+ # 2. USDC peg feed: return how far USDC is from $1.00, in percent (e.g. -1.2).
79
+ # Replace get_usdc_usd_price() with your own price oracle.
80
+ def my_usdc_peg_feed(chain_id: int) -> float:
81
+ price = get_usdc_usd_price(chain_id)
82
+ return (price - 1.0) * 100
83
+
84
+ # 3. Risk-gated payment provider
85
+ firewall = RiskGateActionProvider(
86
+ max_amount=1000.0, # hold transfers above this (USDC)
87
+ depeg_hold_pct=1.0, # hold if USDC is off-peg by >= 1%
88
+ depeg_reject_pct=5.0, # block if off-peg by >= 5%
89
+ peg_feed=my_usdc_peg_feed, # without a peg_feed, depeg checks are disabled
90
+ )
91
+
92
+ agent_kit = AgentKit(AgentKitConfig(
93
+ wallet_provider=wallet_provider,
94
+ action_providers=[firewall],
95
+ ))
96
+
97
  ```
98
 
99
  > **Security Guardrail:** To ensure the firewall cannot be bypassed by an autonomous agent, register `RiskGateActionProvider` as the **sole** payment action provider. Do not register generic native transfer or unconstrained ERC-20 providers alongside it.
 
105
  | **Invalid / Zero Address** | Hard Reject | Aborts `0x0...0` burner or malformed hex executions |
106
  | **Self-Transfer** | Hard Reject | Blocks recursive or hallucinated self-loops that waste gas |
107
  | **Exceeds Amount Ceiling** | Paused (`HOLD`) | Intercepts rogue agent spending beyond allocated policy |
108
+ | **Severe Depeg ($\ge 5\%$)** | Critical Abort (`REJECT`) | Prevents clearing payments in collapsing or depegged assets. Requires `peg_feed`; if the feed fails, the transfer is held. |
 
109
  ---
110
 
111
  ## 🚀 Transformers Quickstart
 
175
  "payee": "0x5e8E36575Ebf9841e54b8641E4Eb1EA38136A3d7",
176
  "amount_usdc": "0.674731",
177
  "valid_after": 1793063857,
178
+ "valid_before": 1793066322
179
  },
180
  "payment_signature": {"checked": True, "valid": True},
181
  "attestations": {