@kamino-finance/klend-sdk 7.1.4-beta.0 → 7.1.4
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 +3 -144
- package/dist/@codegen/klend/accounts/LendingMarket.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/LendingMarket.js +3 -105
- package/dist/@codegen/klend/accounts/LendingMarket.js.map +1 -1
- package/dist/@codegen/klend/accounts/Obligation.d.ts +15 -30
- package/dist/@codegen/klend/accounts/Obligation.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/Obligation.js +21 -31
- package/dist/@codegen/klend/accounts/Obligation.js.map +1 -1
- package/dist/@codegen/klend/accounts/Reserve.d.ts +0 -6
- package/dist/@codegen/klend/accounts/Reserve.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/Reserve.js +2 -9
- package/dist/@codegen/klend/accounts/Reserve.js.map +1 -1
- package/dist/@codegen/klend/accounts/UserState.d.ts +75 -0
- package/dist/@codegen/klend/accounts/UserState.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/UserState.js +25 -0
- package/dist/@codegen/klend/accounts/UserState.js.map +1 -1
- package/dist/@codegen/klend/accounts/index.d.ts +0 -6
- package/dist/@codegen/klend/accounts/index.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/index.js +1 -7
- package/dist/@codegen/klend/accounts/index.js.map +1 -1
- package/dist/@codegen/klend/errors/custom.d.ts +2 -226
- package/dist/@codegen/klend/errors/custom.d.ts.map +1 -1
- package/dist/@codegen/klend/errors/custom.js +3 -396
- package/dist/@codegen/klend/errors/custom.js.map +1 -1
- package/dist/@codegen/klend/instructions/idlMissingTypes.d.ts +2 -1
- package/dist/@codegen/klend/instructions/idlMissingTypes.d.ts.map +1 -1
- package/dist/@codegen/klend/instructions/idlMissingTypes.js +2 -6
- package/dist/@codegen/klend/instructions/idlMissingTypes.js.map +1 -1
- package/dist/@codegen/klend/instructions/index.d.ts +0 -16
- package/dist/@codegen/klend/instructions/index.d.ts.map +1 -1
- package/dist/@codegen/klend/instructions/index.js +1 -18
- 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 +5 -1
- package/dist/@codegen/klend/instructions/initReserve.js.map +1 -1
- package/dist/@codegen/klend/instructions/liquidateObligationAndRedeemReserveCollateral.js +1 -1
- 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 +0 -1
- 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 +0 -1
- 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/types/AssetTier.d.ts +45 -0
- package/dist/@codegen/klend/types/AssetTier.d.ts.map +1 -0
- package/dist/@codegen/klend/types/AssetTier.js +132 -0
- package/dist/@codegen/klend/types/AssetTier.js.map +1 -0
- package/dist/@codegen/klend/types/ObligationLiquidity.d.ts +5 -35
- package/dist/@codegen/klend/types/ObligationLiquidity.d.ts.map +1 -1
- package/dist/@codegen/klend/types/ObligationLiquidity.js +7 -17
- 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 +29 -141
- package/dist/@codegen/klend/types/ReserveConfig.d.ts.map +1 -1
- package/dist/@codegen/klend/types/ReserveConfig.js +25 -89
- 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 +8 -26
- package/dist/@codegen/klend/types/ReserveLiquidity.d.ts.map +1 -1
- package/dist/@codegen/klend/types/ReserveLiquidity.js +8 -14
- package/dist/@codegen/klend/types/ReserveLiquidity.js.map +1 -1
- package/dist/@codegen/klend/types/UpdateConfigMode.d.ts +14 -92
- package/dist/@codegen/klend/types/UpdateConfigMode.d.ts.map +1 -1
- package/dist/@codegen/klend/types/UpdateConfigMode.js +23 -168
- package/dist/@codegen/klend/types/UpdateConfigMode.js.map +1 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.d.ts +0 -130
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.d.ts.map +1 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.js +1 -241
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/@codegen/klend/types/index.d.ts +8 -10
- package/dist/@codegen/klend/types/index.d.ts.map +1 -1
- package/dist/@codegen/klend/types/index.js +3 -7
- package/dist/@codegen/klend/types/index.js.map +1 -1
- package/dist/@codegen/klend/zero_padding/ObligationZP.d.ts +4 -9
- package/dist/@codegen/klend/zero_padding/ObligationZP.d.ts.map +1 -1
- package/dist/@codegen/klend/zero_padding/ObligationZP.js +13 -22
- package/dist/@codegen/klend/zero_padding/ObligationZP.js.map +1 -1
- package/dist/classes/action.d.ts +3 -30
- package/dist/classes/action.d.ts.map +1 -1
- package/dist/classes/action.js +10 -364
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +0 -10
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts +2 -6
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js +6 -26
- 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 +7 -13
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/unstakingPool.d.ts +3 -20
- package/dist/classes/unstakingPool.d.ts.map +1 -1
- package/dist/classes/unstakingPool.js +8 -62
- package/dist/classes/unstakingPool.js.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 +46 -28
- package/dist/classes/vault.js.map +1 -1
- package/dist/idl/klend.json +293 -2186
- package/dist/lending_operations/index.d.ts +0 -1
- package/dist/lending_operations/index.d.ts.map +1 -1
- package/dist/lending_operations/index.js +0 -1
- package/dist/lending_operations/index.js.map +1 -1
- package/dist/manager/client_kamino_manager.js +9 -12
- package/dist/manager/client_kamino_manager.js.map +1 -1
- package/dist/utils/ata.d.ts +10 -1
- package/dist/utils/ata.d.ts.map +1 -1
- package/dist/utils/ata.js +47 -0
- package/dist/utils/ata.js.map +1 -1
- package/dist/utils/managerTypes.d.ts.map +1 -1
- package/dist/utils/managerTypes.js +4 -9
- package/dist/utils/managerTypes.js.map +1 -1
- package/dist/utils/seeds.d.ts +14 -10
- package/dist/utils/seeds.d.ts.map +1 -1
- package/dist/utils/seeds.js +22 -25
- package/dist/utils/seeds.js.map +1 -1
- package/package.json +1 -1
- package/src/@codegen/klend/accounts/LendingMarket.ts +5 -210
- package/src/@codegen/klend/accounts/Obligation.ts +31 -53
- package/src/@codegen/klend/accounts/Reserve.ts +2 -13
- package/src/@codegen/klend/accounts/UserState.ts +75 -0
- package/src/@codegen/klend/accounts/index.ts +0 -6
- package/src/@codegen/klend/errors/custom.ts +2 -427
- package/src/@codegen/klend/instructions/idlMissingTypes.ts +4 -7
- package/src/@codegen/klend/instructions/index.ts +0 -34
- package/src/@codegen/klend/instructions/initReserve.ts +6 -2
- package/src/@codegen/klend/instructions/liquidateObligationAndRedeemReserveCollateral.ts +1 -1
- package/src/@codegen/klend/instructions/updateGlobalConfig.ts +1 -2
- package/src/@codegen/klend/instructions/updateReserveConfig.ts +1 -2
- package/src/@codegen/klend/instructions/withdrawObligationCollateral.ts +1 -1
- package/src/@codegen/klend/instructions/withdrawObligationCollateralV2.ts +1 -1
- package/src/@codegen/klend/types/AssetTier.ts +119 -0
- package/src/@codegen/klend/types/ObligationLiquidity.ts +9 -39
- package/src/@codegen/klend/types/ObligationOrder.ts +4 -4
- package/src/@codegen/klend/types/ReserveConfig.ts +39 -171
- package/src/@codegen/klend/types/ReserveFees.ts +12 -12
- package/src/@codegen/klend/types/ReserveLiquidity.ts +12 -30
- package/src/@codegen/klend/types/UpdateConfigMode.ts +26 -206
- package/src/@codegen/klend/types/UpdateLendingMarketMode.ts +0 -300
- package/src/@codegen/klend/types/index.ts +16 -45
- package/src/@codegen/klend/zero_padding/ObligationZP.ts +13 -22
- package/src/classes/action.ts +8 -577
- package/src/classes/manager.ts +0 -11
- package/src/classes/market.ts +5 -36
- package/src/classes/obligation.ts +1 -1
- package/src/classes/reserve.ts +8 -13
- package/src/classes/unstakingPool.ts +6 -83
- package/src/classes/vault.ts +57 -38
- package/src/idl/klend.json +294 -2187
- package/src/lending_operations/index.ts +0 -1
- package/src/manager/client_kamino_manager.ts +9 -13
- package/src/utils/ata.ts +79 -0
- package/src/utils/managerTypes.ts +4 -9
- package/src/utils/seeds.ts +26 -28
- package/dist/@codegen/klend/accounts/PoolState.d.ts +0 -53
- package/dist/@codegen/klend/accounts/PoolState.d.ts.map +0 -1
- package/dist/@codegen/klend/accounts/PoolState.js +0 -167
- package/dist/@codegen/klend/accounts/PoolState.js.map +0 -1
- package/dist/@codegen/klend/accounts/UnstakeTicket.d.ts +0 -41
- package/dist/@codegen/klend/accounts/UnstakeTicket.d.ts.map +0 -1
- package/dist/@codegen/klend/accounts/UnstakeTicket.js +0 -143
- package/dist/@codegen/klend/accounts/UnstakeTicket.js.map +0 -1
- package/dist/@codegen/klend/accounts/WithdrawTicket.d.ts +0 -132
- package/dist/@codegen/klend/accounts/WithdrawTicket.d.ts.map +0 -1
- package/dist/@codegen/klend/accounts/WithdrawTicket.js +0 -191
- package/dist/@codegen/klend/accounts/WithdrawTicket.js.map +0 -1
- package/dist/@codegen/klend/instructions/enqueueToWithdraw.d.ts +0 -39
- package/dist/@codegen/klend/instructions/enqueueToWithdraw.d.ts.map +0 -1
- package/dist/@codegen/klend/instructions/enqueueToWithdraw.js +0 -67
- package/dist/@codegen/klend/instructions/enqueueToWithdraw.js.map +0 -1
- package/dist/@codegen/klend/instructions/fillBorrowOrder.d.ts +0 -36
- package/dist/@codegen/klend/instructions/fillBorrowOrder.d.ts.map +0 -1
- package/dist/@codegen/klend/instructions/fillBorrowOrder.js +0 -49
- package/dist/@codegen/klend/instructions/fillBorrowOrder.js.map +0 -1
- package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.d.ts +0 -47
- package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.d.ts.map +0 -1
- package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.js +0 -66
- package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.js.map +0 -1
- package/dist/@codegen/klend/instructions/setBorrowOrder.d.ts +0 -31
- package/dist/@codegen/klend/instructions/setBorrowOrder.d.ts.map +0 -1
- package/dist/@codegen/klend/instructions/setBorrowOrder.js +0 -64
- package/dist/@codegen/klend/instructions/setBorrowOrder.js.map +0 -1
- package/dist/@codegen/klend/instructions/unstakeLstCollateralEnd.d.ts +0 -53
- package/dist/@codegen/klend/instructions/unstakeLstCollateralEnd.d.ts.map +0 -1
- package/dist/@codegen/klend/instructions/unstakeLstCollateralEnd.js +0 -190
- package/dist/@codegen/klend/instructions/unstakeLstCollateralEnd.js.map +0 -1
- package/dist/@codegen/klend/instructions/unstakeLstCollateralStart.d.ts +0 -70
- package/dist/@codegen/klend/instructions/unstakeLstCollateralStart.d.ts.map +0 -1
- package/dist/@codegen/klend/instructions/unstakeLstCollateralStart.js +0 -261
- package/dist/@codegen/klend/instructions/unstakeLstCollateralStart.js.map +0 -1
- package/dist/@codegen/klend/instructions/withdrawObligationUsol.d.ts +0 -41
- package/dist/@codegen/klend/instructions/withdrawObligationUsol.d.ts.map +0 -1
- package/dist/@codegen/klend/instructions/withdrawObligationUsol.js +0 -135
- package/dist/@codegen/klend/instructions/withdrawObligationUsol.js.map +0 -1
- package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.d.ts +0 -51
- package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.d.ts.map +0 -1
- package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.js +0 -28
- package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.js.map +0 -1
- package/dist/@codegen/klend/types/BorrowOrder.d.ts +0 -192
- package/dist/@codegen/klend/types/BorrowOrder.d.ts.map +0 -1
- package/dist/@codegen/klend/types/BorrowOrder.js +0 -194
- package/dist/@codegen/klend/types/BorrowOrder.js.map +0 -1
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.d.ts +0 -39
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.d.ts.map +0 -1
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.js +0 -100
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.js.map +0 -1
- package/dist/@codegen/klend/types/WithdrawQueue.d.ts +0 -64
- package/dist/@codegen/klend/types/WithdrawQueue.d.ts.map +0 -1
- package/dist/@codegen/klend/types/WithdrawQueue.js +0 -104
- package/dist/@codegen/klend/types/WithdrawQueue.js.map +0 -1
- package/dist/lending_operations/unstake_lst_collateral.d.ts +0 -12
- package/dist/lending_operations/unstake_lst_collateral.d.ts.map +0 -1
- package/dist/lending_operations/unstake_lst_collateral.js +0 -104
- package/dist/lending_operations/unstake_lst_collateral.js.map +0 -1
- package/src/@codegen/klend/accounts/PoolState.ts +0 -192
- package/src/@codegen/klend/accounts/UnstakeTicket.ts +0 -160
- package/src/@codegen/klend/accounts/WithdrawTicket.ts +0 -256
- package/src/@codegen/klend/instructions/enqueueToWithdraw.ts +0 -89
- package/src/@codegen/klend/instructions/fillBorrowOrder.ts +0 -96
- package/src/@codegen/klend/instructions/recoverInvalidTicketCollateral.ts +0 -96
- package/src/@codegen/klend/instructions/setBorrowOrder.ts +0 -77
- package/src/@codegen/klend/instructions/unstakeLstCollateralEnd.ts +0 -251
- package/src/@codegen/klend/instructions/unstakeLstCollateralStart.ts +0 -353
- package/src/@codegen/klend/instructions/withdrawObligationUsol.ts +0 -168
- package/src/@codegen/klend/instructions/withdrawQueuedLiquidity.ts +0 -92
- package/src/@codegen/klend/types/BorrowOrder.ts +0 -267
- package/src/@codegen/klend/types/BorrowOrderConfigArgs.ts +0 -87
- package/src/@codegen/klend/types/WithdrawQueue.ts +0 -117
- package/src/lending_operations/unstake_lst_collateral.ts +0 -174
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { address, Address } from "@solana/kit" // 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
|
+
import { borshAddress } from "../utils"
|
|
6
|
+
|
|
7
|
+
export interface RegularJSON {
|
|
8
|
+
kind: "Regular"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class Regular {
|
|
12
|
+
static readonly discriminator = 0
|
|
13
|
+
static readonly kind = "Regular"
|
|
14
|
+
readonly discriminator = 0
|
|
15
|
+
readonly kind = "Regular"
|
|
16
|
+
|
|
17
|
+
toJSON(): RegularJSON {
|
|
18
|
+
return {
|
|
19
|
+
kind: "Regular",
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
toEncodable() {
|
|
24
|
+
return {
|
|
25
|
+
Regular: {},
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface IsolatedCollateralJSON {
|
|
31
|
+
kind: "IsolatedCollateral"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class IsolatedCollateral {
|
|
35
|
+
static readonly discriminator = 1
|
|
36
|
+
static readonly kind = "IsolatedCollateral"
|
|
37
|
+
readonly discriminator = 1
|
|
38
|
+
readonly kind = "IsolatedCollateral"
|
|
39
|
+
|
|
40
|
+
toJSON(): IsolatedCollateralJSON {
|
|
41
|
+
return {
|
|
42
|
+
kind: "IsolatedCollateral",
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
toEncodable() {
|
|
47
|
+
return {
|
|
48
|
+
IsolatedCollateral: {},
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface IsolatedDebtJSON {
|
|
54
|
+
kind: "IsolatedDebt"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export class IsolatedDebt {
|
|
58
|
+
static readonly discriminator = 2
|
|
59
|
+
static readonly kind = "IsolatedDebt"
|
|
60
|
+
readonly discriminator = 2
|
|
61
|
+
readonly kind = "IsolatedDebt"
|
|
62
|
+
|
|
63
|
+
toJSON(): IsolatedDebtJSON {
|
|
64
|
+
return {
|
|
65
|
+
kind: "IsolatedDebt",
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
toEncodable() {
|
|
70
|
+
return {
|
|
71
|
+
IsolatedDebt: {},
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
|
+
export function fromDecoded(obj: any): types.AssetTierKind {
|
|
78
|
+
if (typeof obj !== "object") {
|
|
79
|
+
throw new Error("Invalid enum object")
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if ("Regular" in obj) {
|
|
83
|
+
return new Regular()
|
|
84
|
+
}
|
|
85
|
+
if ("IsolatedCollateral" in obj) {
|
|
86
|
+
return new IsolatedCollateral()
|
|
87
|
+
}
|
|
88
|
+
if ("IsolatedDebt" in obj) {
|
|
89
|
+
return new IsolatedDebt()
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
throw new Error("Invalid enum object")
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function fromJSON(obj: types.AssetTierJSON): types.AssetTierKind {
|
|
96
|
+
switch (obj.kind) {
|
|
97
|
+
case "Regular": {
|
|
98
|
+
return new Regular()
|
|
99
|
+
}
|
|
100
|
+
case "IsolatedCollateral": {
|
|
101
|
+
return new IsolatedCollateral()
|
|
102
|
+
}
|
|
103
|
+
case "IsolatedDebt": {
|
|
104
|
+
return new IsolatedDebt()
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function layout(property?: string) {
|
|
110
|
+
const ret = borsh.rustEnum([
|
|
111
|
+
borsh.struct([], "Regular"),
|
|
112
|
+
borsh.struct([], "IsolatedCollateral"),
|
|
113
|
+
borsh.struct([], "IsolatedDebt"),
|
|
114
|
+
])
|
|
115
|
+
if (property !== undefined) {
|
|
116
|
+
return ret.replicate(property)
|
|
117
|
+
}
|
|
118
|
+
return ret
|
|
119
|
+
}
|
|
@@ -9,17 +9,7 @@ export interface ObligationLiquidityFields {
|
|
|
9
9
|
borrowReserve: Address
|
|
10
10
|
/** Borrow rate used for calculating interest (big scaled fraction) */
|
|
11
11
|
cumulativeBorrowRateBsf: types.BigFractionBytesFields
|
|
12
|
-
|
|
13
|
-
* The timestamp at which this debt was taken.
|
|
14
|
-
* More specifically: when the *first* borrow operation from this reserve happened.
|
|
15
|
-
* This means that:
|
|
16
|
-
* - adding debt of the same reserve does *not* change this timestamp,
|
|
17
|
-
* - repaying the entire debt of this reserve *does* reset this timestamp.
|
|
18
|
-
*
|
|
19
|
-
* Note: this field is *not* only metadata: it is used in the logic, e.g. for enforcing the
|
|
20
|
-
* fixed-term borrows (i.e. those induced by [ReserveConfig::debt_term_seconds]).
|
|
21
|
-
*/
|
|
22
|
-
firstBorrowedAtTimestamp: BN
|
|
12
|
+
padding: BN
|
|
23
13
|
/** Amount of liquidity borrowed plus interest (scaled fraction) */
|
|
24
14
|
borrowedAmountSf: BN
|
|
25
15
|
/** Liquidity market value in quote currency (scaled fraction) */
|
|
@@ -36,17 +26,7 @@ export interface ObligationLiquidityJSON {
|
|
|
36
26
|
borrowReserve: string
|
|
37
27
|
/** Borrow rate used for calculating interest (big scaled fraction) */
|
|
38
28
|
cumulativeBorrowRateBsf: types.BigFractionBytesJSON
|
|
39
|
-
|
|
40
|
-
* The timestamp at which this debt was taken.
|
|
41
|
-
* More specifically: when the *first* borrow operation from this reserve happened.
|
|
42
|
-
* This means that:
|
|
43
|
-
* - adding debt of the same reserve does *not* change this timestamp,
|
|
44
|
-
* - repaying the entire debt of this reserve *does* reset this timestamp.
|
|
45
|
-
*
|
|
46
|
-
* Note: this field is *not* only metadata: it is used in the logic, e.g. for enforcing the
|
|
47
|
-
* fixed-term borrows (i.e. those induced by [ReserveConfig::debt_term_seconds]).
|
|
48
|
-
*/
|
|
49
|
-
firstBorrowedAtTimestamp: string
|
|
29
|
+
padding: string
|
|
50
30
|
/** Amount of liquidity borrowed plus interest (scaled fraction) */
|
|
51
31
|
borrowedAmountSf: string
|
|
52
32
|
/** Liquidity market value in quote currency (scaled fraction) */
|
|
@@ -64,17 +44,7 @@ export class ObligationLiquidity {
|
|
|
64
44
|
readonly borrowReserve: Address
|
|
65
45
|
/** Borrow rate used for calculating interest (big scaled fraction) */
|
|
66
46
|
readonly cumulativeBorrowRateBsf: types.BigFractionBytes
|
|
67
|
-
|
|
68
|
-
* The timestamp at which this debt was taken.
|
|
69
|
-
* More specifically: when the *first* borrow operation from this reserve happened.
|
|
70
|
-
* This means that:
|
|
71
|
-
* - adding debt of the same reserve does *not* change this timestamp,
|
|
72
|
-
* - repaying the entire debt of this reserve *does* reset this timestamp.
|
|
73
|
-
*
|
|
74
|
-
* Note: this field is *not* only metadata: it is used in the logic, e.g. for enforcing the
|
|
75
|
-
* fixed-term borrows (i.e. those induced by [ReserveConfig::debt_term_seconds]).
|
|
76
|
-
*/
|
|
77
|
-
readonly firstBorrowedAtTimestamp: BN
|
|
47
|
+
readonly padding: BN
|
|
78
48
|
/** Amount of liquidity borrowed plus interest (scaled fraction) */
|
|
79
49
|
readonly borrowedAmountSf: BN
|
|
80
50
|
/** Liquidity market value in quote currency (scaled fraction) */
|
|
@@ -90,7 +60,7 @@ export class ObligationLiquidity {
|
|
|
90
60
|
this.cumulativeBorrowRateBsf = new types.BigFractionBytes({
|
|
91
61
|
...fields.cumulativeBorrowRateBsf,
|
|
92
62
|
})
|
|
93
|
-
this.
|
|
63
|
+
this.padding = fields.padding
|
|
94
64
|
this.borrowedAmountSf = fields.borrowedAmountSf
|
|
95
65
|
this.marketValueSf = fields.marketValueSf
|
|
96
66
|
this.borrowFactorAdjustedMarketValueSf =
|
|
@@ -105,7 +75,7 @@ export class ObligationLiquidity {
|
|
|
105
75
|
[
|
|
106
76
|
borshAddress("borrowReserve"),
|
|
107
77
|
types.BigFractionBytes.layout("cumulativeBorrowRateBsf"),
|
|
108
|
-
borsh.u64("
|
|
78
|
+
borsh.u64("padding"),
|
|
109
79
|
borsh.u128("borrowedAmountSf"),
|
|
110
80
|
borsh.u128("marketValueSf"),
|
|
111
81
|
borsh.u128("borrowFactorAdjustedMarketValueSf"),
|
|
@@ -123,7 +93,7 @@ export class ObligationLiquidity {
|
|
|
123
93
|
cumulativeBorrowRateBsf: types.BigFractionBytes.fromDecoded(
|
|
124
94
|
obj.cumulativeBorrowRateBsf
|
|
125
95
|
),
|
|
126
|
-
|
|
96
|
+
padding: obj.padding,
|
|
127
97
|
borrowedAmountSf: obj.borrowedAmountSf,
|
|
128
98
|
marketValueSf: obj.marketValueSf,
|
|
129
99
|
borrowFactorAdjustedMarketValueSf: obj.borrowFactorAdjustedMarketValueSf,
|
|
@@ -139,7 +109,7 @@ export class ObligationLiquidity {
|
|
|
139
109
|
cumulativeBorrowRateBsf: types.BigFractionBytes.toEncodable(
|
|
140
110
|
fields.cumulativeBorrowRateBsf
|
|
141
111
|
),
|
|
142
|
-
|
|
112
|
+
padding: fields.padding,
|
|
143
113
|
borrowedAmountSf: fields.borrowedAmountSf,
|
|
144
114
|
marketValueSf: fields.marketValueSf,
|
|
145
115
|
borrowFactorAdjustedMarketValueSf:
|
|
@@ -154,7 +124,7 @@ export class ObligationLiquidity {
|
|
|
154
124
|
return {
|
|
155
125
|
borrowReserve: this.borrowReserve,
|
|
156
126
|
cumulativeBorrowRateBsf: this.cumulativeBorrowRateBsf.toJSON(),
|
|
157
|
-
|
|
127
|
+
padding: this.padding.toString(),
|
|
158
128
|
borrowedAmountSf: this.borrowedAmountSf.toString(),
|
|
159
129
|
marketValueSf: this.marketValueSf.toString(),
|
|
160
130
|
borrowFactorAdjustedMarketValueSf:
|
|
@@ -171,7 +141,7 @@ export class ObligationLiquidity {
|
|
|
171
141
|
cumulativeBorrowRateBsf: types.BigFractionBytes.fromJSON(
|
|
172
142
|
obj.cumulativeBorrowRateBsf
|
|
173
143
|
),
|
|
174
|
-
|
|
144
|
+
padding: new BN(obj.padding),
|
|
175
145
|
borrowedAmountSf: new BN(obj.borrowedAmountSf),
|
|
176
146
|
marketValueSf: new BN(obj.marketValueSf),
|
|
177
147
|
borrowFactorAdjustedMarketValueSf: new BN(
|
|
@@ -77,7 +77,7 @@ export interface ObligationOrderFields {
|
|
|
77
77
|
*/
|
|
78
78
|
opportunityType: number
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
80
|
+
* Internal padding.
|
|
81
81
|
* The fields above take up 2+2+1+1 bytes = 48 bits, which means we need 80 bits = 10 bytes to
|
|
82
82
|
* align with `u128`s.
|
|
83
83
|
*/
|
|
@@ -162,7 +162,7 @@ export interface ObligationOrderJSON {
|
|
|
162
162
|
*/
|
|
163
163
|
opportunityType: number
|
|
164
164
|
/**
|
|
165
|
-
*
|
|
165
|
+
* Internal padding.
|
|
166
166
|
* The fields above take up 2+2+1+1 bytes = 48 bits, which means we need 80 bits = 10 bytes to
|
|
167
167
|
* align with `u128`s.
|
|
168
168
|
*/
|
|
@@ -176,7 +176,7 @@ export interface ObligationOrderJSON {
|
|
|
176
176
|
|
|
177
177
|
/**
|
|
178
178
|
* A single obligation order.
|
|
179
|
-
* See [Obligation::
|
|
179
|
+
* See [Obligation::orders].
|
|
180
180
|
*/
|
|
181
181
|
export class ObligationOrder {
|
|
182
182
|
/**
|
|
@@ -251,7 +251,7 @@ export class ObligationOrder {
|
|
|
251
251
|
*/
|
|
252
252
|
readonly opportunityType: number
|
|
253
253
|
/**
|
|
254
|
-
*
|
|
254
|
+
* Internal padding.
|
|
255
255
|
* The fields above take up 2+2+1+1 bytes = 48 bits, which means we need 80 bits = 10 bytes to
|
|
256
256
|
* align with `u128`s.
|
|
257
257
|
*/
|
|
@@ -8,18 +8,16 @@ 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
|
+
assetTier: 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
|
|
16
14
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* [DEPRECATED] Space that used to hold 2 fields:
|
|
16
|
+
* - Boost for side (debt or collateral)
|
|
17
|
+
* - Reward points multiplier per obligation type
|
|
18
|
+
* Can be re-used after making sure all underlying production account data is zeroed.
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
/** Past reserved space - feel free to reuse. */
|
|
22
|
-
reserved1: Array<number>
|
|
20
|
+
reserved2: Array<number>
|
|
23
21
|
/** Cut of the order execution bonus that the protocol receives, as a percentage */
|
|
24
22
|
protocolOrderExecutionFeePct: number
|
|
25
23
|
/** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
|
|
@@ -78,14 +76,7 @@ export interface ReserveConfigFields {
|
|
|
78
76
|
* obligations) is NOT affected by this flag.
|
|
79
77
|
*/
|
|
80
78
|
autodeleverageEnabled: number
|
|
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
|
|
79
|
+
reserved1: Array<number>
|
|
89
80
|
/**
|
|
90
81
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
91
82
|
* - u64::MAX for inf
|
|
@@ -104,49 +95,22 @@ export interface ReserveConfigFields {
|
|
|
104
95
|
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
105
96
|
*/
|
|
106
97
|
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
|
|
132
98
|
}
|
|
133
99
|
|
|
134
100
|
export interface ReserveConfigJSON {
|
|
135
101
|
/** Status of the reserve Active/Obsolete/Hidden */
|
|
136
102
|
status: number
|
|
137
103
|
/** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */
|
|
138
|
-
|
|
104
|
+
assetTier: number
|
|
139
105
|
/** Flat rate that goes to the host */
|
|
140
106
|
hostFixedInterestRateBps: number
|
|
141
|
-
/** Starting bonus for deleveraging-related liquidations, in bps. */
|
|
142
|
-
minDeleveragingBonusBps: number
|
|
143
107
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
108
|
+
* [DEPRECATED] Space that used to hold 2 fields:
|
|
109
|
+
* - Boost for side (debt or collateral)
|
|
110
|
+
* - Reward points multiplier per obligation type
|
|
111
|
+
* Can be re-used after making sure all underlying production account data is zeroed.
|
|
146
112
|
*/
|
|
147
|
-
|
|
148
|
-
/** Past reserved space - feel free to reuse. */
|
|
149
|
-
reserved1: Array<number>
|
|
113
|
+
reserved2: Array<number>
|
|
150
114
|
/** Cut of the order execution bonus that the protocol receives, as a percentage */
|
|
151
115
|
protocolOrderExecutionFeePct: number
|
|
152
116
|
/** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
|
|
@@ -205,14 +169,7 @@ export interface ReserveConfigJSON {
|
|
|
205
169
|
* obligations) is NOT affected by this flag.
|
|
206
170
|
*/
|
|
207
171
|
autodeleverageEnabled: number
|
|
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
|
|
172
|
+
reserved1: Array<number>
|
|
216
173
|
/**
|
|
217
174
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
218
175
|
* - u64::MAX for inf
|
|
@@ -231,31 +188,6 @@ export interface ReserveConfigJSON {
|
|
|
231
188
|
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
232
189
|
*/
|
|
233
190
|
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
|
|
259
191
|
}
|
|
260
192
|
|
|
261
193
|
/** Reserve configuration values */
|
|
@@ -263,18 +195,16 @@ export class ReserveConfig {
|
|
|
263
195
|
/** Status of the reserve Active/Obsolete/Hidden */
|
|
264
196
|
readonly status: number
|
|
265
197
|
/** Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt */
|
|
266
|
-
readonly
|
|
198
|
+
readonly assetTier: number
|
|
267
199
|
/** Flat rate that goes to the host */
|
|
268
200
|
readonly hostFixedInterestRateBps: number
|
|
269
|
-
/** Starting bonus for deleveraging-related liquidations, in bps. */
|
|
270
|
-
readonly minDeleveragingBonusBps: number
|
|
271
201
|
/**
|
|
272
|
-
*
|
|
273
|
-
*
|
|
202
|
+
* [DEPRECATED] Space that used to hold 2 fields:
|
|
203
|
+
* - Boost for side (debt or collateral)
|
|
204
|
+
* - Reward points multiplier per obligation type
|
|
205
|
+
* Can be re-used after making sure all underlying production account data is zeroed.
|
|
274
206
|
*/
|
|
275
|
-
readonly
|
|
276
|
-
/** Past reserved space - feel free to reuse. */
|
|
277
|
-
readonly reserved1: Array<number>
|
|
207
|
+
readonly reserved2: Array<number>
|
|
278
208
|
/** Cut of the order execution bonus that the protocol receives, as a percentage */
|
|
279
209
|
readonly protocolOrderExecutionFeePct: number
|
|
280
210
|
/** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
|
|
@@ -333,14 +263,7 @@ export class ReserveConfig {
|
|
|
333
263
|
* obligations) is NOT affected by this flag.
|
|
334
264
|
*/
|
|
335
265
|
readonly autodeleverageEnabled: number
|
|
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
|
|
266
|
+
readonly reserved1: Array<number>
|
|
344
267
|
/**
|
|
345
268
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
346
269
|
* - u64::MAX for inf
|
|
@@ -359,39 +282,12 @@ export class ReserveConfig {
|
|
|
359
282
|
* Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case.
|
|
360
283
|
*/
|
|
361
284
|
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
|
|
387
285
|
|
|
388
286
|
constructor(fields: ReserveConfigFields) {
|
|
389
287
|
this.status = fields.status
|
|
390
|
-
this.
|
|
288
|
+
this.assetTier = fields.assetTier
|
|
391
289
|
this.hostFixedInterestRateBps = fields.hostFixedInterestRateBps
|
|
392
|
-
this.
|
|
393
|
-
this.canUnstakeLstCollateral = fields.canUnstakeLstCollateral
|
|
394
|
-
this.reserved1 = fields.reserved1
|
|
290
|
+
this.reserved2 = fields.reserved2
|
|
395
291
|
this.protocolOrderExecutionFeePct = fields.protocolOrderExecutionFeePct
|
|
396
292
|
this.protocolTakeRatePct = fields.protocolTakeRatePct
|
|
397
293
|
this.protocolLiquidationFeePct = fields.protocolLiquidationFeePct
|
|
@@ -423,27 +319,22 @@ export class ReserveConfig {
|
|
|
423
319
|
this.utilizationLimitBlockBorrowingAbovePct =
|
|
424
320
|
fields.utilizationLimitBlockBorrowingAbovePct
|
|
425
321
|
this.autodeleverageEnabled = fields.autodeleverageEnabled
|
|
426
|
-
this.
|
|
322
|
+
this.reserved1 = fields.reserved1
|
|
427
323
|
this.borrowLimitOutsideElevationGroup =
|
|
428
324
|
fields.borrowLimitOutsideElevationGroup
|
|
429
325
|
this.borrowLimitAgainstThisCollateralInElevationGroup =
|
|
430
326
|
fields.borrowLimitAgainstThisCollateralInElevationGroup
|
|
431
327
|
this.deleveragingBonusIncreaseBpsPerDay =
|
|
432
328
|
fields.deleveragingBonusIncreaseBpsPerDay
|
|
433
|
-
this.debtMaturityTimestamp = fields.debtMaturityTimestamp
|
|
434
|
-
this.debtTermSeconds = fields.debtTermSeconds
|
|
435
|
-
this.ltvLamportsMargin = fields.ltvLamportsMargin
|
|
436
329
|
}
|
|
437
330
|
|
|
438
331
|
static layout(property?: string) {
|
|
439
332
|
return borsh.struct(
|
|
440
333
|
[
|
|
441
334
|
borsh.u8("status"),
|
|
442
|
-
borsh.u8("
|
|
335
|
+
borsh.u8("assetTier"),
|
|
443
336
|
borsh.u16("hostFixedInterestRateBps"),
|
|
444
|
-
borsh.
|
|
445
|
-
borsh.u8("canUnstakeLstCollateral"),
|
|
446
|
-
borsh.array(borsh.u8(), 6, "reserved1"),
|
|
337
|
+
borsh.array(borsh.u8(), 9, "reserved2"),
|
|
447
338
|
borsh.u8("protocolOrderExecutionFeePct"),
|
|
448
339
|
borsh.u8("protocolTakeRatePct"),
|
|
449
340
|
borsh.u8("protocolLiquidationFeePct"),
|
|
@@ -466,7 +357,7 @@ export class ReserveConfig {
|
|
|
466
357
|
borsh.u8("disableUsageAsCollOutsideEmode"),
|
|
467
358
|
borsh.u8("utilizationLimitBlockBorrowingAbovePct"),
|
|
468
359
|
borsh.u8("autodeleverageEnabled"),
|
|
469
|
-
borsh.u8("
|
|
360
|
+
borsh.array(borsh.u8(), 1, "reserved1"),
|
|
470
361
|
borsh.u64("borrowLimitOutsideElevationGroup"),
|
|
471
362
|
borsh.array(
|
|
472
363
|
borsh.u64(),
|
|
@@ -474,9 +365,6 @@ export class ReserveConfig {
|
|
|
474
365
|
"borrowLimitAgainstThisCollateralInElevationGroup"
|
|
475
366
|
),
|
|
476
367
|
borsh.u64("deleveragingBonusIncreaseBpsPerDay"),
|
|
477
|
-
borsh.u64("debtMaturityTimestamp"),
|
|
478
|
-
borsh.u64("debtTermSeconds"),
|
|
479
|
-
borsh.u64("ltvLamportsMargin"),
|
|
480
368
|
],
|
|
481
369
|
property
|
|
482
370
|
)
|
|
@@ -486,11 +374,9 @@ export class ReserveConfig {
|
|
|
486
374
|
static fromDecoded(obj: any) {
|
|
487
375
|
return new ReserveConfig({
|
|
488
376
|
status: obj.status,
|
|
489
|
-
|
|
377
|
+
assetTier: obj.assetTier,
|
|
490
378
|
hostFixedInterestRateBps: obj.hostFixedInterestRateBps,
|
|
491
|
-
|
|
492
|
-
canUnstakeLstCollateral: obj.canUnstakeLstCollateral,
|
|
493
|
-
reserved1: obj.reserved1,
|
|
379
|
+
reserved2: obj.reserved2,
|
|
494
380
|
protocolOrderExecutionFeePct: obj.protocolOrderExecutionFeePct,
|
|
495
381
|
protocolTakeRatePct: obj.protocolTakeRatePct,
|
|
496
382
|
protocolLiquidationFeePct: obj.protocolLiquidationFeePct,
|
|
@@ -519,26 +405,21 @@ export class ReserveConfig {
|
|
|
519
405
|
utilizationLimitBlockBorrowingAbovePct:
|
|
520
406
|
obj.utilizationLimitBlockBorrowingAbovePct,
|
|
521
407
|
autodeleverageEnabled: obj.autodeleverageEnabled,
|
|
522
|
-
|
|
408
|
+
reserved1: obj.reserved1,
|
|
523
409
|
borrowLimitOutsideElevationGroup: obj.borrowLimitOutsideElevationGroup,
|
|
524
410
|
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
525
411
|
obj.borrowLimitAgainstThisCollateralInElevationGroup,
|
|
526
412
|
deleveragingBonusIncreaseBpsPerDay:
|
|
527
413
|
obj.deleveragingBonusIncreaseBpsPerDay,
|
|
528
|
-
debtMaturityTimestamp: obj.debtMaturityTimestamp,
|
|
529
|
-
debtTermSeconds: obj.debtTermSeconds,
|
|
530
|
-
ltvLamportsMargin: obj.ltvLamportsMargin,
|
|
531
414
|
})
|
|
532
415
|
}
|
|
533
416
|
|
|
534
417
|
static toEncodable(fields: ReserveConfigFields) {
|
|
535
418
|
return {
|
|
536
419
|
status: fields.status,
|
|
537
|
-
|
|
420
|
+
assetTier: fields.assetTier,
|
|
538
421
|
hostFixedInterestRateBps: fields.hostFixedInterestRateBps,
|
|
539
|
-
|
|
540
|
-
canUnstakeLstCollateral: fields.canUnstakeLstCollateral,
|
|
541
|
-
reserved1: fields.reserved1,
|
|
422
|
+
reserved2: fields.reserved2,
|
|
542
423
|
protocolOrderExecutionFeePct: fields.protocolOrderExecutionFeePct,
|
|
543
424
|
protocolTakeRatePct: fields.protocolTakeRatePct,
|
|
544
425
|
protocolLiquidationFeePct: fields.protocolLiquidationFeePct,
|
|
@@ -569,26 +450,21 @@ export class ReserveConfig {
|
|
|
569
450
|
utilizationLimitBlockBorrowingAbovePct:
|
|
570
451
|
fields.utilizationLimitBlockBorrowingAbovePct,
|
|
571
452
|
autodeleverageEnabled: fields.autodeleverageEnabled,
|
|
572
|
-
|
|
453
|
+
reserved1: fields.reserved1,
|
|
573
454
|
borrowLimitOutsideElevationGroup: fields.borrowLimitOutsideElevationGroup,
|
|
574
455
|
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
575
456
|
fields.borrowLimitAgainstThisCollateralInElevationGroup,
|
|
576
457
|
deleveragingBonusIncreaseBpsPerDay:
|
|
577
458
|
fields.deleveragingBonusIncreaseBpsPerDay,
|
|
578
|
-
debtMaturityTimestamp: fields.debtMaturityTimestamp,
|
|
579
|
-
debtTermSeconds: fields.debtTermSeconds,
|
|
580
|
-
ltvLamportsMargin: fields.ltvLamportsMargin,
|
|
581
459
|
}
|
|
582
460
|
}
|
|
583
461
|
|
|
584
462
|
toJSON(): ReserveConfigJSON {
|
|
585
463
|
return {
|
|
586
464
|
status: this.status,
|
|
587
|
-
|
|
465
|
+
assetTier: this.assetTier,
|
|
588
466
|
hostFixedInterestRateBps: this.hostFixedInterestRateBps,
|
|
589
|
-
|
|
590
|
-
canUnstakeLstCollateral: this.canUnstakeLstCollateral,
|
|
591
|
-
reserved1: this.reserved1,
|
|
467
|
+
reserved2: this.reserved2,
|
|
592
468
|
protocolOrderExecutionFeePct: this.protocolOrderExecutionFeePct,
|
|
593
469
|
protocolTakeRatePct: this.protocolTakeRatePct,
|
|
594
470
|
protocolLiquidationFeePct: this.protocolLiquidationFeePct,
|
|
@@ -614,7 +490,7 @@ export class ReserveConfig {
|
|
|
614
490
|
utilizationLimitBlockBorrowingAbovePct:
|
|
615
491
|
this.utilizationLimitBlockBorrowingAbovePct,
|
|
616
492
|
autodeleverageEnabled: this.autodeleverageEnabled,
|
|
617
|
-
|
|
493
|
+
reserved1: this.reserved1,
|
|
618
494
|
borrowLimitOutsideElevationGroup:
|
|
619
495
|
this.borrowLimitOutsideElevationGroup.toString(),
|
|
620
496
|
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
@@ -623,20 +499,15 @@ export class ReserveConfig {
|
|
|
623
499
|
),
|
|
624
500
|
deleveragingBonusIncreaseBpsPerDay:
|
|
625
501
|
this.deleveragingBonusIncreaseBpsPerDay.toString(),
|
|
626
|
-
debtMaturityTimestamp: this.debtMaturityTimestamp.toString(),
|
|
627
|
-
debtTermSeconds: this.debtTermSeconds.toString(),
|
|
628
|
-
ltvLamportsMargin: this.ltvLamportsMargin.toString(),
|
|
629
502
|
}
|
|
630
503
|
}
|
|
631
504
|
|
|
632
505
|
static fromJSON(obj: ReserveConfigJSON): ReserveConfig {
|
|
633
506
|
return new ReserveConfig({
|
|
634
507
|
status: obj.status,
|
|
635
|
-
|
|
508
|
+
assetTier: obj.assetTier,
|
|
636
509
|
hostFixedInterestRateBps: obj.hostFixedInterestRateBps,
|
|
637
|
-
|
|
638
|
-
canUnstakeLstCollateral: obj.canUnstakeLstCollateral,
|
|
639
|
-
reserved1: obj.reserved1,
|
|
510
|
+
reserved2: obj.reserved2,
|
|
640
511
|
protocolOrderExecutionFeePct: obj.protocolOrderExecutionFeePct,
|
|
641
512
|
protocolTakeRatePct: obj.protocolTakeRatePct,
|
|
642
513
|
protocolLiquidationFeePct: obj.protocolLiquidationFeePct,
|
|
@@ -666,7 +537,7 @@ export class ReserveConfig {
|
|
|
666
537
|
utilizationLimitBlockBorrowingAbovePct:
|
|
667
538
|
obj.utilizationLimitBlockBorrowingAbovePct,
|
|
668
539
|
autodeleverageEnabled: obj.autodeleverageEnabled,
|
|
669
|
-
|
|
540
|
+
reserved1: obj.reserved1,
|
|
670
541
|
borrowLimitOutsideElevationGroup: new BN(
|
|
671
542
|
obj.borrowLimitOutsideElevationGroup
|
|
672
543
|
),
|
|
@@ -677,9 +548,6 @@ export class ReserveConfig {
|
|
|
677
548
|
deleveragingBonusIncreaseBpsPerDay: new BN(
|
|
678
549
|
obj.deleveragingBonusIncreaseBpsPerDay
|
|
679
550
|
),
|
|
680
|
-
debtMaturityTimestamp: new BN(obj.debtMaturityTimestamp),
|
|
681
|
-
debtTermSeconds: new BN(obj.debtTermSeconds),
|
|
682
|
-
ltvLamportsMargin: new BN(obj.ltvLamportsMargin),
|
|
683
551
|
})
|
|
684
552
|
}
|
|
685
553
|
|