Skip to content

feat: align frontend estimator with backend sweep redesign#145

Merged
owen-eth merged 2 commits into
mainfrom
sweep-redesign-alignment
May 13, 2026
Merged

feat: align frontend estimator with backend sweep redesign#145
owen-eth merged 2 commits into
mainfrom
sweep-redesign-alignment

Conversation

@owen-eth
Copy link
Copy Markdown
Contributor

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)

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>
@owen-eth owen-eth requested a review from passandscore May 13, 2026 17:22
@vercel
Copy link
Copy Markdown

vercel Bot commented May 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fastprotocolapp Ready Ready Preview, Comment May 13, 2026 5:28pm

Request Review

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@owen-eth owen-eth merged commit 469e6d6 into main May 13, 2026
3 checks passed
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.

1 participant