@kamino-finance/klend-sdk 5.2.14 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes/action.d.ts.map +1 -1
- package/dist/classes/action.js +1 -2
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/manager.d.ts +2 -4
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +29 -20
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts +1 -2
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js +7 -20
- package/dist/classes/market.js.map +1 -1
- package/dist/classes/reserve.js +14 -14
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/shared.d.ts +2 -2
- package/dist/classes/shared.d.ts.map +1 -1
- package/dist/classes/vault.d.ts +2 -4
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +7 -15
- package/dist/classes/vault.js.map +1 -1
- package/dist/client_kamino_manager.js +7 -3
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/idl.json +310 -48
- package/dist/idl_codegen/accounts/LendingMarket.d.ts +48 -3
- package/dist/idl_codegen/accounts/LendingMarket.d.ts.map +1 -1
- package/dist/idl_codegen/accounts/LendingMarket.js +35 -8
- package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
- package/dist/idl_codegen/accounts/Obligation.d.ts +30 -0
- package/dist/idl_codegen/accounts/Obligation.d.ts.map +1 -1
- package/dist/idl_codegen/accounts/Obligation.js +23 -2
- package/dist/idl_codegen/accounts/Obligation.js.map +1 -1
- package/dist/idl_codegen/accounts/Reserve.js +1 -1
- package/dist/idl_codegen/errors/custom.d.ts +33 -1
- package/dist/idl_codegen/errors/custom.d.ts.map +1 -1
- package/dist/idl_codegen/errors/custom.js +57 -1
- package/dist/idl_codegen/errors/custom.js.map +1 -1
- package/dist/idl_codegen/instructions/index.d.ts +7 -3
- package/dist/idl_codegen/instructions/index.d.ts.map +1 -1
- package/dist/idl_codegen/instructions/index.js +7 -3
- package/dist/idl_codegen/instructions/index.js.map +1 -1
- package/dist/idl_codegen/instructions/initReferrerTokenState.d.ts +2 -5
- package/dist/idl_codegen/instructions/initReferrerTokenState.d.ts.map +1 -1
- package/dist/idl_codegen/instructions/initReferrerTokenState.js +3 -32
- package/dist/idl_codegen/instructions/initReferrerTokenState.js.map +1 -1
- package/dist/idl_codegen/instructions/markObligationForDeleveraging.d.ts +12 -0
- package/dist/idl_codegen/instructions/markObligationForDeleveraging.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/markObligationForDeleveraging.js +47 -0
- package/dist/idl_codegen/instructions/markObligationForDeleveraging.js.map +1 -0
- package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeem.d.ts +38 -0
- package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeem.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeem.js +159 -0
- package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeem.js.map +1 -0
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +1 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -1
- package/dist/idl_codegen/types/ReserveConfig.d.ts +78 -20
- package/dist/idl_codegen/types/ReserveConfig.d.ts.map +1 -1
- package/dist/idl_codegen/types/ReserveConfig.js +45 -14
- package/dist/idl_codegen/types/ReserveConfig.js.map +1 -1
- package/dist/idl_codegen/types/ReserveLiquidity.d.ts +16 -16
- package/dist/idl_codegen/types/ReserveLiquidity.d.ts.map +1 -1
- package/dist/idl_codegen/types/ReserveLiquidity.js +16 -16
- package/dist/idl_codegen/types/ReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen/types/UpdateConfigMode.d.ts +40 -14
- package/dist/idl_codegen/types/UpdateConfigMode.d.ts.map +1 -1
- package/dist/idl_codegen/types/UpdateConfigMode.js +71 -23
- package/dist/idl_codegen/types/UpdateConfigMode.js.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +37 -11
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js +64 -16
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/idl_codegen/types/index.d.ts +4 -4
- package/dist/idl_codegen/types/index.d.ts.map +1 -1
- package/dist/idl_codegen/types/index.js.map +1 -1
- package/dist/idl_codegen/zero_padding/ObligationZP.d.ts +4 -0
- package/dist/idl_codegen/zero_padding/ObligationZP.d.ts.map +1 -1
- package/dist/idl_codegen/zero_padding/ObligationZP.js +10 -0
- package/dist/idl_codegen/zero_padding/ObligationZP.js.map +1 -1
- package/dist/pyth/accounts/PriceUpdateV2.d.ts +30 -0
- package/dist/pyth/accounts/PriceUpdateV2.d.ts.map +1 -0
- package/dist/pyth/accounts/PriceUpdateV2.js +104 -0
- package/dist/pyth/accounts/PriceUpdateV2.js.map +1 -0
- package/dist/pyth/accounts/index.d.ts +3 -0
- package/dist/pyth/accounts/index.d.ts.map +1 -0
- package/dist/pyth/accounts/index.js +6 -0
- package/dist/pyth/accounts/index.js.map +1 -0
- package/dist/pyth/types/PriceFeedMessage.d.ts +58 -0
- package/dist/pyth/types/PriceFeedMessage.d.ts.map +1 -0
- package/dist/pyth/types/PriceFeedMessage.js +118 -0
- package/dist/pyth/types/PriceFeedMessage.js.map +1 -0
- package/dist/pyth/types/VerificationLevel.d.ts +45 -0
- package/dist/pyth/types/VerificationLevel.d.ts.map +1 -0
- package/dist/pyth/types/VerificationLevel.js +105 -0
- package/dist/pyth/types/VerificationLevel.js.map +1 -0
- package/dist/pyth/types/index.d.ts +7 -0
- package/dist/pyth/types/index.d.ts.map +1 -0
- package/dist/pyth/types/index.js +31 -0
- package/dist/pyth/types/index.js.map +1 -0
- package/dist/referrals/instructions.d.ts.map +1 -1
- package/dist/referrals/instructions.js +1 -2
- package/dist/referrals/instructions.js.map +1 -1
- package/dist/utils/managerTypes.d.ts.map +1 -1
- package/dist/utils/managerTypes.js +5 -4
- package/dist/utils/managerTypes.js.map +1 -1
- package/dist/utils/oracle.d.ts.map +1 -1
- package/dist/utils/oracle.js +9 -14
- package/dist/utils/oracle.js.map +1 -1
- package/dist/utils/rpc.d.ts +2 -1
- package/dist/utils/rpc.d.ts.map +1 -1
- package/dist/utils/rpc.js +8 -6
- package/dist/utils/rpc.js.map +1 -1
- package/package.json +5 -6
- package/src/classes/action.ts +1 -3
- package/src/classes/manager.ts +39 -19
- package/src/classes/market.ts +8 -21
- package/src/classes/reserve.ts +16 -16
- package/src/classes/shared.ts +2 -2
- package/src/classes/vault.ts +10 -14
- package/src/client_kamino_manager.ts +7 -3
- package/src/idl_codegen/accounts/LendingMarket.ts +76 -13
- package/src/idl_codegen/accounts/Obligation.ts +47 -2
- package/src/idl_codegen/accounts/Reserve.ts +1 -1
- package/src/idl_codegen/errors/custom.ts +56 -0
- package/src/idl_codegen/instructions/index.ts +13 -6
- package/src/idl_codegen/instructions/initReferrerTokenState.ts +3 -15
- package/src/idl_codegen/instructions/markObligationForDeleveraging.ts +40 -0
- package/src/idl_codegen/instructions/repayAndWithdrawAndRedeem.ts +177 -0
- package/src/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.ts +1 -1
- package/src/idl_codegen/programId.ts +1 -1
- package/src/idl_codegen/types/ReserveConfig.ts +100 -28
- package/src/idl_codegen/types/ReserveLiquidity.ts +25 -24
- package/src/idl_codegen/types/UpdateConfigMode.ts +86 -26
- package/src/idl_codegen/types/UpdateLendingMarketMode.ts +77 -17
- package/src/idl_codegen/types/index.ts +14 -6
- package/src/idl_codegen/zero_padding/ObligationZP.ts +10 -0
- package/src/pyth/accounts/PriceUpdateV2.ts +110 -0
- package/src/pyth/accounts/index.ts +2 -0
- package/src/pyth/types/PriceFeedMessage.ts +120 -0
- package/src/pyth/types/VerificationLevel.ts +98 -0
- package/src/pyth/types/index.ts +9 -0
- package/src/referrals/instructions.ts +1 -3
- package/src/utils/managerTypes.ts +5 -5
- package/src/utils/oracle.ts +9 -15
- package/src/utils/rpc.ts +8 -5
package/src/classes/manager.ts
CHANGED
|
@@ -495,20 +495,18 @@ export class KaminoManager {
|
|
|
495
495
|
|
|
496
496
|
/**
|
|
497
497
|
* Get all vaults
|
|
498
|
-
* @param useOptimisedRPCCall - if set to true, it will use the optimized getProgramAccounts RPC call, which is more efficient but doesn't work in web environments
|
|
499
498
|
* @returns an array of all vaults
|
|
500
499
|
*/
|
|
501
|
-
async getAllVaults(
|
|
502
|
-
return this._vaultClient.getAllVaults(
|
|
500
|
+
async getAllVaults(): Promise<KaminoVault[]> {
|
|
501
|
+
return this._vaultClient.getAllVaults();
|
|
503
502
|
}
|
|
504
503
|
|
|
505
504
|
/**
|
|
506
505
|
* Get all vaults for owner
|
|
507
506
|
* @param owner the pubkey of the vaults owner
|
|
508
|
-
* @param useOptimisedRPCCall - if set to true, it will use the optimized getProgramAccounts RPC call, which is more efficient but doesn't work in web environments
|
|
509
507
|
* @returns an array of all vaults owned by a given pubkey
|
|
510
508
|
*/
|
|
511
|
-
async getAllVaultsForOwner(owner: PublicKey
|
|
509
|
+
async getAllVaultsForOwner(owner: PublicKey): Promise<KaminoVault[]> {
|
|
512
510
|
const filters = [
|
|
513
511
|
{
|
|
514
512
|
dataSize: VaultState.layout.span + 8,
|
|
@@ -527,16 +525,15 @@ export class KaminoManager {
|
|
|
527
525
|
},
|
|
528
526
|
];
|
|
529
527
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
528
|
+
const kaminoVaults: GetProgramAccountsResponse = await getProgramAccounts(
|
|
529
|
+
this._connection,
|
|
530
|
+
this._kaminoVaultProgramId,
|
|
531
|
+
VaultState.layout.span + 8,
|
|
532
|
+
{
|
|
534
533
|
commitment: this._connection.commitment ?? 'processed',
|
|
535
534
|
filters,
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
kaminoVaults = await this._connection.getProgramAccounts(this._kaminoVaultProgramId, { filters });
|
|
539
|
-
}
|
|
535
|
+
}
|
|
536
|
+
);
|
|
540
537
|
|
|
541
538
|
return kaminoVaults.map((kaminoVault) => {
|
|
542
539
|
if (kaminoVault.account === null) {
|
|
@@ -1013,13 +1010,35 @@ function parseForChangesMarketConfigAndGetIxs(
|
|
|
1013
1010
|
),
|
|
1014
1011
|
});
|
|
1015
1012
|
}
|
|
1016
|
-
} else if (key === '
|
|
1017
|
-
if (!market.
|
|
1013
|
+
} else if (key === 'minValueSkipLiquidationBfChecks') {
|
|
1014
|
+
if (!market.minValueSkipLiquidationBfChecks.eq(newMarket.minValueSkipLiquidationBfChecks)) {
|
|
1015
|
+
updateLendingMarketIxnsArgs.push({
|
|
1016
|
+
mode: UpdateLendingMarketMode.UpdateMinValueBfSkipPriorityLiqCheck.discriminator,
|
|
1017
|
+
value: updateMarketConfigEncodedValue(
|
|
1018
|
+
UpdateLendingMarketMode.UpdateMinValueBfSkipPriorityLiqCheck.discriminator,
|
|
1019
|
+
newMarket.minValueSkipLiquidationBfChecks.toNumber()
|
|
1020
|
+
),
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
} else if (key === 'minValueSkipLiquidationLtvChecks') {
|
|
1024
|
+
if (!market.minValueSkipLiquidationLtvChecks.eq(newMarket.minValueSkipLiquidationLtvChecks)) {
|
|
1025
|
+
updateLendingMarketIxnsArgs.push({
|
|
1026
|
+
mode: UpdateLendingMarketMode.UpdateMinValueLtvSkipPriorityLiqCheck.discriminator,
|
|
1027
|
+
value: updateMarketConfigEncodedValue(
|
|
1028
|
+
UpdateLendingMarketMode.UpdateMinValueLtvSkipPriorityLiqCheck.discriminator,
|
|
1029
|
+
newMarket.minValueSkipLiquidationLtvChecks.toNumber()
|
|
1030
|
+
),
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
} else if (key === 'individualAutodeleverageMarginCallPeriodSecs') {
|
|
1034
|
+
if (
|
|
1035
|
+
!market.individualAutodeleverageMarginCallPeriodSecs.eq(newMarket.individualAutodeleverageMarginCallPeriodSecs)
|
|
1036
|
+
) {
|
|
1018
1037
|
updateLendingMarketIxnsArgs.push({
|
|
1019
|
-
mode: UpdateLendingMarketMode.
|
|
1038
|
+
mode: UpdateLendingMarketMode.UpdateIndividualAutodeleverageMarginCallPeriodSecs.discriminator,
|
|
1020
1039
|
value: updateMarketConfigEncodedValue(
|
|
1021
|
-
UpdateLendingMarketMode.
|
|
1022
|
-
newMarket.
|
|
1040
|
+
UpdateLendingMarketMode.UpdateIndividualAutodeleverageMarginCallPeriodSecs.discriminator,
|
|
1041
|
+
newMarket.individualAutodeleverageMarginCallPeriodSecs.toNumber()
|
|
1023
1042
|
),
|
|
1024
1043
|
});
|
|
1025
1044
|
}
|
|
@@ -1099,7 +1118,8 @@ function updateMarketConfigEncodedValue(
|
|
|
1099
1118
|
case UpdateLendingMarketMode.UpdateGlobalAllowedBorrow.discriminator:
|
|
1100
1119
|
case UpdateLendingMarketMode.UpdateGlobalUnhealthyBorrow.discriminator:
|
|
1101
1120
|
case UpdateLendingMarketMode.UpdateMinFullLiquidationThreshold.discriminator:
|
|
1102
|
-
case UpdateLendingMarketMode.
|
|
1121
|
+
case UpdateLendingMarketMode.UpdateMinValueBfSkipPriorityLiqCheck.discriminator:
|
|
1122
|
+
case UpdateLendingMarketMode.UpdateMinValueLtvSkipPriorityLiqCheck.discriminator:
|
|
1103
1123
|
value = value as number;
|
|
1104
1124
|
buffer.writeBigUint64LE(BigInt(value), 0);
|
|
1105
1125
|
break;
|
package/src/classes/market.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountInfo, Connection,
|
|
1
|
+
import { AccountInfo, Connection, PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { KaminoObligation } from './obligation';
|
|
3
3
|
import { KaminoReserve } from './reserve';
|
|
4
4
|
import { LendingMarket, Obligation, UserMetadata, ReferrerTokenState, Reserve } from '../idl_codegen/accounts';
|
|
@@ -531,9 +531,8 @@ export class KaminoMarket {
|
|
|
531
531
|
* This function will likely require an RPC capable of returning more than the default 100k rows in a single scan
|
|
532
532
|
*
|
|
533
533
|
* @param tag
|
|
534
|
-
* @param useOptimisedRPCCall - use the optimised RPC call (compressed) to get all obligations
|
|
535
534
|
*/
|
|
536
|
-
async getAllObligationsForMarket(tag?: number
|
|
535
|
+
async getAllObligationsForMarket(tag?: number): Promise<KaminoObligation[]> {
|
|
537
536
|
const filters = [
|
|
538
537
|
{
|
|
539
538
|
dataSize: Obligation.layout.span + 8,
|
|
@@ -558,26 +557,14 @@ export class KaminoMarket {
|
|
|
558
557
|
const collateralExchangeRates = new PubkeyHashMap<PublicKey, Decimal>();
|
|
559
558
|
const cumulativeBorrowRates = new PubkeyHashMap<PublicKey, Decimal>();
|
|
560
559
|
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
if (useOptimisedRPCCall) {
|
|
566
|
-
[slot, obligations] = await Promise.all([
|
|
567
|
-
slotPromise,
|
|
568
|
-
getProgramAccounts(this.connection, this.programId, {
|
|
569
|
-
commitment: this.connection.commitment ?? 'processed',
|
|
570
|
-
filters,
|
|
571
|
-
dataSlice: { offset: 0, length: ObligationZP.layout.span + 8 }, // truncate the padding
|
|
572
|
-
}),
|
|
573
|
-
]);
|
|
574
|
-
} else {
|
|
575
|
-
const obligationsPromise = this.connection.getProgramAccounts(this.programId, {
|
|
560
|
+
const [slot, obligations] = await Promise.all([
|
|
561
|
+
this.connection.getSlot(),
|
|
562
|
+
getProgramAccounts(this.connection, this.programId, ObligationZP.layout.span + 8, {
|
|
563
|
+
commitment: this.connection.commitment ?? 'processed',
|
|
576
564
|
filters,
|
|
577
565
|
dataSlice: { offset: 0, length: ObligationZP.layout.span + 8 }, // truncate the padding
|
|
578
|
-
})
|
|
579
|
-
|
|
580
|
-
}
|
|
566
|
+
}),
|
|
567
|
+
]);
|
|
581
568
|
|
|
582
569
|
return obligations.map((obligation) => {
|
|
583
570
|
if (obligation.account === null) {
|
package/src/classes/reserve.ts
CHANGED
|
@@ -878,8 +878,8 @@ export class KaminoReserve {
|
|
|
878
878
|
decimals: this.state.liquidity.mintDecimals.toNumber(),
|
|
879
879
|
accumulatedProtocolFees: this.getAccumulatedProtocolFees().div(this.getMintFactor()),
|
|
880
880
|
mintTotalSupply,
|
|
881
|
-
|
|
882
|
-
|
|
881
|
+
depositLimitCrossedTimestamp: parsedData.liquidity.depositLimitCrossedTimestamp.toNumber(),
|
|
882
|
+
borrowLimitCrossedTimestamp: parsedData.liquidity.borrowLimitCrossedTimestamp.toNumber(),
|
|
883
883
|
borrowFactor: parsedData.config.borrowFactorPct.toNumber(),
|
|
884
884
|
};
|
|
885
885
|
}
|
|
@@ -1478,21 +1478,21 @@ export function parseForChangesReserveConfigAndGetIxs(
|
|
|
1478
1478
|
),
|
|
1479
1479
|
});
|
|
1480
1480
|
}
|
|
1481
|
-
} else if (key === '
|
|
1481
|
+
} else if (key === 'deleveragingThresholdSecsPerBps') {
|
|
1482
1482
|
if (reserve === undefined) {
|
|
1483
1483
|
updateReserveIxnsArgs.push({
|
|
1484
|
-
mode: UpdateConfigMode.
|
|
1484
|
+
mode: UpdateConfigMode.UpdateDeleveragingThresholdSecsPerBps.discriminator,
|
|
1485
1485
|
value: updateReserveConfigEncodedValue(
|
|
1486
|
-
UpdateConfigMode.
|
|
1487
|
-
reserveConfig.
|
|
1486
|
+
UpdateConfigMode.UpdateDeleveragingThresholdSecsPerBps.discriminator,
|
|
1487
|
+
reserveConfig.deleveragingThresholdSecsPerBps.toNumber()
|
|
1488
1488
|
),
|
|
1489
1489
|
});
|
|
1490
|
-
} else if (!reserve.config.
|
|
1490
|
+
} else if (!reserve.config.deleveragingThresholdSecsPerBps.eq(reserveConfig.deleveragingThresholdSecsPerBps)) {
|
|
1491
1491
|
updateReserveIxnsArgs.push({
|
|
1492
|
-
mode: UpdateConfigMode.
|
|
1492
|
+
mode: UpdateConfigMode.UpdateDeleveragingThresholdSecsPerBps.discriminator,
|
|
1493
1493
|
value: updateReserveConfigEncodedValue(
|
|
1494
|
-
UpdateConfigMode.
|
|
1495
|
-
reserveConfig.
|
|
1494
|
+
UpdateConfigMode.UpdateDeleveragingThresholdSecsPerBps.discriminator,
|
|
1495
|
+
reserveConfig.deleveragingThresholdSecsPerBps.toNumber()
|
|
1496
1496
|
),
|
|
1497
1497
|
});
|
|
1498
1498
|
}
|
|
@@ -1654,17 +1654,17 @@ export function parseForChangesReserveConfigAndGetIxs(
|
|
|
1654
1654
|
} else if (key === 'deleveragingMarginCallPeriodSecs') {
|
|
1655
1655
|
if (reserve === undefined) {
|
|
1656
1656
|
updateReserveIxnsArgs.push({
|
|
1657
|
-
mode: UpdateConfigMode.
|
|
1657
|
+
mode: UpdateConfigMode.UpdateDeleveragingMarginCallPeriod.discriminator,
|
|
1658
1658
|
value: updateReserveConfigEncodedValue(
|
|
1659
|
-
UpdateConfigMode.
|
|
1659
|
+
UpdateConfigMode.UpdateDeleveragingMarginCallPeriod.discriminator,
|
|
1660
1660
|
reserveConfig.deleveragingMarginCallPeriodSecs.toNumber()
|
|
1661
1661
|
),
|
|
1662
1662
|
});
|
|
1663
1663
|
} else if (!reserve.config.deleveragingMarginCallPeriodSecs.eq(reserveConfig.deleveragingMarginCallPeriodSecs)) {
|
|
1664
1664
|
updateReserveIxnsArgs.push({
|
|
1665
|
-
mode: UpdateConfigMode.
|
|
1665
|
+
mode: UpdateConfigMode.UpdateDeleveragingMarginCallPeriod.discriminator,
|
|
1666
1666
|
value: updateReserveConfigEncodedValue(
|
|
1667
|
-
UpdateConfigMode.
|
|
1667
|
+
UpdateConfigMode.UpdateDeleveragingMarginCallPeriod.discriminator,
|
|
1668
1668
|
reserveConfig.deleveragingMarginCallPeriodSecs.toNumber()
|
|
1669
1669
|
),
|
|
1670
1670
|
});
|
|
@@ -1979,9 +1979,9 @@ export function updateReserveConfigEncodedValue(
|
|
|
1979
1979
|
case UpdateConfigMode.UpdateTokenInfoTwapMaxAge.discriminator:
|
|
1980
1980
|
case UpdateConfigMode.UpdateDebtWithdrawalCapCurrentTotal.discriminator:
|
|
1981
1981
|
case UpdateConfigMode.UpdateDepositWithdrawalCapCurrentTotal.discriminator:
|
|
1982
|
-
case UpdateConfigMode.
|
|
1982
|
+
case UpdateConfigMode.UpdateDeleveragingMarginCallPeriod.discriminator:
|
|
1983
1983
|
case UpdateConfigMode.UpdateBorrowFactor.discriminator:
|
|
1984
|
-
case UpdateConfigMode.
|
|
1984
|
+
case UpdateConfigMode.UpdateDeleveragingThresholdSecsPerBps.discriminator:
|
|
1985
1985
|
case UpdateConfigMode.UpdateBorrowLimitOutsideElevationGroup.discriminator:
|
|
1986
1986
|
value = value as number;
|
|
1987
1987
|
buffer = Buffer.alloc(8);
|
package/src/classes/shared.ts
CHANGED
|
@@ -35,8 +35,8 @@ export type ReserveDataType = {
|
|
|
35
35
|
liquidationThreshold: number;
|
|
36
36
|
reserveDepositLimit: Decimal;
|
|
37
37
|
reserveBorrowLimit: Decimal;
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
depositLimitCrossedTimestamp: number;
|
|
39
|
+
borrowLimitCrossedTimestamp: number;
|
|
40
40
|
symbol: string;
|
|
41
41
|
decimals: number;
|
|
42
42
|
protocolTakeRate: number;
|
package/src/classes/vault.ts
CHANGED
|
@@ -1349,16 +1349,14 @@ export class KaminoVaultClient {
|
|
|
1349
1349
|
* @param vaultsOverride - a list of vaults to get the tokens per share for; if provided with state it will not fetch the state again
|
|
1350
1350
|
* @param vaultReservesMap - optional parameter; a hashmap from pubkey to reserve state. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
1351
1351
|
* @param slot - current slot, used to estimate the interest earned in the different reserves with allocation from the vault
|
|
1352
|
-
* @param useOptimisedRPCCall - if set to true, it will use the optimized getProgramAccounts RPC call, which is more efficient but doesn't work in web environments
|
|
1353
1352
|
* @returns - token per share value
|
|
1354
1353
|
*/
|
|
1355
1354
|
async getTokensPerShareAllVaults(
|
|
1356
1355
|
slot: number,
|
|
1357
1356
|
vaultsOverride?: Array<KaminoVault>,
|
|
1358
|
-
vaultReservesMap?: PubkeyHashMap<PublicKey, KaminoReserve
|
|
1359
|
-
useOptimisedRPCCall: boolean = true
|
|
1357
|
+
vaultReservesMap?: PubkeyHashMap<PublicKey, KaminoReserve>
|
|
1360
1358
|
): Promise<PubkeyHashMap<PublicKey, Decimal>> {
|
|
1361
|
-
const vaults = vaultsOverride ? vaultsOverride : await this.getAllVaults(
|
|
1359
|
+
const vaults = vaultsOverride ? vaultsOverride : await this.getAllVaults();
|
|
1362
1360
|
const vaultTokensPerShare = new PubkeyHashMap<PublicKey, Decimal>();
|
|
1363
1361
|
for (const vault of vaults) {
|
|
1364
1362
|
const tokensPerShare = await this.getTokensPerShareSingleVault(vault, slot, vaultReservesMap);
|
|
@@ -1370,10 +1368,9 @@ export class KaminoVaultClient {
|
|
|
1370
1368
|
|
|
1371
1369
|
/**
|
|
1372
1370
|
* Get all vaults
|
|
1373
|
-
* @param useOptimisedRPCCall - if set to true, it will use the optimized getProgramAccounts RPC call, which is more efficient but doesn't work in web environments
|
|
1374
1371
|
* @returns an array of all vaults
|
|
1375
1372
|
*/
|
|
1376
|
-
async getAllVaults(
|
|
1373
|
+
async getAllVaults(): Promise<KaminoVault[]> {
|
|
1377
1374
|
const filters = [
|
|
1378
1375
|
{
|
|
1379
1376
|
dataSize: VaultState.layout.span + 8,
|
|
@@ -1386,16 +1383,15 @@ export class KaminoVaultClient {
|
|
|
1386
1383
|
},
|
|
1387
1384
|
];
|
|
1388
1385
|
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1386
|
+
const kaminoVaults: GetProgramAccountsResponse = await getProgramAccounts(
|
|
1387
|
+
this._connection,
|
|
1388
|
+
this._kaminoVaultProgramId,
|
|
1389
|
+
VaultState.layout.span + 8,
|
|
1390
|
+
{
|
|
1393
1391
|
commitment: this._connection.commitment ?? 'processed',
|
|
1394
1392
|
filters,
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
|
-
kaminoVaults = await this._connection.getProgramAccounts(this._kaminoVaultProgramId, { filters });
|
|
1398
|
-
}
|
|
1393
|
+
}
|
|
1394
|
+
);
|
|
1399
1395
|
|
|
1400
1396
|
return kaminoVaults.map((kaminoVault) => {
|
|
1401
1397
|
if (kaminoVault.account === null) {
|
|
@@ -922,7 +922,7 @@ async function main() {
|
|
|
922
922
|
const env = initializeClient(false, false);
|
|
923
923
|
const kaminoManager = new KaminoManager(env.connection, env.kLendProgramId, env.kVaultProgramId);
|
|
924
924
|
|
|
925
|
-
const allVaults = await kaminoManager.getAllVaults(
|
|
925
|
+
const allVaults = await kaminoManager.getAllVaults();
|
|
926
926
|
console.log('all vaults', allVaults);
|
|
927
927
|
});
|
|
928
928
|
|
|
@@ -1284,12 +1284,14 @@ function parseReserveConfigFromFile(farmConfigFromFile: any): ReserveConfig {
|
|
|
1284
1284
|
deleveragingMarginCallPeriodSecs: new BN(farmConfigFromFile.deleveragingMarginCallPeriodSecs),
|
|
1285
1285
|
borrowFactorPct: new BN(farmConfigFromFile.borrowFactorPct),
|
|
1286
1286
|
elevationGroups: farmConfigFromFile.elevationGroups,
|
|
1287
|
-
|
|
1287
|
+
deleveragingThresholdSecsPerBps: new BN(farmConfigFromFile.deleveragingThresholdSecsPerBps),
|
|
1288
1288
|
disableUsageAsCollOutsideEmode: farmConfigFromFile.disableUsageAsCollOutsideEmode,
|
|
1289
1289
|
utilizationLimitBlockBorrowingAbove: farmConfigFromFile.utilizationLimitBlockBorrowingAbove,
|
|
1290
1290
|
hostFixedInterestRateBps: farmConfigFromFile.hostFixedInterestRateBps,
|
|
1291
|
+
autodeleverageEnabled: farmConfigFromFile.autodeleverageEnabled,
|
|
1291
1292
|
borrowLimitOutsideElevationGroup: new BN(farmConfigFromFile.borrowLimitOutsideElevationGroup),
|
|
1292
1293
|
borrowLimitAgainstThisCollateralInElevationGroup: parseReserveBorrowLimitAgainstCollInEmode(farmConfigFromFile),
|
|
1294
|
+
deleveragingBonusIncreaseBpsPerDay: new BN(farmConfigFromFile.deleveragingBonusIncreaseBpsPerDay),
|
|
1293
1295
|
reserved1: Array(2).fill(0),
|
|
1294
1296
|
reserved2: Array(2).fill(0),
|
|
1295
1297
|
reserved3: Array(8).fill(0),
|
|
@@ -1402,13 +1404,15 @@ function parseReserveConfigToFile(reserveConfig: ReserveConfig) {
|
|
|
1402
1404
|
deleveragingMarginCallPeriodSecs: reserveConfig.deleveragingMarginCallPeriodSecs.toString(),
|
|
1403
1405
|
borrowFactorPct: reserveConfig.borrowFactorPct.toString(),
|
|
1404
1406
|
elevationGroups: reserveConfig.elevationGroups,
|
|
1405
|
-
|
|
1407
|
+
deleveragingThresholdSecsPerBps: reserveConfig.deleveragingThresholdSecsPerBps.toString(),
|
|
1406
1408
|
disableUsageAsCollOutsideEmode: reserveConfig.disableUsageAsCollOutsideEmode,
|
|
1407
1409
|
utilizationLimitBlockBorrowingAbove: reserveConfig.utilizationLimitBlockBorrowingAbove,
|
|
1408
1410
|
hostFixedInterestRateBps: reserveConfig.hostFixedInterestRateBps,
|
|
1411
|
+
autodeleverageEnabled: reserveConfig.autodeleverageEnabled,
|
|
1409
1412
|
borrowLimitOutsideElevationGroup: reserveConfig.borrowLimitOutsideElevationGroup.toString(),
|
|
1410
1413
|
borrowLimitAgainstThisCollateralInElevationGroup:
|
|
1411
1414
|
reserveConfig.borrowLimitAgainstThisCollateralInElevationGroup.map((entry) => entry.toString()),
|
|
1415
|
+
deleveragingBonusIncreaseBpsPerDay: reserveConfig.deleveragingBonusIncreaseBpsPerDay.toString(),
|
|
1412
1416
|
reserved1: Array(2).fill(0),
|
|
1413
1417
|
reserved2: Array(2).fill(0),
|
|
1414
1418
|
reserved3: Array(8).fill(0),
|
|
@@ -21,6 +21,13 @@ export interface LendingMarketFields {
|
|
|
21
21
|
/** Referral fee for the lending market, as bps out of the total protocol fee */
|
|
22
22
|
referralFeeBps: number
|
|
23
23
|
emergencyMode: number
|
|
24
|
+
/**
|
|
25
|
+
* Whether the obligations on this market should be subject to auto-deleveraging after deposit
|
|
26
|
+
* or borrow limit is crossed.
|
|
27
|
+
* Besides this flag, the particular reserve's flag also needs to be enabled (logical `AND`).
|
|
28
|
+
* **NOTE:** the manual "target LTV" deleveraging (enabled by the risk council for individual
|
|
29
|
+
* obligations) is NOT affected by this flag.
|
|
30
|
+
*/
|
|
24
31
|
autodeleverageEnabled: number
|
|
25
32
|
borrowDisabled: number
|
|
26
33
|
/**
|
|
@@ -50,9 +57,17 @@ export interface LendingMarketFields {
|
|
|
50
57
|
elevationGroupPadding: Array<BN>
|
|
51
58
|
/** Min net value accepted to be found in a position after any lending action in an obligation (scaled by quote currency decimals) */
|
|
52
59
|
minNetValueInObligationSf: BN
|
|
53
|
-
|
|
60
|
+
/** Minimum value to enforce smallest ltv priority checks on the collateral reserves on liquidation */
|
|
61
|
+
minValueSkipLiquidationLtvChecks: BN
|
|
54
62
|
/** Market name, zero-padded. */
|
|
55
63
|
name: Array<number>
|
|
64
|
+
/** Minimum value to enforce highest borrow factor priority checks on the debt reserves on liquidation */
|
|
65
|
+
minValueSkipLiquidationBfChecks: BN
|
|
66
|
+
/**
|
|
67
|
+
* Time (in seconds) that must pass before liquidation is allowed on an obligation that has
|
|
68
|
+
* been individually marked for auto-deleveraging (by the risk council).
|
|
69
|
+
*/
|
|
70
|
+
individualAutodeleverageMarginCallPeriodSecs: BN
|
|
56
71
|
padding1: Array<BN>
|
|
57
72
|
}
|
|
58
73
|
|
|
@@ -73,6 +88,13 @@ export interface LendingMarketJSON {
|
|
|
73
88
|
/** Referral fee for the lending market, as bps out of the total protocol fee */
|
|
74
89
|
referralFeeBps: number
|
|
75
90
|
emergencyMode: number
|
|
91
|
+
/**
|
|
92
|
+
* Whether the obligations on this market should be subject to auto-deleveraging after deposit
|
|
93
|
+
* or borrow limit is crossed.
|
|
94
|
+
* Besides this flag, the particular reserve's flag also needs to be enabled (logical `AND`).
|
|
95
|
+
* **NOTE:** the manual "target LTV" deleveraging (enabled by the risk council for individual
|
|
96
|
+
* obligations) is NOT affected by this flag.
|
|
97
|
+
*/
|
|
76
98
|
autodeleverageEnabled: number
|
|
77
99
|
borrowDisabled: number
|
|
78
100
|
/**
|
|
@@ -102,9 +124,17 @@ export interface LendingMarketJSON {
|
|
|
102
124
|
elevationGroupPadding: Array<string>
|
|
103
125
|
/** Min net value accepted to be found in a position after any lending action in an obligation (scaled by quote currency decimals) */
|
|
104
126
|
minNetValueInObligationSf: string
|
|
105
|
-
|
|
127
|
+
/** Minimum value to enforce smallest ltv priority checks on the collateral reserves on liquidation */
|
|
128
|
+
minValueSkipLiquidationLtvChecks: string
|
|
106
129
|
/** Market name, zero-padded. */
|
|
107
130
|
name: Array<number>
|
|
131
|
+
/** Minimum value to enforce highest borrow factor priority checks on the debt reserves on liquidation */
|
|
132
|
+
minValueSkipLiquidationBfChecks: string
|
|
133
|
+
/**
|
|
134
|
+
* Time (in seconds) that must pass before liquidation is allowed on an obligation that has
|
|
135
|
+
* been individually marked for auto-deleveraging (by the risk council).
|
|
136
|
+
*/
|
|
137
|
+
individualAutodeleverageMarginCallPeriodSecs: string
|
|
108
138
|
padding1: Array<string>
|
|
109
139
|
}
|
|
110
140
|
|
|
@@ -125,6 +155,13 @@ export class LendingMarket {
|
|
|
125
155
|
/** Referral fee for the lending market, as bps out of the total protocol fee */
|
|
126
156
|
readonly referralFeeBps: number
|
|
127
157
|
readonly emergencyMode: number
|
|
158
|
+
/**
|
|
159
|
+
* Whether the obligations on this market should be subject to auto-deleveraging after deposit
|
|
160
|
+
* or borrow limit is crossed.
|
|
161
|
+
* Besides this flag, the particular reserve's flag also needs to be enabled (logical `AND`).
|
|
162
|
+
* **NOTE:** the manual "target LTV" deleveraging (enabled by the risk council for individual
|
|
163
|
+
* obligations) is NOT affected by this flag.
|
|
164
|
+
*/
|
|
128
165
|
readonly autodeleverageEnabled: number
|
|
129
166
|
readonly borrowDisabled: number
|
|
130
167
|
/**
|
|
@@ -154,9 +191,17 @@ export class LendingMarket {
|
|
|
154
191
|
readonly elevationGroupPadding: Array<BN>
|
|
155
192
|
/** Min net value accepted to be found in a position after any lending action in an obligation (scaled by quote currency decimals) */
|
|
156
193
|
readonly minNetValueInObligationSf: BN
|
|
157
|
-
|
|
194
|
+
/** Minimum value to enforce smallest ltv priority checks on the collateral reserves on liquidation */
|
|
195
|
+
readonly minValueSkipLiquidationLtvChecks: BN
|
|
158
196
|
/** Market name, zero-padded. */
|
|
159
197
|
readonly name: Array<number>
|
|
198
|
+
/** Minimum value to enforce highest borrow factor priority checks on the debt reserves on liquidation */
|
|
199
|
+
readonly minValueSkipLiquidationBfChecks: BN
|
|
200
|
+
/**
|
|
201
|
+
* Time (in seconds) that must pass before liquidation is allowed on an obligation that has
|
|
202
|
+
* been individually marked for auto-deleveraging (by the risk council).
|
|
203
|
+
*/
|
|
204
|
+
readonly individualAutodeleverageMarginCallPeriodSecs: BN
|
|
160
205
|
readonly padding1: Array<BN>
|
|
161
206
|
|
|
162
207
|
static readonly discriminator = Buffer.from([
|
|
@@ -185,9 +230,11 @@ export class LendingMarket {
|
|
|
185
230
|
borsh.array(types.ElevationGroup.layout(), 32, "elevationGroups"),
|
|
186
231
|
borsh.array(borsh.u64(), 90, "elevationGroupPadding"),
|
|
187
232
|
borsh.u128("minNetValueInObligationSf"),
|
|
188
|
-
borsh.u64("
|
|
233
|
+
borsh.u64("minValueSkipLiquidationLtvChecks"),
|
|
189
234
|
borsh.array(borsh.u8(), 32, "name"),
|
|
190
|
-
borsh.
|
|
235
|
+
borsh.u64("minValueSkipLiquidationBfChecks"),
|
|
236
|
+
borsh.u64("individualAutodeleverageMarginCallPeriodSecs"),
|
|
237
|
+
borsh.array(borsh.u64(), 171, "padding1"),
|
|
191
238
|
])
|
|
192
239
|
|
|
193
240
|
constructor(fields: LendingMarketFields) {
|
|
@@ -217,9 +264,13 @@ export class LendingMarket {
|
|
|
217
264
|
)
|
|
218
265
|
this.elevationGroupPadding = fields.elevationGroupPadding
|
|
219
266
|
this.minNetValueInObligationSf = fields.minNetValueInObligationSf
|
|
220
|
-
this.
|
|
221
|
-
fields.
|
|
267
|
+
this.minValueSkipLiquidationLtvChecks =
|
|
268
|
+
fields.minValueSkipLiquidationLtvChecks
|
|
222
269
|
this.name = fields.name
|
|
270
|
+
this.minValueSkipLiquidationBfChecks =
|
|
271
|
+
fields.minValueSkipLiquidationBfChecks
|
|
272
|
+
this.individualAutodeleverageMarginCallPeriodSecs =
|
|
273
|
+
fields.individualAutodeleverageMarginCallPeriodSecs
|
|
223
274
|
this.padding1 = fields.padding1
|
|
224
275
|
}
|
|
225
276
|
|
|
@@ -293,9 +344,11 @@ export class LendingMarket {
|
|
|
293
344
|
),
|
|
294
345
|
elevationGroupPadding: dec.elevationGroupPadding,
|
|
295
346
|
minNetValueInObligationSf: dec.minNetValueInObligationSf,
|
|
296
|
-
|
|
297
|
-
dec.minValueSkipLiquidationLtvBfChecks,
|
|
347
|
+
minValueSkipLiquidationLtvChecks: dec.minValueSkipLiquidationLtvChecks,
|
|
298
348
|
name: dec.name,
|
|
349
|
+
minValueSkipLiquidationBfChecks: dec.minValueSkipLiquidationBfChecks,
|
|
350
|
+
individualAutodeleverageMarginCallPeriodSecs:
|
|
351
|
+
dec.individualAutodeleverageMarginCallPeriodSecs,
|
|
299
352
|
padding1: dec.padding1,
|
|
300
353
|
})
|
|
301
354
|
}
|
|
@@ -327,9 +380,13 @@ export class LendingMarket {
|
|
|
327
380
|
item.toString()
|
|
328
381
|
),
|
|
329
382
|
minNetValueInObligationSf: this.minNetValueInObligationSf.toString(),
|
|
330
|
-
|
|
331
|
-
this.
|
|
383
|
+
minValueSkipLiquidationLtvChecks:
|
|
384
|
+
this.minValueSkipLiquidationLtvChecks.toString(),
|
|
332
385
|
name: this.name,
|
|
386
|
+
minValueSkipLiquidationBfChecks:
|
|
387
|
+
this.minValueSkipLiquidationBfChecks.toString(),
|
|
388
|
+
individualAutodeleverageMarginCallPeriodSecs:
|
|
389
|
+
this.individualAutodeleverageMarginCallPeriodSecs.toString(),
|
|
333
390
|
padding1: this.padding1.map((item) => item.toString()),
|
|
334
391
|
}
|
|
335
392
|
}
|
|
@@ -365,10 +422,16 @@ export class LendingMarket {
|
|
|
365
422
|
(item) => new BN(item)
|
|
366
423
|
),
|
|
367
424
|
minNetValueInObligationSf: new BN(obj.minNetValueInObligationSf),
|
|
368
|
-
|
|
369
|
-
obj.
|
|
425
|
+
minValueSkipLiquidationLtvChecks: new BN(
|
|
426
|
+
obj.minValueSkipLiquidationLtvChecks
|
|
370
427
|
),
|
|
371
428
|
name: obj.name,
|
|
429
|
+
minValueSkipLiquidationBfChecks: new BN(
|
|
430
|
+
obj.minValueSkipLiquidationBfChecks
|
|
431
|
+
),
|
|
432
|
+
individualAutodeleverageMarginCallPeriodSecs: new BN(
|
|
433
|
+
obj.individualAutodeleverageMarginCallPeriodSecs
|
|
434
|
+
),
|
|
372
435
|
padding1: obj.padding1.map((item) => new BN(item)),
|
|
373
436
|
})
|
|
374
437
|
}
|
|
@@ -43,8 +43,18 @@ export interface ObligationFields {
|
|
|
43
43
|
referrer: PublicKey
|
|
44
44
|
/** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
|
|
45
45
|
borrowingDisabled: number
|
|
46
|
+
/**
|
|
47
|
+
* A target LTV set by the risk council when marking this obligation for deleveraging.
|
|
48
|
+
* Only effective when `deleveraging_margin_call_started_slot != 0`.
|
|
49
|
+
*/
|
|
50
|
+
autodeleverageTargetLtvPct: number
|
|
46
51
|
reserved: Array<number>
|
|
47
52
|
highestBorrowFactorPct: BN
|
|
53
|
+
/**
|
|
54
|
+
* A timestamp at which the risk council most-recently marked this obligation for deleveraging.
|
|
55
|
+
* Zero if not currently subject to deleveraging.
|
|
56
|
+
*/
|
|
57
|
+
autodeleverageMarginCallStartedTimestamp: BN
|
|
48
58
|
padding3: Array<BN>
|
|
49
59
|
}
|
|
50
60
|
|
|
@@ -87,8 +97,18 @@ export interface ObligationJSON {
|
|
|
87
97
|
referrer: string
|
|
88
98
|
/** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
|
|
89
99
|
borrowingDisabled: number
|
|
100
|
+
/**
|
|
101
|
+
* A target LTV set by the risk council when marking this obligation for deleveraging.
|
|
102
|
+
* Only effective when `deleveraging_margin_call_started_slot != 0`.
|
|
103
|
+
*/
|
|
104
|
+
autodeleverageTargetLtvPct: number
|
|
90
105
|
reserved: Array<number>
|
|
91
106
|
highestBorrowFactorPct: string
|
|
107
|
+
/**
|
|
108
|
+
* A timestamp at which the risk council most-recently marked this obligation for deleveraging.
|
|
109
|
+
* Zero if not currently subject to deleveraging.
|
|
110
|
+
*/
|
|
111
|
+
autodeleverageMarginCallStartedTimestamp: string
|
|
92
112
|
padding3: Array<string>
|
|
93
113
|
}
|
|
94
114
|
|
|
@@ -132,8 +152,18 @@ export class Obligation {
|
|
|
132
152
|
readonly referrer: PublicKey
|
|
133
153
|
/** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
|
|
134
154
|
readonly borrowingDisabled: number
|
|
155
|
+
/**
|
|
156
|
+
* A target LTV set by the risk council when marking this obligation for deleveraging.
|
|
157
|
+
* Only effective when `deleveraging_margin_call_started_slot != 0`.
|
|
158
|
+
*/
|
|
159
|
+
readonly autodeleverageTargetLtvPct: number
|
|
135
160
|
readonly reserved: Array<number>
|
|
136
161
|
readonly highestBorrowFactorPct: BN
|
|
162
|
+
/**
|
|
163
|
+
* A timestamp at which the risk council most-recently marked this obligation for deleveraging.
|
|
164
|
+
* Zero if not currently subject to deleveraging.
|
|
165
|
+
*/
|
|
166
|
+
readonly autodeleverageMarginCallStartedTimestamp: BN
|
|
137
167
|
readonly padding3: Array<BN>
|
|
138
168
|
|
|
139
169
|
static readonly discriminator = Buffer.from([
|
|
@@ -160,9 +190,11 @@ export class Obligation {
|
|
|
160
190
|
borsh.u8("hasDebt"),
|
|
161
191
|
borsh.publicKey("referrer"),
|
|
162
192
|
borsh.u8("borrowingDisabled"),
|
|
163
|
-
borsh.
|
|
193
|
+
borsh.u8("autodeleverageTargetLtvPct"),
|
|
194
|
+
borsh.array(borsh.u8(), 6, "reserved"),
|
|
164
195
|
borsh.u64("highestBorrowFactorPct"),
|
|
165
|
-
borsh.
|
|
196
|
+
borsh.u64("autodeleverageMarginCallStartedTimestamp"),
|
|
197
|
+
borsh.array(borsh.u64(), 125, "padding3"),
|
|
166
198
|
])
|
|
167
199
|
|
|
168
200
|
constructor(fields: ObligationFields) {
|
|
@@ -191,8 +223,11 @@ export class Obligation {
|
|
|
191
223
|
this.hasDebt = fields.hasDebt
|
|
192
224
|
this.referrer = fields.referrer
|
|
193
225
|
this.borrowingDisabled = fields.borrowingDisabled
|
|
226
|
+
this.autodeleverageTargetLtvPct = fields.autodeleverageTargetLtvPct
|
|
194
227
|
this.reserved = fields.reserved
|
|
195
228
|
this.highestBorrowFactorPct = fields.highestBorrowFactorPct
|
|
229
|
+
this.autodeleverageMarginCallStartedTimestamp =
|
|
230
|
+
fields.autodeleverageMarginCallStartedTimestamp
|
|
196
231
|
this.padding3 = fields.padding3
|
|
197
232
|
}
|
|
198
233
|
|
|
@@ -268,8 +303,11 @@ export class Obligation {
|
|
|
268
303
|
hasDebt: dec.hasDebt,
|
|
269
304
|
referrer: dec.referrer,
|
|
270
305
|
borrowingDisabled: dec.borrowingDisabled,
|
|
306
|
+
autodeleverageTargetLtvPct: dec.autodeleverageTargetLtvPct,
|
|
271
307
|
reserved: dec.reserved,
|
|
272
308
|
highestBorrowFactorPct: dec.highestBorrowFactorPct,
|
|
309
|
+
autodeleverageMarginCallStartedTimestamp:
|
|
310
|
+
dec.autodeleverageMarginCallStartedTimestamp,
|
|
273
311
|
padding3: dec.padding3,
|
|
274
312
|
})
|
|
275
313
|
}
|
|
@@ -297,8 +335,11 @@ export class Obligation {
|
|
|
297
335
|
hasDebt: this.hasDebt,
|
|
298
336
|
referrer: this.referrer.toString(),
|
|
299
337
|
borrowingDisabled: this.borrowingDisabled,
|
|
338
|
+
autodeleverageTargetLtvPct: this.autodeleverageTargetLtvPct,
|
|
300
339
|
reserved: this.reserved,
|
|
301
340
|
highestBorrowFactorPct: this.highestBorrowFactorPct.toString(),
|
|
341
|
+
autodeleverageMarginCallStartedTimestamp:
|
|
342
|
+
this.autodeleverageMarginCallStartedTimestamp.toString(),
|
|
302
343
|
padding3: this.padding3.map((item) => item.toString()),
|
|
303
344
|
}
|
|
304
345
|
}
|
|
@@ -332,8 +373,12 @@ export class Obligation {
|
|
|
332
373
|
hasDebt: obj.hasDebt,
|
|
333
374
|
referrer: new PublicKey(obj.referrer),
|
|
334
375
|
borrowingDisabled: obj.borrowingDisabled,
|
|
376
|
+
autodeleverageTargetLtvPct: obj.autodeleverageTargetLtvPct,
|
|
335
377
|
reserved: obj.reserved,
|
|
336
378
|
highestBorrowFactorPct: new BN(obj.highestBorrowFactorPct),
|
|
379
|
+
autodeleverageMarginCallStartedTimestamp: new BN(
|
|
380
|
+
obj.autodeleverageMarginCallStartedTimestamp
|
|
381
|
+
),
|
|
337
382
|
padding3: obj.padding3.map((item) => new BN(item)),
|
|
338
383
|
})
|
|
339
384
|
}
|
|
@@ -99,7 +99,7 @@ export class Reserve {
|
|
|
99
99
|
types.ReserveCollateral.layout("collateral"),
|
|
100
100
|
borsh.array(borsh.u64(), 150, "reserveCollateralPadding"),
|
|
101
101
|
types.ReserveConfig.layout("config"),
|
|
102
|
-
borsh.array(borsh.u64(),
|
|
102
|
+
borsh.array(borsh.u64(), 116, "configPadding"),
|
|
103
103
|
borsh.u64("borrowedAmountOutsideElevationGroup"),
|
|
104
104
|
borsh.array(
|
|
105
105
|
borsh.u64(),
|