design: research DEX farming/yields vs volume, fees, and CMM cash flow #1207
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/cl8y-dex-terraclassic#1207
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Research / decision only — do not implement a farm, gauge, emissions contract, APR UI, or fee-split migrate in this issue.
Bundle into one investigation (do not split farming vs yields vs case studies vs CMM cash-flow):
dailySupplySideRevenue= 0), and retail copy forbids APR / points / farm chrome.GET /api/v1/overview,GET /api/v1/protocol/fees,GET /api/v1/defillama/daily). Snapshot numbers in this ticket are illustrative as of 2026-09-05 UTC; the memo must re-pull and date its own tables.Related, not duplicates:
/protocolfee and volume census (inputs to this memo).Not in scope: shipping a Generator/gauge, changing
FEE_CONFIGto LPs, adding/farm, advertising APR on/pool, staking CMM LP, emitting CL8Y/UST1/vFDUSD from the treasury, or reversing H531-4 in the dApp until an ADR is Accepted and a follow-up implementation issue exists.Current codebase
CL8Y DEX is a Terra Classic constant-product AMM plus FIFO limit book (hybrid router). Liquidity providers mint LP CW20 shares (18 decimals). They do not receive swap commission. Commission is fee-on-output to each pair’s
FEE_CONFIG.treasury(factory snapshot atCreatePair; production sink is the ustr-cmm CMM treasury). Hooks (burn / tax / LP-burn) are optional post-swap; they are not a farm.provide_liquidity/ CW20withdraw_liquidity. First mint locksMINIMUM_LIQUIDITY. Off-ratio provide donates excess. One-sided zap is dApp multi-msg, not a farm.floor(effective/2)with/tierslimit_discount_bps(I13). Unregistered retail: 90 bps place / 90 bps take at 180 bps pair fee./tiers. Discount reduces protocol take; it does not pay LPs. No staking of LP tokens./pool#lp-howtoanddocs/user-lunc-liquidity.md: “There is no LP or maker incentive program currently.” Tests forbid\bfarm(ing)?\bin that copy./treasurymarks LP into CR with protocol-token haircuts./protocol+ indexerprotocol_fee_events(swap_amm, book_take, limit_place, wrap, unwrap, ust1_mint, ust1_redeem). Llama mapsdailyFees=dailyRevenue; supply-side = 0. Yields/emissions listing is explicitly Do not.docs/terraport.md: Terraport staking/farming/governance are not in this repo and were called out of core in gap analyses.Live scale (public indexer, 2026-09-05 UTC — re-pull in the memo)
GET https://indexer.dex.cl8y.com/api/v1/overview(rounded):total_liquidity_usd)GET /api/v1/protocol/fees?window=30dmix (USD): swap_amm ~$121 (43%), wrap ~$54 (19%), limit_place ~$52 (18%), ust1_mint ~$22, ust1_redeem ~$16, unwrap ~$13, book_take ~$3. Window + wrap fees are CMM product cash, not AMM LP residual. Any farm budget that spends “all protocol fees” is mixing unrelated sinks.Annualizing
$281 / 30d ≈ **$3.4k/year** gross protocol fee USD at this print. That is the ceiling for fee-funded incentives unless the memo proves a volume multiplier that survives mercenary exit.Why this work is needed
/ust1. A farm, points program, or fake APR would collide with IL notices, NFA, and phishing (“send LP to this address”).Constraints / guardrails
aprcolumn, no/farmroute, no Llama yields adapter, noFEE_CONFIGredirect to an LP vault./tiersis a CL8Y demand sink that reduces CMM take. The memo must model stacking a farm on top of 180 bps − tier discounts, not assume 180 bps on every dollar.Relevant files
docs/architecture.md,docs/security-model.md,docs/runbooks/rotate-fee-treasury.md, pairexecute_update_treasury/ factorySetPairTreasury*docs/reference/fee-discount-tiers.md(I4, I13),skills/AGENTS_FEE_DISCOUNT_TIERS.mdsmartcontracts/contracts/hooks/README.mdfrontend-dapp/src/utils/poolLpHowtoCopy.ts,docs/user-lunc-liquidity.md,skills/AGENTS_FRONTEND_POOL_LP_HOWTO.md(H531-4)docs/terraport.mddocs/DEFILLAMA.md(Yields/emissions = Do not)indexer/src/indexer/protocol_fees.rs,frontend-dapp/src/components/protocol/ProtocolFeeStats.tsx,ProtocolGlobalStats.tsxdocs/runbooks/rebalance-mint-ust1-lp.md,skills/AGENTS_REBALANCE_MINT_UST1_LP.mddocs/adr/(next unused number; do not collide with #575’s proposed 0004)Recommended direction
Write ADR
docs/adr/NNNN-dex-farming-yield-cmm-cashflow.md(Status: Proposed) and a one-line pointer fromdocs/README.mdArchitecture. Optional skill stub only if Accepted later.Re-pull live scale (UTC date, endpoint, JSON fields). Split fees by
by_source. Compute:Case-study pack (min. each row: mechanism, who paid, sticky TVL after emissions ended, token dump, protocol insolvency Y/N, lesson for a ~$100k-TVL / few-trader venue):
Strategy scorecard (every option gets cash-flow, CR, mercenary-risk, implementation cost, copy/phishing risk):
/tiers+ no farmtreasurybps)CMM cash-flow test (required formula in the ADR). For each surviving strategy:
Δcash = Δ(DEX fees kept by CMM) + Δ(wrap/window if argued) − incentive paid − POL IL − recapPass only if
Δcash ≥ 0in the base live-volume case and in a mercenary-exit case. CR test: numerator does not drop from spending A-grade assets or un-haircutting protocol tokens.Decision: Stay (S0/S1) / Fee-capped rebate (S2) / Partner-paid only (S4) / Defer / Reject farm. Spawn follow-up implementation issues only if decision ≠ stay. Do not sneak a Generator into this MR.
Verify script
scripts/qa/verify-issue-NNN.sh: required ADR headings present; no farm UI strings; nodailySupplySideRevenuechange;poolLpHowtoCopystill has no-incentive + forbidden farm regex.Acceptance criteria
/tiersdiscount reducing take.docs/README.mdlinks the ADR.Test plan (all research paths)
Document and process tests, not chain deploys. Each path must appear in the ADR (or appendix) with pass/fail.
dailySupplySideRevenue= 0;/poolno-incentive copyprotocol/fees/tiersstack/tmpsim: 20% / 50% / 100% APR on snapshot TVL vs ~annualized DEX feesbook_take+limit_place; cannot exceed that poolpoolLpHowtoCopy.tsNegative / skip paths
Test plan (attack, hack, and abuse)
Research must evaluate each vector. Do not write exploits, PoCs, or attack procedures.
/tiersVerification criteria
scripts/qa/verify-issue-NNN.sh(or documentedmake verify-issue-NNN) asserts required headings, no farm UI, no-incentive copy still present.make check-fee-discount-tier-docsstill passes if that file is untouched (it should be).curls and get the same field names (values will move).Out of scope
/farm.fee_bps, CMM treasury pointer, or Llama methodology except as recommendations.Closing as we will be focused on protocol owned liquidity for the dex, and if need capital will activate staking for ust1 or ustr.