Pythathon - Guards | Risk Leveled Treasury#100
Pythathon - Guards | Risk Leveled Treasury#100f0x1777 wants to merge 9 commits intopyth-network:mainfrom
Conversation
|
Please dismiss last two commits, was uploaded by the agent after submission time when was connected again to internet |
| currentReferencePrice={liveReferencePriceForSymbol( | ||
| liveQuotes ?? {}, | ||
| bootstrapDraft.referenceSymbol, | ||
| )} |
There was a problem hiding this comment.
🟡 Reference price input disabled by stale/wide quotes that fail oracle guardrails
The currentReferencePrice prop passed to VaultBootstrapLab is computed WITHOUT oracle guardrails (dashboard/page.tsx:345-348), while the useEffect that updates bootstrapDraft.referencePrice applies guardrails (dashboard/page.tsx:134-140). When a live quote exists but becomes stale or exceeds confidence thresholds, currentReferencePrice still returns a number (the stale price), causing liveReferenceAvailable to be true at vault-bootstrap-lab.tsx:71-72. This disables manual editing of the reference price field (vault-bootstrap-lab.tsx:365), but the useEffect refuses to sync the stale value into the draft. The result: the input displays a stale value and is locked, preventing the user from overriding it, while the draft holds a different (older but guardrail-passing) value that's actually used by the scenario lab.
Root cause in dashboard/page.tsx call site
The unguarded call at line 345-348:
currentReferencePrice={liveReferencePriceForSymbol(
liveQuotes ?? {},
bootstrapDraft.referenceSymbol,
)}
should match the guarded call at line 134-140 by passing { maxStaleUs: demoState.policy.maxStaleUs, maxConfidenceBps: demoState.policy.maxConfidenceBps } as the third argument.
| currentReferencePrice={liveReferencePriceForSymbol( | |
| liveQuotes ?? {}, | |
| bootstrapDraft.referenceSymbol, | |
| )} | |
| currentReferencePrice={liveReferencePriceForSymbol( | |
| liveQuotes ?? {}, | |
| bootstrapDraft.referenceSymbol, | |
| { | |
| maxStaleUs: demoState.policy.maxStaleUs, | |
| maxConfidenceBps: demoState.policy.maxConfidenceBps, | |
| }, | |
| )} |
Was this helpful? React with 👍 or 👎 to provide feedback.
Pyth Examples Contribution
Team Name: Guards
Submission Name: Guards One
Team Members: @f0x1777 @kevan1 @joaco05
Contact: @f0x1777
Type of Contribution
Project Information
Project/Example Name: Guards One
Pyth Product Used:
Blockchain/Platform:
Description
What does this contribution do?
Guards is a multichain treasury protection workflow focused on monitoring liquid portfolio value, fiat/stable floors, and automated de-risking conditions. This submission focuses on the Cardano deployment surface.
How does it integrate with Pyth?
It uses Pyth price feeds as the oracle layer for treasury risk evaluation and oracle-aware execution decisions, with Cardano as the primary live surface for this hackathon submission.
What problem does it solve or demonstrate?
It demonstrates how a treasury can use Pyth data to protect stable-denominated value and react to market deterioration with objective rules across chains, while delivering the Cardano implementation in this submission.
Testing & Verification
How to Test This Contribution
The current implementation can be verified in three layers:
Prerequisites
>= 24.0.0pnpm.envfile based on.env.examplePYTH_API_KEYPYTH_PREPROD_POLICY_IDCARDANO_BLOCKFROST_PROJECT_IDCARDANO_PYTH_STATE_REFERENCESetup & Run Instructions
Local UI routes:
http://localhost:3000http://localhost:3000/dashboardDeployment Information (if applicable)
Current deployment target for the hackathon is Cardano preprod.
Relevant deployment/runtime notes:
d799d287105dea9377cdf9ea8502a83d2b9eb2d2050a8aea800a21e6apps/uiChecklist
Code Quality
Testing
Additional Context
Related Issues
N/A
Screenshots/Demo (if applicable)
Not added yet.
Notes for Reviewers
Draft bootstrap only. This PR currently contains the initial project description under
lazer/cardano/guards/and will be updated incrementally.