feat: Phase 2 — mainnet UST1↔vFDUSD oracle window deploy #19
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#19
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
Deploy and wire the always-on, oracle-priced UST1 ↔ vFDUSD mint/redeem window on Terra Classic mainnet (
columbus-5), including tokens, CL8Y bridge registration for vFDUSD,ust1-oracle+ust1-window, treasury allowance, and the off-chain oracle service.Phase 0 decisions (approved):
cmm-native-wrapin this repo; native wrap uses ustr-cmm treasury + wrap-mapper (Phase 3).https://dex.cl8y.com/ust1(Phase 4).Approved parameters (governance-updatable after deploy):
fee_bpsDEFAULT_FEE_BPS)per_tx_ust1_limit"1000000000"rolling_24h_ust1_limit"10000000000"Current codebase
Mature CosmWasm monorepo (
v0.1.0/ oracle0.1.1) with contracts, oracle service, LocalTerra, and operator runbook — not yet deployed to mainnet (address registry blank except hardcoded CMM treasury).smartcontracts-terraclassic/packages/ust1-common/RATE_SCALE,DEFAULT_FEE_BPS=100, INV-ORACLE-, INV-MATH-, INV-SWAP-*smartcontracts-terraclassic/packages/ust1-cmm/CMM_TREASURY_MAINNET=terra16j5u6ey7a84g40sr3gd94nzg5w5fm45046k9s2347qhfpwm5fr6sem3lr2ust1-oraclesmartcontracts-terraclassic/contracts/ust1-oracle/UpdateRate; 4h throttle, +2%/UTC day, monotonic non-decreasingust1-windowsmartcontracts-terraclassic/contracts/ust1-window/TransferFromvFDUSDoracle-service/exchangeRateStored, multi-RPC consensus, broadcastsUpdateRatedocs/DEPLOYMENT.mdsmartcontracts-terraclassic/tests/src/integration_tests.rsEffectiveSwapsmartcontracts-terraclassic/contracts/cmm-native-wrap/No frontend in this repo. Integrators use CW20
Send+{"effective_swap":{}}.Why this is needed
dex.cl8y.comis live (CW20 soft launch) but has no UST1 mint/redeem venue. UST1 must be issued/redeemed against bridged Venus vFDUSD at an oracle rate that tracks BSC Venus exchange rate, with inventory held in the CMM treasury — not via an AMM pool. Without Phase 2, Phase 4 UI and secondary DEX pairs have no economic base asset.Constraints / guardrails
cmm-native-wrapfor LUNC/USTC; that is Phase 3 (ustr-cmm).oracle-service(INV-ORACLE-THROTTLE/DAILY/MONO).add_minter(ust1-window).per_tx_ust1_limit="1000000000",rolling_24h_ust1_limit="10000000000",fee_bps=100(not the older DEPLOYMENT.md example of 500 / 2,500).docs/DEPLOYMENT.mdexample instantiate JSON + fill the address registry after deploy.increase_allowancefor the window is required before withdraws work.Relevant files
docs/DEPLOYMENT.mdREADME.mdMakefile/scripts/optimize.sh/scripts/verify_oracle_operator_env.shsmartcontracts-terraclassic/contracts/ust1-oracle/**smartcontracts-terraclassic/contracts/ust1-window/**smartcontracts-terraclassic/packages/ust1-common/**smartcontracts-terraclassic/packages/ust1-cmm/**oracle-service/src/**(esp.config.rs,bsc.rs,evm_rpc.rs,terra_tx.rs)smartcontracts-terraclassic/tests/src/integration_tests.rsdocs/deployment-guide.md§5–6; cw20-mintable code ID 10184 on columbus-5Recommended direction
make build-optimized→ storeust1_oracle.wasm+ust1_window.wasm.cmm_treasury: null(default mainnet treasury) unless ops specify otherwise.add_minter(window)→ treasuryincrease_allowance(vFDUSD, window)→ firstUpdateRate→ start oracle-service (make verify-oracle-envfirst).DEPLOYMENT.mdregistry; hand governance to multisig per ops policy.Acceptance criteria
ust1-oracle+ust1-windowinstantiated withfee_bps=100, per-tx 1000, 24h 10000 UST1.terra16j5u6…(or explicitly documented override).EffectiveSwapquery returns non-stale oracle state.verify_oracle_operator_envpasses against prod env.docs/DEPLOYMENT.mdaddress registry filled; example instantiate JSON updated to approved limits.cmm-native-wrapdeployed as part of this issue.Test plan (happy / functional paths)
make test-contracts— oracle policy, window deposit/withdraw, fee split, pause, limits.EffectiveSwapparity.UpdateRatewhen rate differs and policy allows; silence alert config present.SetFee/ limit updates / pause ↔ unpause.Test plan (attack / hack / abuse vectors)
last_updateolder thanmax_oracle_age_sec)OracleStaleUpdateRateInsufficientVfdusd/InsufficientTreasuryAllowanceVerification criteria
docs/DEPLOYMENT.md.state, windoweffective_swapmatch expected fee/limits/rate freshness.Related
/ust1UI + wrap wiring + secondary AMM pairsCross-repo tracking (Phase 0 approved)
/ust1UI + wraps + secondary AMMApproved params: window
fee_bps=100, per-tx 1000 UST1, 24h 10000 UST1; wrapfee_bps=100(1%). UI atdex.cl8y.com/ust1. Skipcmm-native-wrap. Phase 1 prerequisites confirmed.mentioned in issue PlasticDigits2/ustr-cmm#5
mentioned in issue cl8y-dex-terraclassic#502
mentioned in issue cl8y-dex-terraclassic#503
changed the description
Naming update
Wrapped token symbols are cLUNC and cUSTC (not
LUNC-C/USTC-C).LocalTerra / existing DEX code may still say
LUNC-C/USTC-C— Phase 3–4 implementation must mint and display cLUNC / cUSTC on mainnet and align frontend registry/env naming.DEPLOYMENT.md refresh (2026-07-30)
2074b93substantially rewrotedocs/DEPLOYMENT.mdinto the full mainnet operator runbook (terrad gas/fees, cw20-mintable + CL8Y vFDUSD wiring, UST1 stack, Render oracle host, address registry template).Still open vs this issue’s AC / guardrail #7: the window instantiate example still uses LocalTerra/test limits, not the approved Phase 2 caps:
DEPLOYMENT.mdexamplefee_bps100100✅per_tx_ust1_limit"1000000000"(1,000 UST1)"500000000"(500) ❌rolling_24h_ust1_limit"10000000000"(10,000 UST1)"2500000000"(2,500) ❌Address registry remains a blank template (expected until mainnet deploy). Suggest a follow-up doc patch to swap the instantiate JSON to the approved limits before ops copy-paste for columbus-5.
mentioned in commit
4c94ba1b4dFollow-up: window limit defaults aligned (#19)
Pushed
4c94ba1to update approved Phase 2 caps everywhere operators / tests would copy them:fee_bps100100(unchanged)per_tx_ust1_limit"500000000"(500 UST1)"1000000000"(1,000 UST1)rolling_24h_ust1_limit"2500000000"(2,500 UST1)"10000000000"(10,000 UST1)Changes:
docs/DEPLOYMENT.md— instantiate example + changelog note for these capsust1-common—DEFAULT_PER_TX_UST1_LIMIT/DEFAULT_ROLLING_24H_UST1_LIMIT(alongsideDEFAULT_FEE_BPS)On-chain: no wasm / migrate required. Limits are instantiate args; after deploy they remain governance-updatable via
SetLimits. Mainnet registry still blank — use the new values at instantiate.Progress check — Phase 2 tokens live (2026-07-30)
Done (verified on-chain)
Mainnet CW20s (cw20-mintable code id 10184):
terra1mnl9azefrqpmu888ar2u6zrcwr80hxlt3avf4300r576cw5ar7esvxsvj3terra18m02l…48D01D2D…1F02terra1f0eqgy9w7e5e7up97vjudqwx38tesf8ylx75x2lv3nwm0clry0pqmgfy72terra1xsecn…2A5970A8…3EAFAlso completed in-repo:
make build-optimizedproducesartifacts/ust1_oracle.wasm+ust1_window.wasm(+cmm_native_wrap.wasmbuilt but not deployed — out of scope).docs/DEPLOYMENT.mdwindow instantiate example uses approved limits (fee_bps=100, per-tx 1000 / 24h 10000 UST1).filedocumented.Acceptance criteria status
wasm store’d — no on-chain code IDstoken_info+minteron both contractstokenRegistered(vFDUSD)=false; Terra bridge has notokenconfig for Terra vFDUSD yet → Phase 3ust1-oracle+ust1-windowinstantiated (fee/limits)terra16j5u6…EffectiveSwapverify_oracle_operator_envDEPLOYMENT.mdregistry filled; instantiate JSON = approved limitscmm-native-wrapdeployed for this issueRemaining to close #19
add_token/ destination / incoming mappings; minimal bridge smoke.wasm store+ instantiateust1-oracle/ust1-windowwith approved fee/limits; record code IDs + addresses.add_minter(window)→ treasuryincrease_allowance→ firstUpdateRate→ start oracle-service.Docs:
README.mdmainnet table +docs/DEPLOYMENT.mdregistry (local working tree; commit/push when ready).mentioned in issue cl8y-bridge-monorepo#133
mentioned in commit
10da35e163AC status update (2026-07-30) — after bridge Phase 3 + logo MR
Related: cl8y-bridge-monorepo#133 merged
cl8y-bridge-monorepo#133 closed; MR !45 on
main:packages/frontend/public/tokens/VFDUSD.png'VFDUSD'inLOGO_SYMBOLS(tokenLogos.ts)(UI logo is not a formal #19 AC, but unblocks bridge listing UX for the registered token.)
Re-verified on-chain (this check)
token_infotoken_infotokenRegistered(Venus vFDUSD)tokenfor Terra vFDUSDmint_burn, terra_decimals 6artifacts/ust1_oracle.wasm+ust1_window.wasmpresentAcceptance criteria (#19)
ust1-oracle+ust1-windowinstantiated (fee/limits)EffectiveSwapverify_oracle_operator_envDEPLOYMENT.mdregistry + approved instantiate limitscmm-native-wrapdeployedNext to advance #19
wasm store/ instantiate oracle + window (approved fee/limits).add_minter→ treasury allowance → firstUpdateRate→ oracle-service.Verified BSC→Terra vFDUSD smoke via xchain hash
0x0f03667d268bcdb70f100f3bbcd3e498d60cec1751e006267a4ed371941c739c: BSCdeposits[hash]=true, Terra pending withdrawexecuted=truefor CW20terra1mnl9…svj3→terra1xsecn…(~2.437446 vFDUSD after 8→6 decimal scale; Terra supply matches).mentioned in issue PlasticDigits2/ustr-cmm#6
mentioned in issue #20
Phase 5 withdraw path decision: Option 3 (treasury InstantWithdrawCw20), not CW20 allowance.
add_minterdone; treasury EOA-styleincrease_allowanceis invalid (treasury is a contract). Withdraw smoke waits on the two issues above +SetCw20Spender.mentioned in commit
23d88923a3mentioned in merge request PlasticDigits2/ustr-cmm!38
mentioned in merge request !34
AC status update (2026-08-08) — after ustr-cmm#6 + #20 closed
Re-verified on-chain via LCD (
columbus-5) and repo state. Companion work landed:InstantWithdrawCw20/SetCw20Spendercw20_spender_limitlivemain; mainnet window migrate still pendingOn-chain snapshot (this check)
ust1-oracleterra1fmht…gch8ncode 11549;rate=1e18,last_update_sec=0(no operator commit yet)ust1-windowterra1zxwp…h3rh2code 11550;fee_bps=100, per-tx1000000000, 24h10000000000;cmm_treasury=terra16j5u6…; paused=falsedata_hashmatches local pre-#20artifacts/ust1_window.wasm(Jul 30). InstantWithdrawCw20 wasm from MR !34 is not stored/migrated yetmintersterra1zxwp…✅10575441; vFDUSD minter = bridgecw20_spenderscw20_spender_limitmax_amount_per_window=10000000000/window_seconds=86400; used0✅allowance(treasury, window)0(unused; correct for Option 3)0x0f03667d…739c✅Acceptance criteria (#19)
wasm store+ migrate → new code idtoken_info+ minters/minterust1-oracle+ust1-windowinstantiated with fee/limitsterra16j5u6…config.cmm_treasuryadd_minter(window)✅; Option 3 supersedes allowance:SetCw20Spender+limit_24h✅. Blocker: window still on TransferFrom bytecode (11550); must migrate to InstantWithdrawCw20 code from #20. Treasury vFDUSD balance currently 0EffectiveSwaplast_update_sec=0→ oracle stale for swapsverify_oracle_operator_envDEPLOYMENT.mdregistry filled; instantiate JSON = approved limitsadd_minter/SetCw20Spenderalready executed on-chain)cmm-native-wrapdeployed for this issueVerification criteria
state/ windoweffective_swapmatch fee/limits/freshnesslast_update_sec=0)Remaining to close #19
terra1zxwp…to InstantWithdrawCw20 wasm from #20 /main(leave address stable).UpdateRatefrom oracle operator (then non-staleEffectiveSwap).verify_oracle_operator_env, host up.Transfer, notTransferFrom); over-limit reject.DEPLOYMENT.md/ fix README “add_minter pending” now that minter +SetCw20Spenderare live.Bottom line: Deploy + Option 3 ops wiring (minter, spender, 24h limit) are largely in place. #19 is still open on window migrate to #20 bytecode, first oracle rate, oracle-service prod, inventory, and deposit/withdraw smokes.
mentioned in issue #21
mentioned in issue #28
mentioned in merge request !45
AC status update (2026-08-08) — oracle seed + Coolify live
Re-verified on-chain via LCD (
columbus-5) after window InstantWithdraw migrate, oracle Venus-bootstrap migrate, firstUpdateRate, and Coolify oracle-service redeploy. Docs registry updated in85043b8.Done (this session / recent)
AA40BE6A…037E); oracle code 11568 (storeE8116018…1265)ust1-oracle+ust1-windowinstantiatefee_bps=100, per-tx 1000 / 24h 10000 UST1terra16j5u6…lr2minters = [terra1zxwp…]SetCw20Spender+limit_24h=10000000000(not CW20 allowance — superseded)State.paused)last_update_sec=1786187077,R=1225104516022056627≈ 1.225 FDUSD/vFDUSD);day_baseline_ratesameEffectiveSwapnon-stalelast_update_secabove; window unpausedexchangeRateStored/1e10, operatorterra1hm3ph…; logs show dual-RPC agree +no rate change from BSC(matches seededR)DEPLOYMENT.md/ README registrycmm-native-wrapOn-chain snapshot (this check)
ust1-oracleterra1fmht…gch8nrate=1225104516022056627,last_update_sec=1786187077,paused=falseust1-windowterra1zxwp…h3rh2Acceptance criteria
EffectiveSwapDEPLOYMENT.mdregistry + approved limitscmm-native-wrapRemains to close #19
Transfer(notTransferFrom).ProposeGovernance/AcceptGovernance).dex.cl8y.com/ust1) / Phase 5 ops hardening once smoke is green.Issue should stay open until deposit/withdraw smoke + registry note of probe tx hashes. Oracle bot is idle-healthy until Venus
Rmoves under +2%/4h policy.Complete
mentioned in issue cl8y-dex-terraclassic#506
mentioned in issue cl8y-dex-terraclassic#508
mentioned in issue #30