"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

