/** * Pro-Rata Renewal Fee Module * * Computes the pro-rata renewal fee for a loan extension, crediting users for * the unused portion of origination fees already paid on mints within the * current term. * * Formula: * For each qualifying mint_i (mint.quantumTimestamp >= termStart): * daysElapsed_i = (renewalNow - mint.quantumTimestamp) / SECONDS_PER_DAY * proRataEarned_i = (daysElapsed_i * mint.mintFee) / termDays * credit_i = mint.mintFee - proRataEarned_i * * overpayment = max(0, sum(mintFee_i) - sum(proRataEarned_i)) * baselineRenewalFee = ucdDebt * extensionFeeRateBps / 10000 * finalRenewalFee = max(0, baselineRenewalFee - overpayment) */ export interface MintRecord { mintFee: bigint; quantumTimestamp: bigint; } export interface ProRataFeeParams { /** Mints in the current term (already filtered by termStart) */ mints: MintRecord[]; /** Term start timestamp (seconds) */ termStart: bigint; /** Position expiry timestamp (seconds) */ termExpiry: bigint; /** Current quantum timestamp used for the renewal signing (seconds) */ renewalNow: bigint; /** Current UCD debt (18-decimal) */ ucdDebt: bigint; /** Extension fee rate in basis points (e.g. 300 = 3%) */ extensionFeeRateBps: bigint; } /** * Compute the pro-rata renewal fee. * * All arithmetic uses integer division (bigint) — this matches the Lit Action * execution environment and the on-chain trust model (the signed value is * accepted verbatim by the contract). * * The fee is always >= 0 (floor at zero, no negative/subsidy possible). */ export declare function computeProRataRenewalFee(params: ProRataFeeParams): bigint; //# sourceMappingURL=pro-rata-fee.module.d.ts.map