UNPKG

@kamino-finance/farms-sdk

Version:
50 lines 2 kB
import Decimal from "decimal.js"; /** * Validates VestingConfig parameters to ensure they are within acceptable bounds. * @throws Error if any validation fails */ export declare function validateVestingConfig(config: VestingConfig): void; export interface VestingConfig { vestingStartTimestampSeconds: number; vestingDurationSeconds: number; minClaimablePercentStart: number; maxClaimablePercentEnd: number; growthRate: number; } export interface VestingCalculation { calculatedAt: number; daysElapsed: number; claimablePercent: number; forfeitablePercent: number; claimableAmount: Decimal; forfeitableAmount: Decimal; isFullyVested: boolean; } /** * Calculates the claimable percentage at a specific point in time using an exponential curve. * * Formula: claimablePercent = MIN + (MAX - MIN) * ((e^(k*t/T) - 1) / (e^k - 1)) * where: * - MIN = minimum claimable (10%) * - MAX = maximum claimable (100%) * - k = growth rate (2.506) * - t = time elapsed * - T = total vesting duration * * @param currentTimestamp - The current timestamp in seconds * @param config - Vesting configuration * @returns Claimable percentage (capped between minClaimablePercentStart and maxClaimablePercentEnd) */ export declare function calculateClaimablePercentAtTime(currentTimestamp: number, config: VestingConfig): number; /** * Calculates the full vesting details for a user at the current point in time. * This function can be called by the crank at any time to determine how much * a user can claim and how much they would forfeit. * * @param userAllocation - User's total allocation * @param currentTimestamp - Current timestamp in seconds (defaults to now) * @param config - Vesting configuration * @returns Complete vesting calculation */ export declare function calculateVestingAtTime(userAllocation: Decimal, currentTimestamp: number | undefined, config: VestingConfig): VestingCalculation; //# sourceMappingURL=vestingUtils.d.ts.map