Metadata-Version: 2.4
Name: sra-riskgate
Version: 0.3.4
Summary: Deterministic pre-filter and risk evaluation gate for stablecoin transactions
Author: Sriram Ramakrishnan
License-Expression: Apache-2.0
Project-URL: Homepage, https://huggingface.co/sriram1983007/SRA-RiskGate-4B
Project-URL: Dataset, https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench
Keywords: stablecoin,payments,compliance,risk,x402,usdc,agentkit
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: pydantic>=2.0
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Provides-Extra: agentkit
Requires-Dist: coinbase-agentkit>=0.1.0; extra == "agentkit"

# sra-riskgate

Deterministic pre-filter for stablecoin transactions. It runs fast rule checks
(peg-deviation bounds in both directions, a single-transfer ceiling, and payload
validation) **before** you send a transaction to the
[SRA-RiskGate-4B](https://huggingface.co/sriram1983007/SRA-RiskGate-4B) model.

This package does not run the model and does not perform sanctions screening.

```bash
pip install sra-riskgate
```

```python
from sra_riskgate import RulePreFilter, TransactionPayload

gate = RulePreFilter(max_amount=50_000, depeg_hold_pct=1.0, depeg_reject_pct=5.0)
verdict = gate.inspect(TransactionPayload(
    chain_id=1, token="USDC",
    sender="0x" + "a" * 40, recipient="0x" + "b" * 40,
    amount=5000.0, peg_deviation_pct=-1.5,
))
print(verdict.decision.value, verdict.flags, verdict.required_actions)
# hold ['MODERATE_DEPEG'] ['manual_review']
```

| Rule | Decision |
|---|---|
| Peg deviation NaN / infinite | reject |
| abs(peg deviation) >= `depeg_reject_pct` | reject |
| abs(peg deviation) >= `depeg_hold_pct` | hold |
| amount > `max_amount` | hold |
| otherwise | approve |

## Changelog

**0.3.1**: Unknown constructor arguments now raise `TypeError` instead of being
silently ignored. Legacy `max_allowed_deviation_pct` maps to the hold threshold
again (as in 0.1.x). Non-finite thresholds are rejected. License and author metadata restored.

**0.3.0**: Depeg checks use `abs()` (catches upward depegs). Thresholds validated.

License: Apache-2.0
