feat: wLUNC / wUSTC native wrap (LUNC, USTC) — treasury-backed, no oracle #16

Closed
opened 2026-04-22 03:29:43 +00:00 by PlasticDigits · 5 comments
PlasticDigits commented 2026-04-22 03:29:43 +00:00 (Migrated from gitlab.com)

Summary

Add wrapped native tokens wLUNC and wUSTC for assets held by the CMM Treasury, with a swap experience analogous to UST1 ↔ vFDUSD in ust1-window, but without an oracle (no external rate; backing is native balance held by treasury / contract design).

Treasury context

  • CMM Treasury (native holdings): terra16j5u6ey7a84g40sr3gd94nzg5w5fm45046k9s2347qhfpwm5fr6sem3lr2
  • Scope: Native assets only (not CW20), and for now only LUNC and USTC.

Functional goals

  • Users can swap LUNC → wLUNC and USTC → wUSTC (mint wrapped against treasury/native accounting).
  • Users can swap wLUNC → LUNC and wUSTC → USTC (burn wrapped, release native), with fee behavior tracked in the companion issue (treasury routing + burn fee split).

Design notes

  • Mirror the UX and contract patterns of the existing swap window (smartcontracts-terraclassic/contracts/ust1-window: cw20 receive, mint/burn flows) where it makes sense, but omit oracle queries and rate conversion—use a 1:1 (or otherwise non-oracle) model appropriate for treasury-backed native wrap.
  • CW20 assets held by the treasury are out of scope for this issue; focus on the two native denoms above.

References

Acceptance criteria (suggested)

  • wLUNC / wUSTC contracts (or unified design) support mint on native deposit and burn to native withdrawal for the listed denoms.
  • No oracle dependency for these pairs.
  • Clear separation from CW20 treasury assets; documented limits to LUNC/USTC native only.
## Summary Add **wrapped native** tokens **wLUNC** and **wUSTC** for assets held by the **CMM Treasury**, with a swap experience analogous to **UST1 ↔ vFDUSD** in `ust1-window`, but **without an oracle** (no external rate; backing is native balance held by treasury / contract design). ## Treasury context - **CMM Treasury (native holdings):** `terra16j5u6ey7a84g40sr3gd94nzg5w5fm45046k9s2347qhfpwm5fr6sem3lr2` - **Scope:** **Native assets only** (not CW20), and for now **only LUNC and USTC**. ## Functional goals - Users can swap **LUNC → wLUNC** and **USTC → wUSTC** (mint wrapped against treasury/native accounting). - Users can swap **wLUNC → LUNC** and **wUSTC → USTC** (burn wrapped, release native), with fee behavior tracked in the companion issue (treasury routing + burn fee split). ## Design notes - Mirror the **UX and contract patterns** of the existing swap window (`smartcontracts-terraclassic/contracts/ust1-window`: cw20 receive, mint/burn flows) where it makes sense, but **omit oracle queries and rate conversion**—use a **1:1** (or otherwise non-oracle) model appropriate for treasury-backed native wrap. - **CW20** assets held by the treasury are **out of scope** for this issue; focus on the two native denoms above. ## References - Existing window: `smartcontracts-terraclassic/contracts/ust1-window` - Treasury implementation may live in **ust1-cmm** (see follow-up issue for GitLab dependency): https://gitlab.com/plasticdigits/ust1-cmm ## Acceptance criteria (suggested) - [ ] wLUNC / wUSTC contracts (or unified design) support mint on native deposit and burn to native withdrawal for the listed denoms. - [ ] No oracle dependency for these pairs. - [ ] Clear separation from CW20 treasury assets; documented limits to LUNC/USTC native only.
PlasticDigits commented 2026-04-22 03:29:52 +00:00 (Migrated from gitlab.com)

marked this issue as related to #17

marked this issue as related to #17
PlasticDigits commented 2026-04-22 05:36:04 +00:00 (Migrated from gitlab.com)

@brouie Implementation for native wLUNC / wUSTC (GitLab #16) is merged to main (commit on main after merge).

What landed

  • New CosmWasm crate smartcontracts-terraclassic/contracts/cmm-native-wrap: `ExecuteMsg::Wrap` with exactly one native coin (uluna or uusd), cw20 Receive + `Unwrap { min_native_out }` to burn wrapped tokens and BankMsg::Send native out.
  • 1:1 atom accounting after governance `fee_bps` via existing `ust1_common::math::apply_fee_ust1` (no `ust1-oracle` dependency).
  • INV-LIMIT-NATIVE-001: per-denom per-tx and rolling 24h limits on wrap output / unwrap gross wrapped amount; pause + governance (pair limits, fee, two-step gov transfer).
  • Instantiate requires exactly two pairs: uluna and uusd once each, distinct cw20 addresses.
  • Tests: 11 `cmm-native-wrap` multitests + `ust1-integration-tests::cmm_native_wrap_integration`; `make test-contracts` includes `-p cmm-native-wrap`.
  • README updated (packages table, intro, invariant index).

Request

Please verify against your expectations for treasury custody, fee split with any follow-up issue, and mainnet denoms/decimals. If anything should change (e.g. fee leg, limit semantics), we can adjust in a follow-up MR.

@brouie Implementation for native **wLUNC** / **wUSTC** (GitLab #16) is merged to **main** (commit on `main` after merge). ### What landed - New CosmWasm crate **`smartcontracts-terraclassic/contracts/cmm-native-wrap`**: \`ExecuteMsg::Wrap\` with exactly one native coin (**uluna** or **uusd**), cw20 **Receive** + \`Unwrap { min_native_out }\` to burn wrapped tokens and **BankMsg::Send** native out. - **1:1** atom accounting after governance **\`fee_bps\`** via existing \`ust1_common::math::apply_fee_ust1\` (no \`ust1-oracle\` dependency). - **INV-LIMIT-NATIVE-001**: per-denom **per-tx** and **rolling 24h** limits on wrap output / unwrap gross wrapped amount; pause + governance (pair limits, fee, two-step gov transfer). - Instantiate requires **exactly two** pairs: **uluna** and **uusd** once each, distinct cw20 addresses. - **Tests**: 11 \`cmm-native-wrap\` multitests + \`ust1-integration-tests::cmm_native_wrap_integration\`; \`make test-contracts\` includes \`-p cmm-native-wrap\`. - **README** updated (packages table, intro, invariant index). ### Request Please verify against your expectations for treasury custody, fee split with any follow-up issue, and mainnet denoms/decimals. If anything should change (e.g. fee leg, limit semantics), we can adjust in a follow-up MR.
Brouie commented 2026-04-22 06:21:14 +00:00 (Migrated from gitlab.com)

@PlasticDigits verified on 461584f (cmm-native-wrap) + 2441abf merge.

Implementation in smartcontracts-terraclassic/contracts/cmm-native-wrap/:

  • state.rs defines LUNC_DENOM = "uluna" + USTC_DENOM = "uusd" as constants
  • pairs.rs allowlist: only LUNC/USTC pair valid, enforced via DenomPair check
  • lib.rs module comment explicit: 'There is no oracle. CW20 assets other than the two configured wrapped tokens are out of scope'
  • wrap.rs + unwrap.rs handle native deposit mint → wrapped and wrapped burn → native release
  • gov.rs + limits.rs + msg.rs + error.rs rounding out the contract surface

Tests:

  • cmm-native-wrap multitest: 11/11 pass
  • cmm_native_wrap_integration.rs: 1/1 pass (via 8/8 integration total, up from 7)
  • Full workspace: 57/57 pass (up from 40/40 pre-merge)

All 3 acceptance criteria satisfied:

  • wLUNC / wUSTC support mint on native deposit and burn to native withdrawal
  • No oracle dependency for these pairs
  • Clear separation from CW20 treasury assets; documented LUNC/USTC native only

Closing.

@PlasticDigits verified on 461584f (cmm-native-wrap) + 2441abf merge. Implementation in `smartcontracts-terraclassic/contracts/cmm-native-wrap/`: - `state.rs` defines `LUNC_DENOM = "uluna"` + `USTC_DENOM = "uusd"` as constants - `pairs.rs` allowlist: only LUNC/USTC pair valid, enforced via `DenomPair` check - `lib.rs` module comment explicit: 'There is no oracle. CW20 assets other than the two configured wrapped tokens are out of scope' - `wrap.rs` + `unwrap.rs` handle native deposit mint → wrapped and wrapped burn → native release - `gov.rs` + `limits.rs` + `msg.rs` + `error.rs` rounding out the contract surface Tests: - cmm-native-wrap multitest: 11/11 pass - cmm_native_wrap_integration.rs: 1/1 pass (via 8/8 integration total, up from 7) - Full workspace: 57/57 pass (up from 40/40 pre-merge) All 3 acceptance criteria satisfied: - [x] wLUNC / wUSTC support mint on native deposit and burn to native withdrawal - [x] No oracle dependency for these pairs - [x] Clear separation from CW20 treasury assets; documented LUNC/USTC native only Closing.
Brouie (Migrated from gitlab.com) closed this issue 2026-04-22 06:21:16 +00:00
Brouie commented 2026-04-22 06:23:02 +00:00 (Migrated from gitlab.com)

mentioned in issue #17

mentioned in issue #17
Brouie commented 2026-04-23 09:20:53 +00:00 (Migrated from gitlab.com)

mentioned in issue #5

mentioned in issue #5
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/ust1-window#16
No description provided.