feat(lazer/cardano): add inventory-edge-protocol example#103
feat(lazer/cardano): add inventory-edge-protocol example#103JuanCasimiro wants to merge 5 commits intopyth-network:mainfrom
Conversation
- Refactor console.log statements for signed integers to a single line format - Update README to reflect changes in expected output format - Ensure consistency in logging for price-related outputs
…g, pool/mint UX - README/PITCH: static review path for judges, CLI vs UI, operator pitfalls - server/load_env.ts: load .env from package root; harden stdout under concurrently - mint shadow subprocess, pool chain state, API/UI and onchain lock updates Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
| hasBlockfrostOrMaestro: Boolean( | ||
| process.env.BLOCKFROST_PROJECT_ID?.trim() ?? | ||
| process.env.MAESTRO_API_KEY?.trim(), | ||
| ), |
There was a problem hiding this comment.
🟡 hasBlockfrostOrMaestro uses ?? instead of ||, falsely reports false when BLOCKFROST_PROJECT_ID is empty
The health endpoint uses nullish coalescing (??) to check for Blockfrost or Maestro keys. Since .env.example has BLOCKFROST_PROJECT_ID= uncommented (line 12), users who copy it to .env and only fill in MAESTRO_API_KEY will have BLOCKFROST_PROJECT_ID set to "". The ?? operator does NOT fall through on empty string (only on null/undefined), so Boolean("") evaluates to false even when MAESTRO_API_KEY is valid. This contradicts the actual provider selection in evolution_client.ts:19-25 which uses truthy checks (if (bf)) and correctly falls through to Maestro. The false hasBlockfrostOrMaestro value disables the UI's mint and pool deposit buttons (web/src/App.tsx:1168, web/src/App.tsx:1700-1703).
| hasBlockfrostOrMaestro: Boolean( | |
| process.env.BLOCKFROST_PROJECT_ID?.trim() ?? | |
| process.env.MAESTRO_API_KEY?.trim(), | |
| ), | |
| hasBlockfrostOrMaestro: Boolean( | |
| process.env.BLOCKFROST_PROJECT_ID?.trim() || | |
| process.env.MAESTRO_API_KEY?.trim(), | |
| ), |
Was this helpful? React with 👍 or 👎 to provide feedback.
What this adds
Inventory-Edge Protocol (
lazer/cardano/inventory-edge-protocol) — hackathon-style RealFi / RWA MVP on Cardano PreProd: a vault spending validator (Aiken / Plutus v3) that locks a demo shadow NFT, tracks synthetic debt and collateral, supports parametric insurance (strike in datum), and uses Pyth Lazer in the pull model (pyth.get_updates) for liquidation and insurance paths.Product narrative and judge-facing thesis:
PITCH.md. Full operator / auditor detail:README.md.On-chain
onchain/validators/vault.akLiquidate/ClaimInsurance.onchain/validators/liquidity_pool.akonchain/plutus.jsonaiken build.Same Pyth Lazer Cardano dependency and PreProd governance policy id as the existing reference
lazer/cardano/lazer-rwa(called out explicitly in the README).Shadow NFTs are native assets minted off-chain (Lucid + CIP-25 metadata with Lazer feed hints), not minted by this Aiken project.
Redeemers (vault)
AdjustApplyHedgestrike_raw,payout_lovelace).CloseLiquidateprice * qty * 100 < debt * 110in MVP).ClaimInsurancehedgeset andprice < strike.Off-chain stack
mock_assets, judge UI flows where noted).server/index.ts) + Vite/React judge UI (npm run demo).@pythnetwork/pyth-lazer-sdk+@pythnetwork/pyth-lazer-cardano-jsfor payloads and Pyth state resolution.Layout (high level)
lib/(transactions, feeds, Pyth helpers),scripts/(open vault, hedge, liquidate, mock assets),web/,server/,onchain/— see README §4 for the full tree.How to verify locally
Prerequisites: Node 20+, Aiken 1.1+, PreProd tADA, Lazer
ACCESS_TOKEN, Blockfrost Preprod or Maestro key (see.env.example).Suggested scripted flow:
npm run mock-assets→npm run tx:open-vault→ optionalnpm run tx:hedge→npm run tx:liquidate(needs underwater economics + token). Full UI:npm run demo→ http://127.0.0.1:5173 (API on 8787).Honest MVP limits (from README)
lib/feeds.tsmay be placeholders; XAU (346) is aligned with the reference app — confirm others via Lazer symbols API before production claims.ClaimInsurancewhen price < strike; exact payout routing to outputs is left as a product-layer refinement.License
On-chain: Apache-2.0 (see
onchain/aiken.toml).