Skip to content

Commit e8ccd74

Browse files
rodrigoioyzclaude
andcommitted
Add protocol parameters, user flow, QA and business sections to README
- Protocol parameters: collateral_ratio=150%, liquidation_threshold=120% - Step-by-step user flow for mint, burn and liquidation - Quality assurance: edge cases, oracle failure and price anomaly handling - Business: target users, market need, competitive table, revenue, scalability Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3a78f74 commit e8ccd74

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,92 @@ The Pyth verify script validates the **Ed25519 signature** on each price message
8888

8989
---
9090

91+
## 📐 Protocol Parameters
92+
93+
These values are set at deployment time and enforced entirely on-chain:
94+
95+
| Parameter | Value | Description |
96+
|---|---|---|
97+
| `collateral_ratio` | **150%** | You can mint at most 66% of your ADA's USD value in synth tokens |
98+
| `liquidation_threshold` | **120%** | Positions below this health ratio can be liquidated by anyone |
99+
| `ada_usd_feed_id` | **16** | Pyth Lazer feed ID for ADA/USD |
100+
101+
**Example:** Depositing 100 ADA at $0.70/ADA ($70 collateral value) → you can mint up to **$46.67 of synth-USD**. If ADA drops to $0.56, your health ratio hits 120% and the position becomes liquidatable.
102+
103+
---
104+
105+
## 👤 User Flow
106+
107+
### Minting synth-USD
108+
1. User sends ADA to the protocol pool UTxO
109+
2. On-chain validator fetches live ADA/USD price from Pyth Lazer
110+
3. Calculates max synth: `synth = ada × price × (100 / collateral_ratio)`
111+
4. Minting policy issues exactly that amount of synth tokens to the user's wallet
112+
113+
### Burning synth-USD (withdraw ADA)
114+
1. User decides how much ADA to withdraw
115+
2. Validator fetches live price from Pyth Lazer
116+
3. Calculates synth to burn: `synth_burned = ada_withdrawn × price`
117+
4. Verifies remaining position stays above 120% health
118+
5. User signs the transaction — synth is burned, ADA returned
119+
120+
### Liquidation (undercollateralized position)
121+
1. ADA price drops → a position's health falls below 120%
122+
2. Any user can call `Liquidate`
123+
3. Liquidator burns synth tokens, receives the equivalent ADA from the pool
124+
4. No owner signature required — the health condition is the only gate
125+
126+
---
127+
128+
## 🛡️ Quality Assurance & Reliability
129+
130+
### Edge cases handled on-chain
131+
- **Zero deposit/withdrawal blocked:** `ada_deposited >= 1` and `ada_withdrawn >= 1` enforced explicitly
132+
- **Zero debt guard:** `health_ratio` fails immediately if `debt_amount == 0` — prevents division by zero
133+
- **Double Option price unwrap:** Pyth feed returns `Option<Option<Int>>` — the validator explicitly handles `None` (field missing) and `Some(None)` (price unavailable), failing both cases
134+
- **Single update enforced:** `expect [update] = updates` — rejects transactions with zero or multiple price messages
135+
136+
### Oracle failure handling
137+
- If the Pyth withdraw script is not included in the transaction, `pyth.get_updates` returns an empty list and the validator fails — **no stale or missing price is ever accepted**
138+
- The Ed25519 signature on each price message is verified by the Pyth verify script before our validator runs — invalid or replayed messages are rejected at the protocol level
139+
140+
### Price anomaly protection
141+
- Price is read fresh from the oracle in every transaction — there is no cached or stored price in the datum
142+
- The `collateral_ratio` and `liquidation_threshold` parameters provide a safety buffer against sudden price moves
143+
144+
---
145+
146+
## 💼 Business Development & Viability
147+
148+
### Target users
149+
- ADA holders who want USD-denominated liquidity without selling their ADA
150+
- DeFi users on Cardano seeking synthetic exposure to USD
151+
- Protocols that need a decentralized, oracle-backed stablecoin primitive
152+
153+
### Market need
154+
Cardano has existing decentralized stablecoins (DJED by COTI, iUSD by Indigo Protocol). Synth Peso **expands the offering** with a lightweight, single-collateral design that uses Pyth Lazer — a battle-tested, high-frequency oracle — rather than a custom price mechanism. This brings institutional-grade price feeds to Cardano CDP protocols.
155+
156+
### Competitive positioning
157+
158+
| Protocol | Oracle | Collateral | Chain |
159+
|---|---|---|---|
160+
| DJED (COTI) | Custom | ADA | Cardano |
161+
| iUSD (Indigo) | Chainlink | ADA | Cardano |
162+
| MakerDAO (DAI) | Chainlink | ETH/multi | Ethereum |
163+
| **Synth Peso** | **Pyth Lazer** | **ADA** | **Cardano** |
164+
165+
Pyth Lazer offers sub-second price updates and is already used across 50+ chains — giving Synth Peso a credibility advantage at launch.
166+
167+
### Revenue model
168+
Protocol fees collected on mint and liquidation events (configurable via protocol parameters). Fee revenue funds ongoing development and can be directed to a DAO treasury as the protocol matures.
169+
170+
### Scalability
171+
- **No UTxO contention:** The Pyth State NFT is a reference input — any number of users can mint or burn in the same block without competing for the same UTxO
172+
- **Permissionless liquidation:** Anyone can liquidate, eliminating the need for a centralized keeper network
173+
- **Pyth partnership potential:** As Pyth expands its Cardano presence, Synth Peso is positioned to add new synthetic assets (BTC/USD, ETH/USD) by simply deploying new validator instances with different feed IDs
174+
175+
---
176+
91177
## 🛠️ How to Build
92178

93179
### Prerequisites

0 commit comments

Comments
 (0)