feat: CMM treasury custody for vFDUSD swaps + wLUNC/wUSTC fees (1%) and ust1-cmm dep #17
Labels
No labels
enhancement
governance
QA
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/ust1-window#17
Loading…
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?
Summary
Align vFDUSD flows for UST1 ↔ vFDUSD swaps with the same CMM Treasury used for native wrap operations, and define burn / swap fees for wLUNC and wUSTC so protocol economics match treasury liability management.
CMM Treasury address
terra16j5u6ey7a84g40sr3gd94nzg5w5fm45046k9s2347qhfpwm5fr6sem3lr2All relevant native and routing assumptions should treat this as the canonical treasury account.
vFDUSD routing
Fees on wLUNC / wUSTC (burn side)
On burns / unwrap path (and any symmetric swap fee policy you adopt), apply a total swap fee of 1.0%, split as:
Total: 100 bps (1.0%).
Engineering
(Local reference path if cloning:
~/repos/ust1-cmmor equivalent.)Related
ust1-windowwithout oracle.Acceptance criteria (suggested)
ust1-cmmconsumed from GitLab as a dependency (version pin / tag as appropriate).marked this issue as related to #16
Implementation (merged to
main)Hi @brouie — could you review and verify against GitLab #17?
CMM treasury / vFDUSD
cmm_treasury(config; optional inInstantiateMsg, defaults toust1_cmm::CMM_TREASURY_MAINNET).TransferFromfrom the treasury to the user. The treasury mustIncreaseAllowanceon the vFDUSD token for the window contract (documented in README). New error if allowance is insufficient.Fees (UST1 leg)
fee_bps= 100 (1%) inust1-common.apply_fee_ust1with total bps.fee_split::chain_tax_and_cmm_protocol(floor half + remainder) exposed on deposit/withdraw/SetFeeBpsattributes andEffectiveSwap(fee_chain_tax_bps,fee_cmm_protocol_bps).ust1-cmmust1-cmmwas not accessible from CI; added workspace cratepackages/ust1-cmmas a stub with the canonical treasury bech32 — ready to swap for a git dependency when the repo is public/pinned.Tests
make test-contracts(unit + integration) passes, including withdraw without treasury allowance rejected.Not in this repo
ust1-window; this MR covers UST1 ↔ vFDUSD only per the companion note on the issue.Merge:
afd0bd0onorigin/main. Thanks for any on-chain / economics sanity check.@PlasticDigits verified on
44e90ed+2441abfmerge. 3 of 4 acceptance criteria landed, 1 is a known stub-deferral.vFDUSD treasury routing ✅
packages/ust1-cmm/src/lib.rsexports canonical treasury address:terra16j5u6ey7a84g40sr3gd94nzg5w5fm45046k9s2347qhfpwm5fr6sem3lr2Fee split 50/50 ✅
ust1-common/src/fee_split.rs::chain_tax_and_cmm_protocol(fee_total_bps)returns(chain_tax_coverage_bps, cmm_protocol_fee_bps). Asserted on known vector(100) → (50, 50). Matches spec 0.5% / 0.5%.Accounting explicit in code + events ✅
ust1-window/src/contract.rscallschain_tax_and_cmm_protocolat 4 paths (deposit, withdraw, set_fee_bps variants, unwrap). Event attributesfee_chain_tax_bps+fee_cmm_protocol_bpsemitted on each, enabling indexer accounting.ust1-cmm as GitLab dep ⚠️ DEFERRED
Currently a local workspace stub per
packages/ust1-cmm/src/lib.rsdoc comment: 'This crate is a workspace stub until ust1-cmm is published.'Cargo.tomldescription confirms: 'CMM protocol constants (local stub; replace with GitLab ust1-cmm when published).' Expected until the ust1-cmm GitLab project publishes a consumable crate.Tests: full workspace 57/57 pass + integration 8/8, no regressions from the #16 + #17 merge.
Up to you on close — implementation of the vFDUSD/fee mechanics looks ready. If you want the stub-to-external-dep swap tracked as follow-up, happy to file a separate issue; otherwise this can stay open until the GitLab dep lands.
mentioned in commit
6eff576a77Follow-up: wLUNC / wUSTC fee accounting (GitLab #17)
Hi @brouie — vFDUSD ↔ UST1 treasury custody and UST1-leg fee split were already on
main. The remaining gap for #17 was explicit 50/50 chain-tax vs CMM protocol attribution on cmm-native-wrap (wrap / unwrap /SetFeeBps), matchingust1-windowevent shape.Merged to
main:6eff576Changes:
fee_accountinghelper: wasm attributesfee_total_bps,fee_chain_tax_bps,fee_cmm_protocol_bpsoninstantiate,wrap,unwrap, andset_fee_bps(same semantics asust1_common::fee_split::chain_tax_and_cmm_protocol).EffectiveWrapquery now includesfee_chain_tax_bps/fee_cmm_protocol_bpsfor indexers.fee_split/ust1-commoncrate docs note native-wrap usage.DEFAULT_FEE_BPS(1%) with 50/50 assertions; multitest locks wasm event attrs.Verification:
make test-contracts(all packages) green.ust1-cmmexternal GitLab dep remains the deferred item from earlier notes.Hi @brouie — quick follow-up for verification.
crates.io
ust1-common0.1.0 andust1-oracle0.1.0 are published (thanks for running publish).cargo publish -p ust1-oraclewarnings: fixed onmainin9623780:#[allow(dead_code)]on the Wasmentrymodule (same pattern ascmm-native-wrap).rlibverification builds otherwise reportinstantiate/execute/query/migrateas unused.ust1-oracleis bumped to 0.1.1 in-tree so a clean republish is possible: aftergit pull, runcargo publish -p ust1-oracle(still depends onust1-common0.1.0 on crates.io). Optional: yank 0.1.0 if you want consumers only on the warning-free release.ust1-window: samedead_codeallow on its entry module for consistency (no version bump there yet).make test-contractspasses on the pushed commit.Please sanity-check the published manifests and the 0.1.1 republish when you have a moment.
@PlasticDigits AC2 verified on
6eff576.Test run: 58 workspace + 8 integration = 66 tests passing, 0 failures.
AC-by-AC status:
DEFAULT_FEE_BPS = 100(1.0%) inust1_commonchain_tax_and_cmm_protocol()split: floor-half to chain tax, remainder to CMM. Unit tests assert(100) -> (50, 50)andsum == totalacross rangefee_accounting::with_fee_split_attributesappendsfee_total_bps,fee_chain_tax_bps,fee_cmm_protocol_bpsto wrap + unwrap eventsEffectiveWrapResponseextended withfee_chain_tax_bps+fee_cmm_protocol_bpsfieldscmm-native-wrap/src/multitest.rs:203-230asserts both query + event attrs (50 bps test case -> 25/25)tests/src/cmm_native_wrap_integration.rs:145-146locks DEFAULT_FEE_BPS -> (50, 50)ust1-cmm/Cargo.tomldescription: 'local stub; replace with GitLab ust1-cmm when published'; workspace Cargo.toml still usespath =dep). Blocked on GitLab publish of ust1-cmm.Leaving open on your side — close now if AC4 is tracked elsewhere, or keep open until GitLab publish + swap to version-pinned external dep.
@PlasticDigits AC4 fix verified on
7ed070d.Pulled + rebuilt workspace with git-rev-pinned
ust1-cmmdep (pointing at9623780in ust1-window monorepo). All 58 workspace tests still passing, 0 failures. No regression.Approach note for the record: ust1-cmm consumed as self-referential git dep from ust1-window monorepo at a pinned rev, rather than published as separate crate. Source tree retained in-repo for edits. Workspace member entry removed. Clean solution.
All 4 ACs now met. Issue already closed.
mentioned in issue #5