Indexer: distinguish parked-expired limit orders from active (post-#120) #142
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#142
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?
split out from #120 follow-up — @PlasticDigits asked for an indexer issue covering the parked-expired vs active order distinction.
context
after the #120 contract fix (commit
5c744ee), expired limit orders encountered during a match walk get parked instead of silently dropped — the maker can claim back their escrow via the new parked-expired entrypoint. but the indexer today does not distinguish parked-expired orders from active ones in its tracked state, so the frontend (#141 maker recovery path) has no way to surface them with the right UX.proposed scope
Decode the new contract events emitted by the parked-expired flow. the #120 fix adds attribute-tagged events when the match walk parks an order (instead of silently dropping). indexer needs to recognize these and write a row to track the parked state. confirm exact event/attribute names against contract source post-#120.
Order status enum. today the order schema tracks
active/cancelled/filled-style states. addparked_expiredas a distinct state. transition rule: any order whose match-walk encounters expiry moves fromactivetoparked_expiredwith the sameremainingcarried forward.Refund claim event handling. when the maker eventually calls the claim entrypoint, indexer should see that event and transition the row to a final
refundedstate (or whatever is consistent with the existing terminal-state vocabulary).API surface. existing
/orders(or equivalent) endpoint needs the new state visible. consider a?status=parked_expiredfilter and/or include the state inline on every order row. document on the indexer API spec.Migration. schema migration for the new state column or expanded enum. include a
.down.sql(per the team rule that all migrations ship paired up/down).acceptance
parked_expiredstate with clean transitions fromactiverefundedstate.up.sql+.down.sqlparked_expiredwith fullremainingrefundedblocks
cc @PlasticDigits
mentioned in issue #141
Scope is approved.
mentioned in commit
b28a990eedDelivered (GitLab #142)
Indexer now tracks parked-expired vs active limit placements and terminal refunded after claim.
What shipped
limit_order_placementsgainslifecycle_status(active/parked_expired/refunded),remaining_escrow, park/refund metadata. Forward migration:indexer/migrations/20260509160000_limit_order_placement_lifecycle.sql; manual rollback:indexer/migrations/revert/20260509160000_limit_order_placement_lifecycle.down.sql.limit_order_expired_parked(withremaining) andclaim_expired_limit_order(contract attrs match pairorderbook.rs/contract.rs).GET /api/v1/pairs/{addr}/limit-placementsreturnslifecycle_statusand escrow fields on each row; default listing = active + parked_expired (hides refunded);?status=acceptsactive,parked_expired,refunded, orall.docs/indexer-invariants.md,docs/limit-orders.md,docs/testing.md,skills/AGENTS_LOCALNET_TRADING_SWARM.mdcross-linked to #142.Merged to
main(commitb28a990).Verification checklist
sqlx migrate run/ deploy pipeline) and confirm new columns exist.cd indexer && cargo test --lib(parser unit tests incl. park/claim parsing).TEST_DATABASE_URL=postgres://... cargo test --test limit_order_parked_lifecycle --test api_pairs.limit_order_expired_parked, then row showslifecycle_status=parked_expiredandremaining_escrowmatches chain.refunded; defaultlimit-placementsno longer lists it;?status=refundedshows it.cc @brouie — please confirm against acceptance criteria on your side when you can (issue stays open per request).
Verification complete (GitLab #142)
Verified on
main@7f37096— no code changes required; implementation fromb28a990meets all acceptance criteria.Acceptance criteria
limit_order_expired_parkedandclaim_expired_limit_orderwasm events (parser unit tests + contract attrs matchorderbook.rs/contract.rs)parked_expiredwithactive → parked_expired → refundedtransitions (limit_order_lifecycle.rs)refundedlifecycle_status,remaining_escrow, park/refund metadata onGET /api/v1/pairs/{addr}/limit-placements;?status=filter (active|parked_expired|refunded|all)20260509160000_limit_order_placement_lifecycle.sql+ pairedrevert/...down.sqllimit_order_parked_lifecycle::park_event_then_claim_updates_db_and_api_filtersexpired_bid_parked_on_hybrid_walk_claim_refunds_makerVerification checklist (delivered comment)
lifecycle_status,remaining_escrow,parked_*,refunded_*onlimit_order_placementscargo test --lib— 38 passed (incl. park/claim parser tests)TEST_DATABASE_URL=... cargo test --test limit_order_parked_lifecycle --test api_pairs— 15 passedlifecycle_status: "active"on real row; invalid?status=→ HTTP 400/swagger-ui) documentslimit-placements+LimitPlacementResponselifecycle fieldsprocess_block_txs)Infra: shared LocalTerra + Postgres from repo root; indexer running on
:3001.Closing as verified.
mentioned in issue #253
mentioned in issue #259
mentioned in issue #263
marked as related to #263
mentioned in issue #337
mentioned in issue #339
mentioned in issue #530