Feat/dry run preview modal#170
Open
cyberdocs120 wants to merge 3 commits into
Open
Conversation
- Add rate_snapshots table + index to schema.sql - Cron writes (pool, asset, supply_rate, borrow_rate, util, blnd_eps) snapshot each 15-min tick - Cron prunes snapshots older than 365 days - Add GET /rates?pool=&asset=&window= public endpoint - Expose util + blndEps fields on ReserveRates
- Add fetchEwmaRates() to blend.ts: fetches 30d snapshots from B3 /rates endpoint and computes EWMA with 7-day half-life (α ≈ 0.0029 per 15-min tick) - Add apyMode state (instant | smoothed) and activeRates() helper in main.ts - Net supply APY and net borrow cost rows use activeRates() — affected by toggle - Position net APY in renderPosition() also uses activeRates() - Toggle button (#apy-mode-toggle) in APR section header switches modes - EWMA results cached per pool+asset; cache cleared on pool/asset switch - Docs panel (<details id=ewma-docs>) explains EWMA, half-life, and formula
- blend.ts: export buildOpenRequestsVec, buildCloseRequestsVec, buildIncreaseRequestsVec, buildDecreaseRequestsVec to build submit requests without assembling signed XDR - main.ts: showDryRunModal() calls dryRunSubmit via soroban-rpc simulateTransaction, shows net tokens moved, current→projected HF, estimated fee, and any simulation errors; resolves Promise<boolean> so actions bail early on cancel - Wired into openPosition, adjustLeverage, addFundsToPosition — modal renders before the wallet signing prompt - index.html: dry-run modal markup reusing alert-modal shell - style.css: dryrun-table, dryrun-error, dryrun-actions styles Closes Dgetsylver#17
|
@cyberdocs120 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! 🚀 |
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.
What changed
blend.ts — four new exported helpers that build the xdr.ScVal requests vec for each action type without
assembling a signed XDR:
dryRunSubmit was already present and is unchanged.
main.ts — showDryRunModal() calls dryRunSubmit, renders the modal with:
Returns Promise. Wired into openPosition, adjustLeverage, and addFundsToPosition — cancel aborts the
flow before the wallet is ever prompted.
index.html — modal markup reusing the existing .alert-modal-overlay shell.
style.css — .dryrun-table, .dryrun-error, .dryrun-actions styles.
Acceptance checklist
Closes #17