1import { DONALD_OFFICIAL_MINT } from './donald-token-constants.mjs'; 2/** Agreed Donald terms. The durable admin control determines whether purchases are open. */ 3export const DONALD_PRESALE_PLAN = Object.freeze({ 4 enabled: false, 5 mint: DONALD_OFFICIAL_MINT, 6 startsAt: null, 7 durationDays: 30, 8 hardCapLamports: 40_000_000_000n, 9 softTargetLamports: 20_000_000_000n, 10 softTargetIsLaunchCondition: false, 11 tokensPerSol: 11_000_000n, 12 badgeBonusPercent: 20, 13 badgeBonusKey: 'partners_in_crime', 14 presaleAndBonusReserveAtoms: 550_000_000_000_000_000n, 15 allLiquidityBelowSoftCap: false, 16 unusedPresaleAndBonusTokens: 'burn_after_all_buyer_entitlements_are_accounted_for', 17}); 18 19export const DONALD_FUNDS_SPLIT = Object.freeze([ 20 Object.freeze({ key: 'liquidity', label: 'Launch liquidity', percent: 60 }), 21 Object.freeze({ key: 'operations', label: 'Operations and ecosystem development', percent: 15 }), 22 Object.freeze({ key: 'earlierCrew', label: 'Purchases of Mickey and Minnie', percent: 10 }), 23 Object.freeze({ key: 'community', label: 'Raids and community rewards', percent: 10 }), 24 Object.freeze({ key: 'reserve', label: 'Ecosystem reserve', percent: 5 }), 25]); 26 27function checkedLamports(value) { 28 if (typeof value !== 'bigint' && !(typeof value === 'string' && /^\d+$/.test(value))) { 29 throw new Error('Provide an exact integer lamport amount.'); 30 } 31 const amount = BigInt(value); 32 if (amount < 0n || amount > DONALD_PRESALE_PLAN.hardCapLamports) { 33 throw new Error('Amount must be between zero and the 40 SOL hard cap.'); 34 } 35 return amount; 36} 37 38/** Estimate only. The purchase server must determine badge eligibility. */ 39export function quoteDonaldPresale(lamports, bonusEligible = false) { 40 const paid = checkedLamports(lamports); 41 const baseAtoms = paid * DONALD_PRESALE_PLAN.tokensPerSol; 42 const bonusAtoms = bonusEligible ? baseAtoms * 20n / 100n : 0n; 43 return Object.freeze({ baseAtoms, bonusAtoms, totalAtoms: baseAtoms + bonusAtoms }); 44} 45 46/** All raise amounts use this split; rounding dust stays in the 5% reserve. */ 47export function splitDonaldPresaleFunds(lamports) { 48 const total = checkedLamports(lamports); 49 let allocated = 0n; 50 return Object.freeze(DONALD_FUNDS_SPLIT.map((entry, index) => { 51 const amount = index === DONALD_FUNDS_SPLIT.length - 1 52 ? total - allocated 53 : total * BigInt(entry.percent) / 100n; 54 allocated += amount; 55 return Object.freeze({ ...entry, lamports: amount }); 56 })); 57}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.