Design: team maker+taker limit MM bot (Tier 0 waiver, monthly subscription) #597
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#597
Loading…
Add table
Add a link
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?
Parent
Design / investigation only — do not implement a production bot in this issue.
Follow-up to community tax-token SKUs (#592, #593, #594) and the reusable pay-with-any-token invoice module (#595).
This is not AutoV2Lp (on-chain tax skim →
provide_liquidity). This is an off-chain, team-operated maker + taker that posts resting limit orders to deepen the on-chain book, with Tier 0 (0 protocol fee) and a monthly subscription instead of per-trade DEX fees.Problem statement
Retail
/tradebooks on new and thin pairs are empty or one-tick deep. The hybrid AMM + FIFO book only looks like a market when makers rest size. Protocol swap/place fees at the default 180 bps pair (maker half at place + taker half on fill) make a tight two-sided book uneconomic for the team to run.There is no production market-making bot. Existing “bots” are LocalTerra QA noise (Poisson swaps + random off-mid limits). There is no inventory policy, no requote/
UpdateLimitOrderPriceloop, no taker that skips its own restings, no mainnet key/custody story, and no way to charge for a fee waiver except holding CL8Y (which Tier 0 already bypasses).Product intent to investigate:
RegisterWallet), not a new fee-discount ladder.Current codebase
RegisterWallet(governance) assigns any addr, including EOAs/contracts.GetDiscountskips CL8Y balance forgovernance_onlytiers.discount_bpsandlimit_discount_bpsare 10000 → 0 place + 0 take/swap fee. Docs:docs/reference/fee-discount-tiers.md,docs/security-model.md§ Fee DiscountDISCOUNT_REGISTRY. No pair-scope, no expiry, no subscription hook. Key leak = 0-fee trading everywhere.UpdateLimitOrderPrice(no second place fee), batch cancel/claim, hybridSwapwithbook_start_hint,CleanLimitBook(#263 / #274). Fees: makerfloor(eff/2)at place, taker half on fill (#514 I13).scripts/bots/swarm.py--worker limit+@cl8y-dex/localnet-trading-swarm(#119)VITE_NETWORK=localguards.limit-book,insert-hints,limit-placements,route/solvetrader(#245)CleanLimitBookis permissionless; no in-repo watcher (#263). Claim parked (parked_expired, L22 / #504). Pause blocks cancel/claim/clean (L6).SkimToLp→ pool LPscripts/rebalance-mint-ust1-lp.shcl8ydeployhot wallet).GetDiscountper(trader, sender)Why needed
/trade, CG/CMC hybrid orderbook (#220), and hybrid “best execution” look broken even when the pool has LP.Constraints / guardrails
scripts/bots/swarm.pyonto columbus-5.RegisterWalletTier 0 on a customer-controlled key. Team signs; customer pays the invoice. Customer-loaned inventory (if any) sits in the team wallet or a team-admin MM contract.owner, orbook_start_hintpast own prefix). On-chain self-match remains possible (LOB-13); do not treat “fees = 0” as a reason to wash for leaderboard/volume (#553 / #576).skills/AGENTS_TERRACLASSIC_GAS.md(batch/ladder, hybrid 15M cap,max_maker_fills/MAX_SCAN_STEPS).EnableFeatureon the tax token.SetPairPaused; does not route through frozen hops (#585).trader= MM wallet (#418 / #245).docs/operator-secrets.md). Never commit. Distinct from governance 2-of-3 and CMM wasm admin (skills/AGENTS_KEY_CUSTODY.md).Concept to investigate (working hypothesis)
Maker
UpdateLimitOrderPricewhen mid moves (sameorder_id, no extra place fee — already 0 at T0, still saves gas vs cancel+place).max_adjust_steps.expires_atvs perpetual + cancel. Investigate gas vs park/claim load (L1 / L6).limit-placements?status=andOrderStatus(#505); claimDustFilled/ expiry; optionalCleanLimitBookonly for expired prefix, not live size.Taker
book_inputandbook_start_hintskipping own ids.owner == self.max_maker_fills, and whether MM should improve retail fills or avoid competing with them at the inside.Fee waiver + subscription
RegisterWallet { wallet: mm, tier_id: 0 }after invoice;DeregisterWalletwhen prepaid window ends or mandate is revoked. Governance-only; MM cannot self-deregister from T0.mm-subscriptioncontract is optional later (pay UST1 → emitsubscribed_until→ keeper aligns T0). Do not block book MM on a new CosmWasm product.Who is the first book
Priority order to decide:
Research questions (must answer here)
Executestrategy)? Docs mention “MM contracts”.owner != taker) vs client-only?Recommended direction
docs/adr/or adocs/runbooks/draft linked from this issue) covering Q1–Q12. Sign-off = this issue’s Done.scripts/bots/mm/— not swarm. Two-sided grid on one pair, requote, hybrid take with owner skip, T0 register in deploy script. Proof: book stays two-sided under the existing swap swarm.Out of scope (this issue and v1 unless a Q flips)
Attack / abuse tests (design must address; implement later)
DeregisterWallet, no customer keys.Acceptance criteria (design phase)
Test plan (for children, not this issue)
Full path (LocalTerra spike)
make setup-cloud-localterra(ormake deploy-local).RegisterWalletspike addr → Tier 0;GetDiscount→ 10000 / 10000 with 0 TCL8Y./tradebook shows both sides.owner == mm(inspectlimit_order_fillmaker).DeregisterWallet→ next place charges maker half of full fee.Attack (children)
localterrachain id → hard exit (copy swarm invariant).Verification
Design Done when ADR/answers are on this issue and children exist (or are explicitly deferred with dates). No
make verify-issue-*until a child lands code.Likely files (children)
scripts/bots/mm/orpackages/mm-bot/(LocalTerra guard cloned from swarm README invariants).docs/runbooks/market-maker.md, optional ADR.RegisterWalletfor the spike addr inscripts/deploy-dex-local.sh(test-only).Related
marked as related to #592
marked as related to #593
marked as related to #595
marked as related to #119
marked as related to #263
marked as related to #514
marked as related to #594
mentioned in issue #592
mentioned in issue #595
mentioned in merge request !1117
mentioned in merge request !1119
mentioned in issue #601
mentioned in issue #650
marked as related to #650
Fee changes:
50 ust1/mo
8 BPS/mo of inventory in the market maker
0 fee taker/maker orders
anaylze the 8 BPS per month, that should be max tier, should have higher rates for lower cl8y tiers