Economic pairs (cLUNC/UST1, UST1/cUSTC, UST1/USTR) have no discount registry attached — CL8Y tier discount not applied on swaps or limit placement #535

Closed
opened 2026-08-16 14:30:17 +00:00 by leonardocolucci · 14 comments
leonardocolucci commented 2026-08-16 14:30:17 +00:00 (Migrated from gitlab.com)

Summary

Reading discount_registry raw state on every factory pair (/cosmwasm/wasm/v1/contract/<pair>/raw/ZGlzY291bnRfcmVnaXN0cnk=): the 10 gem pairs return the registry address terra1wcczsdk7jwj99n3my6wx8wr4ee0hn6yaapgd792lgx5elrdtrn2scfnecz; UST1/cUSTC, UST1/USTR and cLUNC/UST1 return null.

instantiate sets DISCOUNT_REGISTRY = None (pair contract.rs) and only SetDiscountRegistry / SetDiscountRegistryAll / SetDiscountRegistryBatch on the factory wires it, so any pair created after the last registry sweep is unwired — which is exactly the three economic pairs launched 08-14/15.

Effect

lookup_effective_fee_bps_cached returns (fee_bps, None) → swaps charge the full 180 bps and limit placement pays maker_fee_bps(180) = 90 bps, regardless of CL8Y tier.

Observed: tier-9 wallet (registry get_discount returns discount_bps 9500 / limit_discount_bps 10000) placing on UST1/USTR after the 1.13.0 migrate — tx 0944E85F3BD54EC9A75FC3A5E6A99A8BAC96DFA7E79D4BFAED3CF0914AB256EE: effective_fee_bps: 180, maker_fee_amount: 9000 on 1,000,000 escrowed. Same 180 bps on every cLUNC/UST1 and UST1/cUSTC placement over the last 24h; the fee is not refunded on cancel.

Fix

Owner tx SetDiscountRegistryAll { registry } (or Batch) on the factory. Longer term, consider having create_pair pass the factory's registry into the pair at instantiate so future listings don't need a manual sweep.

Note

The dApp fee-tier UI shows the tier discount as active on these pairs, so takers are quoted a fee they don't actually get.

## Summary Reading `discount_registry` raw state on every factory pair (`/cosmwasm/wasm/v1/contract/<pair>/raw/ZGlzY291bnRfcmVnaXN0cnk=`): the 10 gem pairs return the registry address `terra1wcczsdk7jwj99n3my6wx8wr4ee0hn6yaapgd792lgx5elrdtrn2scfnecz`; **UST1/cUSTC, UST1/USTR and cLUNC/UST1 return `null`**. `instantiate` sets `DISCOUNT_REGISTRY = None` (pair `contract.rs`) and only `SetDiscountRegistry` / `SetDiscountRegistryAll` / `SetDiscountRegistryBatch` on the factory wires it, so any pair created after the last registry sweep is unwired — which is exactly the three economic pairs launched 08-14/15. ## Effect `lookup_effective_fee_bps_cached` returns `(fee_bps, None)` → swaps charge the full 180 bps and limit placement pays `maker_fee_bps(180)` = 90 bps, regardless of CL8Y tier. Observed: tier-9 wallet (registry `get_discount` returns `discount_bps 9500` / `limit_discount_bps 10000`) placing on UST1/USTR after the 1.13.0 migrate — tx `0944E85F3BD54EC9A75FC3A5E6A99A8BAC96DFA7E79D4BFAED3CF0914AB256EE`: `effective_fee_bps: 180`, `maker_fee_amount: 9000` on 1,000,000 escrowed. Same 180 bps on every cLUNC/UST1 and UST1/cUSTC placement over the last 24h; the fee is not refunded on cancel. ## Fix Owner tx `SetDiscountRegistryAll { registry }` (or `Batch`) on the factory. Longer term, consider having `create_pair` pass the factory's registry into the pair at instantiate so future listings don't need a manual sweep. ## Note The dApp fee-tier UI shows the tier discount as active on these pairs, so takers are quoted a fee they don't actually get.
PlasticDigits commented 2026-08-17 00:30:46 +00:00 (Migrated from gitlab.com)

Investigate proposed direction for leo - track immediate ops here, and for a deploy+migrate to fix fguture problems open a new issue

Investigate proposed direction for leo - track immediate ops here, and for a deploy+migrate to fix fguture problems open a new issue
PlasticDigits commented 2026-08-17 00:36:54 +00:00 (Migrated from gitlab.com)

mentioned in issue #536

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

marked as related to #536

marked as related to #536
PlasticDigits commented 2026-08-17 00:36:56 +00:00 (Migrated from gitlab.com)

mentioned in issue #537

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

marked as related to #537

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

Direction

Agreed. Immediate ops stay on this issue. Follow-ups:

  • #536 — factory CreatePair snapshots the discount registry (deploy + migrate) so new listings are not unwired.
  • #537 — dApp fee-tier UI must not advertise a CL8Y discount when the pair registry is None.

On-chain check (2026-08-17)

Factory terra1ejpgvv7g3hj0u6fpcnxhflqp84g0w3cnaskqkg5733ygwlmf963sfchsea has 13 pairs. Governance is the 2-of-3 terra1zlmv2xydxcusurtr6rl78wsvytdc6mfex6hep7 (cl8ydeploy cannot sign this).

Raw discount_registry:

Pair Address Registry
gem (sample) terra1klwuxas6x7p6fjde60kq70t0hu86wvt3fvyr2vgs0nn32fnv0q4qwznwp4 terra1wcczsdk7jwj99n3my6wx8wr4ee0hn6yaapgd792lgx5elrdtrn2scfnecz
UST1/cUSTC terra1ceprjsxp86ggftf5e38wwt34l83e5gq7penkdnv4wsatkwcs8v6qccw55f null
UST1/USTR terra16vxrhpvpcucu05y0nr862vf9hnqeh274uaff4s7hz4n0ea74006qf5hgqy null
cLUNC/UST1 terra1su5363453fj326u4t0kqar30f35cm3n0dc9yksg379u6875z350s4mm7h4 null

Do not use SetDiscountRegistryAll. PAIR_COUNT 13 > All cap 10 (DiscountRegistryAllTooManyPairs, #242). Use three targeted set_discount_registry txs (preferred) or two set_discount_registry_batch txs (limit 10, then start_after 9).

Signer: ./scripts/multisig-2of3-host-tx.sh (multisig_2of3 + multisig1/multisig2).

## Direction Agreed. Immediate ops stay on this issue. Follow-ups: - [#536](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/536) — factory `CreatePair` snapshots the discount registry (deploy + migrate) so new listings are not unwired. - [#537](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/537) — dApp fee-tier UI must not advertise a CL8Y discount when the pair registry is `None`. ## On-chain check (2026-08-17) Factory `terra1ejpgvv7g3hj0u6fpcnxhflqp84g0w3cnaskqkg5733ygwlmf963sfchsea` has **13** pairs. Governance is the 2-of-3 `terra1zlmv2xydxcusurtr6rl78wsvytdc6mfex6hep7` (`cl8ydeploy` cannot sign this). Raw `discount_registry`: | Pair | Address | Registry | |------|---------|----------| | gem (sample) | `terra1klwuxas6x7p6fjde60kq70t0hu86wvt3fvyr2vgs0nn32fnv0q4qwznwp4` | `terra1wcczsdk7jwj99n3my6wx8wr4ee0hn6yaapgd792lgx5elrdtrn2scfnecz` | | UST1/cUSTC | `terra1ceprjsxp86ggftf5e38wwt34l83e5gq7penkdnv4wsatkwcs8v6qccw55f` | `null` | | UST1/USTR | `terra16vxrhpvpcucu05y0nr862vf9hnqeh274uaff4s7hz4n0ea74006qf5hgqy` | `null` | | cLUNC/UST1 | `terra1su5363453fj326u4t0kqar30f35cm3n0dc9yksg379u6875z350s4mm7h4` | `null` | **Do not use `SetDiscountRegistryAll`.** PAIR_COUNT 13 > All cap 10 (`DiscountRegistryAllTooManyPairs`, #242). Use three targeted `set_discount_registry` txs (preferred) or two `set_discount_registry_batch` txs (`limit` 10, then `start_after` 9). Signer: `./scripts/multisig-2of3-host-tx.sh` (`multisig_2of3` + `multisig1`/`multisig2`).
PlasticDigits commented 2026-08-17 00:41:04 +00:00 (Migrated from gitlab.com)

Ops complete — verified 2026-08-17

Full factory sweep via set_discount_registry_batch (All cap is 10; factory has 13 pairs). Signed by 2-of-3 terra1zlmv2xydxcusurtr6rl78wsvytdc6mfex6hep7.

Tx Height Cursor Result
2011B3C7…CB850F9A 29981177 start_after: null, limit: 10 pairs_updated=10, has_more=true, next_start_after=9
BB6C483C…A1FDB28C 29981180 start_after: 9, limit: 10 pairs_updated=3, has_more=false (UST1/cUSTC, UST1/USTR, cLUNC/UST1)

Raw discount_registry on all 13 factory pairs is now terra1wcczsdk7jwj99n3my6wx8wr4ee0hn6yaapgd792lgx5elrdtrn2scfnecz (previously null on the three economic pairs).

Already-paid place fees on those pairs are not refunded. New swaps and new placements will look up CL8Y tier.

Follow-ups stay open: #536 (CreatePair inherit), #537 (dApp UI gate). Closing this issue — ops scope done.

## Ops complete — verified 2026-08-17 Full factory sweep via `set_discount_registry_batch` (All cap is 10; factory has 13 pairs). Signed by 2-of-3 `terra1zlmv2xydxcusurtr6rl78wsvytdc6mfex6hep7`. | Tx | Height | Cursor | Result | |----|--------|--------|--------| | [`2011B3C7…CB850F9A`](https://finder.terra.money/classic/tx/2011B3C76D8EAE8BD3E60696318C8EBEE1FFDE8CD2C210188D404301CB850F9A) | 29981177 | `start_after: null`, `limit: 10` | `pairs_updated=10`, `has_more=true`, `next_start_after=9` | | [`BB6C483C…A1FDB28C`](https://finder.terra.money/classic/tx/BB6C483C106FB7A55345E2624A6B470E9FA600AF0789BC7194CFCC97A1FDB28C) | 29981180 | `start_after: 9`, `limit: 10` | `pairs_updated=3`, `has_more=false` (UST1/cUSTC, UST1/USTR, cLUNC/UST1) | Raw `discount_registry` on **all 13** factory pairs is now `terra1wcczsdk7jwj99n3my6wx8wr4ee0hn6yaapgd792lgx5elrdtrn2scfnecz` (previously `null` on the three economic pairs). Already-paid place fees on those pairs are not refunded. New swaps and new placements will look up CL8Y tier. Follow-ups stay open: [#536](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/536) (CreatePair inherit), [#537](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/537) (dApp UI gate). Closing this issue — ops scope done.
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-08-17 00:41:05 +00:00
PlasticDigits commented 2026-08-17 01:01:03 +00:00 (Migrated from gitlab.com)

mentioned in commit 4d62c40091

mentioned in commit 4d62c400912fc79c44c3a816c02c858b87829d11
PlasticDigits commented 2026-08-17 01:01:21 +00:00 (Migrated from gitlab.com)

mentioned in merge request !1065

mentioned in merge request !1065
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 01:04:45 +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
leonardocolucci commented 2026-08-17 21:14:20 +00:00 (Migrated from gitlab.com)

Thanks for the same-day ops on this (both batch txs verified) and for splitting the durable fixes into #536/#537 — swaps and placements on the economic pairs now pick up the CL8Y tier as expected.

Thanks for the same-day ops on this (both batch txs verified) and for splitting the durable fixes into #536/#537 — swaps and placements on the economic pairs now pick up the CL8Y tier as expected.
leonardocolucci commented 2026-08-22 14:41:05 +00:00 (Migrated from gitlab.com)

mentioned in issue #598

mentioned in issue #598
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#535
No description provided.