Skip to content

Contracts: Add a test suite for stable_swap_pool - #1387

Open
attyolu wants to merge 3 commits into
Pulsefy:mainfrom
attyolu:stable_swap
Open

attyolu wants to merge 3 commits into
Pulsefy:mainfrom
attyolu:stable_swap

Conversation

@attyolu

@attyolu attyolu commented Aug 31, 2026

Copy link
Copy Markdown

##closes #1220

Summary

Add a focused regression suite for the stable-swap pool to exercise the invariants and edge cases that matter for AMM safety.

What changed

  • Added invariant coverage for add-liquidity, swap, and remove-liquidity sequences
  • Asserted rounding behavior always favors the pool over the caller
  • Verified slippage and minimum-output checks reject unsafe trades
  • Covered extreme imbalance and near-empty pool states without panics or overflow
  • Confirmed fee accounting is conserved across a multi-swap sequence
  • Kept reentrancy regression coverage in place

Why

Stable-swap arithmetic is precision-sensitive. A small rounding or fee-accounting error can produce economic drift or exploitable behavior. These tests guard against the exact class of mistakes that are difficult to spot in review.

Verification

  • Ran the stable-swap contract test suite
  • Result: 6 passed, 0 failed

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@attyolu 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! 🚀

Learn more about application limits

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.

Contracts: Add a test suite for stable_swap_pool

1 participant