@kamino-finance/klend-sdk 5.2.13 → 5.3.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/classes/action.d.ts.map +1 -1
- package/dist/classes/action.js +1 -2
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/manager.js +22 -5
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/obligation.d.ts +2 -0
- package/dist/classes/obligation.d.ts.map +1 -1
- package/dist/classes/obligation.js +12 -6
- package/dist/classes/obligation.js.map +1 -1
- package/dist/classes/reserve.js +14 -14
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/shared.d.ts +2 -2
- package/dist/classes/shared.d.ts.map +1 -1
- package/dist/classes/types.d.ts +1 -1
- package/dist/classes/types.d.ts.map +1 -1
- package/dist/classes/vault.d.ts +1 -1
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +16 -3
- package/dist/classes/vault.js.map +1 -1
- package/dist/client_kamino_manager.d.ts.map +1 -1
- package/dist/client_kamino_manager.js +44 -6
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/idl.json +310 -48
- package/dist/idl_codegen/accounts/LendingMarket.d.ts +48 -3
- package/dist/idl_codegen/accounts/LendingMarket.d.ts.map +1 -1
- package/dist/idl_codegen/accounts/LendingMarket.js +35 -8
- package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
- package/dist/idl_codegen/accounts/Obligation.d.ts +30 -0
- package/dist/idl_codegen/accounts/Obligation.d.ts.map +1 -1
- package/dist/idl_codegen/accounts/Obligation.js +23 -2
- package/dist/idl_codegen/accounts/Obligation.js.map +1 -1
- package/dist/idl_codegen/accounts/Reserve.js +1 -1
- package/dist/idl_codegen/errors/custom.d.ts +33 -1
- package/dist/idl_codegen/errors/custom.d.ts.map +1 -1
- package/dist/idl_codegen/errors/custom.js +57 -1
- package/dist/idl_codegen/errors/custom.js.map +1 -1
- package/dist/idl_codegen/instructions/index.d.ts +7 -3
- package/dist/idl_codegen/instructions/index.d.ts.map +1 -1
- package/dist/idl_codegen/instructions/index.js +7 -3
- package/dist/idl_codegen/instructions/index.js.map +1 -1
- package/dist/idl_codegen/instructions/initReferrerTokenState.d.ts +2 -5
- package/dist/idl_codegen/instructions/initReferrerTokenState.d.ts.map +1 -1
- package/dist/idl_codegen/instructions/initReferrerTokenState.js +3 -32
- package/dist/idl_codegen/instructions/initReferrerTokenState.js.map +1 -1
- package/dist/idl_codegen/instructions/markObligationForDeleveraging.d.ts +12 -0
- package/dist/idl_codegen/instructions/markObligationForDeleveraging.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/markObligationForDeleveraging.js +47 -0
- package/dist/idl_codegen/instructions/markObligationForDeleveraging.js.map +1 -0
- package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeem.d.ts +38 -0
- package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeem.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeem.js +159 -0
- package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeem.js.map +1 -0
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +1 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -1
- package/dist/idl_codegen/types/ReserveConfig.d.ts +78 -20
- package/dist/idl_codegen/types/ReserveConfig.d.ts.map +1 -1
- package/dist/idl_codegen/types/ReserveConfig.js +45 -14
- package/dist/idl_codegen/types/ReserveConfig.js.map +1 -1
- package/dist/idl_codegen/types/ReserveLiquidity.d.ts +16 -16
- package/dist/idl_codegen/types/ReserveLiquidity.d.ts.map +1 -1
- package/dist/idl_codegen/types/ReserveLiquidity.js +16 -16
- package/dist/idl_codegen/types/ReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen/types/UpdateConfigMode.d.ts +40 -14
- package/dist/idl_codegen/types/UpdateConfigMode.d.ts.map +1 -1
- package/dist/idl_codegen/types/UpdateConfigMode.js +71 -23
- package/dist/idl_codegen/types/UpdateConfigMode.js.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +37 -11
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js +64 -16
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/idl_codegen/types/index.d.ts +4 -4
- package/dist/idl_codegen/types/index.d.ts.map +1 -1
- package/dist/idl_codegen/types/index.js.map +1 -1
- package/dist/idl_codegen/zero_padding/ObligationZP.d.ts +4 -0
- package/dist/idl_codegen/zero_padding/ObligationZP.d.ts.map +1 -1
- package/dist/idl_codegen/zero_padding/ObligationZP.js +10 -0
- package/dist/idl_codegen/zero_padding/ObligationZP.js.map +1 -1
- package/dist/lending_operations/repay_with_collateral_calcs.d.ts +4 -2
- package/dist/lending_operations/repay_with_collateral_calcs.d.ts.map +1 -1
- package/dist/lending_operations/repay_with_collateral_calcs.js +45 -52
- package/dist/lending_operations/repay_with_collateral_calcs.js.map +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.d.ts +7 -0
- package/dist/lending_operations/repay_with_collateral_operations.d.ts.map +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.js +13 -3
- package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
- package/dist/pyth/accounts/PriceUpdateV2.d.ts +30 -0
- package/dist/pyth/accounts/PriceUpdateV2.d.ts.map +1 -0
- package/dist/pyth/accounts/PriceUpdateV2.js +104 -0
- package/dist/pyth/accounts/PriceUpdateV2.js.map +1 -0
- package/dist/pyth/accounts/index.d.ts +3 -0
- package/dist/pyth/accounts/index.d.ts.map +1 -0
- package/dist/pyth/accounts/index.js +6 -0
- package/dist/pyth/accounts/index.js.map +1 -0
- package/dist/pyth/types/PriceFeedMessage.d.ts +58 -0
- package/dist/pyth/types/PriceFeedMessage.d.ts.map +1 -0
- package/dist/pyth/types/PriceFeedMessage.js +118 -0
- package/dist/pyth/types/PriceFeedMessage.js.map +1 -0
- package/dist/pyth/types/VerificationLevel.d.ts +45 -0
- package/dist/pyth/types/VerificationLevel.d.ts.map +1 -0
- package/dist/pyth/types/VerificationLevel.js +105 -0
- package/dist/pyth/types/VerificationLevel.js.map +1 -0
- package/dist/pyth/types/index.d.ts +7 -0
- package/dist/pyth/types/index.d.ts.map +1 -0
- package/dist/pyth/types/index.js +31 -0
- package/dist/pyth/types/index.js.map +1 -0
- package/dist/referrals/instructions.d.ts.map +1 -1
- package/dist/referrals/instructions.js +1 -2
- package/dist/referrals/instructions.js.map +1 -1
- package/dist/utils/managerTypes.d.ts.map +1 -1
- package/dist/utils/managerTypes.js +5 -4
- package/dist/utils/managerTypes.js.map +1 -1
- package/dist/utils/oracle.d.ts.map +1 -1
- package/dist/utils/oracle.js +9 -14
- package/dist/utils/oracle.js.map +1 -1
- package/package.json +3 -4
- package/src/classes/action.ts +1 -3
- package/src/classes/manager.ts +29 -6
- package/src/classes/obligation.ts +15 -6
- package/src/classes/reserve.ts +16 -16
- package/src/classes/shared.ts +2 -2
- package/src/classes/types.ts +16 -17
- package/src/classes/vault.ts +18 -4
- package/src/client_kamino_manager.ts +61 -6
- package/src/idl_codegen/accounts/LendingMarket.ts +76 -13
- package/src/idl_codegen/accounts/Obligation.ts +47 -2
- package/src/idl_codegen/accounts/Reserve.ts +1 -1
- package/src/idl_codegen/errors/custom.ts +56 -0
- package/src/idl_codegen/instructions/index.ts +13 -6
- package/src/idl_codegen/instructions/initReferrerTokenState.ts +3 -15
- package/src/idl_codegen/instructions/markObligationForDeleveraging.ts +40 -0
- package/src/idl_codegen/instructions/repayAndWithdrawAndRedeem.ts +177 -0
- package/src/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.ts +1 -1
- package/src/idl_codegen/programId.ts +1 -1
- package/src/idl_codegen/types/ReserveConfig.ts +100 -28
- package/src/idl_codegen/types/ReserveLiquidity.ts +25 -24
- package/src/idl_codegen/types/UpdateConfigMode.ts +86 -26
- package/src/idl_codegen/types/UpdateLendingMarketMode.ts +77 -17
- package/src/idl_codegen/types/index.ts +14 -6
- package/src/idl_codegen/zero_padding/ObligationZP.ts +10 -0
- package/src/lending_operations/repay_with_collateral_calcs.ts +55 -61
- package/src/lending_operations/repay_with_collateral_operations.ts +24 -4
- package/src/leverage/operations.ts +1 -1
- package/src/pyth/accounts/PriceUpdateV2.ts +110 -0
- package/src/pyth/accounts/index.ts +2 -0
- package/src/pyth/types/PriceFeedMessage.ts +120 -0
- package/src/pyth/types/VerificationLevel.ts +98 -0
- package/src/pyth/types/index.ts +9 -0
- package/src/referrals/instructions.ts +1 -3
- package/src/utils/managerTypes.ts +5 -5
- package/src/utils/oracle.ts +9 -15
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { TransactionInstruction, PublicKey, AccountMeta } 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
|
+
import { PROGRAM_ID } from "../programId"
|
|
6
|
+
|
|
7
|
+
export interface RepayAndWithdrawAndRedeemArgs {
|
|
8
|
+
repayAmount: BN
|
|
9
|
+
withdrawCollateralAmount: BN
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface RepayAndWithdrawAndRedeemAccounts {
|
|
13
|
+
repayAccounts: {
|
|
14
|
+
owner: PublicKey
|
|
15
|
+
obligation: PublicKey
|
|
16
|
+
lendingMarket: PublicKey
|
|
17
|
+
repayReserve: PublicKey
|
|
18
|
+
reserveLiquidityMint: PublicKey
|
|
19
|
+
reserveDestinationLiquidity: PublicKey
|
|
20
|
+
userSourceLiquidity: PublicKey
|
|
21
|
+
tokenProgram: PublicKey
|
|
22
|
+
instructionSysvarAccount: PublicKey
|
|
23
|
+
}
|
|
24
|
+
withdrawAccounts: {
|
|
25
|
+
owner: PublicKey
|
|
26
|
+
obligation: PublicKey
|
|
27
|
+
lendingMarket: PublicKey
|
|
28
|
+
lendingMarketAuthority: PublicKey
|
|
29
|
+
withdrawReserve: PublicKey
|
|
30
|
+
reserveLiquidityMint: PublicKey
|
|
31
|
+
reserveSourceCollateral: PublicKey
|
|
32
|
+
reserveCollateralMint: PublicKey
|
|
33
|
+
reserveLiquiditySupply: PublicKey
|
|
34
|
+
userDestinationLiquidity: PublicKey
|
|
35
|
+
placeholderUserDestinationCollateral: PublicKey
|
|
36
|
+
collateralTokenProgram: PublicKey
|
|
37
|
+
liquidityTokenProgram: PublicKey
|
|
38
|
+
instructionSysvarAccount: PublicKey
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const layout = borsh.struct([
|
|
43
|
+
borsh.u64("repayAmount"),
|
|
44
|
+
borsh.u64("withdrawCollateralAmount"),
|
|
45
|
+
])
|
|
46
|
+
|
|
47
|
+
export function repayAndWithdrawAndRedeem(
|
|
48
|
+
args: RepayAndWithdrawAndRedeemArgs,
|
|
49
|
+
accounts: RepayAndWithdrawAndRedeemAccounts,
|
|
50
|
+
programId: PublicKey = PROGRAM_ID
|
|
51
|
+
) {
|
|
52
|
+
const keys: Array<AccountMeta> = [
|
|
53
|
+
{ pubkey: accounts.repayAccounts.owner, isSigner: true, isWritable: false },
|
|
54
|
+
{
|
|
55
|
+
pubkey: accounts.repayAccounts.obligation,
|
|
56
|
+
isSigner: false,
|
|
57
|
+
isWritable: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
pubkey: accounts.repayAccounts.lendingMarket,
|
|
61
|
+
isSigner: false,
|
|
62
|
+
isWritable: false,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
pubkey: accounts.repayAccounts.repayReserve,
|
|
66
|
+
isSigner: false,
|
|
67
|
+
isWritable: true,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
pubkey: accounts.repayAccounts.reserveLiquidityMint,
|
|
71
|
+
isSigner: false,
|
|
72
|
+
isWritable: true,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
pubkey: accounts.repayAccounts.reserveDestinationLiquidity,
|
|
76
|
+
isSigner: false,
|
|
77
|
+
isWritable: true,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
pubkey: accounts.repayAccounts.userSourceLiquidity,
|
|
81
|
+
isSigner: false,
|
|
82
|
+
isWritable: true,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
pubkey: accounts.repayAccounts.tokenProgram,
|
|
86
|
+
isSigner: false,
|
|
87
|
+
isWritable: false,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
pubkey: accounts.repayAccounts.instructionSysvarAccount,
|
|
91
|
+
isSigner: false,
|
|
92
|
+
isWritable: false,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
pubkey: accounts.withdrawAccounts.owner,
|
|
96
|
+
isSigner: true,
|
|
97
|
+
isWritable: false,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
pubkey: accounts.withdrawAccounts.obligation,
|
|
101
|
+
isSigner: false,
|
|
102
|
+
isWritable: true,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
pubkey: accounts.withdrawAccounts.lendingMarket,
|
|
106
|
+
isSigner: false,
|
|
107
|
+
isWritable: false,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
pubkey: accounts.withdrawAccounts.lendingMarketAuthority,
|
|
111
|
+
isSigner: false,
|
|
112
|
+
isWritable: false,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
pubkey: accounts.withdrawAccounts.withdrawReserve,
|
|
116
|
+
isSigner: false,
|
|
117
|
+
isWritable: true,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
pubkey: accounts.withdrawAccounts.reserveLiquidityMint,
|
|
121
|
+
isSigner: false,
|
|
122
|
+
isWritable: true,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
pubkey: accounts.withdrawAccounts.reserveSourceCollateral,
|
|
126
|
+
isSigner: false,
|
|
127
|
+
isWritable: true,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
pubkey: accounts.withdrawAccounts.reserveCollateralMint,
|
|
131
|
+
isSigner: false,
|
|
132
|
+
isWritable: true,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
pubkey: accounts.withdrawAccounts.reserveLiquiditySupply,
|
|
136
|
+
isSigner: false,
|
|
137
|
+
isWritable: true,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
pubkey: accounts.withdrawAccounts.userDestinationLiquidity,
|
|
141
|
+
isSigner: false,
|
|
142
|
+
isWritable: true,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
pubkey: accounts.withdrawAccounts.placeholderUserDestinationCollateral,
|
|
146
|
+
isSigner: false,
|
|
147
|
+
isWritable: false,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
pubkey: accounts.withdrawAccounts.collateralTokenProgram,
|
|
151
|
+
isSigner: false,
|
|
152
|
+
isWritable: false,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
pubkey: accounts.withdrawAccounts.liquidityTokenProgram,
|
|
156
|
+
isSigner: false,
|
|
157
|
+
isWritable: false,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
pubkey: accounts.withdrawAccounts.instructionSysvarAccount,
|
|
161
|
+
isSigner: false,
|
|
162
|
+
isWritable: false,
|
|
163
|
+
},
|
|
164
|
+
]
|
|
165
|
+
const identifier = Buffer.from([2, 54, 152, 3, 148, 96, 109, 218])
|
|
166
|
+
const buffer = Buffer.alloc(1000)
|
|
167
|
+
const len = layout.encode(
|
|
168
|
+
{
|
|
169
|
+
repayAmount: args.repayAmount,
|
|
170
|
+
withdrawCollateralAmount: args.withdrawCollateralAmount,
|
|
171
|
+
},
|
|
172
|
+
buffer
|
|
173
|
+
)
|
|
174
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
175
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
176
|
+
return ix
|
|
177
|
+
}
|
package/src/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.ts
CHANGED
|
@@ -33,7 +33,7 @@ export function withdrawObligationCollateralAndRedeemReserveCollateral(
|
|
|
33
33
|
programId: PublicKey = PROGRAM_ID
|
|
34
34
|
) {
|
|
35
35
|
const keys: Array<AccountMeta> = [
|
|
36
|
-
{ pubkey: accounts.owner, isSigner: true, isWritable:
|
|
36
|
+
{ pubkey: accounts.owner, isSigner: true, isWritable: false },
|
|
37
37
|
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
38
38
|
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
39
39
|
{
|
|
@@ -31,13 +31,18 @@ export interface ReserveConfigFields {
|
|
|
31
31
|
maxLiquidationBonusBps: number
|
|
32
32
|
/** Bad debt liquidation bonus for an undercollateralized obligation, as bps */
|
|
33
33
|
badDebtLiquidationBonusBps: number
|
|
34
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Time in seconds that must pass before redemptions are enabled after the deposit limit is
|
|
36
|
+
* crossed.
|
|
37
|
+
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
38
|
+
*/
|
|
35
39
|
deleveragingMarginCallPeriodSecs: BN
|
|
36
40
|
/**
|
|
37
|
-
* The rate at which the deleveraging threshold decreases in
|
|
38
|
-
* e.g. 1 bps per hour would be
|
|
41
|
+
* The rate at which the deleveraging threshold decreases in seconds per bps
|
|
42
|
+
* e.g. 1 bps per hour would be denoted by `3600` here.
|
|
43
|
+
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
39
44
|
*/
|
|
40
|
-
|
|
45
|
+
deleveragingThresholdSecsPerBps: BN
|
|
41
46
|
/** Program owner fees assessed, separate from gains due to interest accrual */
|
|
42
47
|
fees: types.ReserveFeesFields
|
|
43
48
|
/** Borrow rate curve based on utilization */
|
|
@@ -50,13 +55,21 @@ export interface ReserveConfigFields {
|
|
|
50
55
|
borrowLimit: BN
|
|
51
56
|
/** Token id from TokenInfos struct */
|
|
52
57
|
tokenInfo: types.TokenInfoFields
|
|
53
|
-
/** Deposit
|
|
58
|
+
/** Deposit withdrawal caps - deposit & redeem */
|
|
54
59
|
depositWithdrawalCap: types.WithdrawalCapsFields
|
|
55
|
-
/** Debt
|
|
60
|
+
/** Debt withdrawal caps - borrow & repay */
|
|
56
61
|
debtWithdrawalCap: types.WithdrawalCapsFields
|
|
57
62
|
elevationGroups: Array<number>
|
|
58
63
|
disableUsageAsCollOutsideEmode: number
|
|
59
64
|
utilizationLimitBlockBorrowingAbove: number
|
|
65
|
+
/**
|
|
66
|
+
* Whether this reserve should be subject to auto-deleveraging after deposit or borrow limit is
|
|
67
|
+
* crossed.
|
|
68
|
+
* Besides this flag, the lending market's flag also needs to be enabled (logical `AND`).
|
|
69
|
+
* **NOTE:** the manual "target LTV" deleveraging (enabled by the risk council for individual
|
|
70
|
+
* obligations) is NOT affected by this flag.
|
|
71
|
+
*/
|
|
72
|
+
autodeleverageEnabled: number
|
|
60
73
|
reserved1: Array<number>
|
|
61
74
|
/**
|
|
62
75
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
@@ -71,6 +84,11 @@ export interface ReserveConfigFields {
|
|
|
71
84
|
* - 0 to disable borrows in this elevation group (expected value for the debt asset)
|
|
72
85
|
*/
|
|
73
86
|
borrowLimitAgainstThisCollateralInElevationGroup: Array<BN>
|
|
87
|
+
/**
|
|
88
|
+
* The rate at which the deleveraging-related liquidation bonus increases, in bps per day.
|
|
89
|
+
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
90
|
+
*/
|
|
91
|
+
deleveragingBonusIncreaseBpsPerDay: BN
|
|
74
92
|
}
|
|
75
93
|
|
|
76
94
|
export interface ReserveConfigJSON {
|
|
@@ -101,13 +119,18 @@ export interface ReserveConfigJSON {
|
|
|
101
119
|
maxLiquidationBonusBps: number
|
|
102
120
|
/** Bad debt liquidation bonus for an undercollateralized obligation, as bps */
|
|
103
121
|
badDebtLiquidationBonusBps: number
|
|
104
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* Time in seconds that must pass before redemptions are enabled after the deposit limit is
|
|
124
|
+
* crossed.
|
|
125
|
+
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
126
|
+
*/
|
|
105
127
|
deleveragingMarginCallPeriodSecs: string
|
|
106
128
|
/**
|
|
107
|
-
* The rate at which the deleveraging threshold decreases in
|
|
108
|
-
* e.g. 1 bps per hour would be
|
|
129
|
+
* The rate at which the deleveraging threshold decreases in seconds per bps
|
|
130
|
+
* e.g. 1 bps per hour would be denoted by `3600` here.
|
|
131
|
+
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
109
132
|
*/
|
|
110
|
-
|
|
133
|
+
deleveragingThresholdSecsPerBps: string
|
|
111
134
|
/** Program owner fees assessed, separate from gains due to interest accrual */
|
|
112
135
|
fees: types.ReserveFeesJSON
|
|
113
136
|
/** Borrow rate curve based on utilization */
|
|
@@ -120,13 +143,21 @@ export interface ReserveConfigJSON {
|
|
|
120
143
|
borrowLimit: string
|
|
121
144
|
/** Token id from TokenInfos struct */
|
|
122
145
|
tokenInfo: types.TokenInfoJSON
|
|
123
|
-
/** Deposit
|
|
146
|
+
/** Deposit withdrawal caps - deposit & redeem */
|
|
124
147
|
depositWithdrawalCap: types.WithdrawalCapsJSON
|
|
125
|
-
/** Debt
|
|
148
|
+
/** Debt withdrawal caps - borrow & repay */
|
|
126
149
|
debtWithdrawalCap: types.WithdrawalCapsJSON
|
|
127
150
|
elevationGroups: Array<number>
|
|
128
151
|
disableUsageAsCollOutsideEmode: number
|
|
129
152
|
utilizationLimitBlockBorrowingAbove: number
|
|
153
|
+
/**
|
|
154
|
+
* Whether this reserve should be subject to auto-deleveraging after deposit or borrow limit is
|
|
155
|
+
* crossed.
|
|
156
|
+
* Besides this flag, the lending market's flag also needs to be enabled (logical `AND`).
|
|
157
|
+
* **NOTE:** the manual "target LTV" deleveraging (enabled by the risk council for individual
|
|
158
|
+
* obligations) is NOT affected by this flag.
|
|
159
|
+
*/
|
|
160
|
+
autodeleverageEnabled: number
|
|
130
161
|
reserved1: Array<number>
|
|
131
162
|
/**
|
|
132
163
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
@@ -141,6 +172,11 @@ export interface ReserveConfigJSON {
|
|
|
141
172
|
* - 0 to disable borrows in this elevation group (expected value for the debt asset)
|
|
142
173
|
*/
|
|
143
174
|
borrowLimitAgainstThisCollateralInElevationGroup: Array<string>
|
|
175
|
+
/**
|
|
176
|
+
* The rate at which the deleveraging-related liquidation bonus increases, in bps per day.
|
|
177
|
+
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
178
|
+
*/
|
|
179
|
+
deleveragingBonusIncreaseBpsPerDay: string
|
|
144
180
|
}
|
|
145
181
|
|
|
146
182
|
/** Reserve configuration values */
|
|
@@ -172,13 +208,18 @@ export class ReserveConfig {
|
|
|
172
208
|
readonly maxLiquidationBonusBps: number
|
|
173
209
|
/** Bad debt liquidation bonus for an undercollateralized obligation, as bps */
|
|
174
210
|
readonly badDebtLiquidationBonusBps: number
|
|
175
|
-
/**
|
|
211
|
+
/**
|
|
212
|
+
* Time in seconds that must pass before redemptions are enabled after the deposit limit is
|
|
213
|
+
* crossed.
|
|
214
|
+
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
215
|
+
*/
|
|
176
216
|
readonly deleveragingMarginCallPeriodSecs: BN
|
|
177
217
|
/**
|
|
178
|
-
* The rate at which the deleveraging threshold decreases in
|
|
179
|
-
* e.g. 1 bps per hour would be
|
|
218
|
+
* The rate at which the deleveraging threshold decreases in seconds per bps
|
|
219
|
+
* e.g. 1 bps per hour would be denoted by `3600` here.
|
|
220
|
+
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
180
221
|
*/
|
|
181
|
-
readonly
|
|
222
|
+
readonly deleveragingThresholdSecsPerBps: BN
|
|
182
223
|
/** Program owner fees assessed, separate from gains due to interest accrual */
|
|
183
224
|
readonly fees: types.ReserveFees
|
|
184
225
|
/** Borrow rate curve based on utilization */
|
|
@@ -191,13 +232,21 @@ export class ReserveConfig {
|
|
|
191
232
|
readonly borrowLimit: BN
|
|
192
233
|
/** Token id from TokenInfos struct */
|
|
193
234
|
readonly tokenInfo: types.TokenInfo
|
|
194
|
-
/** Deposit
|
|
235
|
+
/** Deposit withdrawal caps - deposit & redeem */
|
|
195
236
|
readonly depositWithdrawalCap: types.WithdrawalCaps
|
|
196
|
-
/** Debt
|
|
237
|
+
/** Debt withdrawal caps - borrow & repay */
|
|
197
238
|
readonly debtWithdrawalCap: types.WithdrawalCaps
|
|
198
239
|
readonly elevationGroups: Array<number>
|
|
199
240
|
readonly disableUsageAsCollOutsideEmode: number
|
|
200
241
|
readonly utilizationLimitBlockBorrowingAbove: number
|
|
242
|
+
/**
|
|
243
|
+
* Whether this reserve should be subject to auto-deleveraging after deposit or borrow limit is
|
|
244
|
+
* crossed.
|
|
245
|
+
* Besides this flag, the lending market's flag also needs to be enabled (logical `AND`).
|
|
246
|
+
* **NOTE:** the manual "target LTV" deleveraging (enabled by the risk council for individual
|
|
247
|
+
* obligations) is NOT affected by this flag.
|
|
248
|
+
*/
|
|
249
|
+
readonly autodeleverageEnabled: number
|
|
201
250
|
readonly reserved1: Array<number>
|
|
202
251
|
/**
|
|
203
252
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
@@ -212,6 +261,11 @@ export class ReserveConfig {
|
|
|
212
261
|
* - 0 to disable borrows in this elevation group (expected value for the debt asset)
|
|
213
262
|
*/
|
|
214
263
|
readonly borrowLimitAgainstThisCollateralInElevationGroup: Array<BN>
|
|
264
|
+
/**
|
|
265
|
+
* The rate at which the deleveraging-related liquidation bonus increases, in bps per day.
|
|
266
|
+
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
267
|
+
*/
|
|
268
|
+
readonly deleveragingBonusIncreaseBpsPerDay: BN
|
|
215
269
|
|
|
216
270
|
constructor(fields: ReserveConfigFields) {
|
|
217
271
|
this.status = fields.status
|
|
@@ -228,8 +282,8 @@ export class ReserveConfig {
|
|
|
228
282
|
this.badDebtLiquidationBonusBps = fields.badDebtLiquidationBonusBps
|
|
229
283
|
this.deleveragingMarginCallPeriodSecs =
|
|
230
284
|
fields.deleveragingMarginCallPeriodSecs
|
|
231
|
-
this.
|
|
232
|
-
fields.
|
|
285
|
+
this.deleveragingThresholdSecsPerBps =
|
|
286
|
+
fields.deleveragingThresholdSecsPerBps
|
|
233
287
|
this.fees = new types.ReserveFees({ ...fields.fees })
|
|
234
288
|
this.borrowRateCurve = new types.BorrowRateCurve({
|
|
235
289
|
...fields.borrowRateCurve,
|
|
@@ -248,11 +302,14 @@ export class ReserveConfig {
|
|
|
248
302
|
this.disableUsageAsCollOutsideEmode = fields.disableUsageAsCollOutsideEmode
|
|
249
303
|
this.utilizationLimitBlockBorrowingAbove =
|
|
250
304
|
fields.utilizationLimitBlockBorrowingAbove
|
|
305
|
+
this.autodeleverageEnabled = fields.autodeleverageEnabled
|
|
251
306
|
this.reserved1 = fields.reserved1
|
|
252
307
|
this.borrowLimitOutsideElevationGroup =
|
|
253
308
|
fields.borrowLimitOutsideElevationGroup
|
|
254
309
|
this.borrowLimitAgainstThisCollateralInElevationGroup =
|
|
255
310
|
fields.borrowLimitAgainstThisCollateralInElevationGroup
|
|
311
|
+
this.deleveragingBonusIncreaseBpsPerDay =
|
|
312
|
+
fields.deleveragingBonusIncreaseBpsPerDay
|
|
256
313
|
}
|
|
257
314
|
|
|
258
315
|
static layout(property?: string) {
|
|
@@ -271,7 +328,7 @@ export class ReserveConfig {
|
|
|
271
328
|
borsh.u16("maxLiquidationBonusBps"),
|
|
272
329
|
borsh.u16("badDebtLiquidationBonusBps"),
|
|
273
330
|
borsh.u64("deleveragingMarginCallPeriodSecs"),
|
|
274
|
-
borsh.u64("
|
|
331
|
+
borsh.u64("deleveragingThresholdSecsPerBps"),
|
|
275
332
|
types.ReserveFees.layout("fees"),
|
|
276
333
|
types.BorrowRateCurve.layout("borrowRateCurve"),
|
|
277
334
|
borsh.u64("borrowFactorPct"),
|
|
@@ -283,13 +340,15 @@ export class ReserveConfig {
|
|
|
283
340
|
borsh.array(borsh.u8(), 20, "elevationGroups"),
|
|
284
341
|
borsh.u8("disableUsageAsCollOutsideEmode"),
|
|
285
342
|
borsh.u8("utilizationLimitBlockBorrowingAbove"),
|
|
286
|
-
borsh.
|
|
343
|
+
borsh.u8("autodeleverageEnabled"),
|
|
344
|
+
borsh.array(borsh.u8(), 1, "reserved1"),
|
|
287
345
|
borsh.u64("borrowLimitOutsideElevationGroup"),
|
|
288
346
|
borsh.array(
|
|
289
347
|
borsh.u64(),
|
|
290
348
|
32,
|
|
291
349
|
"borrowLimitAgainstThisCollateralInElevationGroup"
|
|
292
350
|
),
|
|
351
|
+
borsh.u64("deleveragingBonusIncreaseBpsPerDay"),
|
|
293
352
|
],
|
|
294
353
|
property
|
|
295
354
|
)
|
|
@@ -311,7 +370,7 @@ export class ReserveConfig {
|
|
|
311
370
|
maxLiquidationBonusBps: obj.maxLiquidationBonusBps,
|
|
312
371
|
badDebtLiquidationBonusBps: obj.badDebtLiquidationBonusBps,
|
|
313
372
|
deleveragingMarginCallPeriodSecs: obj.deleveragingMarginCallPeriodSecs,
|
|
314
|
-
|
|
373
|
+
deleveragingThresholdSecsPerBps: obj.deleveragingThresholdSecsPerBps,
|
|
315
374
|
fees: types.ReserveFees.fromDecoded(obj.fees),
|
|
316
375
|
borrowRateCurve: types.BorrowRateCurve.fromDecoded(obj.borrowRateCurve),
|
|
317
376
|
borrowFactorPct: obj.borrowFactorPct,
|
|
@@ -328,10 +387,13 @@ export class ReserveConfig {
|
|
|
328
387
|
disableUsageAsCollOutsideEmode: obj.disableUsageAsCollOutsideEmode,
|
|
329
388
|
utilizationLimitBlockBorrowingAbove:
|
|
330
389
|
obj.utilizationLimitBlockBorrowingAbove,
|
|
390
|
+
autodeleverageEnabled: obj.autodeleverageEnabled,
|
|
331
391
|
reserved1: obj.reserved1,
|
|
332
392
|
borrowLimitOutsideElevationGroup: obj.borrowLimitOutsideElevationGroup,
|
|
333
393
|
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
334
394
|
obj.borrowLimitAgainstThisCollateralInElevationGroup,
|
|
395
|
+
deleveragingBonusIncreaseBpsPerDay:
|
|
396
|
+
obj.deleveragingBonusIncreaseBpsPerDay,
|
|
335
397
|
})
|
|
336
398
|
}
|
|
337
399
|
|
|
@@ -350,7 +412,7 @@ export class ReserveConfig {
|
|
|
350
412
|
maxLiquidationBonusBps: fields.maxLiquidationBonusBps,
|
|
351
413
|
badDebtLiquidationBonusBps: fields.badDebtLiquidationBonusBps,
|
|
352
414
|
deleveragingMarginCallPeriodSecs: fields.deleveragingMarginCallPeriodSecs,
|
|
353
|
-
|
|
415
|
+
deleveragingThresholdSecsPerBps: fields.deleveragingThresholdSecsPerBps,
|
|
354
416
|
fees: types.ReserveFees.toEncodable(fields.fees),
|
|
355
417
|
borrowRateCurve: types.BorrowRateCurve.toEncodable(
|
|
356
418
|
fields.borrowRateCurve
|
|
@@ -369,10 +431,13 @@ export class ReserveConfig {
|
|
|
369
431
|
disableUsageAsCollOutsideEmode: fields.disableUsageAsCollOutsideEmode,
|
|
370
432
|
utilizationLimitBlockBorrowingAbove:
|
|
371
433
|
fields.utilizationLimitBlockBorrowingAbove,
|
|
434
|
+
autodeleverageEnabled: fields.autodeleverageEnabled,
|
|
372
435
|
reserved1: fields.reserved1,
|
|
373
436
|
borrowLimitOutsideElevationGroup: fields.borrowLimitOutsideElevationGroup,
|
|
374
437
|
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
375
438
|
fields.borrowLimitAgainstThisCollateralInElevationGroup,
|
|
439
|
+
deleveragingBonusIncreaseBpsPerDay:
|
|
440
|
+
fields.deleveragingBonusIncreaseBpsPerDay,
|
|
376
441
|
}
|
|
377
442
|
}
|
|
378
443
|
|
|
@@ -392,8 +457,8 @@ export class ReserveConfig {
|
|
|
392
457
|
badDebtLiquidationBonusBps: this.badDebtLiquidationBonusBps,
|
|
393
458
|
deleveragingMarginCallPeriodSecs:
|
|
394
459
|
this.deleveragingMarginCallPeriodSecs.toString(),
|
|
395
|
-
|
|
396
|
-
this.
|
|
460
|
+
deleveragingThresholdSecsPerBps:
|
|
461
|
+
this.deleveragingThresholdSecsPerBps.toString(),
|
|
397
462
|
fees: this.fees.toJSON(),
|
|
398
463
|
borrowRateCurve: this.borrowRateCurve.toJSON(),
|
|
399
464
|
borrowFactorPct: this.borrowFactorPct.toString(),
|
|
@@ -406,6 +471,7 @@ export class ReserveConfig {
|
|
|
406
471
|
disableUsageAsCollOutsideEmode: this.disableUsageAsCollOutsideEmode,
|
|
407
472
|
utilizationLimitBlockBorrowingAbove:
|
|
408
473
|
this.utilizationLimitBlockBorrowingAbove,
|
|
474
|
+
autodeleverageEnabled: this.autodeleverageEnabled,
|
|
409
475
|
reserved1: this.reserved1,
|
|
410
476
|
borrowLimitOutsideElevationGroup:
|
|
411
477
|
this.borrowLimitOutsideElevationGroup.toString(),
|
|
@@ -413,6 +479,8 @@ export class ReserveConfig {
|
|
|
413
479
|
this.borrowLimitAgainstThisCollateralInElevationGroup.map((item) =>
|
|
414
480
|
item.toString()
|
|
415
481
|
),
|
|
482
|
+
deleveragingBonusIncreaseBpsPerDay:
|
|
483
|
+
this.deleveragingBonusIncreaseBpsPerDay.toString(),
|
|
416
484
|
}
|
|
417
485
|
}
|
|
418
486
|
|
|
@@ -433,8 +501,8 @@ export class ReserveConfig {
|
|
|
433
501
|
deleveragingMarginCallPeriodSecs: new BN(
|
|
434
502
|
obj.deleveragingMarginCallPeriodSecs
|
|
435
503
|
),
|
|
436
|
-
|
|
437
|
-
obj.
|
|
504
|
+
deleveragingThresholdSecsPerBps: new BN(
|
|
505
|
+
obj.deleveragingThresholdSecsPerBps
|
|
438
506
|
),
|
|
439
507
|
fees: types.ReserveFees.fromJSON(obj.fees),
|
|
440
508
|
borrowRateCurve: types.BorrowRateCurve.fromJSON(obj.borrowRateCurve),
|
|
@@ -450,6 +518,7 @@ export class ReserveConfig {
|
|
|
450
518
|
disableUsageAsCollOutsideEmode: obj.disableUsageAsCollOutsideEmode,
|
|
451
519
|
utilizationLimitBlockBorrowingAbove:
|
|
452
520
|
obj.utilizationLimitBlockBorrowingAbove,
|
|
521
|
+
autodeleverageEnabled: obj.autodeleverageEnabled,
|
|
453
522
|
reserved1: obj.reserved1,
|
|
454
523
|
borrowLimitOutsideElevationGroup: new BN(
|
|
455
524
|
obj.borrowLimitOutsideElevationGroup
|
|
@@ -458,6 +527,9 @@ export class ReserveConfig {
|
|
|
458
527
|
obj.borrowLimitAgainstThisCollateralInElevationGroup.map(
|
|
459
528
|
(item) => new BN(item)
|
|
460
529
|
),
|
|
530
|
+
deleveragingBonusIncreaseBpsPerDay: new BN(
|
|
531
|
+
obj.deleveragingBonusIncreaseBpsPerDay
|
|
532
|
+
),
|
|
461
533
|
})
|
|
462
534
|
}
|
|
463
535
|
|
|
@@ -21,15 +21,15 @@ export interface ReserveLiquidityFields {
|
|
|
21
21
|
/** Reserve liquidity mint decimals */
|
|
22
22
|
mintDecimals: BN
|
|
23
23
|
/**
|
|
24
|
-
* Timestamp
|
|
24
|
+
* Timestamp when the last refresh reserve detected that the liquidity amount is above the deposit cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
25
25
|
* If the threshold is not crossed, then the timestamp is set to 0
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
depositLimitCrossedTimestamp: BN
|
|
28
28
|
/**
|
|
29
|
-
* Timestamp
|
|
29
|
+
* Timestamp when the last refresh reserve detected that the borrowed amount is above the borrow cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
30
30
|
* If the threshold is not crossed, then the timestamp is set to 0
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
borrowLimitCrossedTimestamp: BN
|
|
33
33
|
/** Reserve liquidity cumulative borrow rate (scaled fraction) */
|
|
34
34
|
cumulativeBorrowRateBsf: types.BigFractionBytesFields
|
|
35
35
|
/** Reserve cumulative protocol fees (scaled fraction) */
|
|
@@ -64,15 +64,15 @@ export interface ReserveLiquidityJSON {
|
|
|
64
64
|
/** Reserve liquidity mint decimals */
|
|
65
65
|
mintDecimals: string
|
|
66
66
|
/**
|
|
67
|
-
* Timestamp
|
|
67
|
+
* Timestamp when the last refresh reserve detected that the liquidity amount is above the deposit cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
68
68
|
* If the threshold is not crossed, then the timestamp is set to 0
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
depositLimitCrossedTimestamp: string
|
|
71
71
|
/**
|
|
72
|
-
* Timestamp
|
|
72
|
+
* Timestamp when the last refresh reserve detected that the borrowed amount is above the borrow cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
73
73
|
* If the threshold is not crossed, then the timestamp is set to 0
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
borrowLimitCrossedTimestamp: string
|
|
76
76
|
/** Reserve liquidity cumulative borrow rate (scaled fraction) */
|
|
77
77
|
cumulativeBorrowRateBsf: types.BigFractionBytesJSON
|
|
78
78
|
/** Reserve cumulative protocol fees (scaled fraction) */
|
|
@@ -108,15 +108,15 @@ export class ReserveLiquidity {
|
|
|
108
108
|
/** Reserve liquidity mint decimals */
|
|
109
109
|
readonly mintDecimals: BN
|
|
110
110
|
/**
|
|
111
|
-
* Timestamp
|
|
111
|
+
* Timestamp when the last refresh reserve detected that the liquidity amount is above the deposit cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
112
112
|
* If the threshold is not crossed, then the timestamp is set to 0
|
|
113
113
|
*/
|
|
114
|
-
readonly
|
|
114
|
+
readonly depositLimitCrossedTimestamp: BN
|
|
115
115
|
/**
|
|
116
|
-
* Timestamp
|
|
116
|
+
* Timestamp when the last refresh reserve detected that the borrowed amount is above the borrow cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.
|
|
117
117
|
* If the threshold is not crossed, then the timestamp is set to 0
|
|
118
118
|
*/
|
|
119
|
-
readonly
|
|
119
|
+
readonly borrowLimitCrossedTimestamp: BN
|
|
120
120
|
/** Reserve liquidity cumulative borrow rate (scaled fraction) */
|
|
121
121
|
readonly cumulativeBorrowRateBsf: types.BigFractionBytes
|
|
122
122
|
/** Reserve cumulative protocol fees (scaled fraction) */
|
|
@@ -141,8 +141,8 @@ export class ReserveLiquidity {
|
|
|
141
141
|
this.marketPriceSf = fields.marketPriceSf
|
|
142
142
|
this.marketPriceLastUpdatedTs = fields.marketPriceLastUpdatedTs
|
|
143
143
|
this.mintDecimals = fields.mintDecimals
|
|
144
|
-
this.
|
|
145
|
-
this.
|
|
144
|
+
this.depositLimitCrossedTimestamp = fields.depositLimitCrossedTimestamp
|
|
145
|
+
this.borrowLimitCrossedTimestamp = fields.borrowLimitCrossedTimestamp
|
|
146
146
|
this.cumulativeBorrowRateBsf = new types.BigFractionBytes({
|
|
147
147
|
...fields.cumulativeBorrowRateBsf,
|
|
148
148
|
})
|
|
@@ -166,8 +166,8 @@ export class ReserveLiquidity {
|
|
|
166
166
|
borsh.u128("marketPriceSf"),
|
|
167
167
|
borsh.u64("marketPriceLastUpdatedTs"),
|
|
168
168
|
borsh.u64("mintDecimals"),
|
|
169
|
-
borsh.u64("
|
|
170
|
-
borsh.u64("
|
|
169
|
+
borsh.u64("depositLimitCrossedTimestamp"),
|
|
170
|
+
borsh.u64("borrowLimitCrossedTimestamp"),
|
|
171
171
|
types.BigFractionBytes.layout("cumulativeBorrowRateBsf"),
|
|
172
172
|
borsh.u128("accumulatedProtocolFeesSf"),
|
|
173
173
|
borsh.u128("accumulatedReferrerFeesSf"),
|
|
@@ -192,8 +192,8 @@ export class ReserveLiquidity {
|
|
|
192
192
|
marketPriceSf: obj.marketPriceSf,
|
|
193
193
|
marketPriceLastUpdatedTs: obj.marketPriceLastUpdatedTs,
|
|
194
194
|
mintDecimals: obj.mintDecimals,
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
depositLimitCrossedTimestamp: obj.depositLimitCrossedTimestamp,
|
|
196
|
+
borrowLimitCrossedTimestamp: obj.borrowLimitCrossedTimestamp,
|
|
197
197
|
cumulativeBorrowRateBsf: types.BigFractionBytes.fromDecoded(
|
|
198
198
|
obj.cumulativeBorrowRateBsf
|
|
199
199
|
),
|
|
@@ -217,8 +217,8 @@ export class ReserveLiquidity {
|
|
|
217
217
|
marketPriceSf: fields.marketPriceSf,
|
|
218
218
|
marketPriceLastUpdatedTs: fields.marketPriceLastUpdatedTs,
|
|
219
219
|
mintDecimals: fields.mintDecimals,
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
depositLimitCrossedTimestamp: fields.depositLimitCrossedTimestamp,
|
|
221
|
+
borrowLimitCrossedTimestamp: fields.borrowLimitCrossedTimestamp,
|
|
222
222
|
cumulativeBorrowRateBsf: types.BigFractionBytes.toEncodable(
|
|
223
223
|
fields.cumulativeBorrowRateBsf
|
|
224
224
|
),
|
|
@@ -242,8 +242,9 @@ export class ReserveLiquidity {
|
|
|
242
242
|
marketPriceSf: this.marketPriceSf.toString(),
|
|
243
243
|
marketPriceLastUpdatedTs: this.marketPriceLastUpdatedTs.toString(),
|
|
244
244
|
mintDecimals: this.mintDecimals.toString(),
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
depositLimitCrossedTimestamp:
|
|
246
|
+
this.depositLimitCrossedTimestamp.toString(),
|
|
247
|
+
borrowLimitCrossedTimestamp: this.borrowLimitCrossedTimestamp.toString(),
|
|
247
248
|
cumulativeBorrowRateBsf: this.cumulativeBorrowRateBsf.toJSON(),
|
|
248
249
|
accumulatedProtocolFeesSf: this.accumulatedProtocolFeesSf.toString(),
|
|
249
250
|
accumulatedReferrerFeesSf: this.accumulatedReferrerFeesSf.toString(),
|
|
@@ -265,8 +266,8 @@ export class ReserveLiquidity {
|
|
|
265
266
|
marketPriceSf: new BN(obj.marketPriceSf),
|
|
266
267
|
marketPriceLastUpdatedTs: new BN(obj.marketPriceLastUpdatedTs),
|
|
267
268
|
mintDecimals: new BN(obj.mintDecimals),
|
|
268
|
-
|
|
269
|
-
|
|
269
|
+
depositLimitCrossedTimestamp: new BN(obj.depositLimitCrossedTimestamp),
|
|
270
|
+
borrowLimitCrossedTimestamp: new BN(obj.borrowLimitCrossedTimestamp),
|
|
270
271
|
cumulativeBorrowRateBsf: types.BigFractionBytes.fromJSON(
|
|
271
272
|
obj.cumulativeBorrowRateBsf
|
|
272
273
|
),
|