@kamino-finance/klend-sdk 7.2.4 → 7.2.6-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/@codegen/klend/accounts/LendingMarket.d.ts +33 -0
- package/dist/@codegen/klend/accounts/LendingMarket.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/LendingMarket.js +24 -2
- package/dist/@codegen/klend/accounts/LendingMarket.js.map +1 -1
- package/dist/@codegen/klend/errors/custom.d.ts +26 -2
- package/dist/@codegen/klend/errors/custom.d.ts.map +1 -1
- package/dist/@codegen/klend/errors/custom.js +45 -3
- package/dist/@codegen/klend/errors/custom.js.map +1 -1
- package/dist/@codegen/klend/instructions/index.d.ts +2 -0
- package/dist/@codegen/klend/instructions/index.d.ts.map +1 -1
- package/dist/@codegen/klend/instructions/index.js +3 -1
- package/dist/@codegen/klend/instructions/index.js.map +1 -1
- package/dist/@codegen/klend/instructions/initReserve.d.ts +1 -1
- package/dist/@codegen/klend/instructions/initReserve.d.ts.map +1 -1
- package/dist/@codegen/klend/instructions/initReserve.js +1 -5
- package/dist/@codegen/klend/instructions/initReserve.js.map +1 -1
- package/dist/@codegen/klend/instructions/liquidateObligationAndRedeemReserveCollateralV2.js +1 -1
- package/dist/@codegen/klend/instructions/seedDepositOnInitReserve.d.ts +13 -0
- package/dist/@codegen/klend/instructions/seedDepositOnInitReserve.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/seedDepositOnInitReserve.js +24 -0
- package/dist/@codegen/klend/instructions/seedDepositOnInitReserve.js.map +1 -0
- package/dist/@codegen/klend/instructions/withdrawObligationCollateral.js +1 -1
- package/dist/@codegen/klend/instructions/withdrawObligationCollateralV2.js +1 -1
- package/dist/@codegen/klend/types/ReserveConfig.d.ts +58 -24
- package/dist/@codegen/klend/types/ReserveConfig.d.ts.map +1 -1
- package/dist/@codegen/klend/types/ReserveConfig.js +40 -18
- 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/UpdateConfigMode.d.ts +46 -7
- package/dist/@codegen/klend/types/UpdateConfigMode.d.ts.map +1 -1
- package/dist/@codegen/klend/types/UpdateConfigMode.js +85 -12
- package/dist/@codegen/klend/types/UpdateConfigMode.js.map +1 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.d.ts +26 -0
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.d.ts.map +1 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.js +49 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/@codegen/klend/types/index.d.ts +4 -4
- package/dist/@codegen/klend/types/index.d.ts.map +1 -1
- package/dist/@codegen/klend/types/index.js.map +1 -1
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +2 -0
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +7 -4
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/vault.js +1 -1
- package/dist/classes/vault.js.map +1 -1
- package/dist/idl/klend.json +129 -59
- package/dist/manager/client_kamino_manager.js +5 -3
- package/dist/manager/client_kamino_manager.js.map +1 -1
- package/dist/utils/managerTypes.d.ts +1 -1
- package/dist/utils/managerTypes.d.ts.map +1 -1
- package/dist/utils/managerTypes.js +5 -3
- package/dist/utils/managerTypes.js.map +1 -1
- package/dist/utils/seeds.d.ts +5 -5
- package/dist/utils/seeds.d.ts.map +1 -1
- package/dist/utils/seeds.js +13 -13
- package/dist/utils/seeds.js.map +1 -1
- package/package.json +1 -1
- package/src/@codegen/klend/accounts/LendingMarket.ts +46 -2
- package/src/@codegen/klend/errors/custom.ts +47 -2
- package/src/@codegen/klend/instructions/index.ts +2 -0
- package/src/@codegen/klend/instructions/initReserve.ts +2 -6
- package/src/@codegen/klend/instructions/liquidateObligationAndRedeemReserveCollateralV2.ts +1 -1
- package/src/@codegen/klend/instructions/seedDepositOnInitReserve.ts +50 -0
- package/src/@codegen/klend/instructions/withdrawObligationCollateral.ts +1 -1
- package/src/@codegen/klend/instructions/withdrawObligationCollateralV2.ts +1 -1
- package/src/@codegen/klend/types/ReserveConfig.ts +72 -30
- package/src/@codegen/klend/types/ReserveFees.ts +12 -12
- package/src/@codegen/klend/types/UpdateConfigMode.ts +103 -13
- package/src/@codegen/klend/types/UpdateLendingMarketMode.ts +60 -0
- package/src/@codegen/klend/types/index.ts +12 -2
- package/src/classes/manager.ts +2 -0
- package/src/classes/reserve.ts +7 -5
- package/src/classes/vault.ts +1 -1
- package/src/idl/klend.json +130 -60
- package/src/manager/client_kamino_manager.ts +5 -3
- package/src/utils/managerTypes.ts +6 -4
- package/src/utils/seeds.ts +13 -17
|
@@ -92,7 +92,18 @@ export interface LendingMarketFields {
|
|
|
92
92
|
* Note: updating or cancelling existing orders is *not* affected by this flag.
|
|
93
93
|
*/
|
|
94
94
|
obligationOrderCreationEnabled: number
|
|
95
|
+
/**
|
|
96
|
+
* Whether the liquidation operations that are triggered by price changes should be disabled.
|
|
97
|
+
* This includes regular liquidation (i.e. LTV exceeding the unhealthy threshold) and some
|
|
98
|
+
* obligation orders' execution.
|
|
99
|
+
*
|
|
100
|
+
* *Caution:* this flag is *disabling* the liquidations when `1` - contrary to all the other
|
|
101
|
+
* liquidation-driving flags (see e.g. [Self::autodeleverage_enabled]).
|
|
102
|
+
*/
|
|
103
|
+
priceTriggeredLiquidationDisabled: number
|
|
95
104
|
padding2: Array<number>
|
|
105
|
+
/** Authority that can propose creating of new reserves but cannot enable them. */
|
|
106
|
+
proposerAuthority: Address
|
|
96
107
|
padding1: Array<BN>
|
|
97
108
|
}
|
|
98
109
|
|
|
@@ -173,7 +184,18 @@ export interface LendingMarketJSON {
|
|
|
173
184
|
* Note: updating or cancelling existing orders is *not* affected by this flag.
|
|
174
185
|
*/
|
|
175
186
|
obligationOrderCreationEnabled: number
|
|
187
|
+
/**
|
|
188
|
+
* Whether the liquidation operations that are triggered by price changes should be disabled.
|
|
189
|
+
* This includes regular liquidation (i.e. LTV exceeding the unhealthy threshold) and some
|
|
190
|
+
* obligation orders' execution.
|
|
191
|
+
*
|
|
192
|
+
* *Caution:* this flag is *disabling* the liquidations when `1` - contrary to all the other
|
|
193
|
+
* liquidation-driving flags (see e.g. [Self::autodeleverage_enabled]).
|
|
194
|
+
*/
|
|
195
|
+
priceTriggeredLiquidationDisabled: number
|
|
176
196
|
padding2: Array<number>
|
|
197
|
+
/** Authority that can propose creating of new reserves but cannot enable them. */
|
|
198
|
+
proposerAuthority: string
|
|
177
199
|
padding1: Array<string>
|
|
178
200
|
}
|
|
179
201
|
|
|
@@ -254,7 +276,18 @@ export class LendingMarket {
|
|
|
254
276
|
* Note: updating or cancelling existing orders is *not* affected by this flag.
|
|
255
277
|
*/
|
|
256
278
|
readonly obligationOrderCreationEnabled: number
|
|
279
|
+
/**
|
|
280
|
+
* Whether the liquidation operations that are triggered by price changes should be disabled.
|
|
281
|
+
* This includes regular liquidation (i.e. LTV exceeding the unhealthy threshold) and some
|
|
282
|
+
* obligation orders' execution.
|
|
283
|
+
*
|
|
284
|
+
* *Caution:* this flag is *disabling* the liquidations when `1` - contrary to all the other
|
|
285
|
+
* liquidation-driving flags (see e.g. [Self::autodeleverage_enabled]).
|
|
286
|
+
*/
|
|
287
|
+
readonly priceTriggeredLiquidationDisabled: number
|
|
257
288
|
readonly padding2: Array<number>
|
|
289
|
+
/** Authority that can propose creating of new reserves but cannot enable them. */
|
|
290
|
+
readonly proposerAuthority: Address
|
|
258
291
|
readonly padding1: Array<BN>
|
|
259
292
|
|
|
260
293
|
static readonly discriminator = Buffer.from([
|
|
@@ -291,8 +324,10 @@ export class LendingMarket {
|
|
|
291
324
|
borsh.u8("obligationOrderExecutionEnabled"),
|
|
292
325
|
borsh.u8("immutable"),
|
|
293
326
|
borsh.u8("obligationOrderCreationEnabled"),
|
|
294
|
-
borsh.
|
|
295
|
-
borsh.array(borsh.
|
|
327
|
+
borsh.u8("priceTriggeredLiquidationDisabled"),
|
|
328
|
+
borsh.array(borsh.u8(), 4, "padding2"),
|
|
329
|
+
borshAddress("proposerAuthority"),
|
|
330
|
+
borsh.array(borsh.u64(), 165, "padding1"),
|
|
296
331
|
])
|
|
297
332
|
|
|
298
333
|
constructor(fields: LendingMarketFields) {
|
|
@@ -334,7 +369,10 @@ export class LendingMarket {
|
|
|
334
369
|
fields.obligationOrderExecutionEnabled
|
|
335
370
|
this.immutable = fields.immutable
|
|
336
371
|
this.obligationOrderCreationEnabled = fields.obligationOrderCreationEnabled
|
|
372
|
+
this.priceTriggeredLiquidationDisabled =
|
|
373
|
+
fields.priceTriggeredLiquidationDisabled
|
|
337
374
|
this.padding2 = fields.padding2
|
|
375
|
+
this.proposerAuthority = fields.proposerAuthority
|
|
338
376
|
this.padding1 = fields.padding1
|
|
339
377
|
}
|
|
340
378
|
|
|
@@ -421,7 +459,9 @@ export class LendingMarket {
|
|
|
421
459
|
obligationOrderExecutionEnabled: dec.obligationOrderExecutionEnabled,
|
|
422
460
|
immutable: dec.immutable,
|
|
423
461
|
obligationOrderCreationEnabled: dec.obligationOrderCreationEnabled,
|
|
462
|
+
priceTriggeredLiquidationDisabled: dec.priceTriggeredLiquidationDisabled,
|
|
424
463
|
padding2: dec.padding2,
|
|
464
|
+
proposerAuthority: dec.proposerAuthority,
|
|
425
465
|
padding1: dec.padding1,
|
|
426
466
|
})
|
|
427
467
|
}
|
|
@@ -464,7 +504,9 @@ export class LendingMarket {
|
|
|
464
504
|
obligationOrderExecutionEnabled: this.obligationOrderExecutionEnabled,
|
|
465
505
|
immutable: this.immutable,
|
|
466
506
|
obligationOrderCreationEnabled: this.obligationOrderCreationEnabled,
|
|
507
|
+
priceTriggeredLiquidationDisabled: this.priceTriggeredLiquidationDisabled,
|
|
467
508
|
padding2: this.padding2,
|
|
509
|
+
proposerAuthority: this.proposerAuthority,
|
|
468
510
|
padding1: this.padding1.map((item) => item.toString()),
|
|
469
511
|
}
|
|
470
512
|
}
|
|
@@ -514,7 +556,9 @@ export class LendingMarket {
|
|
|
514
556
|
obligationOrderExecutionEnabled: obj.obligationOrderExecutionEnabled,
|
|
515
557
|
immutable: obj.immutable,
|
|
516
558
|
obligationOrderCreationEnabled: obj.obligationOrderCreationEnabled,
|
|
559
|
+
priceTriggeredLiquidationDisabled: obj.priceTriggeredLiquidationDisabled,
|
|
517
560
|
padding2: obj.padding2,
|
|
561
|
+
proposerAuthority: address(obj.proposerAuthority),
|
|
518
562
|
padding1: obj.padding1.map((item) => new BN(item)),
|
|
519
563
|
})
|
|
520
564
|
}
|
|
@@ -129,6 +129,9 @@ export type CustomError =
|
|
|
129
129
|
| OperationNotPermittedMarketImmutable
|
|
130
130
|
| OrderCreationDisabled
|
|
131
131
|
| NoUpgradeAuthority
|
|
132
|
+
| InitialAdminDepositExecuted
|
|
133
|
+
| ReserveHasNotReceivedInitialDeposit
|
|
134
|
+
| CTokenUsageBlocked
|
|
132
135
|
|
|
133
136
|
export class InvalidMarketAuthority extends Error {
|
|
134
137
|
static readonly code = 6000
|
|
@@ -189,10 +192,10 @@ export class InvalidSigner extends Error {
|
|
|
189
192
|
static readonly code = 6005
|
|
190
193
|
readonly code = 6005
|
|
191
194
|
readonly name = "InvalidSigner"
|
|
192
|
-
readonly msg = "
|
|
195
|
+
readonly msg = "Signer is not allowed to perform this action"
|
|
193
196
|
|
|
194
197
|
constructor(readonly logs?: string[]) {
|
|
195
|
-
super("6005:
|
|
198
|
+
super("6005: Signer is not allowed to perform this action")
|
|
196
199
|
}
|
|
197
200
|
}
|
|
198
201
|
|
|
@@ -1641,6 +1644,42 @@ export class NoUpgradeAuthority extends Error {
|
|
|
1641
1644
|
}
|
|
1642
1645
|
}
|
|
1643
1646
|
|
|
1647
|
+
export class InitialAdminDepositExecuted extends Error {
|
|
1648
|
+
static readonly code = 6130
|
|
1649
|
+
readonly code = 6130
|
|
1650
|
+
readonly name = "InitialAdminDepositExecuted"
|
|
1651
|
+
readonly msg = "Initial admin deposit in reserve already executed"
|
|
1652
|
+
|
|
1653
|
+
constructor(readonly logs?: string[]) {
|
|
1654
|
+
super("6130: Initial admin deposit in reserve already executed")
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
export class ReserveHasNotReceivedInitialDeposit extends Error {
|
|
1659
|
+
static readonly code = 6131
|
|
1660
|
+
readonly code = 6131
|
|
1661
|
+
readonly name = "ReserveHasNotReceivedInitialDeposit"
|
|
1662
|
+
readonly msg =
|
|
1663
|
+
"Reserve has not received the initial deposit, cannot update config"
|
|
1664
|
+
|
|
1665
|
+
constructor(readonly logs?: string[]) {
|
|
1666
|
+
super(
|
|
1667
|
+
"6131: Reserve has not received the initial deposit, cannot update config"
|
|
1668
|
+
)
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
export class CTokenUsageBlocked extends Error {
|
|
1673
|
+
static readonly code = 6132
|
|
1674
|
+
readonly code = 6132
|
|
1675
|
+
readonly name = "CTokenUsageBlocked"
|
|
1676
|
+
readonly msg = "CToken minting/redeeming is blocked for this reserve"
|
|
1677
|
+
|
|
1678
|
+
constructor(readonly logs?: string[]) {
|
|
1679
|
+
super("6132: CToken minting/redeeming is blocked for this reserve")
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1644
1683
|
export function fromCode(code: number, logs?: string[]): CustomError | null {
|
|
1645
1684
|
switch (code) {
|
|
1646
1685
|
case 6000:
|
|
@@ -1903,6 +1942,12 @@ export function fromCode(code: number, logs?: string[]): CustomError | null {
|
|
|
1903
1942
|
return new OrderCreationDisabled(logs)
|
|
1904
1943
|
case 6129:
|
|
1905
1944
|
return new NoUpgradeAuthority(logs)
|
|
1945
|
+
case 6130:
|
|
1946
|
+
return new InitialAdminDepositExecuted(logs)
|
|
1947
|
+
case 6131:
|
|
1948
|
+
return new ReserveHasNotReceivedInitialDeposit(logs)
|
|
1949
|
+
case 6132:
|
|
1950
|
+
return new CTokenUsageBlocked(logs)
|
|
1906
1951
|
}
|
|
1907
1952
|
|
|
1908
1953
|
return null
|
|
@@ -29,6 +29,8 @@ export type {
|
|
|
29
29
|
WithdrawProtocolFeeArgs,
|
|
30
30
|
WithdrawProtocolFeeAccounts,
|
|
31
31
|
} from "./withdrawProtocolFee"
|
|
32
|
+
export { seedDepositOnInitReserve } from "./seedDepositOnInitReserve"
|
|
33
|
+
export type { SeedDepositOnInitReserveAccounts } from "./seedDepositOnInitReserve"
|
|
32
34
|
export { socializeLoss } from "./socializeLoss"
|
|
33
35
|
export type { SocializeLossArgs, SocializeLossAccounts } from "./socializeLoss"
|
|
34
36
|
export { socializeLossV2 } from "./socializeLossV2"
|
|
@@ -18,7 +18,7 @@ import { PROGRAM_ID } from "../programId"
|
|
|
18
18
|
export const DISCRIMINATOR = Buffer.from([138, 245, 71, 225, 153, 4, 3, 43])
|
|
19
19
|
|
|
20
20
|
export interface InitReserveAccounts {
|
|
21
|
-
|
|
21
|
+
signer: TransactionSigner
|
|
22
22
|
lendingMarket: Address
|
|
23
23
|
lendingMarketAuthority: Address
|
|
24
24
|
reserve: Address
|
|
@@ -40,11 +40,7 @@ export function initReserve(
|
|
|
40
40
|
programAddress: Address = PROGRAM_ID
|
|
41
41
|
) {
|
|
42
42
|
const keys: Array<AccountMeta | AccountSignerMeta> = [
|
|
43
|
-
{
|
|
44
|
-
address: accounts.lendingMarketOwner.address,
|
|
45
|
-
role: 3,
|
|
46
|
-
signer: accounts.lendingMarketOwner,
|
|
47
|
-
},
|
|
43
|
+
{ address: accounts.signer.address, role: 3, signer: accounts.signer },
|
|
48
44
|
{ address: accounts.lendingMarket, role: 0 },
|
|
49
45
|
{ address: accounts.lendingMarketAuthority, role: 0 },
|
|
50
46
|
{ address: accounts.reserve, role: 1 },
|
|
@@ -78,7 +78,7 @@ export function liquidateObligationAndRedeemReserveCollateralV2(
|
|
|
78
78
|
},
|
|
79
79
|
{ address: accounts.liquidationAccounts.obligation, role: 1 },
|
|
80
80
|
{ address: accounts.liquidationAccounts.lendingMarket, role: 0 },
|
|
81
|
-
{ address: accounts.liquidationAccounts.lendingMarketAuthority, role:
|
|
81
|
+
{ address: accounts.liquidationAccounts.lendingMarketAuthority, role: 0 },
|
|
82
82
|
{ address: accounts.liquidationAccounts.repayReserve, role: 1 },
|
|
83
83
|
{
|
|
84
84
|
address: accounts.liquidationAccounts.repayReserveLiquidityMint,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import {
|
|
3
|
+
Address,
|
|
4
|
+
isSome,
|
|
5
|
+
AccountMeta,
|
|
6
|
+
AccountSignerMeta,
|
|
7
|
+
Instruction,
|
|
8
|
+
Option,
|
|
9
|
+
TransactionSigner,
|
|
10
|
+
} from "@solana/kit"
|
|
11
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
12
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
13
|
+
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
14
|
+
import { borshAddress } from "../utils" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
15
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
16
|
+
import { PROGRAM_ID } from "../programId"
|
|
17
|
+
|
|
18
|
+
export const DISCRIMINATOR = Buffer.from([
|
|
19
|
+
254, 197, 228, 118, 183, 206, 62, 226,
|
|
20
|
+
])
|
|
21
|
+
|
|
22
|
+
export interface SeedDepositOnInitReserveAccounts {
|
|
23
|
+
signer: TransactionSigner
|
|
24
|
+
lendingMarket: Address
|
|
25
|
+
reserve: Address
|
|
26
|
+
reserveLiquidityMint: Address
|
|
27
|
+
reserveLiquiditySupply: Address
|
|
28
|
+
initialLiquiditySource: Address
|
|
29
|
+
liquidityTokenProgram: Address
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function seedDepositOnInitReserve(
|
|
33
|
+
accounts: SeedDepositOnInitReserveAccounts,
|
|
34
|
+
remainingAccounts: Array<AccountMeta | AccountSignerMeta> = [],
|
|
35
|
+
programAddress: Address = PROGRAM_ID
|
|
36
|
+
) {
|
|
37
|
+
const keys: Array<AccountMeta | AccountSignerMeta> = [
|
|
38
|
+
{ address: accounts.signer.address, role: 2, signer: accounts.signer },
|
|
39
|
+
{ address: accounts.lendingMarket, role: 0 },
|
|
40
|
+
{ address: accounts.reserve, role: 1 },
|
|
41
|
+
{ address: accounts.reserveLiquidityMint, role: 0 },
|
|
42
|
+
{ address: accounts.reserveLiquiditySupply, role: 1 },
|
|
43
|
+
{ address: accounts.initialLiquiditySource, role: 1 },
|
|
44
|
+
{ address: accounts.liquidityTokenProgram, role: 0 },
|
|
45
|
+
...remainingAccounts,
|
|
46
|
+
]
|
|
47
|
+
const data = DISCRIMINATOR
|
|
48
|
+
const ix: Instruction = { accounts: keys, programAddress, data }
|
|
49
|
+
return ix
|
|
50
|
+
}
|
|
@@ -44,7 +44,7 @@ export function withdrawObligationCollateral(
|
|
|
44
44
|
programAddress: Address = PROGRAM_ID
|
|
45
45
|
) {
|
|
46
46
|
const keys: Array<AccountMeta | AccountSignerMeta> = [
|
|
47
|
-
{ address: accounts.owner.address, role:
|
|
47
|
+
{ address: accounts.owner.address, role: 3, signer: accounts.owner },
|
|
48
48
|
{ address: accounts.obligation, role: 1 },
|
|
49
49
|
{ address: accounts.lendingMarket, role: 0 },
|
|
50
50
|
{ address: accounts.lendingMarketAuthority, role: 0 },
|
|
@@ -55,7 +55,7 @@ export function withdrawObligationCollateralV2(
|
|
|
55
55
|
const keys: Array<AccountMeta | AccountSignerMeta> = [
|
|
56
56
|
{
|
|
57
57
|
address: accounts.withdrawAccounts.owner.address,
|
|
58
|
-
role:
|
|
58
|
+
role: 3,
|
|
59
59
|
signer: accounts.withdrawAccounts.owner,
|
|
60
60
|
},
|
|
61
61
|
{ address: accounts.withdrawAccounts.obligation, role: 1 },
|
|
@@ -11,13 +11,16 @@ export interface ReserveConfigFields {
|
|
|
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
|
|
14
16
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* Can be re-used after making sure all underlying production account data is zeroed.
|
|
17
|
+
* Boolean flag to block minting/redeeming of ctokens
|
|
18
|
+
* Blocks usage of ctokens (minting or withdrawing from obligation)
|
|
19
|
+
* Effectively blocks deposit_reserve_liquidity and withdraw_obligation_collateral
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
+
blockCtokenUsage: number
|
|
22
|
+
/** Past reserved space - feel free to reuse. */
|
|
23
|
+
reserved1: Array<number>
|
|
21
24
|
/** Cut of the order execution bonus that the protocol receives, as a percentage */
|
|
22
25
|
protocolOrderExecutionFeePct: number
|
|
23
26
|
/** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
|
|
@@ -76,7 +79,14 @@ export interface ReserveConfigFields {
|
|
|
76
79
|
* obligations) is NOT affected by this flag.
|
|
77
80
|
*/
|
|
78
81
|
autodeleverageEnabled: number
|
|
79
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Boolean flag indicating whether the reserve is locked for the proposer authority.
|
|
84
|
+
*
|
|
85
|
+
* Once the proposer have finished preparing the reserve, it must be locked to prevent
|
|
86
|
+
* further changes to the reserve configuration allowing review and voting on the proposal
|
|
87
|
+
* without alteration during the voting period.
|
|
88
|
+
*/
|
|
89
|
+
proposerAuthorityLocked: number
|
|
80
90
|
/**
|
|
81
91
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
82
92
|
* - u64::MAX for inf
|
|
@@ -104,13 +114,16 @@ export interface ReserveConfigJSON {
|
|
|
104
114
|
assetTier: number
|
|
105
115
|
/** Flat rate that goes to the host */
|
|
106
116
|
hostFixedInterestRateBps: number
|
|
117
|
+
/** Starting bonus for deleveraging-related liquidations, in bps. */
|
|
118
|
+
minDeleveragingBonusBps: number
|
|
107
119
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* Can be re-used after making sure all underlying production account data is zeroed.
|
|
120
|
+
* Boolean flag to block minting/redeeming of ctokens
|
|
121
|
+
* Blocks usage of ctokens (minting or withdrawing from obligation)
|
|
122
|
+
* Effectively blocks deposit_reserve_liquidity and withdraw_obligation_collateral
|
|
112
123
|
*/
|
|
113
|
-
|
|
124
|
+
blockCtokenUsage: number
|
|
125
|
+
/** Past reserved space - feel free to reuse. */
|
|
126
|
+
reserved1: Array<number>
|
|
114
127
|
/** Cut of the order execution bonus that the protocol receives, as a percentage */
|
|
115
128
|
protocolOrderExecutionFeePct: number
|
|
116
129
|
/** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
|
|
@@ -169,7 +182,14 @@ export interface ReserveConfigJSON {
|
|
|
169
182
|
* obligations) is NOT affected by this flag.
|
|
170
183
|
*/
|
|
171
184
|
autodeleverageEnabled: number
|
|
172
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Boolean flag indicating whether the reserve is locked for the proposer authority.
|
|
187
|
+
*
|
|
188
|
+
* Once the proposer have finished preparing the reserve, it must be locked to prevent
|
|
189
|
+
* further changes to the reserve configuration allowing review and voting on the proposal
|
|
190
|
+
* without alteration during the voting period.
|
|
191
|
+
*/
|
|
192
|
+
proposerAuthorityLocked: number
|
|
173
193
|
/**
|
|
174
194
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
175
195
|
* - u64::MAX for inf
|
|
@@ -198,13 +218,16 @@ export class ReserveConfig {
|
|
|
198
218
|
readonly assetTier: number
|
|
199
219
|
/** Flat rate that goes to the host */
|
|
200
220
|
readonly hostFixedInterestRateBps: number
|
|
221
|
+
/** Starting bonus for deleveraging-related liquidations, in bps. */
|
|
222
|
+
readonly minDeleveragingBonusBps: number
|
|
201
223
|
/**
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* Can be re-used after making sure all underlying production account data is zeroed.
|
|
224
|
+
* Boolean flag to block minting/redeeming of ctokens
|
|
225
|
+
* Blocks usage of ctokens (minting or withdrawing from obligation)
|
|
226
|
+
* Effectively blocks deposit_reserve_liquidity and withdraw_obligation_collateral
|
|
206
227
|
*/
|
|
207
|
-
readonly
|
|
228
|
+
readonly blockCtokenUsage: number
|
|
229
|
+
/** Past reserved space - feel free to reuse. */
|
|
230
|
+
readonly reserved1: Array<number>
|
|
208
231
|
/** Cut of the order execution bonus that the protocol receives, as a percentage */
|
|
209
232
|
readonly protocolOrderExecutionFeePct: number
|
|
210
233
|
/** Protocol take rate is the amount borrowed interest protocol receives, as a percentage */
|
|
@@ -263,7 +286,14 @@ export class ReserveConfig {
|
|
|
263
286
|
* obligations) is NOT affected by this flag.
|
|
264
287
|
*/
|
|
265
288
|
readonly autodeleverageEnabled: number
|
|
266
|
-
|
|
289
|
+
/**
|
|
290
|
+
* Boolean flag indicating whether the reserve is locked for the proposer authority.
|
|
291
|
+
*
|
|
292
|
+
* Once the proposer have finished preparing the reserve, it must be locked to prevent
|
|
293
|
+
* further changes to the reserve configuration allowing review and voting on the proposal
|
|
294
|
+
* without alteration during the voting period.
|
|
295
|
+
*/
|
|
296
|
+
readonly proposerAuthorityLocked: number
|
|
267
297
|
/**
|
|
268
298
|
* Maximum amount liquidity of this reserve borrowed outside all elevation groups
|
|
269
299
|
* - u64::MAX for inf
|
|
@@ -287,7 +317,9 @@ export class ReserveConfig {
|
|
|
287
317
|
this.status = fields.status
|
|
288
318
|
this.assetTier = fields.assetTier
|
|
289
319
|
this.hostFixedInterestRateBps = fields.hostFixedInterestRateBps
|
|
290
|
-
this.
|
|
320
|
+
this.minDeleveragingBonusBps = fields.minDeleveragingBonusBps
|
|
321
|
+
this.blockCtokenUsage = fields.blockCtokenUsage
|
|
322
|
+
this.reserved1 = fields.reserved1
|
|
291
323
|
this.protocolOrderExecutionFeePct = fields.protocolOrderExecutionFeePct
|
|
292
324
|
this.protocolTakeRatePct = fields.protocolTakeRatePct
|
|
293
325
|
this.protocolLiquidationFeePct = fields.protocolLiquidationFeePct
|
|
@@ -319,7 +351,7 @@ export class ReserveConfig {
|
|
|
319
351
|
this.utilizationLimitBlockBorrowingAbovePct =
|
|
320
352
|
fields.utilizationLimitBlockBorrowingAbovePct
|
|
321
353
|
this.autodeleverageEnabled = fields.autodeleverageEnabled
|
|
322
|
-
this.
|
|
354
|
+
this.proposerAuthorityLocked = fields.proposerAuthorityLocked
|
|
323
355
|
this.borrowLimitOutsideElevationGroup =
|
|
324
356
|
fields.borrowLimitOutsideElevationGroup
|
|
325
357
|
this.borrowLimitAgainstThisCollateralInElevationGroup =
|
|
@@ -334,7 +366,9 @@ export class ReserveConfig {
|
|
|
334
366
|
borsh.u8("status"),
|
|
335
367
|
borsh.u8("assetTier"),
|
|
336
368
|
borsh.u16("hostFixedInterestRateBps"),
|
|
337
|
-
borsh.
|
|
369
|
+
borsh.u16("minDeleveragingBonusBps"),
|
|
370
|
+
borsh.u8("blockCtokenUsage"),
|
|
371
|
+
borsh.array(borsh.u8(), 6, "reserved1"),
|
|
338
372
|
borsh.u8("protocolOrderExecutionFeePct"),
|
|
339
373
|
borsh.u8("protocolTakeRatePct"),
|
|
340
374
|
borsh.u8("protocolLiquidationFeePct"),
|
|
@@ -357,7 +391,7 @@ export class ReserveConfig {
|
|
|
357
391
|
borsh.u8("disableUsageAsCollOutsideEmode"),
|
|
358
392
|
borsh.u8("utilizationLimitBlockBorrowingAbovePct"),
|
|
359
393
|
borsh.u8("autodeleverageEnabled"),
|
|
360
|
-
borsh.
|
|
394
|
+
borsh.u8("proposerAuthorityLocked"),
|
|
361
395
|
borsh.u64("borrowLimitOutsideElevationGroup"),
|
|
362
396
|
borsh.array(
|
|
363
397
|
borsh.u64(),
|
|
@@ -376,7 +410,9 @@ export class ReserveConfig {
|
|
|
376
410
|
status: obj.status,
|
|
377
411
|
assetTier: obj.assetTier,
|
|
378
412
|
hostFixedInterestRateBps: obj.hostFixedInterestRateBps,
|
|
379
|
-
|
|
413
|
+
minDeleveragingBonusBps: obj.minDeleveragingBonusBps,
|
|
414
|
+
blockCtokenUsage: obj.blockCtokenUsage,
|
|
415
|
+
reserved1: obj.reserved1,
|
|
380
416
|
protocolOrderExecutionFeePct: obj.protocolOrderExecutionFeePct,
|
|
381
417
|
protocolTakeRatePct: obj.protocolTakeRatePct,
|
|
382
418
|
protocolLiquidationFeePct: obj.protocolLiquidationFeePct,
|
|
@@ -405,7 +441,7 @@ export class ReserveConfig {
|
|
|
405
441
|
utilizationLimitBlockBorrowingAbovePct:
|
|
406
442
|
obj.utilizationLimitBlockBorrowingAbovePct,
|
|
407
443
|
autodeleverageEnabled: obj.autodeleverageEnabled,
|
|
408
|
-
|
|
444
|
+
proposerAuthorityLocked: obj.proposerAuthorityLocked,
|
|
409
445
|
borrowLimitOutsideElevationGroup: obj.borrowLimitOutsideElevationGroup,
|
|
410
446
|
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
411
447
|
obj.borrowLimitAgainstThisCollateralInElevationGroup,
|
|
@@ -419,7 +455,9 @@ export class ReserveConfig {
|
|
|
419
455
|
status: fields.status,
|
|
420
456
|
assetTier: fields.assetTier,
|
|
421
457
|
hostFixedInterestRateBps: fields.hostFixedInterestRateBps,
|
|
422
|
-
|
|
458
|
+
minDeleveragingBonusBps: fields.minDeleveragingBonusBps,
|
|
459
|
+
blockCtokenUsage: fields.blockCtokenUsage,
|
|
460
|
+
reserved1: fields.reserved1,
|
|
423
461
|
protocolOrderExecutionFeePct: fields.protocolOrderExecutionFeePct,
|
|
424
462
|
protocolTakeRatePct: fields.protocolTakeRatePct,
|
|
425
463
|
protocolLiquidationFeePct: fields.protocolLiquidationFeePct,
|
|
@@ -450,7 +488,7 @@ export class ReserveConfig {
|
|
|
450
488
|
utilizationLimitBlockBorrowingAbovePct:
|
|
451
489
|
fields.utilizationLimitBlockBorrowingAbovePct,
|
|
452
490
|
autodeleverageEnabled: fields.autodeleverageEnabled,
|
|
453
|
-
|
|
491
|
+
proposerAuthorityLocked: fields.proposerAuthorityLocked,
|
|
454
492
|
borrowLimitOutsideElevationGroup: fields.borrowLimitOutsideElevationGroup,
|
|
455
493
|
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
456
494
|
fields.borrowLimitAgainstThisCollateralInElevationGroup,
|
|
@@ -464,7 +502,9 @@ export class ReserveConfig {
|
|
|
464
502
|
status: this.status,
|
|
465
503
|
assetTier: this.assetTier,
|
|
466
504
|
hostFixedInterestRateBps: this.hostFixedInterestRateBps,
|
|
467
|
-
|
|
505
|
+
minDeleveragingBonusBps: this.minDeleveragingBonusBps,
|
|
506
|
+
blockCtokenUsage: this.blockCtokenUsage,
|
|
507
|
+
reserved1: this.reserved1,
|
|
468
508
|
protocolOrderExecutionFeePct: this.protocolOrderExecutionFeePct,
|
|
469
509
|
protocolTakeRatePct: this.protocolTakeRatePct,
|
|
470
510
|
protocolLiquidationFeePct: this.protocolLiquidationFeePct,
|
|
@@ -490,7 +530,7 @@ export class ReserveConfig {
|
|
|
490
530
|
utilizationLimitBlockBorrowingAbovePct:
|
|
491
531
|
this.utilizationLimitBlockBorrowingAbovePct,
|
|
492
532
|
autodeleverageEnabled: this.autodeleverageEnabled,
|
|
493
|
-
|
|
533
|
+
proposerAuthorityLocked: this.proposerAuthorityLocked,
|
|
494
534
|
borrowLimitOutsideElevationGroup:
|
|
495
535
|
this.borrowLimitOutsideElevationGroup.toString(),
|
|
496
536
|
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
@@ -507,7 +547,9 @@ export class ReserveConfig {
|
|
|
507
547
|
status: obj.status,
|
|
508
548
|
assetTier: obj.assetTier,
|
|
509
549
|
hostFixedInterestRateBps: obj.hostFixedInterestRateBps,
|
|
510
|
-
|
|
550
|
+
minDeleveragingBonusBps: obj.minDeleveragingBonusBps,
|
|
551
|
+
blockCtokenUsage: obj.blockCtokenUsage,
|
|
552
|
+
reserved1: obj.reserved1,
|
|
511
553
|
protocolOrderExecutionFeePct: obj.protocolOrderExecutionFeePct,
|
|
512
554
|
protocolTakeRatePct: obj.protocolTakeRatePct,
|
|
513
555
|
protocolLiquidationFeePct: obj.protocolLiquidationFeePct,
|
|
@@ -537,7 +579,7 @@ export class ReserveConfig {
|
|
|
537
579
|
utilizationLimitBlockBorrowingAbovePct:
|
|
538
580
|
obj.utilizationLimitBlockBorrowingAbovePct,
|
|
539
581
|
autodeleverageEnabled: obj.autodeleverageEnabled,
|
|
540
|
-
|
|
582
|
+
proposerAuthorityLocked: obj.proposerAuthorityLocked,
|
|
541
583
|
borrowLimitOutsideElevationGroup: new BN(
|
|
542
584
|
obj.borrowLimitOutsideElevationGroup
|
|
543
585
|
),
|
|
@@ -11,9 +11,9 @@ export interface ReserveFeesFields {
|
|
|
11
11
|
* clarity:
|
|
12
12
|
* 1% = (1 << 60) / 100 = 11529215046068470
|
|
13
13
|
* 0.01% (1 basis point) = 115292150460685
|
|
14
|
-
* 0.00001% (Aave
|
|
14
|
+
* 0.00001% (Aave origination fee) = 115292150461
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
originationFeeSf: BN
|
|
17
17
|
/**
|
|
18
18
|
* Fee for flash loan, expressed as scaled fraction.
|
|
19
19
|
* 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541
|
|
@@ -30,9 +30,9 @@ export interface ReserveFeesJSON {
|
|
|
30
30
|
* clarity:
|
|
31
31
|
* 1% = (1 << 60) / 100 = 11529215046068470
|
|
32
32
|
* 0.01% (1 basis point) = 115292150460685
|
|
33
|
-
* 0.00001% (Aave
|
|
33
|
+
* 0.00001% (Aave origination fee) = 115292150461
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
originationFeeSf: string
|
|
36
36
|
/**
|
|
37
37
|
* Fee for flash loan, expressed as scaled fraction.
|
|
38
38
|
* 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541
|
|
@@ -56,9 +56,9 @@ export class ReserveFees {
|
|
|
56
56
|
* clarity:
|
|
57
57
|
* 1% = (1 << 60) / 100 = 11529215046068470
|
|
58
58
|
* 0.01% (1 basis point) = 115292150460685
|
|
59
|
-
* 0.00001% (Aave
|
|
59
|
+
* 0.00001% (Aave origination fee) = 115292150461
|
|
60
60
|
*/
|
|
61
|
-
readonly
|
|
61
|
+
readonly originationFeeSf: BN
|
|
62
62
|
/**
|
|
63
63
|
* Fee for flash loan, expressed as scaled fraction.
|
|
64
64
|
* 0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541
|
|
@@ -68,7 +68,7 @@ export class ReserveFees {
|
|
|
68
68
|
readonly padding: Array<number>
|
|
69
69
|
|
|
70
70
|
constructor(fields: ReserveFeesFields) {
|
|
71
|
-
this.
|
|
71
|
+
this.originationFeeSf = fields.originationFeeSf
|
|
72
72
|
this.flashLoanFeeSf = fields.flashLoanFeeSf
|
|
73
73
|
this.padding = fields.padding
|
|
74
74
|
}
|
|
@@ -76,7 +76,7 @@ export class ReserveFees {
|
|
|
76
76
|
static layout(property?: string) {
|
|
77
77
|
return borsh.struct(
|
|
78
78
|
[
|
|
79
|
-
borsh.u64("
|
|
79
|
+
borsh.u64("originationFeeSf"),
|
|
80
80
|
borsh.u64("flashLoanFeeSf"),
|
|
81
81
|
borsh.array(borsh.u8(), 8, "padding"),
|
|
82
82
|
],
|
|
@@ -87,7 +87,7 @@ export class ReserveFees {
|
|
|
87
87
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
88
88
|
static fromDecoded(obj: any) {
|
|
89
89
|
return new ReserveFees({
|
|
90
|
-
|
|
90
|
+
originationFeeSf: obj.originationFeeSf,
|
|
91
91
|
flashLoanFeeSf: obj.flashLoanFeeSf,
|
|
92
92
|
padding: obj.padding,
|
|
93
93
|
})
|
|
@@ -95,7 +95,7 @@ export class ReserveFees {
|
|
|
95
95
|
|
|
96
96
|
static toEncodable(fields: ReserveFeesFields) {
|
|
97
97
|
return {
|
|
98
|
-
|
|
98
|
+
originationFeeSf: fields.originationFeeSf,
|
|
99
99
|
flashLoanFeeSf: fields.flashLoanFeeSf,
|
|
100
100
|
padding: fields.padding,
|
|
101
101
|
}
|
|
@@ -103,7 +103,7 @@ export class ReserveFees {
|
|
|
103
103
|
|
|
104
104
|
toJSON(): ReserveFeesJSON {
|
|
105
105
|
return {
|
|
106
|
-
|
|
106
|
+
originationFeeSf: this.originationFeeSf.toString(),
|
|
107
107
|
flashLoanFeeSf: this.flashLoanFeeSf.toString(),
|
|
108
108
|
padding: this.padding,
|
|
109
109
|
}
|
|
@@ -111,7 +111,7 @@ export class ReserveFees {
|
|
|
111
111
|
|
|
112
112
|
static fromJSON(obj: ReserveFeesJSON): ReserveFees {
|
|
113
113
|
return new ReserveFees({
|
|
114
|
-
|
|
114
|
+
originationFeeSf: new BN(obj.originationFeeSf),
|
|
115
115
|
flashLoanFeeSf: new BN(obj.flashLoanFeeSf),
|
|
116
116
|
padding: obj.padding,
|
|
117
117
|
})
|