Skip to content

Improve nearBalancedPool check#2898

Open
sparrowDom wants to merge 1 commit into
masterfrom
sparrowDom/StableSwapAMMPriceCheck
Open

Improve nearBalancedPool check#2898
sparrowDom wants to merge 1 commit into
masterfrom
sparrowDom/StableSwapAMMPriceCheck

Conversation

@sparrowDom
Copy link
Copy Markdown
Member

Summary

Relax StableSwapAMMStrategy.nearBalancedPool so the peg check works on pools that are 100–1000× smaller than what the previous probe size required. The check previously failed on the live Hydrex superOETHb/WETH pool (~0.0009 ETH/side) even when the pool was perfectly balanced, because the hard-coded 1 ETH probe was 1000× the pool's reserves — getAmountOut was returning ~the entire pool, not a real marginal-price quote.

Effective floor

Old: pool needed ~50 WETH/side for deposit() to clear the peg check. New: pool needs ~0.05 WETH/side (1000× smaller). Below ~1000 wei reserves the modifier reverts with Pool too small (intentional — an empty pool can't be safely deposited into).

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.72%. Comparing base (cd7218c) to head (2576da6).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2898      +/-   ##
==========================================
+ Coverage   50.68%   50.72%   +0.04%     
==========================================
  Files         110      110              
  Lines        4873     4877       +4     
  Branches     1353     1354       +1     
==========================================
+ Hits         2470     2474       +4     
  Misses       2399     2399              
  Partials        4        4              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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