L402 payment layer implemented; free tier active, paid tier not yet in service. Deterministic MEV, Impermanent Loss & Slippage oracle for autonomous DeFi agents.
Arsenal Decision Engine 🛡️
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
**The Risk-Validation Layer for Autonomous AI Agents (DeFAI)**
> **Method and raw results are published** — backtest script · result data (180 days of Binance ETH/USDC daily closes):
> 🔬 **Breakeven Corridor** is a deterministic algebraic boundary (where IL = accumulated yield). Any position whose price ratio stays within [lower_be, upper_be] has R_net > 0 by mathematical definition — not a probabilistic model.
> 📐 This engine **measures**; it does not forecast. No predictive-accuracy figure is claimed — read the published result files and judge the method for yourself.
---
Mission
**Transform DeFi uncertainty into deterministic, actionable risk metrics for autonomous agents.**
We do not run stateful trading bots or generate speculative prediction signals; we provide a stateless risk middleware layer that agents query before deploying or maintaining standard constant-product / full-range LP positions.
Built for agents. **100 free calls per IP per day — no wallet, no sign-up, custom parameters included.** An L402 payment path is implemented in the gateway but is **not operational in production**: today, the engine is free to use.
---
What This Engine Does
Before an autonomous agent deploys capital or adjusts a standard constant-product / full-range LP position (such as Uniswap V2 or full-range V3), it submits the pool parameters (APY, price ratio, days held) to our API. The engine computes the exact mathematical risk, the net return ($R_{net}$), and the dynamic **Breakeven Corridor** bounds.
- **No LLMs. No hallucinations. Pure algebraic calculation.**
- **Complexity:** $\mathcal{O}(1)$ time and memory.
- **Latency:** $ ",
"layer": "FREE"
}
python
import urllib.request
import urllib.error
import json
import re
import os
API_URL = "https://api.arsenal-quant.com/mcp/evaluate?apy=0.20&price_ratio=0.85&days_held=30"
LNBITS_URL = "https://demo.lnbits.com"
LNbits requires a wallet key with send permission to pay an invoice.
Use a DEDICATED wallet funded with a small working balance, and never the key
of a wallet holding significant funds. Keep it in the environment, never in code.
LNBITS_PAYMENT_KEY = os.getenv("LNBITS_PAYMENT_KEY")
def query_risk_oracle():
req = urllib.request.Request(API_URL, method="GET")
req.add_header("x-agent-id", "autonomous-lp-bot")
try:
with urllib.request.urlopen(req) as resp:
return json.loads(resp.read().decode('utf-8'))
except urllib.error.HTTPError as e:
if e.code == 402:
auth_header = e.headers.get("WWW-Authenticate")
macaroon = re.search(r'token="([^"]+)"', auth_header).group(1)
invoice = re.search(r'invoice="([^"]+)"', auth_header).group(1)
pay_req = urllib.request.Request(
f"{LNBITS_URL}/api/v1/payments",
data=json.dumps({"out": True, "bolt11": invoice}).encode(),
headers={"X-Api-Key": LNBITS_PAYMENT_KEY, "Content-Type": "application/json"}
)
with urllib.request.urlopen(pay_req) as pay_resp:
preimage = json.loads(pay_resp.read().decode())["preimage"]