Skip to content

[codex] Allow exact StackingDAO slippage bounds#18

Open
caydyan wants to merge 1 commit into
BitflowFinance:mainfrom
caydyan:codex/fix-stackingdao-slippage-bounds
Open

[codex] Allow exact StackingDAO slippage bounds#18
caydyan wants to merge 1 commit into
BitflowFinance:mainfrom
caydyan:codex/fix-stackingdao-slippage-bounds

Conversation

@caydyan

@caydyan caydyan commented Jun 22, 2026

Copy link
Copy Markdown

Summary

  • Allow StackingDAO stableswap slippage guards to pass when the computed amount exactly equals the user-provided minimum.
  • Update the affected swap, add-liquidity, and withdraw-liquidity checks from strict > to >=.
  • Add exact-boundary coverage for swap-x-for-y, swap-y-for-x, add-liquidity, and withdraw-liquidity, while keeping failure tests above the actual output amount.

Audit context

This addresses F-05 from the public ClankOS / AIBTC audit notes:
https://gist.github.com/ClankOS/61003f54ed834fdbc9be72fe95a314fa

The prior strict comparisons rejected valid transactions where the caller's minimum output/LP/withdrawal bound matched the computed amount exactly. Slippage minimums are conventionally inclusive: the transaction should fail below the bound, not at the bound.

Validation

  • git diff --check
  • clarinet check passes for all 12 contracts; existing repository warnings remain.
  • Manual Clarinet console exact-boundary checks:
    • swap-x-for-y with min-y = 9995 returns (ok u9995).
    • swap-y-for-x with min-x = 9995 returns (ok u9995).
    • add-liquidity with min-lp = 9998500 returns (ok u9998500).
    • withdraw-liquidity with exact min token amounts returns (ok { withdrawal-x-balance: u5000000000000, withdrawal-y-balance: u5000000000000 }).

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