// Sirius.X pricing model — deterministic per-label cost so users can predict // what a name or TLD will cost before they click Register. Public tiers only; // operator-level discounts and coupon overrides land in a future revision // (the plan is oracle-fed rates + coupon-code redemption at mint time). // // Exposed as window.siriusPricing so both the register-flow modal and the // inline search widgets on landing/tld.html use one source of truth. (() => { // Chipnet placeholder rate: mainnet swaps this for a real BCH/USD oracle. // The numbers keep the demo transactions in the "few chipnet coins" range // so a single faucet visit covers a name or a TLD. const CHIPNET_SATS_PER_USD = 250_000; const usdToSats = (usd) => BigInt(Math.max(0, Math.round(Number(usd) * CHIPNET_SATS_PER_USD))); const cleanLabel = (s) => String(s || "").toLowerCase().replace(/[^a-z0-9-]/g, ""); // Tier picker — LENGTH-first, then downshift for "less brandable" shapes // (all-digits, hyphenated). Kept as multiplicative modifiers so tiers // remain the primary story and mods just soften an edge case. function priceForName(label) { const s = cleanLabel(label); if (!s) return { usd: 0, tier: "invalid" }; let usd, tier; if (s.length === 1) { usd = 5.00; tier = "premium-1"; } else if (s.length === 2) { usd = 3.00; tier = "short-2"; } else if (s.length === 3) { usd = 2.00; tier = "short-3"; } else if (s.length <= 5) { usd = 1.00; tier = "standard"; } else if (s.length <= 7) { usd = 0.50; tier = "long"; } else if (s.length <= 16) { usd = 0.25; tier = "extended"; } else { usd = 0.10; tier = "very-long"; } // Modifiers. if (/^\d+$/.test(s)) { usd = round2(usd * 0.5); tier += "+digits"; } if (s.includes("-")) { usd = round2(usd * 0.7); tier += "+hyphen"; } return { usd, tier, sats: usdToSats(usd) }; } function priceForTld(label) { const s = cleanLabel(label); if (!s) return { usd: 0, tier: "invalid" }; let usd, tier; if (s.length === 1) { usd = 10.00; tier = "premium-1"; } else if (s.length === 2) { usd = 8.00; tier = "short-2"; } else if (s.length === 3) { usd = 6.00; tier = "short-3"; } else if (s.length <= 8) { usd = 5.00; tier = "standard"; } else { usd = 4.00; tier = "long"; } return { usd, tier, sats: usdToSats(usd) }; } // Rounded USD → display string. Under $1 shows cents ($0.25); $1 and up // shows whole dollars ($5) unless there's a fractional part. function formatUsd(usd) { const n = Number(usd || 0); if (n >= 1 && n === Math.floor(n)) return `$${n}`; return `$${n.toFixed(2)}`; } function formatSats(sats) { return `${BigInt(sats || 0n).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")} sat`; } function round2(n) { return Math.round(Number(n) * 100) / 100; } window.siriusPricing = { priceForName, priceForTld, formatUsd, formatSats, usdToSats, CHIPNET_SATS_PER_USD, }; })();