Skip to content

Apy stress test#189

Open
innovativedesign-lab wants to merge 3 commits into
Dgetsylver:mainfrom
innovativedesign-lab:apy-stress-test
Open

Apy stress test#189
innovativedesign-lab wants to merge 3 commits into
Dgetsylver:mainfrom
innovativedesign-lab:apy-stress-test

Conversation

@innovativedesign-lab

Copy link
Copy Markdown

Close: #34

Summary

Here's a summary of every change made:

blend.ts
— new pure function + interface

StressScenario interface — holds util, borrowApr, supplyApr, netApy, hf, daysToLiq, and inRThreeKink for one scenario
computeStressScenario(rs, targetUtil, leverage) — runs the full 3-kink Blend rate model at an arbitrary target utilization (not the current pool state), computes net APY at the given leverage, HF, and days-to-liquidation from the interest spread. Flags inRThreeKink when util > 95% so the UI can surface the steep r_three risk clearly. Pure function, no RPC calls.
index.html
— new

Details panel inside #stats-body

Collapsible ⚡ APY Stress-Test panel with a summary hint line (shows active scenario at a glance without opening)
Four preset buttons: 80% / 90% / 95% / 99% — 95% and 99% styled in danger red since they cross the r_three kink
Custom button (default active) with a range slider (1–99%)
Results table: Utilization · Borrow APR · Net APY · Days to Liq — active row highlighted, kink rows in red
r_three kink warning banner, shown only when any displayed scenario exceeds 95%
main.ts
— render logic + wiring

_stressActiveUtil / _stressCustomUtil state variables
renderStressPanel(rs) — computes all visible scenarios via computeStressScenario, renders the results table with color-coded APY and liquidation days, updates the summary hint
initStressPanel() — wires preset buttons, Custom button, and slider events; called once at startup
renderStressPanel called from renderSelectedAsset() (on data load) and updatePreview() (on leverage slider move) so the panel stays live as the user adjusts leverage
style.css
— ~60 lines of new styles matching the existing design system (surface/border/primary/danger tokens, mono font for numbers, kink row danger styling)

Related Issue

Closes #34

Checks

  • I read the contribution guide.
  • I kept this pull request scoped to the linked issue.
  • I ran the relevant local checks or explained why they were skipped.
  • For Drips wave issues, I claimed the issue before opening this pull request.

Notes for Reviewers

@drips-wave

drips-wave Bot commented May 29, 2026

Copy link
Copy Markdown

@innovativedesign-lab Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@innovativedesign-lab

Copy link
Copy Markdown
Author

Done, Close: #189

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.

B7: APY stress-test panel

2 participants