"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

