Fee-tier UI shows CL8Y discount on pairs with no discount_registry #537

Closed
opened 2026-08-17 00:36:55 +00:00 by PlasticDigits · 13 comments
PlasticDigits commented 2026-08-17 00:36:55 +00:00 (Migrated from gitlab.com)

Summary

Parent: #535. After the ops sweep, the three economic pairs will be wired; this issue is the dApp mismatch that made the bug look like a working discount.

getTraderDiscount always queries VITE_FEE_DISCOUNT_ADDRESS. Swap / Pool / Trade fee copy and useLimitOrderMakerFeeRates then apply that discount to any pair. On-chain, lookup_effective_fee_bps_cached uses the pair’s DISCOUNT_REGISTRY; when that is None the pair charges full fee_bps (180) and maker place is maker_fee_bps(180) = 90 bps, regardless of CL8Y tier.

Hybrid HybridSimulation with trader on an unwired pair already quotes the full fee. The lie is the fee-tier chrome (strikethrough bps, “your discount”, maker place fee) — takers/makers are shown a fee they do not get. Observed on UST1/USTR after the 1.13.0 migrate: registry get_discount 9500/10000 vs effective_fee_bps: 180.

Direction

Do not apply or advertise a CL8Y tier discount for a pair unless that pair’s registry is set (and matches the configured fee-discount contract).

Depends on pair GetDiscountRegistry from the CreatePair inherit issue (today the query variant is not on live wasm; raw key discount_registry works). Until that query ships, a raw-state probe or treating missing registry as “no UI discount” is acceptable.

Scope

  • Gate Swap / Pool / Trade fee-tier display and useLimitOrderMakerFeeRates on pair registry being set.
  • Unwired pair: show full fee_bps / full maker place fee; do not strikethrough a phantom discount.
  • Do not invent a client-side discount that the pair will not apply.
  • Tests for unwired vs wired pair.

Out of scope

  • On-chain wiring (#535) and CreatePair inherit (linked contract issue).
## Summary Parent: [#535](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/535). After the ops sweep, the three economic pairs will be wired; this issue is the **dApp** mismatch that made the bug look like a working discount. `getTraderDiscount` always queries `VITE_FEE_DISCOUNT_ADDRESS`. Swap / Pool / Trade fee copy and `useLimitOrderMakerFeeRates` then apply that discount to **any** pair. On-chain, `lookup_effective_fee_bps_cached` uses the **pair’s** `DISCOUNT_REGISTRY`; when that is `None` the pair charges full `fee_bps` (180) and maker place is `maker_fee_bps(180)` = 90 bps, regardless of CL8Y tier. Hybrid `HybridSimulation` with `trader` on an unwired pair already quotes the full fee. The lie is the fee-tier chrome (strikethrough bps, “your discount”, maker place fee) — takers/makers are shown a fee they do not get. Observed on UST1/USTR after the 1.13.0 migrate: registry `get_discount` 9500/10000 vs `effective_fee_bps: 180`. ## Direction Do not apply or advertise a CL8Y tier discount for a pair unless that pair’s registry is set (and matches the configured fee-discount contract). Depends on pair `GetDiscountRegistry` from the CreatePair inherit issue (today the query variant is **not** on live wasm; raw key `discount_registry` works). Until that query ships, a raw-state probe or treating missing registry as “no UI discount” is acceptable. ## Scope - Gate Swap / Pool / Trade fee-tier display and `useLimitOrderMakerFeeRates` on pair registry being set. - Unwired pair: show full `fee_bps` / full maker place fee; do not strikethrough a phantom discount. - Do not invent a client-side discount that the pair will not apply. - Tests for unwired vs wired pair. ## Out of scope - On-chain wiring (#535) and CreatePair inherit (linked contract issue).
PlasticDigits commented 2026-08-17 00:36:56 +00:00 (Migrated from gitlab.com)

marked as related to #535

marked as related to #535
PlasticDigits commented 2026-08-17 00:37:09 +00:00 (Migrated from gitlab.com)

mentioned in issue #535

mentioned in issue #535
PlasticDigits commented 2026-08-17 01:03:56 +00:00 (Migrated from gitlab.com)

mentioned in merge request !1066

mentioned in merge request !1066
PlasticDigits commented 2026-08-17 03:36:05 +00:00 (Migrated from gitlab.com)

mentioned in commit 395416d03e

mentioned in commit 395416d03e1fd9da48a2cab627d278fd5b3329f1
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-08-17 03:36:38 +00:00
PlasticDigits commented 2026-08-17 03:37:33 +00:00 (Migrated from gitlab.com)

mentioned in commit c4c2b78dd2

mentioned in commit c4c2b78dd22ff98ccc0bd4d664ace631108ed259
PlasticDigits commented 2026-08-17 03:39:51 +00:00 (Migrated from gitlab.com)

mentioned in commit a5639d8ba9

mentioned in commit a5639d8ba9795acc2e4a8f6f143685924fd2528d
PlasticDigits commented 2026-08-17 03:42:11 +00:00 (Migrated from gitlab.com)

mentioned in issue #536

mentioned in issue #536
PlasticDigits commented 2026-08-17 03:42:12 +00:00 (Migrated from gitlab.com)

!1066 merged to main (c4c2b78d). make verify-issue-537 7/7 after merge (29 Vitest).

During !1068 conflict resolution, one-sided pool cards were gated on the selected pair (useFeeDiscountRegistryStatus(pairAddr) / pair?.contract_addr) so zap fee math does not apply a wallet get_discount on an unwired pair (I14). Advanced PoolCard already used pair.contract_addr.

Left open (not blocking this close):

  • No Trade page integration test that pre-submit maker bps is 90 (unwired) vs 0 (tier-9 wired)
  • No component test for LCD probe failure → full fee / no strikethrough
  • Manual QA still unchecked: unwired pair plain fee, wired gem strikethrough, /trade maker bps vs on-chain
  • useLimitOrderMakerFeeRates feeError does not surface pair-probe errors (behavior is still fail-closed)
!1066 merged to `main` (`c4c2b78d`). `make verify-issue-537` 7/7 after merge (29 Vitest). During !1068 conflict resolution, one-sided pool cards were gated on the selected pair (`useFeeDiscountRegistryStatus(pairAddr)` / `pair?.contract_addr`) so zap fee math does not apply a wallet `get_discount` on an unwired pair (I14). Advanced `PoolCard` already used `pair.contract_addr`. Left open (not blocking this close): - No Trade page integration test that pre-submit maker bps is 90 (unwired) vs 0 (tier-9 wired) - No component test for LCD probe failure → full fee / no strikethrough - Manual QA still unchecked: unwired pair plain fee, wired gem strikethrough, `/trade` maker bps vs on-chain - `useLimitOrderMakerFeeRates` `feeError` does not surface pair-probe errors (behavior is still fail-closed)
PlasticDigits commented 2026-08-17 03:42:15 +00:00 (Migrated from gitlab.com)

mentioned in issue #538

mentioned in issue #538
PlasticDigits commented 2026-08-17 10:19:53 +00:00 (Migrated from gitlab.com)

mentioned in merge request !1075

mentioned in merge request !1075
PlasticDigits commented 2026-08-17 10:26:07 +00:00 (Migrated from gitlab.com)

mentioned in issue #547

mentioned in issue #547
PlasticDigits commented 2026-08-18 00:43:31 +00:00 (Migrated from gitlab.com)

mentioned in issue #559

mentioned in issue #559
PlasticDigits commented 2026-08-26 01:06:41 +00:00 (Migrated from gitlab.com)

mentioned in issue #651

mentioned in issue #651
Sign in to join this conversation.
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#537
No description provided.