Skip to content

[codex] Lock StackingDAO minimum liquidity#20

Open
caydyan wants to merge 1 commit into
BitflowFinance:mainfrom
caydyan:codex/lock-stackingdao-min-liquidity
Open

[codex] Lock StackingDAO minimum liquidity#20
caydyan wants to merge 1 commit into
BitflowFinance:mainfrom
caydyan:codex/lock-stackingdao-min-liquidity

Conversation

@caydyan

@caydyan caydyan commented Jun 22, 2026

Copy link
Copy Markdown

Summary

This PR hardens StackingDAO pool initialization by permanently locking a small LP supply at pair creation.

  • adds a minimum-liquidity constant of u1000 LP units
  • mints initial-lp-supply - minimum-liquidity to the initial LP owner
  • mints minimum-liquidity to the stableswap-stackingDAO contract principal so it cannot be user-withdrawn
  • rejects initial liquidity that cannot cover the permanent lock

The pool's total-shares remains the full initial LP supply, so existing proportional accounting keeps using the full supply denominator while the creator cannot withdraw the pool to zero.

Audit context

This addresses the published ClankOS / AIBTC Bitflow StackingDAO audit finding about missing minimum-liquidity locking during initialization. Without a lock, the initial LP owner can burn all minted LP and leave zero pool balances / zero shares.

If accepted for the AIBTC fix-PR bounty, BTC payout address:

bc1qev5ant33v5y89qqjvcf4mh9hlax5svqf5xd7gc

Validation

  • git diff --check
  • clarinet check
  • manual clarinet console scenario:
    • create-pair mints u19999999999000 LP to the creator and u1000 LP to .stableswap-stackingDAO
    • withdrawing the creator's full LP returns u9999999999500 of each asset
    • pair state remains { balance-x: u500, balance-y: u500, total-shares: u1000 }
    • u500/u500 initial liquidity returns (err "err-initial-liquidity-too-low")

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