feat(swap): show the best executable route and hop cost #1330
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#1330
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?
Summary
dex.cl8y.comSwap should show the best executable Terra Classic route before the trader signs: hop legs, hop cost, and expected price impact. If that route cannot execute, the page fails with a clear error and a one-tap retry. When a route that uses CL8Y as a middle hop beats a direct Terraswap or Astroport hop, the quote should offer that path. Direct hops on LUNC → UST1 / USTR have been poor enough that a CL8Y middle hop was the better trade.This is not the fee dashboard on
/protocol, and it is not the open research spike on splitting one amount across several paths (#1203).Current codebase
Routing already has a single-winner solver (
GET /route/solve) and a hybrid pool-plus-book split inside a pair. The retail gap is presentation and selection: the trader cannot see legs and expected loss before signing, a hybrid failure can look like a dead click, and a better CL8Y middle hop is not consistently chosen over a bad direct hop.Why
A route that looks best on spot and then fails, or that hides a large hop loss, is not a usable quote. Campaign links also need to keep their query parameters across that quote and a retry.
Constraints
Recommended direction
Extend the pre-trade quote to list legs and expected loss for the chosen executable route, including a CL8Y middle hop when its executable output beats the direct hop. On hybrid or solver failure, show the error and a retry that re-requests the quote. Preserve campaign query parameters on the swap URL.
Given / When / Then
Given a Swap quote on columbus-5 where a CL8Y middle hop returns more than the direct Terraswap or Astroport hop,
When the trader opens the quote,
Then the page shows the legs and expected loss, signs only that route, and a failed execute offers one retry without dropping campaign parameters.
Acceptance criteria
/protocolfee tables.Test plan
Verification
First-pass model recommendation
Recommendation: grok-high
Quote selection touches the solver and the signed swap, and a wrong winner changes what the wallet signs. That is more than a single presentational edit.
cl8y-agent-control: queued
design_authorjobe132575c-432f-4175-a53f-b9880768251f(not executed; no Hetzner VM).Routing likely does not yet support terraport/astroport, and when it does it must charge an additional flat (not tiered) 2.9% fee on 3rd party dex such as terraport, astroport, and garuda
THis issue should not be implemented until a substantial design/architecture plan as well as security policy for integrating 3rd party dexes is implemented. THere are multiple complexities to handle including unexpected 3rd party dex behavior, lunc/ustc wrap fees, and potential for malicious cw20 codeids on 3rd party dexes
See #690