@kamino-finance/klend-sdk 7.1.2 → 7.1.4-beta.0
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/@codegen/klend/accounts/LendingMarket.d.ts +144 -3
- package/dist/@codegen/klend/accounts/LendingMarket.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/LendingMarket.js +105 -3
- package/dist/@codegen/klend/accounts/LendingMarket.js.map +1 -1
- package/dist/@codegen/klend/accounts/Obligation.d.ts +30 -15
- package/dist/@codegen/klend/accounts/Obligation.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/Obligation.js +31 -21
- package/dist/@codegen/klend/accounts/Obligation.js.map +1 -1
- package/dist/@codegen/klend/accounts/PoolState.d.ts +53 -0
- package/dist/@codegen/klend/accounts/PoolState.d.ts.map +1 -0
- package/dist/@codegen/klend/accounts/PoolState.js +167 -0
- package/dist/@codegen/klend/accounts/PoolState.js.map +1 -0
- package/dist/@codegen/klend/accounts/Reserve.d.ts +6 -0
- package/dist/@codegen/klend/accounts/Reserve.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/Reserve.js +9 -2
- package/dist/@codegen/klend/accounts/Reserve.js.map +1 -1
- package/dist/@codegen/klend/accounts/UnstakeTicket.d.ts +41 -0
- package/dist/@codegen/klend/accounts/UnstakeTicket.d.ts.map +1 -0
- package/dist/@codegen/klend/accounts/UnstakeTicket.js +143 -0
- package/dist/@codegen/klend/accounts/UnstakeTicket.js.map +1 -0
- package/dist/@codegen/klend/accounts/UserState.d.ts +0 -75
- package/dist/@codegen/klend/accounts/UserState.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/UserState.js +0 -25
- package/dist/@codegen/klend/accounts/UserState.js.map +1 -1
- package/dist/@codegen/klend/accounts/WithdrawTicket.d.ts +132 -0
- package/dist/@codegen/klend/accounts/WithdrawTicket.d.ts.map +1 -0
- package/dist/@codegen/klend/accounts/WithdrawTicket.js +191 -0
- package/dist/@codegen/klend/accounts/WithdrawTicket.js.map +1 -0
- package/dist/@codegen/klend/accounts/index.d.ts +6 -0
- package/dist/@codegen/klend/accounts/index.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/index.js +7 -1
- package/dist/@codegen/klend/accounts/index.js.map +1 -1
- package/dist/@codegen/klend/errors/custom.d.ts +226 -2
- package/dist/@codegen/klend/errors/custom.d.ts.map +1 -1
- package/dist/@codegen/klend/errors/custom.js +396 -3
- package/dist/@codegen/klend/errors/custom.js.map +1 -1
- package/dist/@codegen/klend/instructions/enqueueToWithdraw.d.ts +39 -0
- package/dist/@codegen/klend/instructions/enqueueToWithdraw.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/enqueueToWithdraw.js +67 -0
- package/dist/@codegen/klend/instructions/enqueueToWithdraw.js.map +1 -0
- package/dist/@codegen/klend/instructions/fillBorrowOrder.d.ts +36 -0
- package/dist/@codegen/klend/instructions/fillBorrowOrder.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/fillBorrowOrder.js +49 -0
- package/dist/@codegen/klend/instructions/fillBorrowOrder.js.map +1 -0
- package/dist/@codegen/klend/instructions/idlMissingTypes.d.ts +1 -2
- package/dist/@codegen/klend/instructions/idlMissingTypes.d.ts.map +1 -1
- package/dist/@codegen/klend/instructions/idlMissingTypes.js +6 -2
- package/dist/@codegen/klend/instructions/idlMissingTypes.js.map +1 -1
- package/dist/@codegen/klend/instructions/index.d.ts +16 -0
- package/dist/@codegen/klend/instructions/index.d.ts.map +1 -1
- package/dist/@codegen/klend/instructions/index.js +18 -1
- package/dist/@codegen/klend/instructions/index.js.map +1 -1
- package/dist/@codegen/klend/instructions/initReserve.d.ts +1 -1
- package/dist/@codegen/klend/instructions/initReserve.d.ts.map +1 -1
- package/dist/@codegen/klend/instructions/initReserve.js +1 -5
- package/dist/@codegen/klend/instructions/initReserve.js.map +1 -1
- package/dist/@codegen/klend/instructions/liquidateObligationAndRedeemReserveCollateral.js +1 -1
- package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.d.ts +47 -0
- package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.js +66 -0
- package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.js.map +1 -0
- package/dist/@codegen/klend/instructions/setBorrowOrder.d.ts +31 -0
- package/dist/@codegen/klend/instructions/setBorrowOrder.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/setBorrowOrder.js +64 -0
- package/dist/@codegen/klend/instructions/setBorrowOrder.js.map +1 -0
- package/dist/@codegen/klend/instructions/unstakeLstCollateralEnd.d.ts +53 -0
- package/dist/@codegen/klend/instructions/unstakeLstCollateralEnd.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/unstakeLstCollateralEnd.js +190 -0
- package/dist/@codegen/klend/instructions/unstakeLstCollateralEnd.js.map +1 -0
- package/dist/@codegen/klend/instructions/unstakeLstCollateralStart.d.ts +70 -0
- package/dist/@codegen/klend/instructions/unstakeLstCollateralStart.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/unstakeLstCollateralStart.js +261 -0
- package/dist/@codegen/klend/instructions/unstakeLstCollateralStart.js.map +1 -0
- package/dist/@codegen/klend/instructions/updateGlobalConfig.d.ts +1 -1
- package/dist/@codegen/klend/instructions/updateGlobalConfig.d.ts.map +1 -1
- package/dist/@codegen/klend/instructions/updateGlobalConfig.js +1 -0
- package/dist/@codegen/klend/instructions/updateGlobalConfig.js.map +1 -1
- package/dist/@codegen/klend/instructions/updateReserveConfig.d.ts +1 -1
- package/dist/@codegen/klend/instructions/updateReserveConfig.d.ts.map +1 -1
- package/dist/@codegen/klend/instructions/updateReserveConfig.js +1 -0
- package/dist/@codegen/klend/instructions/updateReserveConfig.js.map +1 -1
- package/dist/@codegen/klend/instructions/withdrawObligationCollateral.js +1 -1
- package/dist/@codegen/klend/instructions/withdrawObligationCollateralV2.js +1 -1
- package/dist/@codegen/klend/instructions/withdrawObligationUsol.d.ts +41 -0
- package/dist/@codegen/klend/instructions/withdrawObligationUsol.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/withdrawObligationUsol.js +135 -0
- package/dist/@codegen/klend/instructions/withdrawObligationUsol.js.map +1 -0
- package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.d.ts +51 -0
- package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.js +28 -0
- package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.js.map +1 -0
- package/dist/@codegen/klend/types/BorrowOrder.d.ts +192 -0
- package/dist/@codegen/klend/types/BorrowOrder.d.ts.map +1 -0
- package/dist/@codegen/klend/types/BorrowOrder.js +194 -0
- package/dist/@codegen/klend/types/BorrowOrder.js.map +1 -0
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.d.ts +39 -0
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.d.ts.map +1 -0
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.js +100 -0
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.js.map +1 -0
- package/dist/@codegen/klend/types/ObligationLiquidity.d.ts +35 -5
- package/dist/@codegen/klend/types/ObligationLiquidity.d.ts.map +1 -1
- package/dist/@codegen/klend/types/ObligationLiquidity.js +17 -7
- package/dist/@codegen/klend/types/ObligationLiquidity.js.map +1 -1
- package/dist/@codegen/klend/types/ObligationOrder.d.ts +4 -4
- package/dist/@codegen/klend/types/ObligationOrder.js +2 -2
- package/dist/@codegen/klend/types/ReserveConfig.d.ts +141 -29
- package/dist/@codegen/klend/types/ReserveConfig.d.ts.map +1 -1
- package/dist/@codegen/klend/types/ReserveConfig.js +89 -25
- package/dist/@codegen/klend/types/ReserveConfig.js.map +1 -1
- package/dist/@codegen/klend/types/ReserveFees.d.ts +8 -8
- package/dist/@codegen/klend/types/ReserveFees.d.ts.map +1 -1
- package/dist/@codegen/klend/types/ReserveFees.js +8 -8
- package/dist/@codegen/klend/types/ReserveFees.js.map +1 -1
- package/dist/@codegen/klend/types/ReserveLiquidity.d.ts +26 -8
- package/dist/@codegen/klend/types/ReserveLiquidity.d.ts.map +1 -1
- package/dist/@codegen/klend/types/ReserveLiquidity.js +14 -8
- package/dist/@codegen/klend/types/ReserveLiquidity.js.map +1 -1
- package/dist/@codegen/klend/types/UpdateConfigMode.d.ts +92 -14
- package/dist/@codegen/klend/types/UpdateConfigMode.d.ts.map +1 -1
- package/dist/@codegen/klend/types/UpdateConfigMode.js +168 -23
- package/dist/@codegen/klend/types/UpdateConfigMode.js.map +1 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.d.ts +130 -0
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.d.ts.map +1 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.js +241 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/@codegen/klend/types/WithdrawQueue.d.ts +64 -0
- package/dist/@codegen/klend/types/WithdrawQueue.d.ts.map +1 -0
- package/dist/@codegen/klend/types/WithdrawQueue.js +104 -0
- package/dist/@codegen/klend/types/WithdrawQueue.js.map +1 -0
- package/dist/@codegen/klend/types/index.d.ts +10 -8
- package/dist/@codegen/klend/types/index.d.ts.map +1 -1
- package/dist/@codegen/klend/types/index.js +7 -3
- package/dist/@codegen/klend/types/index.js.map +1 -1
- package/dist/@codegen/klend/zero_padding/ObligationZP.d.ts +9 -4
- package/dist/@codegen/klend/zero_padding/ObligationZP.d.ts.map +1 -1
- package/dist/@codegen/klend/zero_padding/ObligationZP.js +22 -13
- package/dist/@codegen/klend/zero_padding/ObligationZP.js.map +1 -1
- package/dist/classes/action.d.ts +30 -3
- package/dist/classes/action.d.ts.map +1 -1
- package/dist/classes/action.js +364 -10
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +10 -0
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts +6 -2
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js +26 -6
- package/dist/classes/market.js.map +1 -1
- package/dist/classes/obligation.js +1 -1
- package/dist/classes/obligation.js.map +1 -1
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +13 -7
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/unstakingPool.d.ts +20 -3
- package/dist/classes/unstakingPool.d.ts.map +1 -1
- package/dist/classes/unstakingPool.js +62 -8
- package/dist/classes/unstakingPool.js.map +1 -1
- package/dist/idl/klend.json +2125 -232
- package/dist/lending_operations/index.d.ts +1 -0
- package/dist/lending_operations/index.d.ts.map +1 -1
- package/dist/lending_operations/index.js +1 -0
- package/dist/lending_operations/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 +0 -2
- package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
- package/dist/lending_operations/swap_collateral_operations.js +0 -1
- package/dist/lending_operations/swap_collateral_operations.js.map +1 -1
- package/dist/lending_operations/unstake_lst_collateral.d.ts +12 -0
- package/dist/lending_operations/unstake_lst_collateral.d.ts.map +1 -0
- package/dist/lending_operations/unstake_lst_collateral.js +104 -0
- package/dist/lending_operations/unstake_lst_collateral.js.map +1 -0
- package/dist/leverage/calcs.d.ts +2 -27
- package/dist/leverage/calcs.d.ts.map +1 -1
- package/dist/leverage/calcs.js +6 -136
- package/dist/leverage/calcs.js.map +1 -1
- package/dist/leverage/operations.d.ts +8 -9
- package/dist/leverage/operations.d.ts.map +1 -1
- package/dist/leverage/operations.js +72 -228
- package/dist/leverage/operations.js.map +1 -1
- package/dist/leverage/types.d.ts +0 -19
- package/dist/leverage/types.d.ts.map +1 -1
- package/dist/leverage/utils.d.ts +2 -19
- package/dist/leverage/utils.d.ts.map +1 -1
- package/dist/leverage/utils.js +0 -164
- package/dist/leverage/utils.js.map +1 -1
- package/dist/manager/client_kamino_manager.js +11 -8
- package/dist/manager/client_kamino_manager.js.map +1 -1
- package/dist/utils/managerTypes.d.ts.map +1 -1
- package/dist/utils/managerTypes.js +9 -4
- package/dist/utils/managerTypes.js.map +1 -1
- package/dist/utils/seeds.d.ts +10 -14
- package/dist/utils/seeds.d.ts.map +1 -1
- package/dist/utils/seeds.js +25 -22
- package/dist/utils/seeds.js.map +1 -1
- package/package.json +2 -2
- package/src/@codegen/klend/accounts/LendingMarket.ts +210 -5
- package/src/@codegen/klend/accounts/Obligation.ts +53 -31
- package/src/@codegen/klend/accounts/PoolState.ts +192 -0
- package/src/@codegen/klend/accounts/Reserve.ts +13 -2
- package/src/@codegen/klend/accounts/UnstakeTicket.ts +160 -0
- package/src/@codegen/klend/accounts/UserState.ts +0 -75
- package/src/@codegen/klend/accounts/WithdrawTicket.ts +256 -0
- package/src/@codegen/klend/accounts/index.ts +6 -0
- package/src/@codegen/klend/errors/custom.ts +427 -2
- package/src/@codegen/klend/instructions/enqueueToWithdraw.ts +89 -0
- package/src/@codegen/klend/instructions/fillBorrowOrder.ts +96 -0
- package/src/@codegen/klend/instructions/idlMissingTypes.ts +7 -4
- package/src/@codegen/klend/instructions/index.ts +34 -0
- package/src/@codegen/klend/instructions/initReserve.ts +2 -6
- package/src/@codegen/klend/instructions/liquidateObligationAndRedeemReserveCollateral.ts +1 -1
- package/src/@codegen/klend/instructions/recoverInvalidTicketCollateral.ts +96 -0
- package/src/@codegen/klend/instructions/setBorrowOrder.ts +77 -0
- package/src/@codegen/klend/instructions/unstakeLstCollateralEnd.ts +251 -0
- package/src/@codegen/klend/instructions/unstakeLstCollateralStart.ts +353 -0
- package/src/@codegen/klend/instructions/updateGlobalConfig.ts +2 -1
- package/src/@codegen/klend/instructions/updateReserveConfig.ts +2 -1
- package/src/@codegen/klend/instructions/withdrawObligationCollateral.ts +1 -1
- package/src/@codegen/klend/instructions/withdrawObligationCollateralV2.ts +1 -1
- package/src/@codegen/klend/instructions/withdrawObligationUsol.ts +168 -0
- package/src/@codegen/klend/instructions/withdrawQueuedLiquidity.ts +92 -0
- package/src/@codegen/klend/types/BorrowOrder.ts +267 -0
- package/src/@codegen/klend/types/BorrowOrderConfigArgs.ts +87 -0
- package/src/@codegen/klend/types/ObligationLiquidity.ts +39 -9
- package/src/@codegen/klend/types/ObligationOrder.ts +4 -4
- package/src/@codegen/klend/types/ReserveConfig.ts +171 -39
- package/src/@codegen/klend/types/ReserveFees.ts +12 -12
- package/src/@codegen/klend/types/ReserveLiquidity.ts +30 -12
- package/src/@codegen/klend/types/UpdateConfigMode.ts +206 -26
- package/src/@codegen/klend/types/UpdateLendingMarketMode.ts +300 -0
- package/src/@codegen/klend/types/WithdrawQueue.ts +117 -0
- package/src/@codegen/klend/types/index.ts +45 -16
- package/src/@codegen/klend/zero_padding/ObligationZP.ts +22 -13
- package/src/classes/action.ts +577 -8
- package/src/classes/manager.ts +11 -0
- package/src/classes/market.ts +36 -5
- package/src/classes/obligation.ts +1 -1
- package/src/classes/reserve.ts +13 -8
- package/src/classes/unstakingPool.ts +83 -6
- package/src/idl/klend.json +2126 -233
- package/src/lending_operations/index.ts +1 -0
- package/src/lending_operations/repay_with_collateral_operations.ts +0 -2
- package/src/lending_operations/swap_collateral_operations.ts +0 -1
- package/src/lending_operations/unstake_lst_collateral.ts +174 -0
- package/src/leverage/calcs.ts +2 -201
- package/src/leverage/operations.ts +45 -377
- package/src/leverage/types.ts +0 -20
- package/src/leverage/utils.ts +3 -320
- package/src/manager/client_kamino_manager.ts +11 -8
- package/src/utils/managerTypes.ts +9 -4
- package/src/utils/seeds.ts +28 -26
- package/dist/@codegen/klend/types/AssetTier.d.ts +0 -45
- package/dist/@codegen/klend/types/AssetTier.d.ts.map +0 -1
- package/dist/@codegen/klend/types/AssetTier.js +0 -132
- package/dist/@codegen/klend/types/AssetTier.js.map +0 -1
- package/src/@codegen/klend/types/AssetTier.ts +0 -119
|
@@ -8,16 +8,18 @@ export interface ReserveConfigFields {
|
|
|
8
8
|
/** Status of the reserve Active/Obsolete/Hidden */
|
|
9
9
|
status: number
|
|
10
10
|
/** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */
|
|
11
|
-
|
|
11
|
+
paddingDeprecatedAssetTier: number
|
|
12
12
|
/** Flat rate that goes to the host */
|
|
13
13
|
hostFixedInterestRateBps: number
|
|
14
|
+
/** Starting bonus for deleveraging-related liquidations, in bps. */
|
|
15
|
+
minDeleveragingBonusBps: number
|
|
14
16
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* - Reward points multiplier per obligation type
|
|
18
|
-
* Can be re-used after making sure all underlying production account data is zeroed.
|
|
17
|
+
* Boolean flag indicating whether the reserve can be used in the close lst position process.
|
|
18
|
+
* See handler_unstake_lst_collateral_start.rs for more information.
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
canUnstakeLstCollateral: number
|
|
21
|
+
/** Past reserved space - feel free to reuse. */
|
|
22
|
+
reserved1: Array<number>
|
|
21
23
|
/** Cut of the order execution bonus that the protocol receives, as a percentage */
|
|
22
24
|
protocolOrderExecutionFeePct: number
|
|
23
25
|
/** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
|
|
@@ -76,7 +78,14 @@ export interface ReserveConfigFields {
|
|
|
76
78
|
* obligations) is NOT affected by this flag.
|
|
77
79
|
*/
|
|
78
80
|
autodeleverageEnabled: number
|
|
79
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Boolean flag indicating whether the reserve is locked for the proposer authority.
|
|
83
|
+
*
|
|
84
|
+
* Once the proposer have finished preparing the reserve, it must be locked to prevent
|
|
85
|
+
* further changes to the reserve configuration allowing review and voting on the proposal
|
|
86
|
+
* without alteration during the voting period.
|
|
87
|
+
*/
|
|
88
|
+
proposerAuthorityLocked: number
|
|
80
89
|
/**
|
|
81
90
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
82
91
|
* - u64::MAX for inf
|
|
@@ -95,22 +104,49 @@ export interface ReserveConfigFields {
|
|
|
95
104
|
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
96
105
|
*/
|
|
97
106
|
deleveragingBonusIncreaseBpsPerDay: BN
|
|
107
|
+
/**
|
|
108
|
+
* The timestamp at which all [Obligation::borrows] using this reserve become liquidatable
|
|
109
|
+
* (on the same terms as reserve-wide deleveraging).
|
|
110
|
+
* Inactive when zeroed (i.e. debt never matures).
|
|
111
|
+
*
|
|
112
|
+
* Note: this feature is independent of [Self::debt_term_seconds] - the liquidation mechanism
|
|
113
|
+
* is based directly on the timestamp defined here, on Reserve's level.
|
|
114
|
+
*/
|
|
115
|
+
debtMaturityTimestamp: BN
|
|
116
|
+
/**
|
|
117
|
+
* The duration after which any debt coming from this Reserve must be repaid.
|
|
118
|
+
* Inactive when zeroed (i.e. funds can be borrowed indefinitely).
|
|
119
|
+
*
|
|
120
|
+
* Note: this feature is independent of [Self::debt_maturity_timestamp] - the liquidation
|
|
121
|
+
* mechanism is based on the [ObligationLiquidity::first_borrowed_at_timestamp].
|
|
122
|
+
*/
|
|
123
|
+
debtTermSeconds: BN
|
|
124
|
+
/**
|
|
125
|
+
* Maximum number of lamports that can differ when comparing LTVs.
|
|
126
|
+
*
|
|
127
|
+
* For example, when doing deposit_and_withdraw we want to make sure that new_ltv <= old_ltv
|
|
128
|
+
* but for some tokens we want to have a little bit of margin in terms of lamports deposited.
|
|
129
|
+
* This is recommended to be 0 for most (if not all) reserves.
|
|
130
|
+
*/
|
|
131
|
+
ltvLamportsMargin: BN
|
|
98
132
|
}
|
|
99
133
|
|
|
100
134
|
export interface ReserveConfigJSON {
|
|
101
135
|
/** Status of the reserve Active/Obsolete/Hidden */
|
|
102
136
|
status: number
|
|
103
137
|
/** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */
|
|
104
|
-
|
|
138
|
+
paddingDeprecatedAssetTier: number
|
|
105
139
|
/** Flat rate that goes to the host */
|
|
106
140
|
hostFixedInterestRateBps: number
|
|
141
|
+
/** Starting bonus for deleveraging-related liquidations, in bps. */
|
|
142
|
+
minDeleveragingBonusBps: number
|
|
107
143
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* - Reward points multiplier per obligation type
|
|
111
|
-
* Can be re-used after making sure all underlying production account data is zeroed.
|
|
144
|
+
* Boolean flag indicating whether the reserve can be used in the close lst position process.
|
|
145
|
+
* See handler_unstake_lst_collateral_start.rs for more information.
|
|
112
146
|
*/
|
|
113
|
-
|
|
147
|
+
canUnstakeLstCollateral: number
|
|
148
|
+
/** Past reserved space - feel free to reuse. */
|
|
149
|
+
reserved1: Array<number>
|
|
114
150
|
/** Cut of the order execution bonus that the protocol receives, as a percentage */
|
|
115
151
|
protocolOrderExecutionFeePct: number
|
|
116
152
|
/** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
|
|
@@ -169,7 +205,14 @@ export interface ReserveConfigJSON {
|
|
|
169
205
|
* obligations) is NOT affected by this flag.
|
|
170
206
|
*/
|
|
171
207
|
autodeleverageEnabled: number
|
|
172
|
-
|
|
208
|
+
/**
|
|
209
|
+
* Boolean flag indicating whether the reserve is locked for the proposer authority.
|
|
210
|
+
*
|
|
211
|
+
* Once the proposer have finished preparing the reserve, it must be locked to prevent
|
|
212
|
+
* further changes to the reserve configuration allowing review and voting on the proposal
|
|
213
|
+
* without alteration during the voting period.
|
|
214
|
+
*/
|
|
215
|
+
proposerAuthorityLocked: number
|
|
173
216
|
/**
|
|
174
217
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
175
218
|
* - u64::MAX for inf
|
|
@@ -188,6 +231,31 @@ export interface ReserveConfigJSON {
|
|
|
188
231
|
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
189
232
|
*/
|
|
190
233
|
deleveragingBonusIncreaseBpsPerDay: string
|
|
234
|
+
/**
|
|
235
|
+
* The timestamp at which all [Obligation::borrows] using this reserve become liquidatable
|
|
236
|
+
* (on the same terms as reserve-wide deleveraging).
|
|
237
|
+
* Inactive when zeroed (i.e. debt never matures).
|
|
238
|
+
*
|
|
239
|
+
* Note: this feature is independent of [Self::debt_term_seconds] - the liquidation mechanism
|
|
240
|
+
* is based directly on the timestamp defined here, on Reserve's level.
|
|
241
|
+
*/
|
|
242
|
+
debtMaturityTimestamp: string
|
|
243
|
+
/**
|
|
244
|
+
* The duration after which any debt coming from this Reserve must be repaid.
|
|
245
|
+
* Inactive when zeroed (i.e. funds can be borrowed indefinitely).
|
|
246
|
+
*
|
|
247
|
+
* Note: this feature is independent of [Self::debt_maturity_timestamp] - the liquidation
|
|
248
|
+
* mechanism is based on the [ObligationLiquidity::first_borrowed_at_timestamp].
|
|
249
|
+
*/
|
|
250
|
+
debtTermSeconds: string
|
|
251
|
+
/**
|
|
252
|
+
* Maximum number of lamports that can differ when comparing LTVs.
|
|
253
|
+
*
|
|
254
|
+
* For example, when doing deposit_and_withdraw we want to make sure that new_ltv <= old_ltv
|
|
255
|
+
* but for some tokens we want to have a little bit of margin in terms of lamports deposited.
|
|
256
|
+
* This is recommended to be 0 for most (if not all) reserves.
|
|
257
|
+
*/
|
|
258
|
+
ltvLamportsMargin: string
|
|
191
259
|
}
|
|
192
260
|
|
|
193
261
|
/** Reserve configuration values */
|
|
@@ -195,16 +263,18 @@ export class ReserveConfig {
|
|
|
195
263
|
/** Status of the reserve Active/Obsolete/Hidden */
|
|
196
264
|
readonly status: number
|
|
197
265
|
/** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */
|
|
198
|
-
readonly
|
|
266
|
+
readonly paddingDeprecatedAssetTier: number
|
|
199
267
|
/** Flat rate that goes to the host */
|
|
200
268
|
readonly hostFixedInterestRateBps: number
|
|
269
|
+
/** Starting bonus for deleveraging-related liquidations, in bps. */
|
|
270
|
+
readonly minDeleveragingBonusBps: number
|
|
201
271
|
/**
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* - Reward points multiplier per obligation type
|
|
205
|
-
* Can be re-used after making sure all underlying production account data is zeroed.
|
|
272
|
+
* Boolean flag indicating whether the reserve can be used in the close lst position process.
|
|
273
|
+
* See handler_unstake_lst_collateral_start.rs for more information.
|
|
206
274
|
*/
|
|
207
|
-
readonly
|
|
275
|
+
readonly canUnstakeLstCollateral: number
|
|
276
|
+
/** Past reserved space - feel free to reuse. */
|
|
277
|
+
readonly reserved1: Array<number>
|
|
208
278
|
/** Cut of the order execution bonus that the protocol receives, as a percentage */
|
|
209
279
|
readonly protocolOrderExecutionFeePct: number
|
|
210
280
|
/** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
|
|
@@ -263,7 +333,14 @@ export class ReserveConfig {
|
|
|
263
333
|
* obligations) is NOT affected by this flag.
|
|
264
334
|
*/
|
|
265
335
|
readonly autodeleverageEnabled: number
|
|
266
|
-
|
|
336
|
+
/**
|
|
337
|
+
* Boolean flag indicating whether the reserve is locked for the proposer authority.
|
|
338
|
+
*
|
|
339
|
+
* Once the proposer have finished preparing the reserve, it must be locked to prevent
|
|
340
|
+
* further changes to the reserve configuration allowing review and voting on the proposal
|
|
341
|
+
* without alteration during the voting period.
|
|
342
|
+
*/
|
|
343
|
+
readonly proposerAuthorityLocked: number
|
|
267
344
|
/**
|
|
268
345
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
269
346
|
* - u64::MAX for inf
|
|
@@ -282,12 +359,39 @@ export class ReserveConfig {
|
|
|
282
359
|
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
283
360
|
*/
|
|
284
361
|
readonly deleveragingBonusIncreaseBpsPerDay: BN
|
|
362
|
+
/**
|
|
363
|
+
* The timestamp at which all [Obligation::borrows] using this reserve become liquidatable
|
|
364
|
+
* (on the same terms as reserve-wide deleveraging).
|
|
365
|
+
* Inactive when zeroed (i.e. debt never matures).
|
|
366
|
+
*
|
|
367
|
+
* Note: this feature is independent of [Self::debt_term_seconds] - the liquidation mechanism
|
|
368
|
+
* is based directly on the timestamp defined here, on Reserve's level.
|
|
369
|
+
*/
|
|
370
|
+
readonly debtMaturityTimestamp: BN
|
|
371
|
+
/**
|
|
372
|
+
* The duration after which any debt coming from this Reserve must be repaid.
|
|
373
|
+
* Inactive when zeroed (i.e. funds can be borrowed indefinitely).
|
|
374
|
+
*
|
|
375
|
+
* Note: this feature is independent of [Self::debt_maturity_timestamp] - the liquidation
|
|
376
|
+
* mechanism is based on the [ObligationLiquidity::first_borrowed_at_timestamp].
|
|
377
|
+
*/
|
|
378
|
+
readonly debtTermSeconds: BN
|
|
379
|
+
/**
|
|
380
|
+
* Maximum number of lamports that can differ when comparing LTVs.
|
|
381
|
+
*
|
|
382
|
+
* For example, when doing deposit_and_withdraw we want to make sure that new_ltv <= old_ltv
|
|
383
|
+
* but for some tokens we want to have a little bit of margin in terms of lamports deposited.
|
|
384
|
+
* This is recommended to be 0 for most (if not all) reserves.
|
|
385
|
+
*/
|
|
386
|
+
readonly ltvLamportsMargin: BN
|
|
285
387
|
|
|
286
388
|
constructor(fields: ReserveConfigFields) {
|
|
287
389
|
this.status = fields.status
|
|
288
|
-
this.
|
|
390
|
+
this.paddingDeprecatedAssetTier = fields.paddingDeprecatedAssetTier
|
|
289
391
|
this.hostFixedInterestRateBps = fields.hostFixedInterestRateBps
|
|
290
|
-
this.
|
|
392
|
+
this.minDeleveragingBonusBps = fields.minDeleveragingBonusBps
|
|
393
|
+
this.canUnstakeLstCollateral = fields.canUnstakeLstCollateral
|
|
394
|
+
this.reserved1 = fields.reserved1
|
|
291
395
|
this.protocolOrderExecutionFeePct = fields.protocolOrderExecutionFeePct
|
|
292
396
|
this.protocolTakeRatePct = fields.protocolTakeRatePct
|
|
293
397
|
this.protocolLiquidationFeePct = fields.protocolLiquidationFeePct
|
|
@@ -319,22 +423,27 @@ export class ReserveConfig {
|
|
|
319
423
|
this.utilizationLimitBlockBorrowingAbovePct =
|
|
320
424
|
fields.utilizationLimitBlockBorrowingAbovePct
|
|
321
425
|
this.autodeleverageEnabled = fields.autodeleverageEnabled
|
|
322
|
-
this.
|
|
426
|
+
this.proposerAuthorityLocked = fields.proposerAuthorityLocked
|
|
323
427
|
this.borrowLimitOutsideElevationGroup =
|
|
324
428
|
fields.borrowLimitOutsideElevationGroup
|
|
325
429
|
this.borrowLimitAgainstThisCollateralInElevationGroup =
|
|
326
430
|
fields.borrowLimitAgainstThisCollateralInElevationGroup
|
|
327
431
|
this.deleveragingBonusIncreaseBpsPerDay =
|
|
328
432
|
fields.deleveragingBonusIncreaseBpsPerDay
|
|
433
|
+
this.debtMaturityTimestamp = fields.debtMaturityTimestamp
|
|
434
|
+
this.debtTermSeconds = fields.debtTermSeconds
|
|
435
|
+
this.ltvLamportsMargin = fields.ltvLamportsMargin
|
|
329
436
|
}
|
|
330
437
|
|
|
331
438
|
static layout(property?: string) {
|
|
332
439
|
return borsh.struct(
|
|
333
440
|
[
|
|
334
441
|
borsh.u8("status"),
|
|
335
|
-
borsh.u8("
|
|
442
|
+
borsh.u8("paddingDeprecatedAssetTier"),
|
|
336
443
|
borsh.u16("hostFixedInterestRateBps"),
|
|
337
|
-
borsh.
|
|
444
|
+
borsh.u16("minDeleveragingBonusBps"),
|
|
445
|
+
borsh.u8("canUnstakeLstCollateral"),
|
|
446
|
+
borsh.array(borsh.u8(), 6, "reserved1"),
|
|
338
447
|
borsh.u8("protocolOrderExecutionFeePct"),
|
|
339
448
|
borsh.u8("protocolTakeRatePct"),
|
|
340
449
|
borsh.u8("protocolLiquidationFeePct"),
|
|
@@ -357,7 +466,7 @@ export class ReserveConfig {
|
|
|
357
466
|
borsh.u8("disableUsageAsCollOutsideEmode"),
|
|
358
467
|
borsh.u8("utilizationLimitBlockBorrowingAbovePct"),
|
|
359
468
|
borsh.u8("autodeleverageEnabled"),
|
|
360
|
-
borsh.
|
|
469
|
+
borsh.u8("proposerAuthorityLocked"),
|
|
361
470
|
borsh.u64("borrowLimitOutsideElevationGroup"),
|
|
362
471
|
borsh.array(
|
|
363
472
|
borsh.u64(),
|
|
@@ -365,6 +474,9 @@ export class ReserveConfig {
|
|
|
365
474
|
"borrowLimitAgainstThisCollateralInElevationGroup"
|
|
366
475
|
),
|
|
367
476
|
borsh.u64("deleveragingBonusIncreaseBpsPerDay"),
|
|
477
|
+
borsh.u64("debtMaturityTimestamp"),
|
|
478
|
+
borsh.u64("debtTermSeconds"),
|
|
479
|
+
borsh.u64("ltvLamportsMargin"),
|
|
368
480
|
],
|
|
369
481
|
property
|
|
370
482
|
)
|
|
@@ -374,9 +486,11 @@ export class ReserveConfig {
|
|
|
374
486
|
static fromDecoded(obj: any) {
|
|
375
487
|
return new ReserveConfig({
|
|
376
488
|
status: obj.status,
|
|
377
|
-
|
|
489
|
+
paddingDeprecatedAssetTier: obj.paddingDeprecatedAssetTier,
|
|
378
490
|
hostFixedInterestRateBps: obj.hostFixedInterestRateBps,
|
|
379
|
-
|
|
491
|
+
minDeleveragingBonusBps: obj.minDeleveragingBonusBps,
|
|
492
|
+
canUnstakeLstCollateral: obj.canUnstakeLstCollateral,
|
|
493
|
+
reserved1: obj.reserved1,
|
|
380
494
|
protocolOrderExecutionFeePct: obj.protocolOrderExecutionFeePct,
|
|
381
495
|
protocolTakeRatePct: obj.protocolTakeRatePct,
|
|
382
496
|
protocolLiquidationFeePct: obj.protocolLiquidationFeePct,
|
|
@@ -405,21 +519,26 @@ export class ReserveConfig {
|
|
|
405
519
|
utilizationLimitBlockBorrowingAbovePct:
|
|
406
520
|
obj.utilizationLimitBlockBorrowingAbovePct,
|
|
407
521
|
autodeleverageEnabled: obj.autodeleverageEnabled,
|
|
408
|
-
|
|
522
|
+
proposerAuthorityLocked: obj.proposerAuthorityLocked,
|
|
409
523
|
borrowLimitOutsideElevationGroup: obj.borrowLimitOutsideElevationGroup,
|
|
410
524
|
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
411
525
|
obj.borrowLimitAgainstThisCollateralInElevationGroup,
|
|
412
526
|
deleveragingBonusIncreaseBpsPerDay:
|
|
413
527
|
obj.deleveragingBonusIncreaseBpsPerDay,
|
|
528
|
+
debtMaturityTimestamp: obj.debtMaturityTimestamp,
|
|
529
|
+
debtTermSeconds: obj.debtTermSeconds,
|
|
530
|
+
ltvLamportsMargin: obj.ltvLamportsMargin,
|
|
414
531
|
})
|
|
415
532
|
}
|
|
416
533
|
|
|
417
534
|
static toEncodable(fields: ReserveConfigFields) {
|
|
418
535
|
return {
|
|
419
536
|
status: fields.status,
|
|
420
|
-
|
|
537
|
+
paddingDeprecatedAssetTier: fields.paddingDeprecatedAssetTier,
|
|
421
538
|
hostFixedInterestRateBps: fields.hostFixedInterestRateBps,
|
|
422
|
-
|
|
539
|
+
minDeleveragingBonusBps: fields.minDeleveragingBonusBps,
|
|
540
|
+
canUnstakeLstCollateral: fields.canUnstakeLstCollateral,
|
|
541
|
+
reserved1: fields.reserved1,
|
|
423
542
|
protocolOrderExecutionFeePct: fields.protocolOrderExecutionFeePct,
|
|
424
543
|
protocolTakeRatePct: fields.protocolTakeRatePct,
|
|
425
544
|
protocolLiquidationFeePct: fields.protocolLiquidationFeePct,
|
|
@@ -450,21 +569,26 @@ export class ReserveConfig {
|
|
|
450
569
|
utilizationLimitBlockBorrowingAbovePct:
|
|
451
570
|
fields.utilizationLimitBlockBorrowingAbovePct,
|
|
452
571
|
autodeleverageEnabled: fields.autodeleverageEnabled,
|
|
453
|
-
|
|
572
|
+
proposerAuthorityLocked: fields.proposerAuthorityLocked,
|
|
454
573
|
borrowLimitOutsideElevationGroup: fields.borrowLimitOutsideElevationGroup,
|
|
455
574
|
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
456
575
|
fields.borrowLimitAgainstThisCollateralInElevationGroup,
|
|
457
576
|
deleveragingBonusIncreaseBpsPerDay:
|
|
458
577
|
fields.deleveragingBonusIncreaseBpsPerDay,
|
|
578
|
+
debtMaturityTimestamp: fields.debtMaturityTimestamp,
|
|
579
|
+
debtTermSeconds: fields.debtTermSeconds,
|
|
580
|
+
ltvLamportsMargin: fields.ltvLamportsMargin,
|
|
459
581
|
}
|
|
460
582
|
}
|
|
461
583
|
|
|
462
584
|
toJSON(): ReserveConfigJSON {
|
|
463
585
|
return {
|
|
464
586
|
status: this.status,
|
|
465
|
-
|
|
587
|
+
paddingDeprecatedAssetTier: this.paddingDeprecatedAssetTier,
|
|
466
588
|
hostFixedInterestRateBps: this.hostFixedInterestRateBps,
|
|
467
|
-
|
|
589
|
+
minDeleveragingBonusBps: this.minDeleveragingBonusBps,
|
|
590
|
+
canUnstakeLstCollateral: this.canUnstakeLstCollateral,
|
|
591
|
+
reserved1: this.reserved1,
|
|
468
592
|
protocolOrderExecutionFeePct: this.protocolOrderExecutionFeePct,
|
|
469
593
|
protocolTakeRatePct: this.protocolTakeRatePct,
|
|
470
594
|
protocolLiquidationFeePct: this.protocolLiquidationFeePct,
|
|
@@ -490,7 +614,7 @@ export class ReserveConfig {
|
|
|
490
614
|
utilizationLimitBlockBorrowingAbovePct:
|
|
491
615
|
this.utilizationLimitBlockBorrowingAbovePct,
|
|
492
616
|
autodeleverageEnabled: this.autodeleverageEnabled,
|
|
493
|
-
|
|
617
|
+
proposerAuthorityLocked: this.proposerAuthorityLocked,
|
|
494
618
|
borrowLimitOutsideElevationGroup:
|
|
495
619
|
this.borrowLimitOutsideElevationGroup.toString(),
|
|
496
620
|
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
@@ -499,15 +623,20 @@ export class ReserveConfig {
|
|
|
499
623
|
),
|
|
500
624
|
deleveragingBonusIncreaseBpsPerDay:
|
|
501
625
|
this.deleveragingBonusIncreaseBpsPerDay.toString(),
|
|
626
|
+
debtMaturityTimestamp: this.debtMaturityTimestamp.toString(),
|
|
627
|
+
debtTermSeconds: this.debtTermSeconds.toString(),
|
|
628
|
+
ltvLamportsMargin: this.ltvLamportsMargin.toString(),
|
|
502
629
|
}
|
|
503
630
|
}
|
|
504
631
|
|
|
505
632
|
static fromJSON(obj: ReserveConfigJSON): ReserveConfig {
|
|
506
633
|
return new ReserveConfig({
|
|
507
634
|
status: obj.status,
|
|
508
|
-
|
|
635
|
+
paddingDeprecatedAssetTier: obj.paddingDeprecatedAssetTier,
|
|
509
636
|
hostFixedInterestRateBps: obj.hostFixedInterestRateBps,
|
|
510
|
-
|
|
637
|
+
minDeleveragingBonusBps: obj.minDeleveragingBonusBps,
|
|
638
|
+
canUnstakeLstCollateral: obj.canUnstakeLstCollateral,
|
|
639
|
+
reserved1: obj.reserved1,
|
|
511
640
|
protocolOrderExecutionFeePct: obj.protocolOrderExecutionFeePct,
|
|
512
641
|
protocolTakeRatePct: obj.protocolTakeRatePct,
|
|
513
642
|
protocolLiquidationFeePct: obj.protocolLiquidationFeePct,
|
|
@@ -537,7 +666,7 @@ export class ReserveConfig {
|
|
|
537
666
|
utilizationLimitBlockBorrowingAbovePct:
|
|
538
667
|
obj.utilizationLimitBlockBorrowingAbovePct,
|
|
539
668
|
autodeleverageEnabled: obj.autodeleverageEnabled,
|
|
540
|
-
|
|
669
|
+
proposerAuthorityLocked: obj.proposerAuthorityLocked,
|
|
541
670
|
borrowLimitOutsideElevationGroup: new BN(
|
|
542
671
|
obj.borrowLimitOutsideElevationGroup
|
|
543
672
|
),
|
|
@@ -548,6 +677,9 @@ export class ReserveConfig {
|
|
|
548
677
|
deleveragingBonusIncreaseBpsPerDay: new BN(
|
|
549
678
|
obj.deleveragingBonusIncreaseBpsPerDay
|
|
550
679
|
),
|
|
680
|
+
debtMaturityTimestamp: new BN(obj.debtMaturityTimestamp),
|
|
681
|
+
debtTermSeconds: new BN(obj.debtTermSeconds),
|
|
682
|
+
ltvLamportsMargin: new BN(obj.ltvLamportsMargin),
|
|
551
683
|
})
|
|
552
684
|
}
|
|
553
685
|
|
|
@@ -11,9 +11,9 @@ export interface ReserveFeesFields {
|
|
|
11
11
|
* clarity:
|
|
12
12
|
* 1% = (1 << 60) / 100 = 11529215046068470
|
|
13
13
|
* 0.01% (1 basis point) = 115292150460685
|
|
14
|
-
* 0.00001% (Aave
|
|
14
|
+
* 0.00001% (Aave origination fee) = 115292150461
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
originationFeeSf: BN
|
|
17
17
|
/**
|
|
18
18
|
* Fee for flash loan, expressed as scaled fraction.
|
|
19
19
|
* 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541
|
|
@@ -30,9 +30,9 @@ export interface ReserveFeesJSON {
|
|
|
30
30
|
* clarity:
|
|
31
31
|
* 1% = (1 << 60) / 100 = 11529215046068470
|
|
32
32
|
* 0.01% (1 basis point) = 115292150460685
|
|
33
|
-
* 0.00001% (Aave
|
|
33
|
+
* 0.00001% (Aave origination fee) = 115292150461
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
originationFeeSf: string
|
|
36
36
|
/**
|
|
37
37
|
* Fee for flash loan, expressed as scaled fraction.
|
|
38
38
|
* 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541
|
|
@@ -56,9 +56,9 @@ export class ReserveFees {
|
|
|
56
56
|
* clarity:
|
|
57
57
|
* 1% = (1 << 60) / 100 = 11529215046068470
|
|
58
58
|
* 0.01% (1 basis point) = 115292150460685
|
|
59
|
-
* 0.00001% (Aave
|
|
59
|
+
* 0.00001% (Aave origination fee) = 115292150461
|
|
60
60
|
*/
|
|
61
|
-
readonly
|
|
61
|
+
readonly originationFeeSf: BN
|
|
62
62
|
/**
|
|
63
63
|
* Fee for flash loan, expressed as scaled fraction.
|
|
64
64
|
* 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541
|
|
@@ -68,7 +68,7 @@ export class ReserveFees {
|
|
|
68
68
|
readonly padding: Array<number>
|
|
69
69
|
|
|
70
70
|
constructor(fields: ReserveFeesFields) {
|
|
71
|
-
this.
|
|
71
|
+
this.originationFeeSf = fields.originationFeeSf
|
|
72
72
|
this.flashLoanFeeSf = fields.flashLoanFeeSf
|
|
73
73
|
this.padding = fields.padding
|
|
74
74
|
}
|
|
@@ -76,7 +76,7 @@ export class ReserveFees {
|
|
|
76
76
|
static layout(property?: string) {
|
|
77
77
|
return borsh.struct(
|
|
78
78
|
[
|
|
79
|
-
borsh.u64("
|
|
79
|
+
borsh.u64("originationFeeSf"),
|
|
80
80
|
borsh.u64("flashLoanFeeSf"),
|
|
81
81
|
borsh.array(borsh.u8(), 8, "padding"),
|
|
82
82
|
],
|
|
@@ -87,7 +87,7 @@ export class ReserveFees {
|
|
|
87
87
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
88
88
|
static fromDecoded(obj: any) {
|
|
89
89
|
return new ReserveFees({
|
|
90
|
-
|
|
90
|
+
originationFeeSf: obj.originationFeeSf,
|
|
91
91
|
flashLoanFeeSf: obj.flashLoanFeeSf,
|
|
92
92
|
padding: obj.padding,
|
|
93
93
|
})
|
|
@@ -95,7 +95,7 @@ export class ReserveFees {
|
|
|
95
95
|
|
|
96
96
|
static toEncodable(fields: ReserveFeesFields) {
|
|
97
97
|
return {
|
|
98
|
-
|
|
98
|
+
originationFeeSf: fields.originationFeeSf,
|
|
99
99
|
flashLoanFeeSf: fields.flashLoanFeeSf,
|
|
100
100
|
padding: fields.padding,
|
|
101
101
|
}
|
|
@@ -103,7 +103,7 @@ export class ReserveFees {
|
|
|
103
103
|
|
|
104
104
|
toJSON(): ReserveFeesJSON {
|
|
105
105
|
return {
|
|
106
|
-
|
|
106
|
+
originationFeeSf: this.originationFeeSf.toString(),
|
|
107
107
|
flashLoanFeeSf: this.flashLoanFeeSf.toString(),
|
|
108
108
|
padding: this.padding,
|
|
109
109
|
}
|
|
@@ -111,7 +111,7 @@ export class ReserveFees {
|
|
|
111
111
|
|
|
112
112
|
static fromJSON(obj: ReserveFeesJSON): ReserveFees {
|
|
113
113
|
return new ReserveFees({
|
|
114
|
-
|
|
114
|
+
originationFeeSf: new BN(obj.originationFeeSf),
|
|
115
115
|
flashLoanFeeSf: new BN(obj.flashLoanFeeSf),
|
|
116
116
|
padding: obj.padding,
|
|
117
117
|
})
|
|
@@ -11,8 +11,14 @@ export interface ReserveLiquidityFields {
|
|
|
11
11
|
supplyVault: Address
|
|
12
12
|
/** Reserve liquidity fee collection address */
|
|
13
13
|
feeVault: Address
|
|
14
|
-
/**
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Total reserve liquidity available.
|
|
16
|
+
*
|
|
17
|
+
* Note: not all of this liquidity can be freely used for any purpose. Production code should
|
|
18
|
+
* use the specialized getters - see e.g. [Reserve::total_available_liquidity_amount()],
|
|
19
|
+
* [Reserve::freely_available_liquidity_amount()].
|
|
20
|
+
*/
|
|
21
|
+
totalAvailableAmount: BN
|
|
16
22
|
/** Reserve liquidity borrowed (scaled fraction) */
|
|
17
23
|
borrowedAmountSf: BN
|
|
18
24
|
/** Reserve liquidity market price in quote currency (scaled fraction) */
|
|
@@ -54,8 +60,14 @@ export interface ReserveLiquidityJSON {
|
|
|
54
60
|
supplyVault: string
|
|
55
61
|
/** Reserve liquidity fee collection address */
|
|
56
62
|
feeVault: string
|
|
57
|
-
/**
|
|
58
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Total reserve liquidity available.
|
|
65
|
+
*
|
|
66
|
+
* Note: not all of this liquidity can be freely used for any purpose. Production code should
|
|
67
|
+
* use the specialized getters - see e.g. [Reserve::total_available_liquidity_amount()],
|
|
68
|
+
* [Reserve::freely_available_liquidity_amount()].
|
|
69
|
+
*/
|
|
70
|
+
totalAvailableAmount: string
|
|
59
71
|
/** Reserve liquidity borrowed (scaled fraction) */
|
|
60
72
|
borrowedAmountSf: string
|
|
61
73
|
/** Reserve liquidity market price in quote currency (scaled fraction) */
|
|
@@ -98,8 +110,14 @@ export class ReserveLiquidity {
|
|
|
98
110
|
readonly supplyVault: Address
|
|
99
111
|
/** Reserve liquidity fee collection address */
|
|
100
112
|
readonly feeVault: Address
|
|
101
|
-
/**
|
|
102
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Total reserve liquidity available.
|
|
115
|
+
*
|
|
116
|
+
* Note: not all of this liquidity can be freely used for any purpose. Production code should
|
|
117
|
+
* use the specialized getters - see e.g. [Reserve::total_available_liquidity_amount()],
|
|
118
|
+
* [Reserve::freely_available_liquidity_amount()].
|
|
119
|
+
*/
|
|
120
|
+
readonly totalAvailableAmount: BN
|
|
103
121
|
/** Reserve liquidity borrowed (scaled fraction) */
|
|
104
122
|
readonly borrowedAmountSf: BN
|
|
105
123
|
/** Reserve liquidity market price in quote currency (scaled fraction) */
|
|
@@ -137,7 +155,7 @@ export class ReserveLiquidity {
|
|
|
137
155
|
this.mintPubkey = fields.mintPubkey
|
|
138
156
|
this.supplyVault = fields.supplyVault
|
|
139
157
|
this.feeVault = fields.feeVault
|
|
140
|
-
this.
|
|
158
|
+
this.totalAvailableAmount = fields.totalAvailableAmount
|
|
141
159
|
this.borrowedAmountSf = fields.borrowedAmountSf
|
|
142
160
|
this.marketPriceSf = fields.marketPriceSf
|
|
143
161
|
this.marketPriceLastUpdatedTs = fields.marketPriceLastUpdatedTs
|
|
@@ -162,7 +180,7 @@ export class ReserveLiquidity {
|
|
|
162
180
|
borshAddress("mintPubkey"),
|
|
163
181
|
borshAddress("supplyVault"),
|
|
164
182
|
borshAddress("feeVault"),
|
|
165
|
-
borsh.u64("
|
|
183
|
+
borsh.u64("totalAvailableAmount"),
|
|
166
184
|
borsh.u128("borrowedAmountSf"),
|
|
167
185
|
borsh.u128("marketPriceSf"),
|
|
168
186
|
borsh.u64("marketPriceLastUpdatedTs"),
|
|
@@ -188,7 +206,7 @@ export class ReserveLiquidity {
|
|
|
188
206
|
mintPubkey: obj.mintPubkey,
|
|
189
207
|
supplyVault: obj.supplyVault,
|
|
190
208
|
feeVault: obj.feeVault,
|
|
191
|
-
|
|
209
|
+
totalAvailableAmount: obj.totalAvailableAmount,
|
|
192
210
|
borrowedAmountSf: obj.borrowedAmountSf,
|
|
193
211
|
marketPriceSf: obj.marketPriceSf,
|
|
194
212
|
marketPriceLastUpdatedTs: obj.marketPriceLastUpdatedTs,
|
|
@@ -213,7 +231,7 @@ export class ReserveLiquidity {
|
|
|
213
231
|
mintPubkey: fields.mintPubkey,
|
|
214
232
|
supplyVault: fields.supplyVault,
|
|
215
233
|
feeVault: fields.feeVault,
|
|
216
|
-
|
|
234
|
+
totalAvailableAmount: fields.totalAvailableAmount,
|
|
217
235
|
borrowedAmountSf: fields.borrowedAmountSf,
|
|
218
236
|
marketPriceSf: fields.marketPriceSf,
|
|
219
237
|
marketPriceLastUpdatedTs: fields.marketPriceLastUpdatedTs,
|
|
@@ -238,7 +256,7 @@ export class ReserveLiquidity {
|
|
|
238
256
|
mintPubkey: this.mintPubkey,
|
|
239
257
|
supplyVault: this.supplyVault,
|
|
240
258
|
feeVault: this.feeVault,
|
|
241
|
-
|
|
259
|
+
totalAvailableAmount: this.totalAvailableAmount.toString(),
|
|
242
260
|
borrowedAmountSf: this.borrowedAmountSf.toString(),
|
|
243
261
|
marketPriceSf: this.marketPriceSf.toString(),
|
|
244
262
|
marketPriceLastUpdatedTs: this.marketPriceLastUpdatedTs.toString(),
|
|
@@ -262,7 +280,7 @@ export class ReserveLiquidity {
|
|
|
262
280
|
mintPubkey: address(obj.mintPubkey),
|
|
263
281
|
supplyVault: address(obj.supplyVault),
|
|
264
282
|
feeVault: address(obj.feeVault),
|
|
265
|
-
|
|
283
|
+
totalAvailableAmount: new BN(obj.totalAvailableAmount),
|
|
266
284
|
borrowedAmountSf: new BN(obj.borrowedAmountSf),
|
|
267
285
|
marketPriceSf: new BN(obj.marketPriceSf),
|
|
268
286
|
marketPriceLastUpdatedTs: new BN(obj.marketPriceLastUpdatedTs),
|