fix: humanize tape Amount in/out and invert Price (#557) #1093

Merged
PlasticDigits merged 2 commits from fix/557-tape-human-amounts into main 2026-08-19 02:03:47 +00:00
PlasticDigits commented 2026-08-19 01:12:32 +00:00 (Migrated from gitlab.com)

Summary

Humanize Amount in / Amount out / Price on Charts, Trade, Trader, Portfolio tape and wallet pair history (#557).

Indexer JSON/CSV keep raw integer digit strings (plain, never 1e+19) and add offer_decimals / ask_decimals (fills: token0_decimals / token1_decimals) from indexed assets.decimals. The dApp scales with formatTapeAmount / formatTapePrice. Charts/Trade invert reciprocates human Price only; amounts stay offer → ask. Buy/sell color follows display-base (A11).

Closes #557.

What changed

  • Indexer: additive decimals on trade + fill JSON/CSV; bd_plain_string so 18-dec raw amounts stay parseable by JS BigInt.
  • Frontend: shared tradeTapeDisplay.ts; TradesTable + wallet history use it; Charts/Trade pass inverted.
  • Docs/skills: T557-1–T557-11, docs/indexer-invariants.md, skills/AGENTS_FRONTEND_TAPE_AMOUNTS.md, make verify-issue-557.

Acceptance (issue + notes)

  • A1. Charts UST1/cUSTC: 1e6 / 2.06e8 → human 1 / 206 class, not 1.000M.
  • A2. Charts UST1/USTR: 18-dec ordinary size is 10, not T.
  • A3. Trade tape shares TradesTable with Charts.
  • A4. Trader / Portfolio mixed rows use per-trade API decimals (no invert).
  • A5. Wallet pair history Amount in/out/Price + fill sizes humanized; CSV download stays raw.
  • A6. Tape Price is human quote-per-base (formatPairPrice); never USD; never compact T from raw 18/6.
  • A7. Invert reciprocates human Price only; Amount in/out stay offer → ask.
  • A8. JSON/CSV raw amount columns stay plain integer strings; decimals additive.
  • A9. RTL + indexer tests + make verify-issue-557 (passed twice); docs/invariants/skill.
  • A10. Amount cells include pay/receive symbol.
  • A11. Green/red buy color follows display-base (paying UST1 while inverted is a buy of display-base).

Out of scope (not in this MR)

  • Hub DEX USD (#556)
  • Leaderboard volume (#553)
  • Portfolio P&L (#551)
  • Charts 24h Vol leftover (related #565)
  • Production E2E / manual QA on dex.cl8y.com/charts

Test plan

  • make verify-issue-557 (docs greps, indexer lib + integration, frontend RTL) — 2/2
  • Indexer: 6/6 seed, 6/18 mixed, omit out-of-range decimals, CSV raw + additive columns, no scientific notation on 1e19
  • Frontend: UST1/cUSTC human amounts + symbols; USTR 18-dec not T; invert Price; buy color; wallet history
  • Manual: production Charts UST1/cUSTC tape vs LCD raw ÷ 10^6
  • Manual: invert pill — Price matches display orientation; amounts stay pay → receive
  • Manual: /trader/{addr} mixed UST1/cUSTC and UST1/USTR rows

Closes #557

## Summary Humanize **Amount in / Amount out / Price** on Charts, Trade, Trader, Portfolio tape and wallet pair history ([#557](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/557)). Indexer JSON/CSV keep **raw integer digit strings** (plain, never `1e+19`) and add **`offer_decimals` / `ask_decimals`** (fills: **`token0_decimals` / `token1_decimals`**) from indexed `assets.decimals`. The dApp scales with `formatTapeAmount` / `formatTapePrice`. Charts/Trade invert reciprocates **human** Price only; amounts stay offer → ask. Buy/sell color follows display-base (**A11**). Closes #557. ## What changed - Indexer: additive decimals on trade + fill JSON/CSV; `bd_plain_string` so 18-dec raw amounts stay parseable by JS `BigInt`. - Frontend: shared `tradeTapeDisplay.ts`; `TradesTable` + wallet history use it; Charts/Trade pass `inverted`. - Docs/skills: **T557-1–T557-11**, `docs/indexer-invariants.md`, `skills/AGENTS_FRONTEND_TAPE_AMOUNTS.md`, `make verify-issue-557`. ## Acceptance (issue + notes) - [x] **A1.** Charts UST1/cUSTC: 1e6 / 2.06e8 → human `1` / `206` class, not `1.000M`. - [x] **A2.** Charts UST1/USTR: 18-dec ordinary size is `10`, not `T`. - [x] **A3.** Trade tape shares `TradesTable` with Charts. - [x] **A4.** Trader / Portfolio mixed rows use **per-trade** API decimals (no invert). - [x] **A5.** Wallet pair history Amount in/out/Price + fill sizes humanized; CSV download stays raw. - [x] **A6.** Tape Price is human quote-per-base (`formatPairPrice`); never USD; never compact `T` from raw 18/6. - [x] **A7.** Invert reciprocates **human** Price only; Amount in/out stay offer → ask. - [x] **A8.** JSON/CSV raw amount columns stay plain integer strings; decimals additive. - [x] **A9.** RTL + indexer tests + `make verify-issue-557` (passed **twice**); docs/invariants/skill. - [x] **A10.** Amount cells include pay/receive **symbol**. - [x] **A11.** Green/red buy color follows display-base (paying UST1 while inverted is a buy of display-base). ## Out of scope (not in this MR) - Hub DEX USD ([#556](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/556)) - Leaderboard volume ([#553](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/553)) - Portfolio P&L ([#551](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/551)) - Charts 24h Vol leftover (related [#565](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/565)) - Production E2E / manual QA on `dex.cl8y.com/charts` ## Test plan - [x] `make verify-issue-557` (docs greps, indexer lib + integration, frontend RTL) — **2/2** - [x] Indexer: 6/6 seed, 6/18 mixed, omit out-of-range decimals, CSV raw + additive columns, no scientific notation on 1e19 - [x] Frontend: UST1/cUSTC human amounts + symbols; USTR 18-dec not `T`; invert Price; buy color; wallet history - [ ] Manual: production Charts UST1/cUSTC tape vs LCD raw ÷ 10^6 - [ ] Manual: invert pill — Price matches display orientation; amounts stay pay → receive - [ ] Manual: `/trader/{addr}` mixed UST1/cUSTC and UST1/USTR rows Closes #557
PlasticDigits commented 2026-08-19 01:12:39 +00:00 (Migrated from gitlab.com)

marked this merge request as ready

marked this merge request as **ready**
PlasticDigits commented 2026-08-19 02:03:44 +00:00 (Migrated from gitlab.com)

added 11 commits

  • db630256...a6f44c18 - 10 commits from branch main
  • e6b3d682 - Merge origin/main into fix/557-tape-human-amounts.

Compare with previous version

added 11 commits <ul><li>db630256...a6f44c18 - 10 commits from branch <code>main</code></li><li>e6b3d682 - Merge origin/main into fix/557-tape-human-amounts.</li></ul> [Compare with previous version](/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/375/diffs?diff_id=1969757296&start_sha=db630256fd9b7b02309ef51f94ab028584e9c4ff)
PlasticDigits (Migrated from gitlab.com) merged commit f36aedac2a into main 2026-08-19 02:03:47 +00:00
PlasticDigits commented 2026-08-19 02:03:48 +00:00 (Migrated from gitlab.com)

mentioned in commit f36aedac2a

mentioned in commit f36aedac2ac2d7a3562bf61ab57bc8c022a513cf
PlasticDigits commented 2026-08-19 02:16:39 +00:00 (Migrated from gitlab.com)

mentioned in issue #557

mentioned in issue #557
PlasticDigits commented 2026-08-19 02:28:47 +00:00 (Migrated from gitlab.com)

mentioned in issue #573

mentioned in issue #573
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!1093
No description provided.