fix: limit price deviation chips always invalid for buy 0/1/5/10% and sell 0% #495
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#495
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
On the limit order price row, the deviation chips (
0%,+1%,+5%,+10%) always set price toref × (1 + pct/100). That makes every chip invalid for buy, and0%invalid for sell, because retail limits must stay strictly on the maker side of the reference.Observed
0%,+1%,+5%,+10%0%UI shows the red “Invalid buy/sell” state and blocks place.
Expected
Deviation chips should produce valid maker prices for the active side:
0%−/ slightly under,-1%,-5%,-10%— or exclude at-market0%if equality remains invalid)0%,+1%,+5%,+10%)Root cause (likely)
LimitOrderPriceInputWithContextcallslimitPriceFromRefDeviationPercent(ref, pct)with unsigned positive presets fromLIMIT_PRICE_DEVIATION_CHIP_PRESETS = [0, 1, 5, 10], ignoring side.Direction guard (
isLimitPriceDirectionInvalid, GitLab #154):limit >= reflimit <= ref(equality treated as invalid)So buy chips always land on/above ref; sell
0%lands exactly on ref.Relevant code:
frontend-dapp/src/components/trade/LimitOrderPriceField.tsx(chiponClick)frontend-dapp/src/utils/limitOrderPriceReference.ts(LIMIT_PRICE_DEVIATION_CHIP_PRESETS,limitPriceFromRefDeviationPercent,isLimitPriceDirectionInvalid)Suggested fix
Make chip presets side-aware (signed deviation from ref), and decide whether a true at-market
0%chip should be omitted or map to a tiny offset so equality stays invalid.Repro
0%,+1%,+5%,+10%→ each shows Invalid buy.0%→ Invalid sell.Acceptance
mentioned in commit
a010b1441fmentioned in merge request !1040
mentioned in commit
3151a42fca