import { Provider } from '@ethersproject/providers'; import { BigNumber, ContractTransaction, Signer } from 'ethers'; import { SdkConfig } from '../../sdk-config'; import { LockPeriod, LockPeriodInterface, LoyaltySchedule, RSVDeadlineValue, UserBonusData, UserLock } from './types'; export declare class KSULocking { private _kasuConfig; private readonly _contractAbi; private readonly _kasuToken; private readonly _kasuBonusAddress; private readonly _graph; private readonly _userManagerAbi; private readonly _systemVariablesAbi; private readonly _ksuPriceAbi; private readonly _userLoyaltyRewardsAbi; private readonly _isLiteDeployment; constructor(_kasuConfig: SdkConfig, signerOrProvider: Signer | Provider); /** * Check if this is a Lite deployment (no KSU token functionality) */ get isLiteDeployment(): boolean; lockKSUTokens(amount: BigNumber, lockPeriod: BigNumber): Promise; lockKSUWithPermit(amount: number, lockPeriod: number, permit: RSVDeadlineValue): Promise; unlockKSU(amount: BigNumber, userLockId: BigNumber): Promise; claimFees(): Promise; lockDetails(lockPeriod: BigNumber): Promise; userTotalDeposits(userAddress: string): Promise; calculateUserLockProjectedProtocolFeeRewards(epochId: string, KSULocked: number, lockPeriod: BigNumber): Promise; /** * A per-epoch interest rate compounded into an APY. * * This used to read `(1 + epochInterestRate) ^ (EPOCHS_IN_YEAR - 1)`. * `^` is JavaScript's BITWISE XOR, not exponentiation: both operands were * coerced to int32, so for a realistic epoch rate of ~0.003 it computed * `1 ^ 51` and returned the constant 50 — a 5000% APY — for every tranche, * regardless of its rate. Its only caller, * `calculateUserLockProjectedProtocolFeeRewards`, multiplied that by each * tranche balance, so its projection was nonsense rather than merely * imprecise. * * Now the same compounding every other rate in the SDK uses. */ calculateApy(epochInterestRate: number): number; getUserLocks(userAddress: string): Promise; getUserBonusData(userAddress: string): Promise; /** * The loyalty thresholds and each level's KSU bonus, read from chain: * `SystemVariables.loyaltyThresholds()` and * `UserLoyaltyRewards.loyaltyEpochRewardRates(level)` for every level. * Both are admin-settable, so nothing here is hard-coded. Lite has no * levels: `{ thresholdsBps: [], apyBonuses: [0], epochRewardRates: [0] }`. * * For one lender's full status (level, requirements, one block), use * `kasu.loyalty.getStatus`. */ getLoyaltySchedule(): Promise; /** * The level a ratio reaches under `schedule` (from `getLoyaltySchedule`): * how many thresholds it meets, in order, stopping at the first miss — * `UserManager._userLoyaltyLevel`'s rule — and that level's annual KSU * bonus as a fraction (`0.001` = 0.1 %). * * @param rKSUtoStableRatio a 0..1 fraction (`getRKSUvsStableRatio`). * A float ratio can land either side of a threshold the contract decides * in integers; for a level to show a lender, use `kasu.loyalty.getStatus`, * which computes it exactly and checks it against the contract. */ getLoyaltyLevelAndApyBonusFromRatio(rKSUtoStableRatio: number, schedule: LoyaltySchedule): { loyaltyLevel: number; apyBonus: number; }; getRKSUvsStableRatio(rKSUAmount: string, userAddress: string): Promise; /** @deprecated Use `getRKSUvsStableRatio` instead. */ getRKSUvsUSDCRatio(rKSUAmount: string, userAddress: string): Promise; getClaimableRewards(userAddress: string): Promise; getKasuTokenPrice(): Promise<{ price: BigNumber; decimals: number; }>; getKasuEpochTokenPrice(): Promise<{ price: BigNumber; decimals: number; }>; getLifetimeRewards(userAddress: string, rewardDecimals: number, claimableRewards?: BigNumber): Promise; getLaunchBonusAmount(lockAmount: BigNumber, bonusMultiplier: number, bonusTokensLeft: BigNumber): BigNumber; getUserStakedKsu(userAddress: string): Promise; getUserEarnedrKsu(userAddress: string): Promise; getUserTotalBonusAmount(userAddress: string): Promise; getLockingRewards(userAddress: string): Promise<{ claimableRewards: string; lifeTimeRewards: string; }>; getTotalKsuStaked(): Promise; getAvailableKsuBonus(): Promise; getUserKsuBalance(userAddress: string): Promise; getNextEpochDate(): Promise; /** * Unix SECONDS at which epoch 0 started: * `SystemVariables.epochStartTimestamp(0)`. The contract writes this once, * at initialisation, so it never changes for a deployment and may be cached * for the life of the app. Every epoch boundary follows from it — * `epochEndTimestamp(initial, epoch)` and `epochAccrual` in the domain * layer. * * Available on every deployment, Full and Lite. A failed read rejects; the * caller validates the value (a positive integer) before using it. */ getInitialEpochStartTimestamp(): Promise; getNextClearingPeriodDate(): Promise; getActiveLockPeriods(): Promise; getProjectedApy(): string; getProjectedStableAmount(): string; /** @deprecated Use `getProjectedStableAmount` instead. */ getProjectedUSDC(): string; }