feat: align frontend estimator with backend sweep redesign#145
Merged
Conversation
Frontend miles formula now mirrors the new upfront-awarding backend (mev-commit/fastswap-sweep-redesign): replaces the `sweepMultiplier` bandaid with an additive per-token sweep overhead term that matches backend's `costEstimator` SQL exactly (14d window, p25 with p75 low-data fallback, ETH-input filter). Bid cost moves to Edge Config alongside surplus rate, and the cron bumps to hourly for gas-regime reactivity. - `use-estimated-miles.ts`: `net = surplus - bid - userGas - sweepOverhead` (additive); new `outputTokenAddress` prop drives per-token lookup - `use-miles-estimate-config.ts` (renamed from use-surplus-rate.ts): bundles surplusRate + bidCostEth in one fetch - Cron writes `miles_estimate_sweep_overhead_eth_by_token` (JSON map) and `miles_estimate_bid_cost_eth` (scalar). Map's `default` = 0.001 ETH mirrors backend's `costEstimateLastResort` - Bid-cost query window 7d for gas reactivity; sweep-overhead 14d matches backend - Cron daily -> hourly so frontend lags backend by ~1h max during gas regime changes (Alchemy budget impact negligible) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Frontend miles formula now mirrors the new upfront-awarding backend (mev-commit/fastswap-sweep-redesign): replaces the
sweepMultiplierbandaid with an additive per-token sweep overhead term that matches backend'scostEstimatorSQL exactly (14d window, p25 with p75 low-data fallback, ETH-input filter). Bid cost moves to Edge Config alongside surplus rate, and the cron bumps to hourly for gas-regime reactivity.use-estimated-miles.ts:net = surplus - bid - userGas - sweepOverhead(additive); newoutputTokenAddressprop drives per-token lookupuse-miles-estimate-config.ts(renamed from use-surplus-rate.ts): bundles surplusRate + bidCostEth in one fetchmiles_estimate_sweep_overhead_eth_by_token(JSON map) andmiles_estimate_bid_cost_eth(scalar). Map'sdefault= 0.001 ETH mirrors backend'scostEstimateLastResort