UNPKG

@kamino-finance/klend-sdk

Version:

Typescript SDK for interacting with the Kamino Lending (klend) protocol

365 lines 15.4 kB
import { PublicKey } from "@solana/web3.js"; import BN from "bn.js"; import * as types from "../types"; export interface ReserveConfigFields { /** Status of the reserve Active/Obsolete/Hidden */ status: number; /** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */ assetTier: number; /** Flat rate that goes to the host */ hostFixedInterestRateBps: number; /** [DEPRECATED] Boost for side (debt or collateral) */ reserved2: Array<number>; /** [DEPRECATED] Reward points multiplier per obligation type */ reserved3: Array<number>; /** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */ protocolTakeRatePct: number; /** Cut of the liquidation bonus that the protocol receives, as a percentage */ protocolLiquidationFeePct: number; /** * Target ratio of the value of borrows to deposits, as a percentage * 0 if use as collateral is disabled */ loanToValuePct: number; /** Loan to value ratio at which an obligation can be liquidated, as percentage */ liquidationThresholdPct: number; /** Minimum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */ minLiquidationBonusBps: number; /** Maximum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */ maxLiquidationBonusBps: number; /** Bad debt liquidation bonus for an undercollateralized obligation, as bps */ badDebtLiquidationBonusBps: number; /** Time in seconds that must pass before redemptions are enabled after the deposit limit is crossed */ deleveragingMarginCallPeriodSecs: BN; /** * The rate at which the deleveraging threshold decreases in slots per bps * e.g. 1 bps per hour would be 7200 slots per bps (assuming 2 slots per second) */ deleveragingThresholdSlotsPerBps: BN; /** Program owner fees assessed, separate from gains due to interest accrual */ fees: types.ReserveFeesFields; /** Borrow rate curve based on utilization */ borrowRateCurve: types.BorrowRateCurveFields; /** Borrow factor in percentage - used for risk adjustment */ borrowFactorPct: BN; /** Maximum deposit limit of liquidity in native units, u64::MAX for inf */ depositLimit: BN; /** Maximum amount borrowed, u64::MAX for inf, 0 to disable borrows (protected deposits) */ borrowLimit: BN; /** Token id from TokenInfos struct */ tokenInfo: types.TokenInfoFields; /** Deposit withdrawl caps - deposit & redeem */ depositWithdrawalCap: types.WithdrawalCapsFields; /** Debt withdrawl caps - borrow & repay */ debtWithdrawalCap: types.WithdrawalCapsFields; elevationGroups: Array<number>; disableUsageAsCollOutsideEmode: number; utilizationLimitBlockBorrowingAbove: number; reserved1: Array<number>; /** * Maximum amount liquidity of this reserve borrowed outside all elevation groups * - u64::MAX for inf * - 0 to disable borrows outside elevation groups */ borrowLimitOutsideElevationGroup: BN; /** * Defines the maximum amount (in lamports of elevation group debt asset) * that can be borrowed when this reserve is used as collateral. * - u64::MAX for inf * - 0 to disable borrows in this elevation group (expected value for the debt asset) */ borrowLimitAgainstThisCollateralInElevationGroup: Array<BN>; } export interface ReserveConfigJSON { /** Status of the reserve Active/Obsolete/Hidden */ status: number; /** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */ assetTier: number; /** Flat rate that goes to the host */ hostFixedInterestRateBps: number; /** [DEPRECATED] Boost for side (debt or collateral) */ reserved2: Array<number>; /** [DEPRECATED] Reward points multiplier per obligation type */ reserved3: Array<number>; /** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */ protocolTakeRatePct: number; /** Cut of the liquidation bonus that the protocol receives, as a percentage */ protocolLiquidationFeePct: number; /** * Target ratio of the value of borrows to deposits, as a percentage * 0 if use as collateral is disabled */ loanToValuePct: number; /** Loan to value ratio at which an obligation can be liquidated, as percentage */ liquidationThresholdPct: number; /** Minimum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */ minLiquidationBonusBps: number; /** Maximum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */ maxLiquidationBonusBps: number; /** Bad debt liquidation bonus for an undercollateralized obligation, as bps */ badDebtLiquidationBonusBps: number; /** Time in seconds that must pass before redemptions are enabled after the deposit limit is crossed */ deleveragingMarginCallPeriodSecs: string; /** * The rate at which the deleveraging threshold decreases in slots per bps * e.g. 1 bps per hour would be 7200 slots per bps (assuming 2 slots per second) */ deleveragingThresholdSlotsPerBps: string; /** Program owner fees assessed, separate from gains due to interest accrual */ fees: types.ReserveFeesJSON; /** Borrow rate curve based on utilization */ borrowRateCurve: types.BorrowRateCurveJSON; /** Borrow factor in percentage - used for risk adjustment */ borrowFactorPct: string; /** Maximum deposit limit of liquidity in native units, u64::MAX for inf */ depositLimit: string; /** Maximum amount borrowed, u64::MAX for inf, 0 to disable borrows (protected deposits) */ borrowLimit: string; /** Token id from TokenInfos struct */ tokenInfo: types.TokenInfoJSON; /** Deposit withdrawl caps - deposit & redeem */ depositWithdrawalCap: types.WithdrawalCapsJSON; /** Debt withdrawl caps - borrow & repay */ debtWithdrawalCap: types.WithdrawalCapsJSON; elevationGroups: Array<number>; disableUsageAsCollOutsideEmode: number; utilizationLimitBlockBorrowingAbove: number; reserved1: Array<number>; /** * Maximum amount liquidity of this reserve borrowed outside all elevation groups * - u64::MAX for inf * - 0 to disable borrows outside elevation groups */ borrowLimitOutsideElevationGroup: string; /** * Defines the maximum amount (in lamports of elevation group debt asset) * that can be borrowed when this reserve is used as collateral. * - u64::MAX for inf * - 0 to disable borrows in this elevation group (expected value for the debt asset) */ borrowLimitAgainstThisCollateralInElevationGroup: Array<string>; } /** Reserve configuration values */ export declare class ReserveConfig { /** Status of the reserve Active/Obsolete/Hidden */ readonly status: number; /** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */ readonly assetTier: number; /** Flat rate that goes to the host */ readonly hostFixedInterestRateBps: number; /** [DEPRECATED] Boost for side (debt or collateral) */ readonly reserved2: Array<number>; /** [DEPRECATED] Reward points multiplier per obligation type */ readonly reserved3: Array<number>; /** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */ readonly protocolTakeRatePct: number; /** Cut of the liquidation bonus that the protocol receives, as a percentage */ readonly protocolLiquidationFeePct: number; /** * Target ratio of the value of borrows to deposits, as a percentage * 0 if use as collateral is disabled */ readonly loanToValuePct: number; /** Loan to value ratio at which an obligation can be liquidated, as percentage */ readonly liquidationThresholdPct: number; /** Minimum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */ readonly minLiquidationBonusBps: number; /** Maximum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */ readonly maxLiquidationBonusBps: number; /** Bad debt liquidation bonus for an undercollateralized obligation, as bps */ readonly badDebtLiquidationBonusBps: number; /** Time in seconds that must pass before redemptions are enabled after the deposit limit is crossed */ readonly deleveragingMarginCallPeriodSecs: BN; /** * The rate at which the deleveraging threshold decreases in slots per bps * e.g. 1 bps per hour would be 7200 slots per bps (assuming 2 slots per second) */ readonly deleveragingThresholdSlotsPerBps: BN; /** Program owner fees assessed, separate from gains due to interest accrual */ readonly fees: types.ReserveFees; /** Borrow rate curve based on utilization */ readonly borrowRateCurve: types.BorrowRateCurve; /** Borrow factor in percentage - used for risk adjustment */ readonly borrowFactorPct: BN; /** Maximum deposit limit of liquidity in native units, u64::MAX for inf */ readonly depositLimit: BN; /** Maximum amount borrowed, u64::MAX for inf, 0 to disable borrows (protected deposits) */ readonly borrowLimit: BN; /** Token id from TokenInfos struct */ readonly tokenInfo: types.TokenInfo; /** Deposit withdrawl caps - deposit & redeem */ readonly depositWithdrawalCap: types.WithdrawalCaps; /** Debt withdrawl caps - borrow & repay */ readonly debtWithdrawalCap: types.WithdrawalCaps; readonly elevationGroups: Array<number>; readonly disableUsageAsCollOutsideEmode: number; readonly utilizationLimitBlockBorrowingAbove: number; readonly reserved1: Array<number>; /** * Maximum amount liquidity of this reserve borrowed outside all elevation groups * - u64::MAX for inf * - 0 to disable borrows outside elevation groups */ readonly borrowLimitOutsideElevationGroup: BN; /** * Defines the maximum amount (in lamports of elevation group debt asset) * that can be borrowed when this reserve is used as collateral. * - u64::MAX for inf * - 0 to disable borrows in this elevation group (expected value for the debt asset) */ readonly borrowLimitAgainstThisCollateralInElevationGroup: Array<BN>; constructor(fields: ReserveConfigFields); static layout(property?: string): any; static fromDecoded(obj: any): types.ReserveConfig; static toEncodable(fields: ReserveConfigFields): { status: number; assetTier: number; hostFixedInterestRateBps: number; reserved2: number[]; reserved3: number[]; protocolTakeRatePct: number; protocolLiquidationFeePct: number; loanToValuePct: number; liquidationThresholdPct: number; minLiquidationBonusBps: number; maxLiquidationBonusBps: number; badDebtLiquidationBonusBps: number; deleveragingMarginCallPeriodSecs: BN; deleveragingThresholdSlotsPerBps: BN; fees: { borrowFeeSf: BN; flashLoanFeeSf: BN; padding: number[]; }; borrowRateCurve: { points: { utilizationRateBps: number; borrowRateBps: number; }[]; }; borrowFactorPct: BN; depositLimit: BN; borrowLimit: BN; tokenInfo: { name: number[]; heuristic: { lower: BN; upper: BN; exp: BN; }; maxTwapDivergenceBps: BN; maxAgePriceSeconds: BN; maxAgeTwapSeconds: BN; scopeConfiguration: { priceFeed: PublicKey; priceChain: number[]; twapChain: number[]; }; switchboardConfiguration: { priceAggregator: PublicKey; twapAggregator: PublicKey; }; pythConfiguration: { price: PublicKey; }; blockPriceUsage: number; reserved: number[]; padding: BN[]; }; depositWithdrawalCap: { configCapacity: BN; currentTotal: BN; lastIntervalStartTimestamp: BN; configIntervalLengthSeconds: BN; }; debtWithdrawalCap: { configCapacity: BN; currentTotal: BN; lastIntervalStartTimestamp: BN; configIntervalLengthSeconds: BN; }; elevationGroups: number[]; disableUsageAsCollOutsideEmode: number; utilizationLimitBlockBorrowingAbove: number; reserved1: number[]; borrowLimitOutsideElevationGroup: BN; borrowLimitAgainstThisCollateralInElevationGroup: BN[]; }; toJSON(): ReserveConfigJSON; static fromJSON(obj: ReserveConfigJSON): ReserveConfig; toEncodable(): { status: number; assetTier: number; hostFixedInterestRateBps: number; reserved2: number[]; reserved3: number[]; protocolTakeRatePct: number; protocolLiquidationFeePct: number; loanToValuePct: number; liquidationThresholdPct: number; minLiquidationBonusBps: number; maxLiquidationBonusBps: number; badDebtLiquidationBonusBps: number; deleveragingMarginCallPeriodSecs: BN; deleveragingThresholdSlotsPerBps: BN; fees: { borrowFeeSf: BN; flashLoanFeeSf: BN; padding: number[]; }; borrowRateCurve: { points: { utilizationRateBps: number; borrowRateBps: number; }[]; }; borrowFactorPct: BN; depositLimit: BN; borrowLimit: BN; tokenInfo: { name: number[]; heuristic: { lower: BN; upper: BN; exp: BN; }; maxTwapDivergenceBps: BN; maxAgePriceSeconds: BN; maxAgeTwapSeconds: BN; scopeConfiguration: { priceFeed: PublicKey; priceChain: number[]; twapChain: number[]; }; switchboardConfiguration: { priceAggregator: PublicKey; twapAggregator: PublicKey; }; pythConfiguration: { price: PublicKey; }; blockPriceUsage: number; reserved: number[]; padding: BN[]; }; depositWithdrawalCap: { configCapacity: BN; currentTotal: BN; lastIntervalStartTimestamp: BN; configIntervalLengthSeconds: BN; }; debtWithdrawalCap: { configCapacity: BN; currentTotal: BN; lastIntervalStartTimestamp: BN; configIntervalLengthSeconds: BN; }; elevationGroups: number[]; disableUsageAsCollOutsideEmode: number; utilizationLimitBlockBorrowingAbove: number; reserved1: number[]; borrowLimitOutsideElevationGroup: BN; borrowLimitAgainstThisCollateralInElevationGroup: BN[]; }; } //# sourceMappingURL=ReserveConfig.d.ts.map