π₯ Overview
SPARQ Shield is a Solana-based coverage platform that lets users:
- Stake or deposit tokens into a shared coverage pool.
- Purchase coverage policies for DeFi protocols.
- Receive instant or automated payouts if an incident occurs.
- Earn yield (APY) from capital utilization and premiums.
The system has three major parts:
- Smart contract (Anchor program) β On-chain logic (pools, vaults, policies, payouts).
- Frontend (Coinsparq site) β User dashboard, coverage purchase UI, metrics display.
- Off-chain indexer/service β Listens to events, computes APY & metrics, powers frontend dashboards.
β Current State (Completed Work)
Environment
- Rust 1.81, Anchor 0.30.1 installed and working.
- Solana CLI 2.3.13.
- Local validator functional.
- Devnet ready.
- Frontend already implemented under Coinsparq.com (deployed, styled, token sale section built).
Program groundwork
- Anchor project initialized:
sparq_shield declare_id!aligned with deployment keypair.- PDAs defined for:
- Pool
- Vault ATA (allow owner off-curve)
depositandwithdrawinstruction logic drafted (userβvault, vaultβuser).- Token flow validated manually via JS scripts:
- Mint creation β
- User ATA β
- Vault ATA β
- Deposit/transfer verified on-chain β
- Node scripts exist for mint/deposit/withdraw.
- Local builds compiling with Anchor 0.30.1 (minor feature warnings only).
Frontend integration
- Website and branding complete (Coinsparq.com).
- Pages exist for coverage plans, FAQ, token sale, dashboard mockups.
- Wallet connect UI placeholder implemented (front-end side).
- Designed flow:
Connect Wallet β Choose Plan β Pay Premium β Coverage Active β Dashboard Metrics.
β οΈ Current Gaps / Issues
Technical
- Ubuntu/WSL instability causes shutdowns (Windows 11 issue).
- Anchor build occasionally fails due to feature flags.
- Withdraw instruction still untested in program.
- IDL/TS client generation incomplete.
- Program missing policy structs, events, and configuration instructions.
- No indexer or API layer yet.
- No tests or devnet deploy automation.
Functional (vs website promise)
The website markets full coverage functionality, including dynamic risk, instant payouts, APY, and dashboard analytics.
The current MVP only handles raw token transfer logic.
π§οΈ Gap Analysis
| Feature | Website Promise | Current State | Needed Work |
|---|---|---|---|
| Coverage Pools | Users deposit capital, earn yield, funds secure policies | PDA + vault exist | Add PoolState struct (authority, mint, vault, bump, fee_bps) and init instruction |
| Policy Purchase | Buy plans (Bronze/Silver/Gold), pay premium | Not yet implemented | Add Policy struct, purchase_policy instruction, premium transfer, events |
| Instant Payouts | Auto payout on incident | Manual transfer possible | Add trigger_claim (keeper/oracle call), stub now, oracle later |
| Dynamic Risk/Plans | Adjust pricing by plan, protocol, duration | Not yet implemented | Add config instructions + on-chain params for plan tiers |
| APY / Metrics Dashboard | Show capital, utilization, active policies | Not implemented | Add indexer that listens to events and exposes metrics.json |
| Protocol Coverage List | Audited protocols and risk data | Not implemented | Add allowlist registry (off-chain JSON first, later on-chain) |
| Governance | Community-driven, liquidity votes | Future phase | Add in Phase 2 via SPL governance hooks |
| Frontend Integration | Full flow through website | UI ready, backend incomplete | Connect via IDL/TS client once program finalized |
π§± Architecture (Final System)
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FRONTEND (React) β
β – Wallet connect β
β – Buy coverage UI β
β – Dashboard metrics β
β – Token sale / plans β
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BACKEND / INDEXER β
β – Subscribes to program logsβ
β – Stores Pools & Policies β
β – Computes APY, Utilization β
β – Exposes /metrics.json β
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ANCHOR PROGRAM (on-chain)β
β – initialize_pool β
β – deposit / withdraw β
β – purchase_policy β
β – trigger_claim β
β – config setters β
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Required Deliverables (to reach full parity)
1. Smart Contract (Anchor Program)
Implement:
initialize_pooldepositwithdrawpurchase_policy(amount, duration, plan)trigger_claim(policy_id, payout_bps)set_fee_bps/set_plan_config(admin only)
Include:
- Events: PoolInitialized, DepositMade, PolicyPurchased, ClaimTriggered
- Structs:PoolState { authority, mint, vault, bump, fee_bps }Policy { pool, owner, amount, start_ts, end_ts, premium_paid, plan_tier, active }
- Validation: checked seeds, allow_owner_off_curve for PDAs
- Tests for all success/failure paths
- Build + deploy to Devnet + export IDL
2. Off-Chain Indexer/API
- Listen for events via WebSocket (Helius or RPC)
- Aggregate:
- total capital locked
- total active policies
- utilization rate (active cover / capital)
- APY (premiums / time / capital)
- Output
/metrics.jsonfor the frontend.
3. Front-End Integration
- Use generated IDL via
@project-serum/anchorclient - Connect wallet β fetch pools/policies
- Display
/metrics.jsonvalues - Submit transactions for:
initialize_pooldepositpurchase_policywithdraw
- Integrate βProtection Estimatorβ (premium calculator using same formula as program).
4. Infrastructure
- Scripts for:
- Local validator + airdrop
- Devnet deploy
- Demo (init, deposit, purchase, trigger claim)
README.mddescribing full flow- Automated build/test pipeline
π§© Phase Plan
Phase 1 (Core Completion)
Goal: Fully functional MVP matching site promises for coverage, payouts, and dashboard data.
Duration: ~3 weeks
Deliver:
- Working Anchor program (Pool + Policy + Claim)
- IDL + TS client
- Indexer service (basic JSON metrics)
- Frontend wired to indexer & program
- Devnet deployment and public demo addresses
Phase 1.5 (Enhancements)
- Oracle or keeper automation for claim triggers.
- Advanced pricing (risk score input).
- Protocol allowlist & audit registry.
Phase 2 (Expansion)
- Governance, community pool voting.
- Institutional coverage and multi-mint pools.
- Integration with Coinsparq tokenomics ($SPARQ utility).
πΎ Deliverables Checklist for Developer
| Category | Deliverable | Description |
| Program | β
sparq_shield.so | Compiled program binary |
| Program | β
sparq_shield.json | IDL |
| Program | β
sparq_shield-keypair.json | Deployment keypair |
| Tests | β
anchor test suite | Covers all instructions |
| Scripts | β
init.ts, deposit.ts, withdraw.ts, buy_policy.ts, trigger_claim.ts | Transaction scripts |
| API | β
/metrics.json | Dashboard data |
| Docs | β
README.md, SPEC_GAP.md | Full setup + deploy guide |
| Devnet | β Program address + sample tx links | Public demo proof |
| Frontend | β Connected wallet flow | Confirmed working on live site |
π€ Summary for Developer
You are inheriting:
- A functional foundation (environment + partial token logic + frontend shell)
- All branding & UI done
- Need to finalize and connect the on-chain logic, indexer, and frontend hooks
so that the product delivers everything Coinsparq.com advertises.