"If markets contradict themselves, eat the contradiction."
Permission-safe arbitrage agent for Polymarket using ERC-7715 Advanced Permissions + Envio HyperIndex.
| Traditional Bots | PolyShark + ERC-7715 |
|---|---|
| โ Popup every trade | โ One popup, then autonomous |
| โ Trust-based limits | โ Cryptographic enforcement |
| โ Unlimited risk | โ $10/day max, instant revoke |
| โ No data freshness | โ Halts on stale data |
๐ก This is the last popup you'll see for the next thousand trades.
USER โ Grant Permission (once)
โ
MetaMask Smart Account (ERC-7715) โ Enforced Daily Limit
โ
PolyShark Agent (Rust)
โโโ Constraint Engine โ YES + NO = 1 violations
โโโ Arbitrage Detector โ Expected profit calculation
โโโ Execution Engine โ Permission-validated trades
โ โ
Polymarket Contracts โโโ Envio HyperIndex (~150ms)
5 Steps: Detect mispricing โ Validate allowance โ Execute trade โ Adapt strategy โ Halt if stale
| Layer | Protection |
|---|---|
| ERC-7715 | Cryptographic daily limits, instant revocation |
| Envio | ~150ms latency, auto-halt if >5s stale |
| Strategy | AggressiveโNormalโConservative based on budget |
| Failures | 3 strikes โ Safe mode (5 min cooldown) |
# config.toml
[safety]
max_data_delay_ms = 5000
max_consecutive_failures = 3src/
โโโ metamask.rs โ ERC-7715 client, strategy modes
โโโ wallet.rs โ Permission-aware execution
โโโ market.rs โ Envio data consumer
โโโ constraint.rs โ Logical arbitrage (YES+NO=1)
โโโ arb.rs โ Profit calculation
โโโ execution.rs โ Trade engine (fees, slippage, fills)
โโโ engine.rs โ Main loop + safety halt
{
"erc7715:permission": {
"type": "spend",
"token": { "symbol": "USDC", "address": "0x2791Bca1f2..." },
"limit": { "amount": 10.0, "period": "day" },
"duration": { "days": 30 },
"scope": { "protocol": "polymarket" }
}
}| Property | Value |
|---|---|
| Token | USDC (Polygon) |
| Limit | 10 USDC/day (configurable 5-50) |
| Duration | 30 days |
| Revocation | Instant, one-click |
| Component | Tech |
|---|---|
| Agent | Rust (async, high-perf) |
| Wallet | MetaMask Smart Account |
| Permissions | ERC-7715 |
| Data | Envio HyperIndex |
| Chain | Polygon (137) |
| UI | HTML/CSS/JS Dashboard |
git clone https://github.com/dinxsh/polyshark
cp .env.example .env
cargo build --release && cargo runOpen dashboard/index.html โ Connect MetaMask โ Grant permission โ Watch autonomous trading.
| Mode | Budget | Min Edge |
|---|---|---|
| ๐ข Aggressive | >70% left | โฅ1% |
| ๐ก Normal | 30-70% | โฅ2% |
| ๐ด Conservative | <30% | โฅ5% |
PolyShark = reference implementation for ERC-7715 agents.
Swap layers:
market.rsโ Your data source (Uniswap, OpenSea, etc.)constraint.rsโ Your domain logic (DEX routes, NFT bids)- Keep permission layer unchanged
See
examples/gator-bridge.tsfor TypeScript example.
| Doc | Purpose |
|---|---|
| metamask/v1.md | ERC-7715 Architecture |
| spec.md | Technical Spec |
| demo-script.md | Demo Walkthrough |
| HACKQUEST_SUBMISSION.md | Hackathon Submission |
Delegation Toolkit โข Smart Accounts โข ERC-7715 โข create-gator-app โข Envio
MIT License โข Built for MetaMask x Envio Hackathon

