@kamino-finance/klend-sdk 7.4.0-beta.0 → 7.4.0-beta.2
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/kvault/accounts/LendingMarket.d.ts +480 -0
- package/dist/@codegen/kvault/accounts/LendingMarket.d.ts.map +1 -0
- package/dist/@codegen/kvault/accounts/LendingMarket.js +480 -0
- package/dist/@codegen/kvault/accounts/LendingMarket.js.map +1 -0
- package/dist/@codegen/kvault/accounts/Obligation.d.ts +208 -0
- package/dist/@codegen/kvault/accounts/Obligation.d.ts.map +1 -0
- package/dist/@codegen/kvault/accounts/Obligation.js +298 -0
- package/dist/@codegen/kvault/accounts/Obligation.js.map +1 -0
- package/dist/@codegen/kvault/accounts/ReferrerTokenState.d.ts +51 -0
- package/dist/@codegen/kvault/accounts/ReferrerTokenState.d.ts.map +1 -0
- package/dist/@codegen/kvault/accounts/ReferrerTokenState.js +137 -0
- package/dist/@codegen/kvault/accounts/ReferrerTokenState.js.map +1 -0
- package/dist/@codegen/kvault/accounts/Reserve.d.ts +6 -0
- package/dist/@codegen/kvault/accounts/Reserve.d.ts.map +1 -1
- package/dist/@codegen/kvault/accounts/Reserve.js +9 -2
- package/dist/@codegen/kvault/accounts/Reserve.js.map +1 -1
- package/dist/@codegen/kvault/accounts/VaultState.d.ts +45 -3
- package/dist/@codegen/kvault/accounts/VaultState.d.ts.map +1 -1
- package/dist/@codegen/kvault/accounts/VaultState.js +28 -4
- package/dist/@codegen/kvault/accounts/VaultState.js.map +1 -1
- package/dist/@codegen/kvault/accounts/WithdrawTicket.d.ts +144 -0
- package/dist/@codegen/kvault/accounts/WithdrawTicket.d.ts.map +1 -0
- package/dist/@codegen/kvault/accounts/WithdrawTicket.js +205 -0
- package/dist/@codegen/kvault/accounts/WithdrawTicket.js.map +1 -0
- package/dist/@codegen/kvault/accounts/index.d.ts +8 -0
- package/dist/@codegen/kvault/accounts/index.d.ts.map +1 -1
- package/dist/@codegen/kvault/accounts/index.js +9 -1
- package/dist/@codegen/kvault/accounts/index.js.map +1 -1
- package/dist/@codegen/kvault/errors/custom.d.ts +81 -1
- package/dist/@codegen/kvault/errors/custom.d.ts.map +1 -1
- package/dist/@codegen/kvault/errors/custom.js +141 -1
- package/dist/@codegen/kvault/errors/custom.js.map +1 -1
- package/dist/@codegen/kvault/instructions/index.d.ts +4 -0
- package/dist/@codegen/kvault/instructions/index.d.ts.map +1 -1
- package/dist/@codegen/kvault/instructions/index.js +5 -1
- package/dist/@codegen/kvault/instructions/index.js.map +1 -1
- package/dist/@codegen/kvault/instructions/invest.d.ts +9 -0
- package/dist/@codegen/kvault/instructions/invest.d.ts.map +1 -1
- package/dist/@codegen/kvault/instructions/invest.js +7 -0
- package/dist/@codegen/kvault/instructions/invest.js.map +1 -1
- package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillOrder.d.ts +51 -0
- package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillOrder.d.ts.map +1 -0
- package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillOrder.js +154 -0
- package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillOrder.js.map +1 -0
- package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillWithdrawalTicket.d.ts +54 -0
- package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillWithdrawalTicket.d.ts.map +1 -0
- package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillWithdrawalTicket.js +166 -0
- package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillWithdrawalTicket.js.map +1 -0
- package/dist/@codegen/kvault/instructions/updateKlendQueueAccounting.d.ts +1 -0
- package/dist/@codegen/kvault/instructions/updateKlendQueueAccounting.d.ts.map +1 -0
- package/dist/@codegen/kvault/instructions/updateKlendQueueAccounting.js +72 -0
- package/dist/@codegen/kvault/instructions/updateKlendQueueAccounting.js.map +1 -0
- package/dist/@codegen/kvault/instructions/updateReserveAllocation.d.ts +3 -1
- package/dist/@codegen/kvault/instructions/updateReserveAllocation.d.ts.map +1 -1
- package/dist/@codegen/kvault/instructions/updateReserveAllocation.js +3 -0
- package/dist/@codegen/kvault/instructions/updateReserveAllocation.js.map +1 -1
- package/dist/@codegen/kvault/types/BorrowOrder.d.ts +192 -0
- package/dist/@codegen/kvault/types/BorrowOrder.d.ts.map +1 -0
- package/dist/@codegen/kvault/types/BorrowOrder.js +194 -0
- package/dist/@codegen/kvault/types/BorrowOrder.js.map +1 -0
- package/dist/@codegen/kvault/types/ElevationGroup.d.ts +67 -0
- package/dist/@codegen/kvault/types/ElevationGroup.d.ts.map +1 -0
- package/dist/@codegen/kvault/types/ElevationGroup.js +137 -0
- package/dist/@codegen/kvault/types/ElevationGroup.js.map +1 -0
- package/dist/@codegen/kvault/types/FixedTermBorrowRolloverConfig.d.ts +145 -0
- package/dist/@codegen/kvault/types/FixedTermBorrowRolloverConfig.d.ts.map +1 -0
- package/dist/@codegen/kvault/types/FixedTermBorrowRolloverConfig.js +144 -0
- package/dist/@codegen/kvault/types/FixedTermBorrowRolloverConfig.js.map +1 -0
- package/dist/@codegen/kvault/types/ObligationCollateral.d.ts +72 -0
- package/dist/@codegen/kvault/types/ObligationCollateral.d.ts.map +1 -0
- package/dist/@codegen/kvault/types/ObligationCollateral.js +119 -0
- package/dist/@codegen/kvault/types/ObligationCollateral.js.map +1 -0
- package/dist/@codegen/kvault/types/ObligationLiquidity.d.ts +143 -0
- package/dist/@codegen/kvault/types/ObligationLiquidity.d.ts.map +1 -0
- package/dist/@codegen/kvault/types/ObligationLiquidity.js +165 -0
- package/dist/@codegen/kvault/types/ObligationLiquidity.js.map +1 -0
- package/dist/@codegen/kvault/types/ObligationOrder.d.ts +284 -0
- package/dist/@codegen/kvault/types/ObligationOrder.d.ts.map +1 -0
- package/dist/@codegen/kvault/types/ObligationOrder.js +205 -0
- package/dist/@codegen/kvault/types/ObligationOrder.js.map +1 -0
- package/dist/@codegen/kvault/types/ReserveConfig.d.ts +60 -5
- package/dist/@codegen/kvault/types/ReserveConfig.d.ts.map +1 -1
- package/dist/@codegen/kvault/types/ReserveConfig.js +36 -7
- package/dist/@codegen/kvault/types/ReserveConfig.js.map +1 -1
- package/dist/@codegen/kvault/types/ReserveLiquidity.d.ts +26 -8
- package/dist/@codegen/kvault/types/ReserveLiquidity.d.ts.map +1 -1
- package/dist/@codegen/kvault/types/ReserveLiquidity.js +14 -8
- package/dist/@codegen/kvault/types/ReserveLiquidity.js.map +1 -1
- package/dist/@codegen/kvault/types/ReserveType.d.ts +32 -0
- package/dist/@codegen/kvault/types/ReserveType.d.ts.map +1 -0
- package/dist/@codegen/kvault/types/ReserveType.js +108 -0
- package/dist/@codegen/kvault/types/ReserveType.js.map +1 -0
- package/dist/@codegen/kvault/types/VaultAllocation.d.ts +60 -0
- package/dist/@codegen/kvault/types/VaultAllocation.d.ts.map +1 -1
- package/dist/@codegen/kvault/types/VaultAllocation.js +38 -2
- package/dist/@codegen/kvault/types/VaultAllocation.js.map +1 -1
- package/dist/@codegen/kvault/types/WithdrawQueue.d.ts +64 -0
- package/dist/@codegen/kvault/types/WithdrawQueue.d.ts.map +1 -0
- package/dist/@codegen/kvault/types/WithdrawQueue.js +104 -0
- package/dist/@codegen/kvault/types/WithdrawQueue.js.map +1 -0
- package/dist/@codegen/kvault/types/WithdrawTicketProgressEvent.d.ts +19 -0
- package/dist/@codegen/kvault/types/WithdrawTicketProgressEvent.d.ts.map +1 -0
- package/dist/@codegen/kvault/types/WithdrawTicketProgressEvent.js +82 -0
- package/dist/@codegen/kvault/types/WithdrawTicketProgressEvent.js.map +1 -0
- package/dist/@codegen/kvault/types/index.d.ts +34 -0
- package/dist/@codegen/kvault/types/index.d.ts.map +1 -1
- package/dist/@codegen/kvault/types/index.js +19 -1
- package/dist/@codegen/kvault/types/index.js.map +1 -1
- package/dist/classes/action.d.ts +21 -91
- package/dist/classes/action.d.ts.map +1 -1
- package/dist/classes/action.js +141 -119
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/actionTypes.d.ts +310 -0
- package/dist/classes/actionTypes.d.ts.map +1 -0
- package/dist/classes/actionTypes.js +3 -0
- package/dist/classes/actionTypes.js.map +1 -0
- package/dist/classes/market.d.ts +109 -15
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js +186 -26
- package/dist/classes/market.js.map +1 -1
- package/dist/classes/obligation.d.ts +11 -11
- package/dist/classes/obligation.d.ts.map +1 -1
- package/dist/classes/obligation.js +56 -56
- package/dist/classes/obligation.js.map +1 -1
- package/dist/classes/obligationOrder.d.ts.map +1 -1
- package/dist/classes/obligationOrder.js +6 -3
- package/dist/classes/obligationOrder.js.map +1 -1
- package/dist/classes/reserve.d.ts +9 -1
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +20 -0
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/shared.d.ts +1 -0
- package/dist/classes/shared.d.ts.map +1 -1
- package/dist/classes/utils.d.ts +2 -0
- package/dist/classes/utils.d.ts.map +1 -1
- package/dist/classes/utils.js +12 -1
- package/dist/classes/utils.js.map +1 -1
- package/dist/classes/vault.d.ts +4 -2
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +12 -2
- package/dist/classes/vault.js.map +1 -1
- package/dist/client/commands/borrow.d.ts +1 -1
- package/dist/client/commands/borrow.d.ts.map +1 -1
- package/dist/client/commands/borrow.js +11 -2
- package/dist/client/commands/borrow.js.map +1 -1
- package/dist/client/commands/deposit.d.ts +1 -1
- package/dist/client/commands/deposit.d.ts.map +1 -1
- package/dist/client/commands/deposit.js +11 -2
- package/dist/client/commands/deposit.js.map +1 -1
- package/dist/client/commands/printReserve.d.ts +1 -1
- package/dist/client/commands/printReserve.d.ts.map +1 -1
- package/dist/client/commands/printReserve.js +2 -4
- package/dist/client/commands/printReserve.js.map +1 -1
- package/dist/client/commands/repay.d.ts +1 -1
- package/dist/client/commands/repay.d.ts.map +1 -1
- package/dist/client/commands/repay.js +12 -2
- package/dist/client/commands/repay.js.map +1 -1
- package/dist/client/commands/withdraw.d.ts +1 -1
- package/dist/client/commands/withdraw.d.ts.map +1 -1
- package/dist/client/commands/withdraw.js +11 -2
- package/dist/client/commands/withdraw.js.map +1 -1
- package/dist/lending_operations/repay_with_collateral_calcs.d.ts +1 -1
- package/dist/lending_operations/repay_with_collateral_calcs.d.ts.map +1 -1
- package/dist/lending_operations/repay_with_collateral_calcs.js +2 -2
- package/dist/lending_operations/repay_with_collateral_calcs.js.map +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.d.ts +4 -4
- package/dist/lending_operations/repay_with_collateral_operations.d.ts.map +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.js +43 -10
- package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
- package/dist/lending_operations/swap_collateral_operations.d.ts +4 -4
- package/dist/lending_operations/swap_collateral_operations.d.ts.map +1 -1
- package/dist/lending_operations/swap_collateral_operations.js +40 -21
- package/dist/lending_operations/swap_collateral_operations.js.map +1 -1
- package/dist/leverage/operations.d.ts +6 -6
- package/dist/leverage/operations.d.ts.map +1 -1
- package/dist/leverage/operations.js +167 -52
- package/dist/leverage/operations.js.map +1 -1
- package/dist/leverage/types.d.ts +2 -2
- package/dist/leverage/types.d.ts.map +1 -1
- package/dist/manager/client_kamino_manager.js +0 -2
- package/dist/manager/client_kamino_manager.js.map +1 -1
- package/dist/obligation_orders/price_based.js +5 -3
- package/dist/obligation_orders/price_based.js.map +1 -1
- package/dist/utils/ObligationType.d.ts +33 -1
- package/dist/utils/ObligationType.d.ts.map +1 -1
- package/dist/utils/ObligationType.js +81 -2
- package/dist/utils/ObligationType.js.map +1 -1
- package/dist/utils/ReserveKind.d.ts +57 -0
- package/dist/utils/ReserveKind.d.ts.map +1 -0
- package/dist/utils/ReserveKind.js +76 -0
- package/dist/utils/ReserveKind.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/userMetadata.d.ts +2 -2
- package/dist/utils/userMetadata.d.ts.map +1 -1
- package/dist/utils/userMetadata.js +49 -25
- package/dist/utils/userMetadata.js.map +1 -1
- package/dist/utils/validations.d.ts +1 -0
- package/dist/utils/validations.d.ts.map +1 -1
- package/dist/utils/validations.js +5 -0
- package/dist/utils/validations.js.map +1 -1
- package/dist/utils/vault.d.ts.map +1 -1
- package/dist/utils/vault.js +2 -0
- package/dist/utils/vault.js.map +1 -1
- package/package.json +1 -1
- package/src/@codegen/kvault/accounts/LendingMarket.ts +837 -0
- package/src/@codegen/kvault/accounts/Obligation.ts +459 -0
- package/src/@codegen/kvault/accounts/ReferrerTokenState.ts +160 -0
- package/src/@codegen/kvault/accounts/Reserve.ts +13 -2
- package/src/@codegen/kvault/accounts/VaultState.ts +59 -7
- package/src/@codegen/kvault/accounts/WithdrawTicket.ts +280 -0
- package/src/@codegen/kvault/accounts/index.ts +11 -0
- package/src/@codegen/kvault/errors/custom.ts +152 -0
- package/src/@codegen/kvault/instructions/index.ts +10 -0
- package/src/@codegen/kvault/instructions/invest.ts +16 -0
- package/src/@codegen/kvault/instructions/investInVirtualReserveAndFillOrder.ts +189 -0
- package/src/@codegen/kvault/instructions/investInVirtualReserveAndFillWithdrawalTicket.ts +205 -0
- package/src/@codegen/kvault/instructions/updateKlendQueueAccounting.ts +76 -0
- package/src/@codegen/kvault/instructions/updateReserveAllocation.ts +4 -1
- package/src/@codegen/kvault/types/BorrowOrder.ts +267 -0
- package/src/@codegen/kvault/types/ElevationGroup.ts +134 -0
- package/src/@codegen/kvault/types/FixedTermBorrowRolloverConfig.ts +199 -0
- package/src/@codegen/kvault/types/ObligationCollateral.ts +129 -0
- package/src/@codegen/kvault/types/ObligationLiquidity.ts +226 -0
- package/src/@codegen/kvault/types/ObligationOrder.ts +348 -0
- package/src/@codegen/kvault/types/ReserveConfig.ts +72 -9
- package/src/@codegen/kvault/types/ReserveLiquidity.ts +30 -12
- package/src/@codegen/kvault/types/ReserveType.ts +89 -0
- package/src/@codegen/kvault/types/VaultAllocation.ts +74 -2
- package/src/@codegen/kvault/types/WithdrawQueue.ts +117 -0
- package/src/@codegen/kvault/types/WithdrawTicketProgressEvent.ts +59 -0
- package/src/@codegen/kvault/types/index.ts +52 -0
- package/src/classes/action.ts +321 -347
- package/src/classes/actionTypes.ts +295 -0
- package/src/classes/manager.ts +1 -1
- package/src/classes/market.ts +232 -30
- package/src/classes/obligation.ts +62 -59
- package/src/classes/obligationOrder.ts +6 -3
- package/src/classes/reserve.ts +24 -0
- package/src/classes/shared.ts +2 -0
- package/src/classes/utils.ts +8 -0
- package/src/classes/vault.ts +35 -4
- package/src/client/client.ts +17 -18
- package/src/client/commands/borrow.ts +10 -9
- package/src/client/commands/deposit.ts +10 -9
- package/src/client/commands/printReserve.ts +2 -4
- package/src/client/commands/repay.ts +11 -10
- package/src/client/commands/withdraw.ts +15 -9
- package/src/idl/kvault.json +2336 -299
- package/src/lending_operations/repay_with_collateral_calcs.ts +3 -4
- package/src/lending_operations/repay_with_collateral_operations.ts +40 -38
- package/src/lending_operations/swap_collateral_operations.ts +47 -41
- package/src/leverage/operations.ts +168 -129
- package/src/leverage/types.ts +2 -2
- package/src/manager/client_kamino_manager.ts +0 -2
- package/src/obligation_orders/price_based.ts +7 -5
- package/src/utils/ObligationType.ts +92 -1
- package/src/utils/ReserveKind.ts +94 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/userMetadata.ts +64 -30
- package/src/utils/validations.ts +5 -0
- package/src/utils/vault.ts +2 -0
|
@@ -0,0 +1,89 @@
|
|
|
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 StandardJSON {
|
|
8
|
+
kind: "Standard"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class Standard {
|
|
12
|
+
static readonly discriminator = 0
|
|
13
|
+
static readonly kind = "Standard"
|
|
14
|
+
readonly discriminator = 0
|
|
15
|
+
readonly kind = "Standard"
|
|
16
|
+
|
|
17
|
+
toJSON(): StandardJSON {
|
|
18
|
+
return {
|
|
19
|
+
kind: "Standard",
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
toEncodable() {
|
|
24
|
+
return {
|
|
25
|
+
Standard: {},
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface VirtualJSON {
|
|
31
|
+
kind: "Virtual"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class Virtual {
|
|
35
|
+
static readonly discriminator = 1
|
|
36
|
+
static readonly kind = "Virtual"
|
|
37
|
+
readonly discriminator = 1
|
|
38
|
+
readonly kind = "Virtual"
|
|
39
|
+
|
|
40
|
+
toJSON(): VirtualJSON {
|
|
41
|
+
return {
|
|
42
|
+
kind: "Virtual",
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
toEncodable() {
|
|
47
|
+
return {
|
|
48
|
+
Virtual: {},
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
+
export function fromDecoded(obj: any): types.ReserveTypeKind {
|
|
55
|
+
if (typeof obj !== "object") {
|
|
56
|
+
throw new Error("Invalid enum object")
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if ("Standard" in obj) {
|
|
60
|
+
return new Standard()
|
|
61
|
+
}
|
|
62
|
+
if ("Virtual" in obj) {
|
|
63
|
+
return new Virtual()
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
throw new Error("Invalid enum object")
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function fromJSON(obj: types.ReserveTypeJSON): types.ReserveTypeKind {
|
|
70
|
+
switch (obj.kind) {
|
|
71
|
+
case "Standard": {
|
|
72
|
+
return new Standard()
|
|
73
|
+
}
|
|
74
|
+
case "Virtual": {
|
|
75
|
+
return new Virtual()
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function layout(property?: string) {
|
|
81
|
+
const ret = borsh.rustEnum([
|
|
82
|
+
borsh.struct([], "Standard"),
|
|
83
|
+
borsh.struct([], "Virtual"),
|
|
84
|
+
])
|
|
85
|
+
if (property !== undefined) {
|
|
86
|
+
return ret.replicate(property)
|
|
87
|
+
}
|
|
88
|
+
return ret
|
|
89
|
+
}
|
|
@@ -11,10 +11,28 @@ export interface VaultAllocationFields {
|
|
|
11
11
|
/** Maximum token invested in this reserve */
|
|
12
12
|
tokenAllocationCap: BN
|
|
13
13
|
ctokenVaultBump: BN
|
|
14
|
+
/** should match the ReserveType enum */
|
|
15
|
+
reserveType: number
|
|
16
|
+
padding0: Array<number>
|
|
14
17
|
configPadding: Array<BN>
|
|
18
|
+
/**
|
|
19
|
+
* The amount of ctokens that currently earns yield for the vault.
|
|
20
|
+
*
|
|
21
|
+
* Please note that these ctokens are *not* necessarily all in the [Self::ctoken_vault] - they
|
|
22
|
+
* may also be e.g. queued for withdrawal (and held by the corresponding Klend queue vault),
|
|
23
|
+
* see [Self::klend_queued_ctokens].
|
|
24
|
+
*/
|
|
15
25
|
ctokenAllocation: BN
|
|
16
26
|
lastInvestSlot: BN
|
|
17
27
|
tokenTargetAllocationSf: BN
|
|
28
|
+
/**
|
|
29
|
+
* The ctokens that are still locked in the [Self::reserve]'s "queued collateral vault" on the
|
|
30
|
+
* Klend's withdraw queue side.
|
|
31
|
+
*
|
|
32
|
+
* Please note that - since such queued ctokens still earn yield for the vault - this amount is
|
|
33
|
+
* also included in the [Self::ctoken_allocation].
|
|
34
|
+
*/
|
|
35
|
+
klendQueuedCtokens: BN
|
|
18
36
|
statePadding: Array<BN>
|
|
19
37
|
}
|
|
20
38
|
|
|
@@ -25,10 +43,28 @@ export interface VaultAllocationJSON {
|
|
|
25
43
|
/** Maximum token invested in this reserve */
|
|
26
44
|
tokenAllocationCap: string
|
|
27
45
|
ctokenVaultBump: string
|
|
46
|
+
/** should match the ReserveType enum */
|
|
47
|
+
reserveType: number
|
|
48
|
+
padding0: Array<number>
|
|
28
49
|
configPadding: Array<string>
|
|
50
|
+
/**
|
|
51
|
+
* The amount of ctokens that currently earns yield for the vault.
|
|
52
|
+
*
|
|
53
|
+
* Please note that these ctokens are *not* necessarily all in the [Self::ctoken_vault] - they
|
|
54
|
+
* may also be e.g. queued for withdrawal (and held by the corresponding Klend queue vault),
|
|
55
|
+
* see [Self::klend_queued_ctokens].
|
|
56
|
+
*/
|
|
29
57
|
ctokenAllocation: string
|
|
30
58
|
lastInvestSlot: string
|
|
31
59
|
tokenTargetAllocationSf: string
|
|
60
|
+
/**
|
|
61
|
+
* The ctokens that are still locked in the [Self::reserve]'s "queued collateral vault" on the
|
|
62
|
+
* Klend's withdraw queue side.
|
|
63
|
+
*
|
|
64
|
+
* Please note that - since such queued ctokens still earn yield for the vault - this amount is
|
|
65
|
+
* also included in the [Self::ctoken_allocation].
|
|
66
|
+
*/
|
|
67
|
+
klendQueuedCtokens: string
|
|
32
68
|
statePadding: Array<string>
|
|
33
69
|
}
|
|
34
70
|
|
|
@@ -39,10 +75,28 @@ export class VaultAllocation {
|
|
|
39
75
|
/** Maximum token invested in this reserve */
|
|
40
76
|
readonly tokenAllocationCap: BN
|
|
41
77
|
readonly ctokenVaultBump: BN
|
|
78
|
+
/** should match the ReserveType enum */
|
|
79
|
+
readonly reserveType: number
|
|
80
|
+
readonly padding0: Array<number>
|
|
42
81
|
readonly configPadding: Array<BN>
|
|
82
|
+
/**
|
|
83
|
+
* The amount of ctokens that currently earns yield for the vault.
|
|
84
|
+
*
|
|
85
|
+
* Please note that these ctokens are *not* necessarily all in the [Self::ctoken_vault] - they
|
|
86
|
+
* may also be e.g. queued for withdrawal (and held by the corresponding Klend queue vault),
|
|
87
|
+
* see [Self::klend_queued_ctokens].
|
|
88
|
+
*/
|
|
43
89
|
readonly ctokenAllocation: BN
|
|
44
90
|
readonly lastInvestSlot: BN
|
|
45
91
|
readonly tokenTargetAllocationSf: BN
|
|
92
|
+
/**
|
|
93
|
+
* The ctokens that are still locked in the [Self::reserve]'s "queued collateral vault" on the
|
|
94
|
+
* Klend's withdraw queue side.
|
|
95
|
+
*
|
|
96
|
+
* Please note that - since such queued ctokens still earn yield for the vault - this amount is
|
|
97
|
+
* also included in the [Self::ctoken_allocation].
|
|
98
|
+
*/
|
|
99
|
+
readonly klendQueuedCtokens: BN
|
|
46
100
|
readonly statePadding: Array<BN>
|
|
47
101
|
|
|
48
102
|
constructor(fields: VaultAllocationFields) {
|
|
@@ -51,10 +105,13 @@ export class VaultAllocation {
|
|
|
51
105
|
this.targetAllocationWeight = fields.targetAllocationWeight
|
|
52
106
|
this.tokenAllocationCap = fields.tokenAllocationCap
|
|
53
107
|
this.ctokenVaultBump = fields.ctokenVaultBump
|
|
108
|
+
this.reserveType = fields.reserveType
|
|
109
|
+
this.padding0 = fields.padding0
|
|
54
110
|
this.configPadding = fields.configPadding
|
|
55
111
|
this.ctokenAllocation = fields.ctokenAllocation
|
|
56
112
|
this.lastInvestSlot = fields.lastInvestSlot
|
|
57
113
|
this.tokenTargetAllocationSf = fields.tokenTargetAllocationSf
|
|
114
|
+
this.klendQueuedCtokens = fields.klendQueuedCtokens
|
|
58
115
|
this.statePadding = fields.statePadding
|
|
59
116
|
}
|
|
60
117
|
|
|
@@ -66,11 +123,14 @@ export class VaultAllocation {
|
|
|
66
123
|
borsh.u64("targetAllocationWeight"),
|
|
67
124
|
borsh.u64("tokenAllocationCap"),
|
|
68
125
|
borsh.u64("ctokenVaultBump"),
|
|
69
|
-
borsh.
|
|
126
|
+
borsh.u8("reserveType"),
|
|
127
|
+
borsh.array(borsh.u8(), 7, "padding0"),
|
|
128
|
+
borsh.array(borsh.u64(), 126, "configPadding"),
|
|
70
129
|
borsh.u64("ctokenAllocation"),
|
|
71
130
|
borsh.u64("lastInvestSlot"),
|
|
72
131
|
borsh.u128("tokenTargetAllocationSf"),
|
|
73
|
-
borsh.
|
|
132
|
+
borsh.u64("klendQueuedCtokens"),
|
|
133
|
+
borsh.array(borsh.u64(), 127, "statePadding"),
|
|
74
134
|
],
|
|
75
135
|
property
|
|
76
136
|
)
|
|
@@ -84,10 +144,13 @@ export class VaultAllocation {
|
|
|
84
144
|
targetAllocationWeight: obj.targetAllocationWeight,
|
|
85
145
|
tokenAllocationCap: obj.tokenAllocationCap,
|
|
86
146
|
ctokenVaultBump: obj.ctokenVaultBump,
|
|
147
|
+
reserveType: obj.reserveType,
|
|
148
|
+
padding0: obj.padding0,
|
|
87
149
|
configPadding: obj.configPadding,
|
|
88
150
|
ctokenAllocation: obj.ctokenAllocation,
|
|
89
151
|
lastInvestSlot: obj.lastInvestSlot,
|
|
90
152
|
tokenTargetAllocationSf: obj.tokenTargetAllocationSf,
|
|
153
|
+
klendQueuedCtokens: obj.klendQueuedCtokens,
|
|
91
154
|
statePadding: obj.statePadding,
|
|
92
155
|
})
|
|
93
156
|
}
|
|
@@ -99,10 +162,13 @@ export class VaultAllocation {
|
|
|
99
162
|
targetAllocationWeight: fields.targetAllocationWeight,
|
|
100
163
|
tokenAllocationCap: fields.tokenAllocationCap,
|
|
101
164
|
ctokenVaultBump: fields.ctokenVaultBump,
|
|
165
|
+
reserveType: fields.reserveType,
|
|
166
|
+
padding0: fields.padding0,
|
|
102
167
|
configPadding: fields.configPadding,
|
|
103
168
|
ctokenAllocation: fields.ctokenAllocation,
|
|
104
169
|
lastInvestSlot: fields.lastInvestSlot,
|
|
105
170
|
tokenTargetAllocationSf: fields.tokenTargetAllocationSf,
|
|
171
|
+
klendQueuedCtokens: fields.klendQueuedCtokens,
|
|
106
172
|
statePadding: fields.statePadding,
|
|
107
173
|
}
|
|
108
174
|
}
|
|
@@ -114,10 +180,13 @@ export class VaultAllocation {
|
|
|
114
180
|
targetAllocationWeight: this.targetAllocationWeight.toString(),
|
|
115
181
|
tokenAllocationCap: this.tokenAllocationCap.toString(),
|
|
116
182
|
ctokenVaultBump: this.ctokenVaultBump.toString(),
|
|
183
|
+
reserveType: this.reserveType,
|
|
184
|
+
padding0: this.padding0,
|
|
117
185
|
configPadding: this.configPadding.map((item) => item.toString()),
|
|
118
186
|
ctokenAllocation: this.ctokenAllocation.toString(),
|
|
119
187
|
lastInvestSlot: this.lastInvestSlot.toString(),
|
|
120
188
|
tokenTargetAllocationSf: this.tokenTargetAllocationSf.toString(),
|
|
189
|
+
klendQueuedCtokens: this.klendQueuedCtokens.toString(),
|
|
121
190
|
statePadding: this.statePadding.map((item) => item.toString()),
|
|
122
191
|
}
|
|
123
192
|
}
|
|
@@ -129,10 +198,13 @@ export class VaultAllocation {
|
|
|
129
198
|
targetAllocationWeight: new BN(obj.targetAllocationWeight),
|
|
130
199
|
tokenAllocationCap: new BN(obj.tokenAllocationCap),
|
|
131
200
|
ctokenVaultBump: new BN(obj.ctokenVaultBump),
|
|
201
|
+
reserveType: obj.reserveType,
|
|
202
|
+
padding0: obj.padding0,
|
|
132
203
|
configPadding: obj.configPadding.map((item) => new BN(item)),
|
|
133
204
|
ctokenAllocation: new BN(obj.ctokenAllocation),
|
|
134
205
|
lastInvestSlot: new BN(obj.lastInvestSlot),
|
|
135
206
|
tokenTargetAllocationSf: new BN(obj.tokenTargetAllocationSf),
|
|
207
|
+
klendQueuedCtokens: new BN(obj.klendQueuedCtokens),
|
|
136
208
|
statePadding: obj.statePadding.map((item) => new BN(item)),
|
|
137
209
|
})
|
|
138
210
|
}
|
|
@@ -0,0 +1,117 @@
|
|
|
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 WithdrawQueueFields {
|
|
8
|
+
/** The part of [ReserveLiquidity::total_available_amount] locked for ticketed withdrawals. */
|
|
9
|
+
queuedCollateralAmount: BN
|
|
10
|
+
/**
|
|
11
|
+
* The sequence number of the next ticket to be issued when enqueueing to withdraw.
|
|
12
|
+
* Note: it is also a number of tickets issued so far.
|
|
13
|
+
*/
|
|
14
|
+
nextIssuedTicketSequenceNumber: BN
|
|
15
|
+
/**
|
|
16
|
+
* The sequence number of the next ticket to be used for actually transferring the withdrawn
|
|
17
|
+
* liquidity (assuming it is available in the reserve).
|
|
18
|
+
* Note: it is also a number of fully-consumed tickets so far.
|
|
19
|
+
*/
|
|
20
|
+
nextWithdrawableTicketSequenceNumber: BN
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface WithdrawQueueJSON {
|
|
24
|
+
/** The part of [ReserveLiquidity::total_available_amount] locked for ticketed withdrawals. */
|
|
25
|
+
queuedCollateralAmount: string
|
|
26
|
+
/**
|
|
27
|
+
* The sequence number of the next ticket to be issued when enqueueing to withdraw.
|
|
28
|
+
* Note: it is also a number of tickets issued so far.
|
|
29
|
+
*/
|
|
30
|
+
nextIssuedTicketSequenceNumber: string
|
|
31
|
+
/**
|
|
32
|
+
* The sequence number of the next ticket to be used for actually transferring the withdrawn
|
|
33
|
+
* liquidity (assuming it is available in the reserve).
|
|
34
|
+
* Note: it is also a number of fully-consumed tickets so far.
|
|
35
|
+
*/
|
|
36
|
+
nextWithdrawableTicketSequenceNumber: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** A tracker of ticket-based withdrawals. */
|
|
40
|
+
export class WithdrawQueue {
|
|
41
|
+
/** The part of [ReserveLiquidity::total_available_amount] locked for ticketed withdrawals. */
|
|
42
|
+
readonly queuedCollateralAmount: BN
|
|
43
|
+
/**
|
|
44
|
+
* The sequence number of the next ticket to be issued when enqueueing to withdraw.
|
|
45
|
+
* Note: it is also a number of tickets issued so far.
|
|
46
|
+
*/
|
|
47
|
+
readonly nextIssuedTicketSequenceNumber: BN
|
|
48
|
+
/**
|
|
49
|
+
* The sequence number of the next ticket to be used for actually transferring the withdrawn
|
|
50
|
+
* liquidity (assuming it is available in the reserve).
|
|
51
|
+
* Note: it is also a number of fully-consumed tickets so far.
|
|
52
|
+
*/
|
|
53
|
+
readonly nextWithdrawableTicketSequenceNumber: BN
|
|
54
|
+
|
|
55
|
+
constructor(fields: WithdrawQueueFields) {
|
|
56
|
+
this.queuedCollateralAmount = fields.queuedCollateralAmount
|
|
57
|
+
this.nextIssuedTicketSequenceNumber = fields.nextIssuedTicketSequenceNumber
|
|
58
|
+
this.nextWithdrawableTicketSequenceNumber =
|
|
59
|
+
fields.nextWithdrawableTicketSequenceNumber
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static layout(property?: string) {
|
|
63
|
+
return borsh.struct(
|
|
64
|
+
[
|
|
65
|
+
borsh.u64("queuedCollateralAmount"),
|
|
66
|
+
borsh.u64("nextIssuedTicketSequenceNumber"),
|
|
67
|
+
borsh.u64("nextWithdrawableTicketSequenceNumber"),
|
|
68
|
+
],
|
|
69
|
+
property
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
|
+
static fromDecoded(obj: any) {
|
|
75
|
+
return new WithdrawQueue({
|
|
76
|
+
queuedCollateralAmount: obj.queuedCollateralAmount,
|
|
77
|
+
nextIssuedTicketSequenceNumber: obj.nextIssuedTicketSequenceNumber,
|
|
78
|
+
nextWithdrawableTicketSequenceNumber:
|
|
79
|
+
obj.nextWithdrawableTicketSequenceNumber,
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static toEncodable(fields: WithdrawQueueFields) {
|
|
84
|
+
return {
|
|
85
|
+
queuedCollateralAmount: fields.queuedCollateralAmount,
|
|
86
|
+
nextIssuedTicketSequenceNumber: fields.nextIssuedTicketSequenceNumber,
|
|
87
|
+
nextWithdrawableTicketSequenceNumber:
|
|
88
|
+
fields.nextWithdrawableTicketSequenceNumber,
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
toJSON(): WithdrawQueueJSON {
|
|
93
|
+
return {
|
|
94
|
+
queuedCollateralAmount: this.queuedCollateralAmount.toString(),
|
|
95
|
+
nextIssuedTicketSequenceNumber:
|
|
96
|
+
this.nextIssuedTicketSequenceNumber.toString(),
|
|
97
|
+
nextWithdrawableTicketSequenceNumber:
|
|
98
|
+
this.nextWithdrawableTicketSequenceNumber.toString(),
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static fromJSON(obj: WithdrawQueueJSON): WithdrawQueue {
|
|
103
|
+
return new WithdrawQueue({
|
|
104
|
+
queuedCollateralAmount: new BN(obj.queuedCollateralAmount),
|
|
105
|
+
nextIssuedTicketSequenceNumber: new BN(
|
|
106
|
+
obj.nextIssuedTicketSequenceNumber
|
|
107
|
+
),
|
|
108
|
+
nextWithdrawableTicketSequenceNumber: new BN(
|
|
109
|
+
obj.nextWithdrawableTicketSequenceNumber
|
|
110
|
+
),
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
toEncodable() {
|
|
115
|
+
return WithdrawQueue.toEncodable(this)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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 QueuedLiquidityWithdrawnJSON {
|
|
8
|
+
kind: "QueuedLiquidityWithdrawn"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class QueuedLiquidityWithdrawn {
|
|
12
|
+
static readonly discriminator = 0
|
|
13
|
+
static readonly kind = "QueuedLiquidityWithdrawn"
|
|
14
|
+
readonly discriminator = 0
|
|
15
|
+
readonly kind = "QueuedLiquidityWithdrawn"
|
|
16
|
+
|
|
17
|
+
toJSON(): QueuedLiquidityWithdrawnJSON {
|
|
18
|
+
return {
|
|
19
|
+
kind: "QueuedLiquidityWithdrawn",
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
toEncodable() {
|
|
24
|
+
return {
|
|
25
|
+
QueuedLiquidityWithdrawn: {},
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
+
export function fromDecoded(obj: any): types.WithdrawTicketProgressEventKind {
|
|
32
|
+
if (typeof obj !== "object") {
|
|
33
|
+
throw new Error("Invalid enum object")
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if ("QueuedLiquidityWithdrawn" in obj) {
|
|
37
|
+
return new QueuedLiquidityWithdrawn()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
throw new Error("Invalid enum object")
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function fromJSON(
|
|
44
|
+
obj: types.WithdrawTicketProgressEventJSON
|
|
45
|
+
): types.WithdrawTicketProgressEventKind {
|
|
46
|
+
switch (obj.kind) {
|
|
47
|
+
case "QueuedLiquidityWithdrawn": {
|
|
48
|
+
return new QueuedLiquidityWithdrawn()
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function layout(property?: string) {
|
|
54
|
+
const ret = borsh.rustEnum([borsh.struct([], "QueuedLiquidityWithdrawn")])
|
|
55
|
+
if (property !== undefined) {
|
|
56
|
+
return ret.replicate(property)
|
|
57
|
+
}
|
|
58
|
+
return ret
|
|
59
|
+
}
|
|
@@ -1,9 +1,35 @@
|
|
|
1
|
+
import * as WithdrawTicketProgressEvent from "./WithdrawTicketProgressEvent"
|
|
1
2
|
import * as UpdateReserveWhitelistMode from "./UpdateReserveWhitelistMode"
|
|
2
3
|
import * as VaultConfigField from "./VaultConfigField"
|
|
3
4
|
import * as UpdateGlobalConfigMode from "./UpdateGlobalConfigMode"
|
|
5
|
+
import * as ReserveType from "./ReserveType"
|
|
4
6
|
|
|
5
7
|
export { LastUpdate } from "./LastUpdate"
|
|
6
8
|
export type { LastUpdateFields, LastUpdateJSON } from "./LastUpdate"
|
|
9
|
+
export { ElevationGroup } from "./ElevationGroup"
|
|
10
|
+
export type { ElevationGroupFields, ElevationGroupJSON } from "./ElevationGroup"
|
|
11
|
+
export { BorrowOrder } from "./BorrowOrder"
|
|
12
|
+
export type { BorrowOrderFields, BorrowOrderJSON } from "./BorrowOrder"
|
|
13
|
+
export { FixedTermBorrowRolloverConfig } from "./FixedTermBorrowRolloverConfig"
|
|
14
|
+
export type {
|
|
15
|
+
FixedTermBorrowRolloverConfigFields,
|
|
16
|
+
FixedTermBorrowRolloverConfigJSON,
|
|
17
|
+
} from "./FixedTermBorrowRolloverConfig"
|
|
18
|
+
export { ObligationCollateral } from "./ObligationCollateral"
|
|
19
|
+
export type {
|
|
20
|
+
ObligationCollateralFields,
|
|
21
|
+
ObligationCollateralJSON,
|
|
22
|
+
} from "./ObligationCollateral"
|
|
23
|
+
export { ObligationLiquidity } from "./ObligationLiquidity"
|
|
24
|
+
export type {
|
|
25
|
+
ObligationLiquidityFields,
|
|
26
|
+
ObligationLiquidityJSON,
|
|
27
|
+
} from "./ObligationLiquidity"
|
|
28
|
+
export { ObligationOrder } from "./ObligationOrder"
|
|
29
|
+
export type {
|
|
30
|
+
ObligationOrderFields,
|
|
31
|
+
ObligationOrderJSON,
|
|
32
|
+
} from "./ObligationOrder"
|
|
7
33
|
export { BigFractionBytes } from "./BigFractionBytes"
|
|
8
34
|
export type {
|
|
9
35
|
BigFractionBytesFields,
|
|
@@ -23,6 +49,8 @@ export type {
|
|
|
23
49
|
ReserveLiquidityFields,
|
|
24
50
|
ReserveLiquidityJSON,
|
|
25
51
|
} from "./ReserveLiquidity"
|
|
52
|
+
export { WithdrawQueue } from "./WithdrawQueue"
|
|
53
|
+
export type { WithdrawQueueFields, WithdrawQueueJSON } from "./WithdrawQueue"
|
|
26
54
|
export { WithdrawalCaps } from "./WithdrawalCaps"
|
|
27
55
|
export type { WithdrawalCapsFields, WithdrawalCapsJSON } from "./WithdrawalCaps"
|
|
28
56
|
export { PriceHeuristic } from "./PriceHeuristic"
|
|
@@ -44,6 +72,13 @@ export type {
|
|
|
44
72
|
} from "./SwitchboardConfiguration"
|
|
45
73
|
export { TokenInfo } from "./TokenInfo"
|
|
46
74
|
export type { TokenInfoFields, TokenInfoJSON } from "./TokenInfo"
|
|
75
|
+
export { WithdrawTicketProgressEvent }
|
|
76
|
+
|
|
77
|
+
export type WithdrawTicketProgressEventKind =
|
|
78
|
+
WithdrawTicketProgressEvent.QueuedLiquidityWithdrawn
|
|
79
|
+
export type WithdrawTicketProgressEventJSON =
|
|
80
|
+
WithdrawTicketProgressEvent.QueuedLiquidityWithdrawnJSON
|
|
81
|
+
|
|
47
82
|
export { BorrowRateCurve } from "./BorrowRateCurve"
|
|
48
83
|
export type {
|
|
49
84
|
BorrowRateCurveFields,
|
|
@@ -118,3 +153,20 @@ export type UpdateGlobalConfigModeJSON =
|
|
|
118
153
|
| UpdateGlobalConfigMode.PendingAdminJSON
|
|
119
154
|
| UpdateGlobalConfigMode.MinWithdrawalPenaltyLamportsJSON
|
|
120
155
|
| UpdateGlobalConfigMode.MinWithdrawalPenaltyBPSJSON
|
|
156
|
+
|
|
157
|
+
export { ReserveType }
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The type of the reserve determine how investing and uninvesting (mechanisms + the way to compute how much should be invested/uninvested) works
|
|
161
|
+
*
|
|
162
|
+
* Standard:
|
|
163
|
+
* - investing happens through the `invest` handler and the amount invested is computed based on the weight of the reserve, from the vault AUM - the amount invested in virtual reserves
|
|
164
|
+
*
|
|
165
|
+
* Virtual (i.e. the allocation can be moved to that reserve if needed, so it is virtually there but will be allocated only if needed by a borrow order or reserve withdrawal ticket):
|
|
166
|
+
* - investing in a virtual reserve doesn't happen through the `invest` handler but using a dedicated handler which ensures that the amount to be invested fills (fully or partially) a borrow order or a reserve withdrawal ticket
|
|
167
|
+
* - has a higher allocation priority comparing to the Standard reserves and can disinvest from a Standard reserve and invest into the Virtual one if needed
|
|
168
|
+
* -the weight is not used for virtual reserves, only the cap is limiting the amount that can be invested in the reserve, and calling `invest` on a virtual reserve will disinvest if the amount invested exceeds the cap
|
|
169
|
+
* - current main use case is for fixed term reserves, such that the manager decides their desired max exposure to a fixed term reserve and anytime there is an order or withdrawal ticket we invest into the fixed term reserve until the cap is reached or the order/ticket is filled
|
|
170
|
+
*/
|
|
171
|
+
export type ReserveTypeKind = ReserveType.Standard | ReserveType.Virtual
|
|
172
|
+
export type ReserveTypeJSON = ReserveType.StandardJSON | ReserveType.VirtualJSON
|