@kamino-finance/klend-sdk 5.0.3 → 5.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes/manager.d.ts +38 -4
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +98 -4
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js +2 -25
- package/dist/classes/market.js.map +1 -1
- package/dist/classes/vault.d.ts +12 -8
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +94 -66
- package/dist/classes/vault.js.map +1 -1
- package/dist/client_kamino_manager.d.ts.map +1 -1
- package/dist/client_kamino_manager.js +14 -0
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.d.ts +3 -3
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.js +22 -18
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts +45 -15
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.js +101 -39
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/index.d.ts +4 -4
- package/dist/idl_codegen_kamino_vault/accounts/index.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/anchor.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/anchor.js +162 -162
- package/dist/idl_codegen_kamino_vault/errors/anchor.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.d.ts +144 -32
- package/dist/idl_codegen_kamino_vault/errors/custom.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.js +305 -109
- package/dist/idl_codegen_kamino_vault/errors/custom.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/index.d.ts +3 -3
- package/dist/idl_codegen_kamino_vault/errors/index.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/index.js +7 -2
- package/dist/idl_codegen_kamino_vault/errors/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/deposit.d.ts +4 -2
- package/dist/idl_codegen_kamino_vault/instructions/deposit.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/deposit.js +3 -1
- package/dist/idl_codegen_kamino_vault/instructions/deposit.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.d.ts +13 -0
- package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.js +47 -0
- package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/index.d.ts +18 -10
- package/dist/idl_codegen_kamino_vault/instructions/index.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/index.js +9 -1
- package/dist/idl_codegen_kamino_vault/instructions/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts +2 -1
- package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/initVault.js +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/initVault.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/invest.d.ts +6 -2
- package/dist/idl_codegen_kamino_vault/instructions/invest.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/invest.js +9 -1
- package/dist/idl_codegen_kamino_vault/instructions/invest.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.d.ts +7 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.js +16 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.d.ts +14 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.js +52 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.d.ts +4 -2
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.js +8 -2
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.d.ts +23 -0
- package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.js +51 -0
- package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/programId.d.ts +1 -1
- package/dist/idl_codegen_kamino_vault/programId.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/programId.js +1 -1
- package/dist/idl_codegen_kamino_vault/programId.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.js +4 -1
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.d.ts +1 -1
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.d.ts +1 -1
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.js +6 -1
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.d.ts +3 -3
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.js +5 -5
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.d.ts +27 -24
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.js +59 -53
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.js +5 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.d.ts +11 -3
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.js +25 -17
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.js +3 -3
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.d.ts +3 -3
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.js +11 -11
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.d.ts +18 -8
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.js +27 -13
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts +110 -0
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js +242 -0
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/index.d.ts +34 -30
- package/dist/idl_codegen_kamino_vault/types/index.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/index.js +26 -1
- package/dist/idl_codegen_kamino_vault/types/index.js.map +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.d.ts.map +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.js +6 -0
- package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
- package/dist/leverage/calcs.d.ts +28 -1
- package/dist/leverage/calcs.d.ts.map +1 -1
- package/dist/leverage/calcs.js +204 -8
- package/dist/leverage/calcs.js.map +1 -1
- package/dist/leverage/index.d.ts +1 -0
- package/dist/leverage/index.d.ts.map +1 -1
- package/dist/leverage/index.js +1 -0
- package/dist/leverage/index.js.map +1 -1
- package/dist/leverage/operations.d.ts +14 -241
- package/dist/leverage/operations.d.ts.map +1 -1
- package/dist/leverage/operations.js +508 -776
- package/dist/leverage/operations.js.map +1 -1
- package/dist/leverage/types.d.ts +173 -0
- package/dist/leverage/types.d.ts.map +1 -0
- package/dist/leverage/types.js +3 -0
- package/dist/leverage/types.js.map +1 -0
- package/dist/leverage/utils.d.ts +5 -5
- package/dist/leverage/utils.d.ts.map +1 -1
- package/dist/leverage/utils.js +68 -33
- package/dist/leverage/utils.js.map +1 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +2 -1
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/fuzz.d.ts +3 -0
- package/dist/utils/fuzz.d.ts.map +1 -0
- package/dist/utils/fuzz.js +11 -0
- package/dist/utils/fuzz.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/rpc.d.ts.map +1 -1
- package/dist/utils/rpc.js +2 -1
- package/dist/utils/rpc.js.map +1 -1
- package/package.json +2 -1
- package/src/classes/manager.ts +122 -4
- package/src/classes/market.ts +1 -1
- package/src/classes/vault.ts +123 -49
- package/src/client_kamino_manager.ts +18 -0
- package/src/idl_codegen_kamino_vault/accounts/Reserve.ts +132 -105
- package/src/idl_codegen_kamino_vault/accounts/VaultState.ts +217 -124
- package/src/idl_codegen_kamino_vault/accounts/index.ts +4 -4
- package/src/idl_codegen_kamino_vault/errors/anchor.ts +335 -326
- package/src/idl_codegen_kamino_vault/errors/custom.ts +353 -157
- package/src/idl_codegen_kamino_vault/errors/index.ts +35 -22
- package/src/idl_codegen_kamino_vault/instructions/deposit.ts +33 -25
- package/src/idl_codegen_kamino_vault/instructions/giveUpPendingFees.ts +40 -0
- package/src/idl_codegen_kamino_vault/instructions/index.ts +27 -10
- package/src/idl_codegen_kamino_vault/instructions/initVault.ts +25 -20
- package/src/idl_codegen_kamino_vault/instructions/invest.ts +40 -25
- package/src/idl_codegen_kamino_vault/instructions/updateAdmin.ts +24 -0
- package/src/idl_codegen_kamino_vault/instructions/updateReserveAllocation.ts +24 -24
- package/src/idl_codegen_kamino_vault/instructions/updateVaultConfig.ts +49 -0
- package/src/idl_codegen_kamino_vault/instructions/withdraw.ts +45 -33
- package/src/idl_codegen_kamino_vault/instructions/withdrawPendingFees.ts +75 -0
- package/src/idl_codegen_kamino_vault/programId.ts +5 -3
- package/src/idl_codegen_kamino_vault/types/BigFractionBytes.ts +24 -18
- package/src/idl_codegen_kamino_vault/types/BorrowRateCurve.ts +21 -16
- package/src/idl_codegen_kamino_vault/types/CurvePoint.ts +21 -18
- package/src/idl_codegen_kamino_vault/types/LastUpdate.ts +32 -27
- package/src/idl_codegen_kamino_vault/types/PriceHeuristic.ts +25 -22
- package/src/idl_codegen_kamino_vault/types/PythConfiguration.ts +14 -14
- package/src/idl_codegen_kamino_vault/types/ReserveCollateral.ts +35 -35
- package/src/idl_codegen_kamino_vault/types/ReserveConfig.ts +232 -191
- package/src/idl_codegen_kamino_vault/types/ReserveFees.ts +27 -23
- package/src/idl_codegen_kamino_vault/types/ReserveLiquidity.ts +116 -98
- package/src/idl_codegen_kamino_vault/types/ScopeConfiguration.ts +25 -25
- package/src/idl_codegen_kamino_vault/types/SwitchboardConfiguration.ts +21 -18
- package/src/idl_codegen_kamino_vault/types/TokenInfo.ts +92 -74
- package/src/idl_codegen_kamino_vault/types/VaultAllocation.ts +67 -49
- package/src/idl_codegen_kamino_vault/types/VaultConfigField.ts +270 -0
- package/src/idl_codegen_kamino_vault/types/index.ts +77 -30
- package/src/lending_operations/repay_with_collateral_operations.ts +2 -0
- package/src/leverage/calcs.ts +315 -8
- package/src/leverage/index.ts +1 -0
- package/src/leverage/operations.ts +1079 -1331
- package/src/leverage/types.ts +211 -0
- package/src/leverage/utils.ts +103 -64
- package/src/utils/constants.ts +2 -0
- package/src/utils/fuzz.ts +5 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/rpc.ts +2 -1
|
@@ -1,286 +1,298 @@
|
|
|
1
|
-
import { PublicKey } from
|
|
2
|
-
import BN from
|
|
3
|
-
import * as types from
|
|
4
|
-
import * as borsh from
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
|
5
5
|
|
|
6
6
|
export interface ReserveConfigFields {
|
|
7
7
|
/** Status of the reserve Active/Obsolete/Hidden */
|
|
8
|
-
status: number
|
|
8
|
+
status: number
|
|
9
9
|
/** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */
|
|
10
|
-
assetTier: number
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
assetTier: number
|
|
11
|
+
/** Flat rate that goes to the host */
|
|
12
|
+
hostFixedInterestRateBps: number
|
|
13
|
+
/** [DEPRECATED] Boost for side (debt or collateral) */
|
|
14
|
+
reserved2: Array<number>
|
|
15
|
+
/** [DEPRECATED] Reward points multiplier per obligation type */
|
|
16
|
+
reserved3: Array<number>
|
|
16
17
|
/** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
|
|
17
|
-
protocolTakeRatePct: number
|
|
18
|
+
protocolTakeRatePct: number
|
|
18
19
|
/** Cut of the liquidation bonus that the protocol receives, as a percentage */
|
|
19
|
-
protocolLiquidationFeePct: number
|
|
20
|
+
protocolLiquidationFeePct: number
|
|
20
21
|
/**
|
|
21
22
|
* Target ratio of the value of borrows to deposits, as a percentage
|
|
22
23
|
* 0 if use as collateral is disabled
|
|
23
24
|
*/
|
|
24
|
-
loanToValuePct: number
|
|
25
|
+
loanToValuePct: number
|
|
25
26
|
/** Loan to value ratio at which an obligation can be liquidated, as percentage */
|
|
26
|
-
liquidationThresholdPct: number
|
|
27
|
+
liquidationThresholdPct: number
|
|
27
28
|
/** Minimum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */
|
|
28
|
-
minLiquidationBonusBps: number
|
|
29
|
+
minLiquidationBonusBps: number
|
|
29
30
|
/** Maximum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */
|
|
30
|
-
maxLiquidationBonusBps: number
|
|
31
|
+
maxLiquidationBonusBps: number
|
|
31
32
|
/** Bad debt liquidation bonus for an undercollateralized obligation, as bps */
|
|
32
|
-
badDebtLiquidationBonusBps: number
|
|
33
|
+
badDebtLiquidationBonusBps: number
|
|
33
34
|
/** Time in seconds that must pass before redemptions are enabled after the deposit limit is crossed */
|
|
34
|
-
deleveragingMarginCallPeriodSecs: BN
|
|
35
|
+
deleveragingMarginCallPeriodSecs: BN
|
|
35
36
|
/**
|
|
36
37
|
* The rate at which the deleveraging threshold decreases in slots per bps
|
|
37
38
|
* e.g. 1 bps per hour would be 7200 slots per bps (assuming 2 slots per second)
|
|
38
39
|
*/
|
|
39
|
-
deleveragingThresholdSlotsPerBps: BN
|
|
40
|
+
deleveragingThresholdSlotsPerBps: BN
|
|
40
41
|
/** Program owner fees assessed, separate from gains due to interest accrual */
|
|
41
|
-
fees: types.ReserveFeesFields
|
|
42
|
+
fees: types.ReserveFeesFields
|
|
42
43
|
/** Borrow rate curve based on utilization */
|
|
43
|
-
borrowRateCurve: types.BorrowRateCurveFields
|
|
44
|
+
borrowRateCurve: types.BorrowRateCurveFields
|
|
44
45
|
/** Borrow factor in percentage - used for risk adjustment */
|
|
45
|
-
borrowFactorPct: BN
|
|
46
|
+
borrowFactorPct: BN
|
|
46
47
|
/** Maximum deposit limit of liquidity in native units, u64::MAX for inf */
|
|
47
|
-
depositLimit: BN
|
|
48
|
+
depositLimit: BN
|
|
48
49
|
/** Maximum amount borrowed, u64::MAX for inf, 0 to disable borrows (protected deposits) */
|
|
49
|
-
borrowLimit: BN
|
|
50
|
+
borrowLimit: BN
|
|
50
51
|
/** Token id from TokenInfos struct */
|
|
51
|
-
tokenInfo: types.TokenInfoFields
|
|
52
|
+
tokenInfo: types.TokenInfoFields
|
|
52
53
|
/** Deposit withdrawl caps - deposit & redeem */
|
|
53
|
-
depositWithdrawalCap: types.WithdrawalCapsFields
|
|
54
|
+
depositWithdrawalCap: types.WithdrawalCapsFields
|
|
54
55
|
/** Debt withdrawl caps - borrow & repay */
|
|
55
|
-
debtWithdrawalCap: types.WithdrawalCapsFields
|
|
56
|
-
elevationGroups: Array<number
|
|
57
|
-
disableUsageAsCollOutsideEmode: number
|
|
58
|
-
utilizationLimitBlockBorrowingAbove: number
|
|
59
|
-
reserved1: Array<number
|
|
56
|
+
debtWithdrawalCap: types.WithdrawalCapsFields
|
|
57
|
+
elevationGroups: Array<number>
|
|
58
|
+
disableUsageAsCollOutsideEmode: number
|
|
59
|
+
utilizationLimitBlockBorrowingAbove: number
|
|
60
|
+
reserved1: Array<number>
|
|
60
61
|
/**
|
|
61
62
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
62
63
|
* - u64::MAX for inf
|
|
63
64
|
* - 0 to disable borrows outside elevation groups
|
|
64
65
|
*/
|
|
65
|
-
borrowLimitOutsideElevationGroup: BN
|
|
66
|
+
borrowLimitOutsideElevationGroup: BN
|
|
66
67
|
/**
|
|
67
68
|
* Defines the maximum amount (in lamports of elevation group debt asset)
|
|
68
69
|
* that can be borrowed when this reserve is used as collateral.
|
|
69
70
|
* - u64::MAX for inf
|
|
70
71
|
* - 0 to disable borrows in this elevation group (expected value for the debt asset)
|
|
71
72
|
*/
|
|
72
|
-
borrowLimitAgainstThisCollateralInElevationGroup: Array<BN
|
|
73
|
+
borrowLimitAgainstThisCollateralInElevationGroup: Array<BN>
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
export interface ReserveConfigJSON {
|
|
76
77
|
/** Status of the reserve Active/Obsolete/Hidden */
|
|
77
|
-
status: number
|
|
78
|
+
status: number
|
|
78
79
|
/** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */
|
|
79
|
-
assetTier: number
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
assetTier: number
|
|
81
|
+
/** Flat rate that goes to the host */
|
|
82
|
+
hostFixedInterestRateBps: number
|
|
83
|
+
/** [DEPRECATED] Boost for side (debt or collateral) */
|
|
84
|
+
reserved2: Array<number>
|
|
85
|
+
/** [DEPRECATED] Reward points multiplier per obligation type */
|
|
86
|
+
reserved3: Array<number>
|
|
85
87
|
/** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
|
|
86
|
-
protocolTakeRatePct: number
|
|
88
|
+
protocolTakeRatePct: number
|
|
87
89
|
/** Cut of the liquidation bonus that the protocol receives, as a percentage */
|
|
88
|
-
protocolLiquidationFeePct: number
|
|
90
|
+
protocolLiquidationFeePct: number
|
|
89
91
|
/**
|
|
90
92
|
* Target ratio of the value of borrows to deposits, as a percentage
|
|
91
93
|
* 0 if use as collateral is disabled
|
|
92
94
|
*/
|
|
93
|
-
loanToValuePct: number
|
|
95
|
+
loanToValuePct: number
|
|
94
96
|
/** Loan to value ratio at which an obligation can be liquidated, as percentage */
|
|
95
|
-
liquidationThresholdPct: number
|
|
97
|
+
liquidationThresholdPct: number
|
|
96
98
|
/** Minimum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */
|
|
97
|
-
minLiquidationBonusBps: number
|
|
99
|
+
minLiquidationBonusBps: number
|
|
98
100
|
/** Maximum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */
|
|
99
|
-
maxLiquidationBonusBps: number
|
|
101
|
+
maxLiquidationBonusBps: number
|
|
100
102
|
/** Bad debt liquidation bonus for an undercollateralized obligation, as bps */
|
|
101
|
-
badDebtLiquidationBonusBps: number
|
|
103
|
+
badDebtLiquidationBonusBps: number
|
|
102
104
|
/** Time in seconds that must pass before redemptions are enabled after the deposit limit is crossed */
|
|
103
|
-
deleveragingMarginCallPeriodSecs: string
|
|
105
|
+
deleveragingMarginCallPeriodSecs: string
|
|
104
106
|
/**
|
|
105
107
|
* The rate at which the deleveraging threshold decreases in slots per bps
|
|
106
108
|
* e.g. 1 bps per hour would be 7200 slots per bps (assuming 2 slots per second)
|
|
107
109
|
*/
|
|
108
|
-
deleveragingThresholdSlotsPerBps: string
|
|
110
|
+
deleveragingThresholdSlotsPerBps: string
|
|
109
111
|
/** Program owner fees assessed, separate from gains due to interest accrual */
|
|
110
|
-
fees: types.ReserveFeesJSON
|
|
112
|
+
fees: types.ReserveFeesJSON
|
|
111
113
|
/** Borrow rate curve based on utilization */
|
|
112
|
-
borrowRateCurve: types.BorrowRateCurveJSON
|
|
114
|
+
borrowRateCurve: types.BorrowRateCurveJSON
|
|
113
115
|
/** Borrow factor in percentage - used for risk adjustment */
|
|
114
|
-
borrowFactorPct: string
|
|
116
|
+
borrowFactorPct: string
|
|
115
117
|
/** Maximum deposit limit of liquidity in native units, u64::MAX for inf */
|
|
116
|
-
depositLimit: string
|
|
118
|
+
depositLimit: string
|
|
117
119
|
/** Maximum amount borrowed, u64::MAX for inf, 0 to disable borrows (protected deposits) */
|
|
118
|
-
borrowLimit: string
|
|
120
|
+
borrowLimit: string
|
|
119
121
|
/** Token id from TokenInfos struct */
|
|
120
|
-
tokenInfo: types.TokenInfoJSON
|
|
122
|
+
tokenInfo: types.TokenInfoJSON
|
|
121
123
|
/** Deposit withdrawl caps - deposit & redeem */
|
|
122
|
-
depositWithdrawalCap: types.WithdrawalCapsJSON
|
|
124
|
+
depositWithdrawalCap: types.WithdrawalCapsJSON
|
|
123
125
|
/** Debt withdrawl caps - borrow & repay */
|
|
124
|
-
debtWithdrawalCap: types.WithdrawalCapsJSON
|
|
125
|
-
elevationGroups: Array<number
|
|
126
|
-
disableUsageAsCollOutsideEmode: number
|
|
127
|
-
utilizationLimitBlockBorrowingAbove: number
|
|
128
|
-
reserved1: Array<number
|
|
126
|
+
debtWithdrawalCap: types.WithdrawalCapsJSON
|
|
127
|
+
elevationGroups: Array<number>
|
|
128
|
+
disableUsageAsCollOutsideEmode: number
|
|
129
|
+
utilizationLimitBlockBorrowingAbove: number
|
|
130
|
+
reserved1: Array<number>
|
|
129
131
|
/**
|
|
130
132
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
131
133
|
* - u64::MAX for inf
|
|
132
134
|
* - 0 to disable borrows outside elevation groups
|
|
133
135
|
*/
|
|
134
|
-
borrowLimitOutsideElevationGroup: string
|
|
136
|
+
borrowLimitOutsideElevationGroup: string
|
|
135
137
|
/**
|
|
136
138
|
* Defines the maximum amount (in lamports of elevation group debt asset)
|
|
137
139
|
* that can be borrowed when this reserve is used as collateral.
|
|
138
140
|
* - u64::MAX for inf
|
|
139
141
|
* - 0 to disable borrows in this elevation group (expected value for the debt asset)
|
|
140
142
|
*/
|
|
141
|
-
borrowLimitAgainstThisCollateralInElevationGroup: Array<string
|
|
143
|
+
borrowLimitAgainstThisCollateralInElevationGroup: Array<string>
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
/** Reserve configuration values */
|
|
145
147
|
export class ReserveConfig {
|
|
146
148
|
/** Status of the reserve Active/Obsolete/Hidden */
|
|
147
|
-
readonly status: number
|
|
149
|
+
readonly status: number
|
|
148
150
|
/** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */
|
|
149
|
-
readonly assetTier: number
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
readonly assetTier: number
|
|
152
|
+
/** Flat rate that goes to the host */
|
|
153
|
+
readonly hostFixedInterestRateBps: number
|
|
154
|
+
/** [DEPRECATED] Boost for side (debt or collateral) */
|
|
155
|
+
readonly reserved2: Array<number>
|
|
156
|
+
/** [DEPRECATED] Reward points multiplier per obligation type */
|
|
157
|
+
readonly reserved3: Array<number>
|
|
155
158
|
/** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
|
|
156
|
-
readonly protocolTakeRatePct: number
|
|
159
|
+
readonly protocolTakeRatePct: number
|
|
157
160
|
/** Cut of the liquidation bonus that the protocol receives, as a percentage */
|
|
158
|
-
readonly protocolLiquidationFeePct: number
|
|
161
|
+
readonly protocolLiquidationFeePct: number
|
|
159
162
|
/**
|
|
160
163
|
* Target ratio of the value of borrows to deposits, as a percentage
|
|
161
164
|
* 0 if use as collateral is disabled
|
|
162
165
|
*/
|
|
163
|
-
readonly loanToValuePct: number
|
|
166
|
+
readonly loanToValuePct: number
|
|
164
167
|
/** Loan to value ratio at which an obligation can be liquidated, as percentage */
|
|
165
|
-
readonly liquidationThresholdPct: number
|
|
168
|
+
readonly liquidationThresholdPct: number
|
|
166
169
|
/** Minimum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */
|
|
167
|
-
readonly minLiquidationBonusBps: number
|
|
170
|
+
readonly minLiquidationBonusBps: number
|
|
168
171
|
/** Maximum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps */
|
|
169
|
-
readonly maxLiquidationBonusBps: number
|
|
172
|
+
readonly maxLiquidationBonusBps: number
|
|
170
173
|
/** Bad debt liquidation bonus for an undercollateralized obligation, as bps */
|
|
171
|
-
readonly badDebtLiquidationBonusBps: number
|
|
174
|
+
readonly badDebtLiquidationBonusBps: number
|
|
172
175
|
/** Time in seconds that must pass before redemptions are enabled after the deposit limit is crossed */
|
|
173
|
-
readonly deleveragingMarginCallPeriodSecs: BN
|
|
176
|
+
readonly deleveragingMarginCallPeriodSecs: BN
|
|
174
177
|
/**
|
|
175
178
|
* The rate at which the deleveraging threshold decreases in slots per bps
|
|
176
179
|
* e.g. 1 bps per hour would be 7200 slots per bps (assuming 2 slots per second)
|
|
177
180
|
*/
|
|
178
|
-
readonly deleveragingThresholdSlotsPerBps: BN
|
|
181
|
+
readonly deleveragingThresholdSlotsPerBps: BN
|
|
179
182
|
/** Program owner fees assessed, separate from gains due to interest accrual */
|
|
180
|
-
readonly fees: types.ReserveFees
|
|
183
|
+
readonly fees: types.ReserveFees
|
|
181
184
|
/** Borrow rate curve based on utilization */
|
|
182
|
-
readonly borrowRateCurve: types.BorrowRateCurve
|
|
185
|
+
readonly borrowRateCurve: types.BorrowRateCurve
|
|
183
186
|
/** Borrow factor in percentage - used for risk adjustment */
|
|
184
|
-
readonly borrowFactorPct: BN
|
|
187
|
+
readonly borrowFactorPct: BN
|
|
185
188
|
/** Maximum deposit limit of liquidity in native units, u64::MAX for inf */
|
|
186
|
-
readonly depositLimit: BN
|
|
189
|
+
readonly depositLimit: BN
|
|
187
190
|
/** Maximum amount borrowed, u64::MAX for inf, 0 to disable borrows (protected deposits) */
|
|
188
|
-
readonly borrowLimit: BN
|
|
191
|
+
readonly borrowLimit: BN
|
|
189
192
|
/** Token id from TokenInfos struct */
|
|
190
|
-
readonly tokenInfo: types.TokenInfo
|
|
193
|
+
readonly tokenInfo: types.TokenInfo
|
|
191
194
|
/** Deposit withdrawl caps - deposit & redeem */
|
|
192
|
-
readonly depositWithdrawalCap: types.WithdrawalCaps
|
|
195
|
+
readonly depositWithdrawalCap: types.WithdrawalCaps
|
|
193
196
|
/** Debt withdrawl caps - borrow & repay */
|
|
194
|
-
readonly debtWithdrawalCap: types.WithdrawalCaps
|
|
195
|
-
readonly elevationGroups: Array<number
|
|
196
|
-
readonly disableUsageAsCollOutsideEmode: number
|
|
197
|
-
readonly utilizationLimitBlockBorrowingAbove: number
|
|
198
|
-
readonly reserved1: Array<number
|
|
197
|
+
readonly debtWithdrawalCap: types.WithdrawalCaps
|
|
198
|
+
readonly elevationGroups: Array<number>
|
|
199
|
+
readonly disableUsageAsCollOutsideEmode: number
|
|
200
|
+
readonly utilizationLimitBlockBorrowingAbove: number
|
|
201
|
+
readonly reserved1: Array<number>
|
|
199
202
|
/**
|
|
200
203
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
201
204
|
* - u64::MAX for inf
|
|
202
205
|
* - 0 to disable borrows outside elevation groups
|
|
203
206
|
*/
|
|
204
|
-
readonly borrowLimitOutsideElevationGroup: BN
|
|
207
|
+
readonly borrowLimitOutsideElevationGroup: BN
|
|
205
208
|
/**
|
|
206
209
|
* Defines the maximum amount (in lamports of elevation group debt asset)
|
|
207
210
|
* that can be borrowed when this reserve is used as collateral.
|
|
208
211
|
* - u64::MAX for inf
|
|
209
212
|
* - 0 to disable borrows in this elevation group (expected value for the debt asset)
|
|
210
213
|
*/
|
|
211
|
-
readonly borrowLimitAgainstThisCollateralInElevationGroup: Array<BN
|
|
214
|
+
readonly borrowLimitAgainstThisCollateralInElevationGroup: Array<BN>
|
|
212
215
|
|
|
213
216
|
constructor(fields: ReserveConfigFields) {
|
|
214
|
-
this.status = fields.status
|
|
215
|
-
this.assetTier = fields.assetTier
|
|
216
|
-
this.
|
|
217
|
-
this.
|
|
218
|
-
this.
|
|
219
|
-
this.protocolTakeRatePct = fields.protocolTakeRatePct
|
|
220
|
-
this.protocolLiquidationFeePct = fields.protocolLiquidationFeePct
|
|
221
|
-
this.loanToValuePct = fields.loanToValuePct
|
|
222
|
-
this.liquidationThresholdPct = fields.liquidationThresholdPct
|
|
223
|
-
this.minLiquidationBonusBps = fields.minLiquidationBonusBps
|
|
224
|
-
this.maxLiquidationBonusBps = fields.maxLiquidationBonusBps
|
|
225
|
-
this.badDebtLiquidationBonusBps = fields.badDebtLiquidationBonusBps
|
|
226
|
-
this.deleveragingMarginCallPeriodSecs =
|
|
227
|
-
|
|
228
|
-
this.
|
|
217
|
+
this.status = fields.status
|
|
218
|
+
this.assetTier = fields.assetTier
|
|
219
|
+
this.hostFixedInterestRateBps = fields.hostFixedInterestRateBps
|
|
220
|
+
this.reserved2 = fields.reserved2
|
|
221
|
+
this.reserved3 = fields.reserved3
|
|
222
|
+
this.protocolTakeRatePct = fields.protocolTakeRatePct
|
|
223
|
+
this.protocolLiquidationFeePct = fields.protocolLiquidationFeePct
|
|
224
|
+
this.loanToValuePct = fields.loanToValuePct
|
|
225
|
+
this.liquidationThresholdPct = fields.liquidationThresholdPct
|
|
226
|
+
this.minLiquidationBonusBps = fields.minLiquidationBonusBps
|
|
227
|
+
this.maxLiquidationBonusBps = fields.maxLiquidationBonusBps
|
|
228
|
+
this.badDebtLiquidationBonusBps = fields.badDebtLiquidationBonusBps
|
|
229
|
+
this.deleveragingMarginCallPeriodSecs =
|
|
230
|
+
fields.deleveragingMarginCallPeriodSecs
|
|
231
|
+
this.deleveragingThresholdSlotsPerBps =
|
|
232
|
+
fields.deleveragingThresholdSlotsPerBps
|
|
233
|
+
this.fees = new types.ReserveFees({ ...fields.fees })
|
|
229
234
|
this.borrowRateCurve = new types.BorrowRateCurve({
|
|
230
235
|
...fields.borrowRateCurve,
|
|
231
|
-
})
|
|
232
|
-
this.borrowFactorPct = fields.borrowFactorPct
|
|
233
|
-
this.depositLimit = fields.depositLimit
|
|
234
|
-
this.borrowLimit = fields.borrowLimit
|
|
235
|
-
this.tokenInfo = new types.TokenInfo({ ...fields.tokenInfo })
|
|
236
|
+
})
|
|
237
|
+
this.borrowFactorPct = fields.borrowFactorPct
|
|
238
|
+
this.depositLimit = fields.depositLimit
|
|
239
|
+
this.borrowLimit = fields.borrowLimit
|
|
240
|
+
this.tokenInfo = new types.TokenInfo({ ...fields.tokenInfo })
|
|
236
241
|
this.depositWithdrawalCap = new types.WithdrawalCaps({
|
|
237
242
|
...fields.depositWithdrawalCap,
|
|
238
|
-
})
|
|
243
|
+
})
|
|
239
244
|
this.debtWithdrawalCap = new types.WithdrawalCaps({
|
|
240
245
|
...fields.debtWithdrawalCap,
|
|
241
|
-
})
|
|
242
|
-
this.elevationGroups = fields.elevationGroups
|
|
243
|
-
this.disableUsageAsCollOutsideEmode = fields.disableUsageAsCollOutsideEmode
|
|
244
|
-
this.utilizationLimitBlockBorrowingAbove =
|
|
245
|
-
|
|
246
|
-
this.
|
|
247
|
-
this.
|
|
246
|
+
})
|
|
247
|
+
this.elevationGroups = fields.elevationGroups
|
|
248
|
+
this.disableUsageAsCollOutsideEmode = fields.disableUsageAsCollOutsideEmode
|
|
249
|
+
this.utilizationLimitBlockBorrowingAbove =
|
|
250
|
+
fields.utilizationLimitBlockBorrowingAbove
|
|
251
|
+
this.reserved1 = fields.reserved1
|
|
252
|
+
this.borrowLimitOutsideElevationGroup =
|
|
253
|
+
fields.borrowLimitOutsideElevationGroup
|
|
254
|
+
this.borrowLimitAgainstThisCollateralInElevationGroup =
|
|
255
|
+
fields.borrowLimitAgainstThisCollateralInElevationGroup
|
|
248
256
|
}
|
|
249
257
|
|
|
250
258
|
static layout(property?: string) {
|
|
251
259
|
return borsh.struct(
|
|
252
260
|
[
|
|
253
|
-
borsh.u8(
|
|
254
|
-
borsh.u8(
|
|
255
|
-
borsh.
|
|
256
|
-
borsh.array(borsh.u8(), 2,
|
|
257
|
-
borsh.array(borsh.u8(), 8,
|
|
258
|
-
borsh.u8(
|
|
259
|
-
borsh.u8(
|
|
260
|
-
borsh.u8(
|
|
261
|
-
borsh.u8(
|
|
262
|
-
borsh.u16(
|
|
263
|
-
borsh.u16(
|
|
264
|
-
borsh.u16(
|
|
265
|
-
borsh.u64(
|
|
266
|
-
borsh.u64(
|
|
267
|
-
types.ReserveFees.layout(
|
|
268
|
-
types.BorrowRateCurve.layout(
|
|
269
|
-
borsh.u64(
|
|
270
|
-
borsh.u64(
|
|
271
|
-
borsh.u64(
|
|
272
|
-
types.TokenInfo.layout(
|
|
273
|
-
types.WithdrawalCaps.layout(
|
|
274
|
-
types.WithdrawalCaps.layout(
|
|
275
|
-
borsh.array(borsh.u8(), 20,
|
|
276
|
-
borsh.u8(
|
|
277
|
-
borsh.u8(
|
|
278
|
-
borsh.array(borsh.u8(), 2,
|
|
279
|
-
borsh.u64(
|
|
280
|
-
borsh.array(
|
|
261
|
+
borsh.u8("status"),
|
|
262
|
+
borsh.u8("assetTier"),
|
|
263
|
+
borsh.u16("hostFixedInterestRateBps"),
|
|
264
|
+
borsh.array(borsh.u8(), 2, "reserved2"),
|
|
265
|
+
borsh.array(borsh.u8(), 8, "reserved3"),
|
|
266
|
+
borsh.u8("protocolTakeRatePct"),
|
|
267
|
+
borsh.u8("protocolLiquidationFeePct"),
|
|
268
|
+
borsh.u8("loanToValuePct"),
|
|
269
|
+
borsh.u8("liquidationThresholdPct"),
|
|
270
|
+
borsh.u16("minLiquidationBonusBps"),
|
|
271
|
+
borsh.u16("maxLiquidationBonusBps"),
|
|
272
|
+
borsh.u16("badDebtLiquidationBonusBps"),
|
|
273
|
+
borsh.u64("deleveragingMarginCallPeriodSecs"),
|
|
274
|
+
borsh.u64("deleveragingThresholdSlotsPerBps"),
|
|
275
|
+
types.ReserveFees.layout("fees"),
|
|
276
|
+
types.BorrowRateCurve.layout("borrowRateCurve"),
|
|
277
|
+
borsh.u64("borrowFactorPct"),
|
|
278
|
+
borsh.u64("depositLimit"),
|
|
279
|
+
borsh.u64("borrowLimit"),
|
|
280
|
+
types.TokenInfo.layout("tokenInfo"),
|
|
281
|
+
types.WithdrawalCaps.layout("depositWithdrawalCap"),
|
|
282
|
+
types.WithdrawalCaps.layout("debtWithdrawalCap"),
|
|
283
|
+
borsh.array(borsh.u8(), 20, "elevationGroups"),
|
|
284
|
+
borsh.u8("disableUsageAsCollOutsideEmode"),
|
|
285
|
+
borsh.u8("utilizationLimitBlockBorrowingAbove"),
|
|
286
|
+
borsh.array(borsh.u8(), 2, "reserved1"),
|
|
287
|
+
borsh.u64("borrowLimitOutsideElevationGroup"),
|
|
288
|
+
borsh.array(
|
|
289
|
+
borsh.u64(),
|
|
290
|
+
32,
|
|
291
|
+
"borrowLimitAgainstThisCollateralInElevationGroup"
|
|
292
|
+
),
|
|
281
293
|
],
|
|
282
294
|
property
|
|
283
|
-
)
|
|
295
|
+
)
|
|
284
296
|
}
|
|
285
297
|
|
|
286
298
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -288,9 +300,9 @@ export class ReserveConfig {
|
|
|
288
300
|
return new ReserveConfig({
|
|
289
301
|
status: obj.status,
|
|
290
302
|
assetTier: obj.assetTier,
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
303
|
+
hostFixedInterestRateBps: obj.hostFixedInterestRateBps,
|
|
304
|
+
reserved2: obj.reserved2,
|
|
305
|
+
reserved3: obj.reserved3,
|
|
294
306
|
protocolTakeRatePct: obj.protocolTakeRatePct,
|
|
295
307
|
protocolLiquidationFeePct: obj.protocolLiquidationFeePct,
|
|
296
308
|
loanToValuePct: obj.loanToValuePct,
|
|
@@ -306,24 +318,30 @@ export class ReserveConfig {
|
|
|
306
318
|
depositLimit: obj.depositLimit,
|
|
307
319
|
borrowLimit: obj.borrowLimit,
|
|
308
320
|
tokenInfo: types.TokenInfo.fromDecoded(obj.tokenInfo),
|
|
309
|
-
depositWithdrawalCap: types.WithdrawalCaps.fromDecoded(
|
|
310
|
-
|
|
321
|
+
depositWithdrawalCap: types.WithdrawalCaps.fromDecoded(
|
|
322
|
+
obj.depositWithdrawalCap
|
|
323
|
+
),
|
|
324
|
+
debtWithdrawalCap: types.WithdrawalCaps.fromDecoded(
|
|
325
|
+
obj.debtWithdrawalCap
|
|
326
|
+
),
|
|
311
327
|
elevationGroups: obj.elevationGroups,
|
|
312
328
|
disableUsageAsCollOutsideEmode: obj.disableUsageAsCollOutsideEmode,
|
|
313
|
-
utilizationLimitBlockBorrowingAbove:
|
|
329
|
+
utilizationLimitBlockBorrowingAbove:
|
|
330
|
+
obj.utilizationLimitBlockBorrowingAbove,
|
|
314
331
|
reserved1: obj.reserved1,
|
|
315
332
|
borrowLimitOutsideElevationGroup: obj.borrowLimitOutsideElevationGroup,
|
|
316
|
-
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
317
|
-
|
|
333
|
+
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
334
|
+
obj.borrowLimitAgainstThisCollateralInElevationGroup,
|
|
335
|
+
})
|
|
318
336
|
}
|
|
319
337
|
|
|
320
338
|
static toEncodable(fields: ReserveConfigFields) {
|
|
321
339
|
return {
|
|
322
340
|
status: fields.status,
|
|
323
341
|
assetTier: fields.assetTier,
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
342
|
+
hostFixedInterestRateBps: fields.hostFixedInterestRateBps,
|
|
343
|
+
reserved2: fields.reserved2,
|
|
344
|
+
reserved3: fields.reserved3,
|
|
327
345
|
protocolTakeRatePct: fields.protocolTakeRatePct,
|
|
328
346
|
protocolLiquidationFeePct: fields.protocolLiquidationFeePct,
|
|
329
347
|
loanToValuePct: fields.loanToValuePct,
|
|
@@ -334,29 +352,37 @@ export class ReserveConfig {
|
|
|
334
352
|
deleveragingMarginCallPeriodSecs: fields.deleveragingMarginCallPeriodSecs,
|
|
335
353
|
deleveragingThresholdSlotsPerBps: fields.deleveragingThresholdSlotsPerBps,
|
|
336
354
|
fees: types.ReserveFees.toEncodable(fields.fees),
|
|
337
|
-
borrowRateCurve: types.BorrowRateCurve.toEncodable(
|
|
355
|
+
borrowRateCurve: types.BorrowRateCurve.toEncodable(
|
|
356
|
+
fields.borrowRateCurve
|
|
357
|
+
),
|
|
338
358
|
borrowFactorPct: fields.borrowFactorPct,
|
|
339
359
|
depositLimit: fields.depositLimit,
|
|
340
360
|
borrowLimit: fields.borrowLimit,
|
|
341
361
|
tokenInfo: types.TokenInfo.toEncodable(fields.tokenInfo),
|
|
342
|
-
depositWithdrawalCap: types.WithdrawalCaps.toEncodable(
|
|
343
|
-
|
|
362
|
+
depositWithdrawalCap: types.WithdrawalCaps.toEncodable(
|
|
363
|
+
fields.depositWithdrawalCap
|
|
364
|
+
),
|
|
365
|
+
debtWithdrawalCap: types.WithdrawalCaps.toEncodable(
|
|
366
|
+
fields.debtWithdrawalCap
|
|
367
|
+
),
|
|
344
368
|
elevationGroups: fields.elevationGroups,
|
|
345
369
|
disableUsageAsCollOutsideEmode: fields.disableUsageAsCollOutsideEmode,
|
|
346
|
-
utilizationLimitBlockBorrowingAbove:
|
|
370
|
+
utilizationLimitBlockBorrowingAbove:
|
|
371
|
+
fields.utilizationLimitBlockBorrowingAbove,
|
|
347
372
|
reserved1: fields.reserved1,
|
|
348
373
|
borrowLimitOutsideElevationGroup: fields.borrowLimitOutsideElevationGroup,
|
|
349
|
-
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
350
|
-
|
|
374
|
+
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
375
|
+
fields.borrowLimitAgainstThisCollateralInElevationGroup,
|
|
376
|
+
}
|
|
351
377
|
}
|
|
352
378
|
|
|
353
379
|
toJSON(): ReserveConfigJSON {
|
|
354
380
|
return {
|
|
355
381
|
status: this.status,
|
|
356
382
|
assetTier: this.assetTier,
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
383
|
+
hostFixedInterestRateBps: this.hostFixedInterestRateBps,
|
|
384
|
+
reserved2: this.reserved2,
|
|
385
|
+
reserved3: this.reserved3,
|
|
360
386
|
protocolTakeRatePct: this.protocolTakeRatePct,
|
|
361
387
|
protocolLiquidationFeePct: this.protocolLiquidationFeePct,
|
|
362
388
|
loanToValuePct: this.loanToValuePct,
|
|
@@ -364,8 +390,10 @@ export class ReserveConfig {
|
|
|
364
390
|
minLiquidationBonusBps: this.minLiquidationBonusBps,
|
|
365
391
|
maxLiquidationBonusBps: this.maxLiquidationBonusBps,
|
|
366
392
|
badDebtLiquidationBonusBps: this.badDebtLiquidationBonusBps,
|
|
367
|
-
deleveragingMarginCallPeriodSecs:
|
|
368
|
-
|
|
393
|
+
deleveragingMarginCallPeriodSecs:
|
|
394
|
+
this.deleveragingMarginCallPeriodSecs.toString(),
|
|
395
|
+
deleveragingThresholdSlotsPerBps:
|
|
396
|
+
this.deleveragingThresholdSlotsPerBps.toString(),
|
|
369
397
|
fees: this.fees.toJSON(),
|
|
370
398
|
borrowRateCurve: this.borrowRateCurve.toJSON(),
|
|
371
399
|
borrowFactorPct: this.borrowFactorPct.toString(),
|
|
@@ -376,22 +404,25 @@ export class ReserveConfig {
|
|
|
376
404
|
debtWithdrawalCap: this.debtWithdrawalCap.toJSON(),
|
|
377
405
|
elevationGroups: this.elevationGroups,
|
|
378
406
|
disableUsageAsCollOutsideEmode: this.disableUsageAsCollOutsideEmode,
|
|
379
|
-
utilizationLimitBlockBorrowingAbove:
|
|
407
|
+
utilizationLimitBlockBorrowingAbove:
|
|
408
|
+
this.utilizationLimitBlockBorrowingAbove,
|
|
380
409
|
reserved1: this.reserved1,
|
|
381
|
-
borrowLimitOutsideElevationGroup:
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
410
|
+
borrowLimitOutsideElevationGroup:
|
|
411
|
+
this.borrowLimitOutsideElevationGroup.toString(),
|
|
412
|
+
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
413
|
+
this.borrowLimitAgainstThisCollateralInElevationGroup.map((item) =>
|
|
414
|
+
item.toString()
|
|
415
|
+
),
|
|
416
|
+
}
|
|
386
417
|
}
|
|
387
418
|
|
|
388
419
|
static fromJSON(obj: ReserveConfigJSON): ReserveConfig {
|
|
389
420
|
return new ReserveConfig({
|
|
390
421
|
status: obj.status,
|
|
391
422
|
assetTier: obj.assetTier,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
423
|
+
hostFixedInterestRateBps: obj.hostFixedInterestRateBps,
|
|
424
|
+
reserved2: obj.reserved2,
|
|
425
|
+
reserved3: obj.reserved3,
|
|
395
426
|
protocolTakeRatePct: obj.protocolTakeRatePct,
|
|
396
427
|
protocolLiquidationFeePct: obj.protocolLiquidationFeePct,
|
|
397
428
|
loanToValuePct: obj.loanToValuePct,
|
|
@@ -399,28 +430,38 @@ export class ReserveConfig {
|
|
|
399
430
|
minLiquidationBonusBps: obj.minLiquidationBonusBps,
|
|
400
431
|
maxLiquidationBonusBps: obj.maxLiquidationBonusBps,
|
|
401
432
|
badDebtLiquidationBonusBps: obj.badDebtLiquidationBonusBps,
|
|
402
|
-
deleveragingMarginCallPeriodSecs: new BN(
|
|
403
|
-
|
|
433
|
+
deleveragingMarginCallPeriodSecs: new BN(
|
|
434
|
+
obj.deleveragingMarginCallPeriodSecs
|
|
435
|
+
),
|
|
436
|
+
deleveragingThresholdSlotsPerBps: new BN(
|
|
437
|
+
obj.deleveragingThresholdSlotsPerBps
|
|
438
|
+
),
|
|
404
439
|
fees: types.ReserveFees.fromJSON(obj.fees),
|
|
405
440
|
borrowRateCurve: types.BorrowRateCurve.fromJSON(obj.borrowRateCurve),
|
|
406
441
|
borrowFactorPct: new BN(obj.borrowFactorPct),
|
|
407
442
|
depositLimit: new BN(obj.depositLimit),
|
|
408
443
|
borrowLimit: new BN(obj.borrowLimit),
|
|
409
444
|
tokenInfo: types.TokenInfo.fromJSON(obj.tokenInfo),
|
|
410
|
-
depositWithdrawalCap: types.WithdrawalCaps.fromJSON(
|
|
445
|
+
depositWithdrawalCap: types.WithdrawalCaps.fromJSON(
|
|
446
|
+
obj.depositWithdrawalCap
|
|
447
|
+
),
|
|
411
448
|
debtWithdrawalCap: types.WithdrawalCaps.fromJSON(obj.debtWithdrawalCap),
|
|
412
449
|
elevationGroups: obj.elevationGroups,
|
|
413
450
|
disableUsageAsCollOutsideEmode: obj.disableUsageAsCollOutsideEmode,
|
|
414
|
-
utilizationLimitBlockBorrowingAbove:
|
|
451
|
+
utilizationLimitBlockBorrowingAbove:
|
|
452
|
+
obj.utilizationLimitBlockBorrowingAbove,
|
|
415
453
|
reserved1: obj.reserved1,
|
|
416
|
-
borrowLimitOutsideElevationGroup: new BN(
|
|
417
|
-
|
|
418
|
-
(item) => new BN(item)
|
|
454
|
+
borrowLimitOutsideElevationGroup: new BN(
|
|
455
|
+
obj.borrowLimitOutsideElevationGroup
|
|
419
456
|
),
|
|
420
|
-
|
|
457
|
+
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
458
|
+
obj.borrowLimitAgainstThisCollateralInElevationGroup.map(
|
|
459
|
+
(item) => new BN(item)
|
|
460
|
+
),
|
|
461
|
+
})
|
|
421
462
|
}
|
|
422
463
|
|
|
423
464
|
toEncodable() {
|
|
424
|
-
return ReserveConfig.toEncodable(this)
|
|
465
|
+
return ReserveConfig.toEncodable(this)
|
|
425
466
|
}
|
|
426
467
|
}
|