Skip to content

DevalGuard — Parametric devaluation insurance on Cardano#96

Open
qmarquez wants to merge 3 commits intopyth-network:mainfrom
qmarquez:cardano/deval-guard
Open

DevalGuard — Parametric devaluation insurance on Cardano#96
qmarquez wants to merge 3 commits intopyth-network:mainfrom
qmarquez:cardano/deval-guard

Conversation

@qmarquez
Copy link

Team Information

Team Name: DevalGuard
Submission Name: DevalGuard
Team Members: Quimey Marquez (@qmarquez)
Contact: quimey.marquez@gmail.com

Type of Contribution

  • Hackathon Submission

Project Information

Project/Example Name: DevalGuard

Pyth Product Used:

  • Price Feeds

Blockchain/Platform:

  • Cardano

Description

What does this contribution do?

DevalGuard is the first parametric devaluation insurance protocol on any blockchain. Users pay a small premium in ADA and choose a devaluation threshold (5-20%). If the exchange rate crosses that threshold during the coverage period, the smart contract automatically pays out — no claims process, no intermediaries.

The system includes:

  • 3 Aiken validators: Pyth oracle consumer, liquidity pool (deposit/withdraw/reserves), and policy engine (subscribe/claim/expire)
  • Off-chain TypeScript: transaction builders using @pythnetwork/pyth-lazer-cardano-js
  • React frontend: wallet connection, subscription form, live price display, policy management with devaluation meter
  • 29 passing unit tests covering all validator logic

How does it integrate with Pyth?

Pyth is the heart of the protocol. Every core operation depends on Pyth's price feed:

  1. Subscribe: reads current ARS/USD price from Pyth to set the strike price
  2. Claim: reads current price from Pyth, verifies devaluation exceeds threshold
  3. Freshness: enforces 60-second max age on price updates

Integration uses the withdraw-script verification pattern (Pyth Pro/Lazer on Cardano):

  • On-chain: pyth-network/pyth-lazer-cardano Aiken library
  • Off-chain: @pythnetwork/pyth-lazer-cardano-js SDK
  • PreProd Policy ID: d799d287105dea9377cdf9ea8502a83d2b9eb2d2050a8aea800a21e6

What problem does it solve?

In Argentina, 1 in 3 people use crypto to hedge devaluation. But the only option is converting all savings to stablecoins. DevalGuard offers an insurance alternative — pay a small premium and get automatic coverage. No DeFi protocol on any chain offers this today.

Testing & Verification

Prerequisites

  • Aiken v1.1.21+
  • Node.js 18+

Setup & Run

cd lazer/cardano/deval-guard

# Smart contracts
aiken build
aiken check  # 29 tests

# Frontend
cd frontend && npm install && npm run dev

Test Results

29 tests | 29 passed | 0 failed
- pyth_oracle: 7 tests
- pool_tests: 11 tests
- policy_tests: 11 tests

Checklist

  • Code follows existing patterns in the repository
  • Error handling is implemented appropriately
  • No hardcoded sensitive values
  • Code has been tested locally
  • Changes don't break existing examples

Notes for Reviewers

This creates the first /lazer/cardano/ directory in the repository. The project demonstrates deep Pyth integration where the oracle is not just a "nice to have" — it's the core mechanism that drives the entire insurance protocol.

qmarquez and others added 3 commits March 22, 2026 10:48
Aiken smart contracts + React frontend for automatic devaluation
insurance using Pyth price feeds on Cardano.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Real CIP-30 wallet connection (Eternl/Nami) on PreProd
- Pool init, deposit, and subscribe transactions on-chain
- Live ADA/USD price from Pyth Hermes
- Demo mode with simulated pool and manual price slider
- Guided hints UI with step-by-step walkthrough
- Policies read from blockchain, filtered by wallet
- Parametrized config via .env for judges
- Wallet setup instructions in README

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant