UNPKG

@kamino-finance/klend-sdk

Version:

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

479 lines 20.9 kB
import { Address } from "@solana/kit"; 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] Space that used to hold 2 fields: * - Boost for side (debt or collateral) * - Reward points multiplier per obligation type * Can be re-used after making sure all underlying production account data is zeroed. */ reserved1: Array<number>; /** Cut of the order execution bonus that the protocol receives, as a percentage */ protocolOrderExecutionFeePct: 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. * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case. */ deleveragingMarginCallPeriodSecs: BN; /** * The rate at which the deleveraging threshold decreases, in bps per day. * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case. */ deleveragingThresholdDecreaseBpsPerDay: 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 withdrawal caps - deposit & redeem */ depositWithdrawalCap: types.WithdrawalCapsFields; /** Debt withdrawal caps - borrow & repay */ debtWithdrawalCap: types.WithdrawalCapsFields; elevationGroups: Array<number>; disableUsageAsCollOutsideEmode: number; /** Utilization (in percentage) above which borrowing is blocked. 0 to disable. */ utilizationLimitBlockBorrowingAbovePct: number; /** * Whether this reserve should be subject to auto-deleveraging after deposit or borrow limit is * crossed. * Besides this flag, the lending market's flag also needs to be enabled (logical `AND`). * **NOTE:** the manual "target LTV" deleveraging (enabled by the risk council for individual * obligations) is NOT affected by this flag. */ autodeleverageEnabled: number; /** * Boolean flag indicating whether the reserve is locked for the proposer authority. * * Once the proposer have finished preparing the reserve, it must be locked to prevent * further changes to the reserve configuration allowing review and voting on the proposal * without alteration during the voting period. */ proposerAuthorityLocked: 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>; /** * The rate at which the deleveraging-related liquidation bonus increases, in bps per day. * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case. */ deleveragingBonusIncreaseBpsPerDay: BN; /** * The timestamp at which all [Obligation::borrows] using this reserve become liquidatable * (on the same terms as reserve-wide deleveraging). * Inactive when zeroed (i.e. debt never matures). */ debtMaturityTimestamp: 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] Space that used to hold 2 fields: * - Boost for side (debt or collateral) * - Reward points multiplier per obligation type * Can be re-used after making sure all underlying production account data is zeroed. */ reserved1: Array<number>; /** Cut of the order execution bonus that the protocol receives, as a percentage */ protocolOrderExecutionFeePct: 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. * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case. */ deleveragingMarginCallPeriodSecs: string; /** * The rate at which the deleveraging threshold decreases, in bps per day. * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case. */ deleveragingThresholdDecreaseBpsPerDay: 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 withdrawal caps - deposit & redeem */ depositWithdrawalCap: types.WithdrawalCapsJSON; /** Debt withdrawal caps - borrow & repay */ debtWithdrawalCap: types.WithdrawalCapsJSON; elevationGroups: Array<number>; disableUsageAsCollOutsideEmode: number; /** Utilization (in percentage) above which borrowing is blocked. 0 to disable. */ utilizationLimitBlockBorrowingAbovePct: number; /** * Whether this reserve should be subject to auto-deleveraging after deposit or borrow limit is * crossed. * Besides this flag, the lending market's flag also needs to be enabled (logical `AND`). * **NOTE:** the manual "target LTV" deleveraging (enabled by the risk council for individual * obligations) is NOT affected by this flag. */ autodeleverageEnabled: number; /** * Boolean flag indicating whether the reserve is locked for the proposer authority. * * Once the proposer have finished preparing the reserve, it must be locked to prevent * further changes to the reserve configuration allowing review and voting on the proposal * without alteration during the voting period. */ proposerAuthorityLocked: 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>; /** * The rate at which the deleveraging-related liquidation bonus increases, in bps per day. * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case. */ deleveragingBonusIncreaseBpsPerDay: string; /** * The timestamp at which all [Obligation::borrows] using this reserve become liquidatable * (on the same terms as reserve-wide deleveraging). * Inactive when zeroed (i.e. debt never matures). */ debtMaturityTimestamp: 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] Space that used to hold 2 fields: * - Boost for side (debt or collateral) * - Reward points multiplier per obligation type * Can be re-used after making sure all underlying production account data is zeroed. */ readonly reserved1: Array<number>; /** Cut of the order execution bonus that the protocol receives, as a percentage */ readonly protocolOrderExecutionFeePct: 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. * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case. */ readonly deleveragingMarginCallPeriodSecs: BN; /** * The rate at which the deleveraging threshold decreases, in bps per day. * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case. */ readonly deleveragingThresholdDecreaseBpsPerDay: 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 withdrawal caps - deposit & redeem */ readonly depositWithdrawalCap: types.WithdrawalCaps; /** Debt withdrawal caps - borrow & repay */ readonly debtWithdrawalCap: types.WithdrawalCaps; readonly elevationGroups: Array<number>; readonly disableUsageAsCollOutsideEmode: number; /** Utilization (in percentage) above which borrowing is blocked. 0 to disable. */ readonly utilizationLimitBlockBorrowingAbovePct: number; /** * Whether this reserve should be subject to auto-deleveraging after deposit or borrow limit is * crossed. * Besides this flag, the lending market's flag also needs to be enabled (logical `AND`). * **NOTE:** the manual "target LTV" deleveraging (enabled by the risk council for individual * obligations) is NOT affected by this flag. */ readonly autodeleverageEnabled: number; /** * Boolean flag indicating whether the reserve is locked for the proposer authority. * * Once the proposer have finished preparing the reserve, it must be locked to prevent * further changes to the reserve configuration allowing review and voting on the proposal * without alteration during the voting period. */ readonly proposerAuthorityLocked: 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>; /** * The rate at which the deleveraging-related liquidation bonus increases, in bps per day. * Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case. */ readonly deleveragingBonusIncreaseBpsPerDay: BN; /** * The timestamp at which all [Obligation::borrows] using this reserve become liquidatable * (on the same terms as reserve-wide deleveraging). * Inactive when zeroed (i.e. debt never matures). */ readonly debtMaturityTimestamp: BN; constructor(fields: ReserveConfigFields); static layout(property?: string): import("buffer-layout").Layout<unknown>; static fromDecoded(obj: any): types.ReserveConfig; static toEncodable(fields: ReserveConfigFields): { status: number; assetTier: number; hostFixedInterestRateBps: number; reserved1: number[]; protocolOrderExecutionFeePct: number; protocolTakeRatePct: number; protocolLiquidationFeePct: number; loanToValuePct: number; liquidationThresholdPct: number; minLiquidationBonusBps: number; maxLiquidationBonusBps: number; badDebtLiquidationBonusBps: number; deleveragingMarginCallPeriodSecs: BN; deleveragingThresholdDecreaseBpsPerDay: 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: Address; priceChain: number[]; twapChain: number[]; }; switchboardConfiguration: { priceAggregator: Address; twapAggregator: Address; }; pythConfiguration: { price: Address; }; 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; utilizationLimitBlockBorrowingAbovePct: number; autodeleverageEnabled: number; proposerAuthorityLocked: number; borrowLimitOutsideElevationGroup: BN; borrowLimitAgainstThisCollateralInElevationGroup: BN[]; deleveragingBonusIncreaseBpsPerDay: BN; debtMaturityTimestamp: BN; }; toJSON(): ReserveConfigJSON; static fromJSON(obj: ReserveConfigJSON): ReserveConfig; toEncodable(): { status: number; assetTier: number; hostFixedInterestRateBps: number; reserved1: number[]; protocolOrderExecutionFeePct: number; protocolTakeRatePct: number; protocolLiquidationFeePct: number; loanToValuePct: number; liquidationThresholdPct: number; minLiquidationBonusBps: number; maxLiquidationBonusBps: number; badDebtLiquidationBonusBps: number; deleveragingMarginCallPeriodSecs: BN; deleveragingThresholdDecreaseBpsPerDay: 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: Address; priceChain: number[]; twapChain: number[]; }; switchboardConfiguration: { priceAggregator: Address; twapAggregator: Address; }; pythConfiguration: { price: Address; }; 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; utilizationLimitBlockBorrowingAbovePct: number; autodeleverageEnabled: number; proposerAuthorityLocked: number; borrowLimitOutsideElevationGroup: BN; borrowLimitAgainstThisCollateralInElevationGroup: BN[]; deleveragingBonusIncreaseBpsPerDay: BN; debtMaturityTimestamp: BN; }; } //# sourceMappingURL=ReserveConfig.d.ts.map