API: server hybrid best execution + Terraport-shaped events for Vyntrex + consolidated CMC/CG reporting #189
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#189
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?
Problem statement
Vyntrex integration needs server-driven hybrid best execution (not only manual Pattern C / opt-in
hybrid_optimize) and on-chain/indexer events that match Terraport-compatible shapes for volume, price, and related swap fields on hybrid settlements. CoinGecko / CoinMarketCap endpoints must report hybrid and v2 (pool-only) activity in one consolidated view so external listings do not under-count book legs.Evidence / context
GET /api/v1/route/solvestill defaults pool-only unlesshybrid_optimize=true(indexer/src/api/route_solver.rs).docs/terraport.md.docs/CG_CMC_COMPLIANCE.md; indexer CMC/CG routes underindexer/src/api/.book_return_amount,limit_book_offer_consumed,pool_return_amountonswap_events(docs/limit-orders.md).Proposed solution
hybrid_route_opt/HybridSimulation+ LCD sim where configured).Acceptance criteria
docs/integrators.mdsection defines hybrid best-execution API contract, hop limits, and Terraport field mapping for Vyntrex.Dependencies
Priority
P0 (integration + listings)
mentioned in commit
216ef38822Implementation summary (merged to
main@216ef38)Implemented GitLab #189 — server-driven hybrid best execution, Terraport-shaped event documentation, and consolidated CG/CMC reporting.
Changes
Best-execution route API
GET /api/v1/route/solve/best— retail / Vyntrex path; requiresamount_in, always runs per-hop hybrid optimization (max 3 hops), same engine ashybrid_optimize=true.execute_hybrid_route_solveinroute_solver.rs.pool_only=trueopt-out on legacyGET /route/solvefor pool-only integrators.Terraport / Vyntrex event mapping
docs/integrators.mdand CL8Y hybrid extension section indocs/terraport.md.docs/indexer-invariants.md.Consolidated CG/CMC reporting
consolidated_statsmodule +get_24h_hybrid_breakdownSQL./cg/tickersand/cmc/summaryincludecl8y_extensions(hybrid vs pool-only trade counts + leg volumes).pool_leg_volume/book_leg_volumeon hybrid swaps.docs/CG_CMC_COMPLIANCE.md.Agent skill
skills/AGENTS_INDEXER_HYBRID_BEST_EXECUTION.mdfor third-party integrators.Tests
api_route_solve.rs:/bestendpoint, degraded LCD fallback.api_consolidated_reporting.rs: CG/CMC extension fields.swap_events_hybrid_columns.rscovers fixture tx → DB round-trip.Verification checklist
GET /api/v1/route/solve/best?token_in=…&token_out=…&amount_in=…returnsquote_kindofindexer_hybrid_lcd(orindexer_hybrid_lcd_degradedwhen LCD hybrid sim unavailable) with non-nullhybridon hops when book liquidity existsGET /api/v1/route/solvewithouthybrid_optimizestill returns pool-onlyhybrid: nullops (no regression)pool_return_amount,book_return_amount,limit_book_offer_consumedonswap_events(see/api/v1/pairs/{addr}/trades)/cg/tickersentries includecl8y_extensions.consolidated: trueand correct hybrid trade counts when hybrid swaps exist in last 24h/cmc/summaryincludes matchingcl8y_extensions/cg/historical_tradesand/cmc/trades/{pair}exposepool_leg_volume/book_leg_volumeon hybrid trades onlylimit_order_fills)integrators.md,terraport.md,CG_CMC_COMPLIANCE.md,indexer-invariants.md, ADR 0001,skills/AGENTS_INDEXER_HYBRID_BEST_EXECUTION.mdTests
@brouie — please verify the above checklist against staging/production indexer when convenient. Leaving issue open until signed off.
/cc @brouie
mentioned in issue #190
mentioned in commit
0e5f020551Verification complete
Verified GitLab #189 against local stack (LocalTerra, host Postgres :5432, indexer :3001, bot swarm 30/30). All acceptance criteria and checklist items pass.
Checklist
GET /api/v1/route/solve/bestreturnsquote_kind: indexer_hybrid_lcdwith non-nullhybridwhen book liquidity exists (EMBER→CORAL, amount_in=1e6)GET /route/solve?pool_only=true&amount_in=…returnshybrid: null(indexer_pool_lcd)pool_return_amount,book_return_amount,limit_book_offer_consumed;/pairs/{addr}/tradesexposes leg columns/cg/tickersand/cmc/summaryincludecl8y_extensions.consolidated: truewith hybrid/pool-only 24h counts/cg/historical_tradesand/cmc/trades/{pair}exposepool_leg_volume/book_leg_volumeintegrators.md,terraport.md,CG_CMC_COMPLIANCE.md,indexer-invariants.md, ADR 0001,skills/AGENTS_INDEXER_HYBRID_BEST_EXECUTION.md)Bug fix (merged @
0e5f020)route_solve_hybrid_optimize_degraded_falls_back_to_pool_onlywas failing: when allHybridSimulationgrid queries returned HTTP 500, LCD endpoint cooldown blocked the poolsimulationfallback, causing/bestto 502. Fixed by:simulationwhen hybrid grid fails (hybrid_route_opt.rs)lcd/mod.rs)Tests
Cursor browser MCP was not available in this environment; verification was API + test driven (backend-only scope).
mentioned in issue #209
marked as related to #209
mentioned in issue #216
mentioned in issue #220
mentioned in issue #631
marked as related to #631
mentioned in issue #690
mentioned in issue #707