feat(frontend): live UST1 mint/burn/circ, cLUNC/cUSTC supply, and CR from UST1 circulating #11
Labels
No labels
bug
docs
documentation
duplicate
enhancement
frontend
good first issue
help wanted
invalid
missing-implementation
priority
medium
product
QA
question
testing
UX
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/ustr-cmm#11
Loading…
Add table
Add a link
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
Replace the UST1 Issuance Coming Soon placeholder with live mint / burn / circulating, plus a finder link. Add cLUNC and cUSTC circulating supply. Fix Key Ratios so collateralization (and related liability ratios) use UST1 circulating supply — not a hardcoded
0that forces∞, and not the stub that would become0%the moment supply is non-zero.Depends on priced treasury assets (including vFDUSD once #10 lands). This issue owns the liability side and the ratio math.
Current codebase
frontend/src/pages/TreasuryPage.tsxnotLaunched={true}→ Coming Soon badge; noexplorerUrl; zeros for mint/burn/supply.frontend/src/components/treasury/IssuanceCard.tsxfrontend/src/hooks/useTreasury.tstoken_info.total_supplyas minted and supply; burned hardcoded0. UST1:ust1Supply = BigInt(0)with comment “Currently no UST1 issued”.ratioshasUst1Issued ? 0 : Infinityforcollateralization,ustcPerUst1,assetsToLiabilities. When supply is 0 →∞(OK). When supply > 0 →0— it never computes a real CR.frontend/src/components/treasury/RatiosCard.tsx%, USTC per UST1, assets/liabilitiesx, USTR backing.∞→ emerald. Color bands (>=100/>=50) do not match ECONOMICS tiers (190 / 110 / 95).frontend/src/types/treasury.tsTokenIssuance { minted, burned, supply };TreasuryRatios.collateralizationdocumented as percent (150 = 150% backed).tokenlist.json,CONTRACTScontractService.getTokenInfo{ token_info: {} }→name, symbol, decimals, total_supply. No lifetime minted/burned counters (standard cw20-mintable).QueryMsg(out of repo)Config+EffectiveSwaponly — no cumulative mint/burn stats.contracts/contracts/wrap-mappertotal_supply.docs/ECONOMICS.md,docs/CONTRACTS.md<95%, YELLOW95–110%, GREEN110–190%, BLUE>190%.docs/ARCHITECTURE.mdMainnet pins (do not invent addresses):
10184terra1f0eqgy9w7e5e7up97vjudqwx38tesf8ylx75x2lv3nwm0clry0pqmgfy7210184terra1437qslye72t7qmmahn4t5chz50r8a62g45phwkquwpyu2l62u6ksqssgdg10184terra1nap4dxh9tv35v0ynd9m4k6zt6c0dq6weszc4j5m564kjls56hu7qcr56ch11566terra1zxwpzpzpleatqn39r00grau4yt29sld8pw78s7ktvjafnj5nsaxq0h3rh2https://finder.terraclassic.community/columbus-5UST1 is minted/burned by
ust1-window(vFDUSD deposit → mint; redeem → burn). cLUNC/cUSTC outstanding = wrapped native (treasury keeps native custody).Why this is needed
docs/DEPLOYMENT.mdPhase 4 frontend checkbox still open). Showing supply (not treasury CW20 dust) proves how much native is wrapped.ust1Supply = 0always prints∞(looks maximally healthy).hasUst1Issued ? 0 : Infinitybranch would flip to 0% if someone only un-hardcodes supply — still not a CR.token_info.total_supply), i.e. unburned liabilities, not “Coming Soon zeros” and not USTR supply.Constraints / guardrails
token_info.total_supply(outstanding = minted − burned on this token). Do not use USTR supply. Do not use window 24h volume.∞only if UST1token_infosucceeded andtotal_supply === 0. Query failure →N/A/ loading / last good — never∞(that hides undercollateralization).> 0, compute ratios. Never return the stub0.collateralization % = (sum of priced treasury assets in USD / UST1_outstanding_in_whole_tokens) * 100.docs/CONTRACTS.md). Do notNumber(bigint)huge values unsafely — use decimal-adjusted floats only after scaling to whole tokens, or integer math then scale.tokenlistas a treasury holding (it is the liability, not collateral).all_accountsto reconstruct lifetime mint/burn (quota + abuse).total_supply. Minted / burned: keep the three-field card; useminted = supply,burned = 0only if you cannot get lifetime totals — and tooltip that these are not lifetime counters. Preferminted − burned = supplyif a later window stats query appears. Do not invent burns.notLaunchedonce live numbers show. Link:{scanner}/address/{TERRA_UST1}.supply/burned=0pattern). Include finder links. Do not imply they back UST1 as extra collateral.contractServiceLCD rate limits; batch/dedupetoken_infoqueries; do not add a new poll faster than existing treasury 30s.RatiosCard; do not expand into a full SSoT dashboard.$0without a visible incomplete state (understates backing) or as$1(overstates). Document which assets entered the sum.Relevant files
frontend/src/pages/TreasuryPage.tsxnotLaunched; pass explorer URL; add cLUNC/cUSTC supply UIfrontend/src/components/treasury/IssuanceCard.tsxfrontend/src/components/treasury/RatiosCard.tsxN/Avs∞; optional tier colorsfrontend/src/hooks/useTreasury.tstoken_info; real ratio mathfrontend/src/types/treasury.tsNaN/incomplete flagfrontend/src/utils/constants.tsust1Token,cLunc,cUstc(and window if needed)frontend/src/services/contract.tsgetTokenInfofrontend/src/hooks/usePrices.tsfrontend/public/assets/tokens/{UST1,CLUNC,CUSTC}.pngdocs/DEPLOYMENT.md,README.mdRecommended direction
CONTRACTS(testnet empty/TODO). Do not put UST1/cLUNC/cUSTC on the treasury-balance tokenlist loop.fetchTreasuryData:ust1Info = getTokenInfo(ust1Token)→supply = total_supply.ustrIssuanceunchanged.cLuncSupply/cUstcSupplyfrom theirtoken_info.ust1Issuance:supplylive; minted/burned per guardrail above.S = whole UST1(supply / 10^6).S == 0:collateralization = ustcPerUst1 = assetsToLiabilities = Infinity.S > 0:assetsUsd = Σ (whole_balance * usd_price)for treasury assets with valid prices (LUNC, USTC, ALPHA, …, vFDUSD when #10 ready). Skip unpriced assets and flag incomplete.collateralization = (assetsUsd / S) * 100ustcPerUst1 = whole_USTC / SassetsToLiabilities = assetsUsd / S(same ratio as CR,xnot%— keep current labels).ustrBackingunchanged (USTC / USTR).assetsUsd. Ship CR without it only with incomplete-data UX.Acceptance criteria
token_info.total_supply.columbus-5addressterra1f0eq…fy72.minted - burned === supplywhen both lifetime fields are known; if burned is unknown, UI does not claim historical burns.token_info.total_supply; finder links correct; not listed as extra treasury collateral rows solely because of this issue.0(successful query) → ratios∞.> 0→ CR = priced assets USD / outstanding UST1 × 100 (not0, not∞, not USTR-based).token_infofailure → ratiosN/A(or last good), not∞.Test plan (all paths)
UST1 issuance
total_supply = 0→ circ0; ratios∞; no Coming Soon.total_supply > 0→ circ formatted (6 dp); finder works.token_infofail → issuance loading/error; ratios not∞.notLaunchedremoved; USTR card still has its finder link.cLUNC / cUSTC
0supply still shown (these are supply infos, not dust-hidden treasury rows).Key ratios — happy
1e12at 6 dp), $2,000,000 priced assets → CR200%, A/L2.00x.Key ratios — edges
0→∞/∞/∞x.N/A, not∞or0%.> 0→ do not print a fake 0% CR as “known empty”; show incomplete.Infinityfrom float overflow; no negative ratios.∞then200%.Integration
token_info+ existing balances).Test plan (attack, hack, abuse)
∞CR hides insolvencyust1Supply = BigInt(0)leftover; live query used∞N/A; only success+zero is∞hasUst1Issued ? 00total_supplyonlyassetsUsdtokenlistbalance fetch$1/vFDUSDhereNumber(bigint)precisionformatAmount) before JS numberall_accountsscrapeexplorerUrl→ phishingrel="noopener noreferrer"already on linksnotLaunchedfalse on mainnet once data wired>=100old band) vs ECONOMICS RED/YELLOWVerification criteria
{"token_info":{}}total_supplyforterra1f0eq…fy72.token_info.total_supply(terra1437…ssgdg,terra1nap4…r56ch).assetsUsd / whole_UST1 * 100within rounding.N/A— not a flip to∞.Currently no UST1 issued, nohasUst1Issued ? 0 : Infinity.docs/DEPLOYMENT.mdPhase 4 frontend address checkbox can be ticked for UST1 + wrap tokens (vFDUSD UI is #10).mentioned in issue #10
mentioned in commit
737f560578mentioned in merge request !32
Implemented on !32 (depends on #10 vFDUSD USD in the CR numerator).
Shipped: live UST1
token_info.total_supply(Coming Soon removed), cLUNC/cUSTC supply cards (not CR assets), real CR math,∞only on successful zero supply,N/Aon query failure, incomplete-price banner, ECONOMICS 95/110/190 colors,getTokenInfoStrictso swallowed0cannot fake∞. Tests:frontend/src/utils/treasuryRatios.test.ts. Playbook:skills/frontend-ust1-ratios/SKILL.md.mentioned in commit
09a54333aamentioned in issue #14
mentioned in issue #16
marked as related to #16
mentioned in merge request !34
mentioned in merge request !35
mentioned in issue #19
marked as related to #19