Apy stress test#189
Open
innovativedesign-lab wants to merge 3 commits into
Open
Conversation
|
@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! 🚀 |
Author
|
Done, Close: #189 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-bodyCollapsible ⚡ 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
Notes for Reviewers