@kamino-finance/klend-sdk 5.10.12 → 5.10.14

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.
Files changed (151) hide show
  1. package/README.md +32 -0
  2. package/dist/classes/action.d.ts.map +1 -1
  3. package/dist/classes/action.js +8 -6
  4. package/dist/classes/action.js.map +1 -1
  5. package/dist/classes/manager.d.ts +20 -17
  6. package/dist/classes/manager.d.ts.map +1 -1
  7. package/dist/classes/manager.js +28 -35
  8. package/dist/classes/manager.js.map +1 -1
  9. package/dist/classes/obligation.d.ts +1 -0
  10. package/dist/classes/obligation.d.ts.map +1 -1
  11. package/dist/classes/obligation.js +23 -1
  12. package/dist/classes/obligation.js.map +1 -1
  13. package/dist/classes/reserve.js +10 -10
  14. package/dist/classes/reserve.js.map +1 -1
  15. package/dist/classes/types_utils.d.ts +5 -2
  16. package/dist/classes/types_utils.d.ts.map +1 -1
  17. package/dist/classes/types_utils.js +31 -2
  18. package/dist/classes/types_utils.js.map +1 -1
  19. package/dist/classes/utils.d.ts +8 -0
  20. package/dist/classes/utils.d.ts.map +1 -1
  21. package/dist/classes/utils.js +48 -0
  22. package/dist/classes/utils.js.map +1 -1
  23. package/dist/classes/vault.d.ts +24 -19
  24. package/dist/classes/vault.d.ts.map +1 -1
  25. package/dist/classes/vault.js +80 -47
  26. package/dist/classes/vault.js.map +1 -1
  27. package/dist/client_kamino_manager.js +4 -4
  28. package/dist/client_kamino_manager.js.map +1 -1
  29. package/dist/idl.json +1137 -132
  30. package/dist/idl_codegen/accounts/LendingMarket.d.ts +6 -6
  31. package/dist/idl_codegen/accounts/LendingMarket.d.ts.map +1 -1
  32. package/dist/idl_codegen/accounts/LendingMarket.js +7 -7
  33. package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
  34. package/dist/idl_codegen/errors/custom.d.ts +15 -7
  35. package/dist/idl_codegen/errors/custom.d.ts.map +1 -1
  36. package/dist/idl_codegen/errors/custom.js +28 -14
  37. package/dist/idl_codegen/errors/custom.js.map +1 -1
  38. package/dist/idl_codegen/instructions/borrowObligationLiquidityV2.d.ts +29 -0
  39. package/dist/idl_codegen/instructions/borrowObligationLiquidityV2.d.ts.map +1 -0
  40. package/dist/idl_codegen/instructions/borrowObligationLiquidityV2.js +125 -0
  41. package/dist/idl_codegen/instructions/borrowObligationLiquidityV2.js.map +1 -0
  42. package/dist/idl_codegen/instructions/depositObligationCollateralV2.d.ts +26 -0
  43. package/dist/idl_codegen/instructions/depositObligationCollateralV2.d.ts.map +1 -0
  44. package/dist/idl_codegen/instructions/depositObligationCollateralV2.js +110 -0
  45. package/dist/idl_codegen/instructions/depositObligationCollateralV2.js.map +1 -0
  46. package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.d.ts +31 -0
  47. package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.d.ts.map +1 -0
  48. package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.js +135 -0
  49. package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.js.map +1 -0
  50. package/dist/idl_codegen/instructions/index.d.ts +18 -0
  51. package/dist/idl_codegen/instructions/index.d.ts.map +1 -1
  52. package/dist/idl_codegen/instructions/index.js +19 -1
  53. package/dist/idl_codegen/instructions/index.js.map +1 -1
  54. package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.d.ts +43 -0
  55. package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.d.ts.map +1 -0
  56. package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.js +181 -0
  57. package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.js.map +1 -0
  58. package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.d.ts +8 -6
  59. package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.d.ts.map +1 -1
  60. package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.js +23 -7
  61. package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.js.map +1 -1
  62. package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeemV2.d.ts +49 -0
  63. package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeemV2.d.ts.map +1 -0
  64. package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeemV2.js +205 -0
  65. package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeemV2.js.map +1 -0
  66. package/dist/idl_codegen/instructions/repayObligationLiquidityV2.d.ts +27 -0
  67. package/dist/idl_codegen/instructions/repayObligationLiquidityV2.d.ts.map +1 -0
  68. package/dist/idl_codegen/instructions/repayObligationLiquidityV2.js +111 -0
  69. package/dist/idl_codegen/instructions/repayObligationLiquidityV2.js.map +1 -0
  70. package/dist/idl_codegen/instructions/socializeLossV2.d.ts +23 -0
  71. package/dist/idl_codegen/instructions/socializeLossV2.d.ts.map +1 -0
  72. package/dist/idl_codegen/instructions/socializeLossV2.js +95 -0
  73. package/dist/idl_codegen/instructions/socializeLossV2.js.map +1 -0
  74. package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.d.ts +31 -0
  75. package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.d.ts.map +1 -0
  76. package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js +135 -0
  77. package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js.map +1 -0
  78. package/dist/idl_codegen/instructions/withdrawObligationCollateralV2.d.ts +26 -0
  79. package/dist/idl_codegen/instructions/withdrawObligationCollateralV2.d.ts.map +1 -0
  80. package/dist/idl_codegen/instructions/withdrawObligationCollateralV2.js +110 -0
  81. package/dist/idl_codegen/instructions/withdrawObligationCollateralV2.js.map +1 -0
  82. package/dist/idl_codegen/types/ReserveConfig.d.ts +8 -5
  83. package/dist/idl_codegen/types/ReserveConfig.d.ts.map +1 -1
  84. package/dist/idl_codegen/types/ReserveConfig.js +9 -8
  85. package/dist/idl_codegen/types/ReserveConfig.js.map +1 -1
  86. package/dist/idl_codegen/types/UpdateConfigMode.d.ts +7 -7
  87. package/dist/idl_codegen/types/UpdateConfigMode.d.ts.map +1 -1
  88. package/dist/idl_codegen/types/UpdateConfigMode.js +12 -12
  89. package/dist/idl_codegen/types/UpdateConfigMode.js.map +1 -1
  90. package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +7 -7
  91. package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts.map +1 -1
  92. package/dist/idl_codegen/types/UpdateLendingMarketMode.js +12 -12
  93. package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
  94. package/dist/idl_codegen/types/index.d.ts +4 -4
  95. package/dist/idl_codegen/types/index.d.ts.map +1 -1
  96. package/dist/idl_codegen_kamino_vault/programId.d.ts +2 -1
  97. package/dist/idl_codegen_kamino_vault/programId.d.ts.map +1 -1
  98. package/dist/idl_codegen_kamino_vault/programId.js +5 -1
  99. package/dist/idl_codegen_kamino_vault/programId.js.map +1 -1
  100. package/dist/lending_operations/swap_collateral_operations.js.map +1 -1
  101. package/dist/pyth/accounts/index.d.ts +1 -1
  102. package/dist/pyth/accounts/index.d.ts.map +1 -1
  103. package/dist/utils/ObligationType.d.ts +10 -4
  104. package/dist/utils/ObligationType.d.ts.map +1 -1
  105. package/dist/utils/ObligationType.js +36 -11
  106. package/dist/utils/ObligationType.js.map +1 -1
  107. package/dist/utils/accountListing.d.ts +3 -1
  108. package/dist/utils/accountListing.d.ts.map +1 -1
  109. package/dist/utils/accountListing.js +40 -0
  110. package/dist/utils/accountListing.js.map +1 -1
  111. package/dist/utils/constants.d.ts +1 -0
  112. package/dist/utils/constants.d.ts.map +1 -1
  113. package/dist/utils/constants.js +2 -1
  114. package/dist/utils/constants.js.map +1 -1
  115. package/dist/utils/managerTypes.js +1 -1
  116. package/dist/utils/managerTypes.js.map +1 -1
  117. package/package.json +1 -1
  118. package/src/classes/action.ts +8 -6
  119. package/src/classes/manager.ts +34 -38
  120. package/src/classes/obligation.ts +43 -3
  121. package/src/classes/reserve.ts +12 -12
  122. package/src/classes/types_utils.ts +33 -3
  123. package/src/classes/utils.ts +50 -1
  124. package/src/classes/vault.ts +104 -57
  125. package/src/client.ts +22 -0
  126. package/src/client_kamino_manager.ts +4 -4
  127. package/src/idl.json +1137 -132
  128. package/src/idl_codegen/accounts/LendingMarket.ts +11 -11
  129. package/src/idl_codegen/errors/custom.ts +26 -12
  130. package/src/idl_codegen/instructions/borrowObligationLiquidityV2.ts +124 -0
  131. package/src/idl_codegen/instructions/depositObligationCollateralV2.ts +106 -0
  132. package/src/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.ts +136 -0
  133. package/src/idl_codegen/instructions/index.ts +45 -0
  134. package/src/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.ts +195 -0
  135. package/src/idl_codegen/instructions/refreshObligationFarmsForReserve.ts +31 -13
  136. package/src/idl_codegen/instructions/repayAndWithdrawAndRedeemV2.ts +239 -0
  137. package/src/idl_codegen/instructions/repayObligationLiquidityV2.ts +108 -0
  138. package/src/idl_codegen/instructions/socializeLossV2.ts +88 -0
  139. package/src/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.ts +136 -0
  140. package/src/idl_codegen/instructions/withdrawObligationCollateralV2.ts +106 -0
  141. package/src/idl_codegen/types/ReserveConfig.ts +17 -14
  142. package/src/idl_codegen/types/UpdateConfigMode.ts +13 -13
  143. package/src/idl_codegen/types/UpdateLendingMarketMode.ts +13 -13
  144. package/src/idl_codegen/types/index.ts +4 -4
  145. package/src/idl_codegen_kamino_vault/programId.ts +5 -1
  146. package/src/lending_operations/swap_collateral_operations.ts +1 -1
  147. package/src/pyth/accounts/index.ts +1 -1
  148. package/src/utils/ObligationType.ts +41 -12
  149. package/src/utils/accountListing.ts +43 -1
  150. package/src/utils/constants.ts +2 -0
  151. package/src/utils/managerTypes.ts +1 -1
@@ -541,7 +541,7 @@ export class KaminoReserve {
541
541
 
542
542
  maxBorrowAmount = maxBorrowAmount.sub(borrowFee);
543
543
 
544
- const utilizationRatioLimit = this.state.config.utilizationLimitBlockBorrowingAbove / 100;
544
+ const utilizationRatioLimit = this.state.config.utilizationLimitBlockBorrowingAbovePct / 100;
545
545
  const currentUtilizationRatio = this.calculateUtilizationRatio();
546
546
 
547
547
  if (utilizationRatioLimit > 0 && currentUtilizationRatio > utilizationRatioLimit) {
@@ -988,7 +988,7 @@ export class KaminoReserve {
988
988
 
989
989
  getBorrowCapForReserve(market: KaminoMarket): BorrowCapsAndCounters {
990
990
  // Utilization cap
991
- const utilizationCap = this.state.config.utilizationLimitBlockBorrowingAbove;
991
+ const utilizationCap = this.state.config.utilizationLimitBlockBorrowingAbovePct;
992
992
  const utilizationCurrentValue = this.calculateUtilizationRatio();
993
993
 
994
994
  // Daily borrow cap
@@ -1215,7 +1215,7 @@ export function updateEntireReserveConfigIx(
1215
1215
  const args: UpdateReserveConfigArgs = {
1216
1216
  mode: new anchor.BN(25),
1217
1217
  value: value,
1218
- skipValidation: true,
1218
+ skipValidation: false,
1219
1219
  };
1220
1220
 
1221
1221
  const accounts: UpdateReserveConfigAccounts = {
@@ -1458,23 +1458,23 @@ export function parseForChangesReserveConfigAndGetIxs(
1458
1458
  ),
1459
1459
  });
1460
1460
  }
1461
- } else if (key === 'utilizationLimitBlockBorrowingAbove') {
1461
+ } else if (key === 'utilizationLimitBlockBorrowingAbovePct') {
1462
1462
  if (reserve === undefined) {
1463
1463
  updateReserveIxnsArgs.push({
1464
- mode: UpdateConfigMode.UpdateBlockBorrowingAboveUtilization.discriminator,
1464
+ mode: UpdateConfigMode.UpdateBlockBorrowingAboveUtilizationPct.discriminator,
1465
1465
  value: updateReserveConfigEncodedValue(
1466
- UpdateConfigMode.UpdateBlockBorrowingAboveUtilization.discriminator,
1467
- reserveConfig.utilizationLimitBlockBorrowingAbove
1466
+ UpdateConfigMode.UpdateBlockBorrowingAboveUtilizationPct.discriminator,
1467
+ reserveConfig.utilizationLimitBlockBorrowingAbovePct
1468
1468
  ),
1469
1469
  });
1470
1470
  } else if (
1471
- reserve.config.utilizationLimitBlockBorrowingAbove !== reserveConfig.utilizationLimitBlockBorrowingAbove
1471
+ reserve.config.utilizationLimitBlockBorrowingAbovePct !== reserveConfig.utilizationLimitBlockBorrowingAbovePct
1472
1472
  ) {
1473
1473
  updateReserveIxnsArgs.push({
1474
- mode: UpdateConfigMode.UpdateBlockBorrowingAboveUtilization.discriminator,
1474
+ mode: UpdateConfigMode.UpdateBlockBorrowingAboveUtilizationPct.discriminator,
1475
1475
  value: updateReserveConfigEncodedValue(
1476
- UpdateConfigMode.UpdateBlockBorrowingAboveUtilization.discriminator,
1477
- reserveConfig.utilizationLimitBlockBorrowingAbove
1476
+ UpdateConfigMode.UpdateBlockBorrowingAboveUtilizationPct.discriminator,
1477
+ reserveConfig.utilizationLimitBlockBorrowingAbovePct
1478
1478
  ),
1479
1479
  });
1480
1480
  }
@@ -1958,7 +1958,7 @@ export function updateReserveConfigEncodedValue(
1958
1958
  case UpdateConfigMode.UpdateAssetTier.discriminator:
1959
1959
  case UpdateConfigMode.UpdateReserveStatus.discriminator:
1960
1960
  case UpdateConfigMode.UpdateDisableUsageAsCollateralOutsideEmode.discriminator:
1961
- case UpdateConfigMode.UpdateBlockBorrowingAboveUtilization.discriminator:
1961
+ case UpdateConfigMode.UpdateBlockBorrowingAboveUtilizationPct.discriminator:
1962
1962
  case UpdateConfigMode.UpdateBlockPriceUsage.discriminator:
1963
1963
  buffer = Buffer.alloc(1);
1964
1964
  buffer.writeUIntLE(value as number, 0, 1);
@@ -1,12 +1,13 @@
1
1
  import { pubkeyHashMapToJson } from './utils';
2
- import { VaultHoldings } from './vault';
2
+ import { VaultHoldings, VaultHoldingsWithUSDValue, VaultOverview } from './vault';
3
3
 
4
4
  export function holdingsToJson(holdings: VaultHoldings) {
5
5
  return {
6
6
  available: holdings.available.toString(),
7
7
  invested: holdings.invested.toString(),
8
- total: holdings.total.toString(),
8
+ totalAUMIncludingFees: holdings.totalAUMIncludingFees.toString(),
9
9
  investedInReserves: pubkeyHashMapToJson(holdings.investedInReserves),
10
+ pendingFees: holdings.pendingFees.toString(),
10
11
  };
11
12
  }
12
13
 
@@ -14,6 +15,35 @@ export function printHoldings(holdings: VaultHoldings) {
14
15
  console.log('Holdings:');
15
16
  console.log(' Available:', holdings.available.toString());
16
17
  console.log(' Invested:', holdings.invested.toString());
17
- console.log(' Total:', holdings.total.toString());
18
+ console.log(' Total AUM including fees:', holdings.totalAUMIncludingFees.toString());
19
+ console.log(' Pending fees:', holdings.pendingFees.toString());
18
20
  console.log(' Invested in reserves:', pubkeyHashMapToJson(holdings.investedInReserves));
19
21
  }
22
+
23
+ export function printHoldingsWithUSDValue(holdings: VaultHoldingsWithUSDValue) {
24
+ console.log('Holdings with USD value:');
25
+ console.log(' Available:', holdings.availableUSD.toString());
26
+ console.log(' Invested:', holdings.investedUSD.toString());
27
+ console.log(' Total including pending fees:', holdings.totalUSDIncludingFees.toString());
28
+ console.log(' Pending fees:', holdings.pendingFeesUSD.toString());
29
+ console.log(' Invested in reserves:', pubkeyHashMapToJson(holdings.investedInReservesUSD));
30
+ }
31
+
32
+ export function printVaultOverview(vaultOverview: VaultOverview) {
33
+ console.log('Vault overview:');
34
+ printHoldingsWithUSDValue(vaultOverview.holdingsUSD);
35
+ console.log(' Theoretical Supply APY:', vaultOverview.theoreticalSupplyAPY.toString());
36
+ console.log(' Utilization ratio:', vaultOverview.utilizationRatio.toString());
37
+ console.log(' Total supplied:', vaultOverview.totalSupplied.toString());
38
+ console.log(' Borrowed amount:', vaultOverview.totalBorrowed.toString());
39
+
40
+ vaultOverview.reservesOverview.forEach((reserveOverview, pubkey) => {
41
+ console.log(' Reserve:', pubkey.toString());
42
+ console.log(' Total borrowed from reserve:', reserveOverview.totalBorrowedAmount.toString());
43
+ console.log(' Supplied:', reserveOverview.suppliedAmount.toString());
44
+ console.log(' Utilization ratio:', reserveOverview.utilizationRatio.toString());
45
+ console.log(' Liquidation Threshold Pct:', reserveOverview.liquidationThresholdPct.toString());
46
+ console.log(' Supply APY:', reserveOverview.supplyAPY.toString());
47
+ console.log(' Lending market:', reserveOverview.market.toString());
48
+ });
49
+ }
@@ -1,8 +1,9 @@
1
1
  import { PubkeyHashMap, SLOTS_PER_SECOND, SLOTS_PER_YEAR } from '../utils';
2
2
  import Decimal from 'decimal.js';
3
3
  import { AccountInfo, PublicKey } from '@solana/web3.js';
4
- import { SOL_MINTS } from '../lib';
4
+ import { MarketOverview, ReserveOverview, SOL_MINTS } from '../lib';
5
5
  import { AccountLayout } from '@solana/spl-token';
6
+ import { ReserveAllocationOverview } from './types';
6
7
 
7
8
  type ObligationFarmScoreType = {
8
9
  obligationId: string;
@@ -271,3 +272,51 @@ export function pubkeyHashMapToJson(map: PubkeyHashMap<PublicKey, any>): { [key:
271
272
  export function printPubkeyHashMap<V>(map: PubkeyHashMap<PublicKey, V>) {
272
273
  console.log(pubkeyHashMapToJson(map));
273
274
  }
275
+
276
+ export function printReservesOverviewMap(map: PubkeyHashMap<PublicKey, ReserveOverview>) {
277
+ map.forEach((value, key) => {
278
+ console.log('Reserve:', key.toString());
279
+ printReserveOverview(value);
280
+ });
281
+ }
282
+
283
+ export function printReserveOverview(reserveOverview: ReserveOverview) {
284
+ console.log('Total borrowed from reserve:', reserveOverview.totalBorrowedAmount.toString());
285
+ console.log('Borrowed from the supplied amount:', reserveOverview.amountBorrowedFromSupplied.toString());
286
+ console.log('Supplied:', reserveOverview.suppliedAmount.toString());
287
+ console.log('Utilization ratio:', reserveOverview.utilizationRatio.toString());
288
+ console.log('Liquidation Threshold Pct:', reserveOverview.liquidationThresholdPct.toString());
289
+ console.log('Supply APY:', reserveOverview.supplyAPY.toString());
290
+ console.log('Lending market:', reserveOverview.market.toString());
291
+ }
292
+
293
+ export function printMarketsOverviewMap(map: PubkeyHashMap<PublicKey, MarketOverview>) {
294
+ map.forEach((value, key) => {
295
+ console.log('Reserve:', key.toString());
296
+ printMarketOverview(value);
297
+ });
298
+ }
299
+
300
+ export function printMarketOverview(marketOverview: MarketOverview) {
301
+ console.log('Market overview:');
302
+ console.log(' Address:', marketOverview.address.toString());
303
+ console.log(' Min LTV percentage:', marketOverview.minLTVPct.toString());
304
+ console.log(' Max LTV percentage:', marketOverview.maxLTVPct.toString());
305
+ marketOverview.reservesAsCollateral.forEach((reserve, _) => {
306
+ console.log(' Liquidation LTV percentage:', reserve.liquidationLTVPct.toString());
307
+ });
308
+ }
309
+
310
+ export function printReservesAllocationOverviewMap(map: PubkeyHashMap<PublicKey, ReserveAllocationOverview>) {
311
+ map.forEach((value, key) => {
312
+ console.log('Reserve:', key.toString());
313
+ printReserveAllocationOverview(value);
314
+ });
315
+ }
316
+
317
+ export function printReserveAllocationOverview(reserveAllocationOverview: ReserveAllocationOverview) {
318
+ console.log('Reserve allocation overview:');
319
+ console.log(' Target weight:', reserveAllocationOverview.targetWeight.toString());
320
+ console.log(' Token allocation cap:', reserveAllocationOverview.tokenAllocationCap.toString());
321
+ console.log(' Ctoken allocation:', reserveAllocationOverview.ctokenAllocation.toString());
322
+ }
@@ -79,7 +79,7 @@ import {
79
79
  UserSharesForVault,
80
80
  WithdrawIxs,
81
81
  } from './types';
82
- import { collToLamportsDecimal } from '@kamino-finance/kliquidity-sdk';
82
+ import { collToLamportsDecimal, ZERO } from '@kamino-finance/kliquidity-sdk';
83
83
  import { FullBPSDecimal } from '@kamino-finance/kliquidity-sdk/dist/utils/CreationParameters';
84
84
  import { FarmState } from '@kamino-finance/farms-sdk/dist';
85
85
  import { getAccountsInLUT, initLookupTableIx } from './lut_utils';
@@ -338,7 +338,7 @@ export class KaminoVaultClient {
338
338
  * @param vault the vault to update
339
339
  * @param mode the field to update (based on VaultConfigFieldKind enum)
340
340
  * @param value the value to update the field with
341
- * @param [signer] the signer of the transaction. Optional. If not provided the admin of the vault will be used. It should be used when changing the admin of the vault if we want to batch multiple ixs in the same tx
341
+ * @param [signer] the signer of the transaction. Optional. If not provided the admin of the vault will be used. It should be used when changing the admin of the vault if we want to build or batch multiple ixs in the same tx
342
342
  * @returns a struct that contains the instruction to update the field and an optional list of instructions to update the lookup table
343
343
  */
344
344
  async updateVaultConfigIxs(
@@ -404,7 +404,7 @@ export class KaminoVaultClient {
404
404
  updateVaultConfigIx.keys = updateVaultConfigIx.keys.concat(vaultReservesAccountMetas);
405
405
  updateVaultConfigIx.keys = updateVaultConfigIx.keys.concat(vaultReservesLendingMarkets);
406
406
 
407
- const updateLUTIxs = [];
407
+ const updateLUTIxs: TransactionInstruction[] = [];
408
408
 
409
409
  if (mode.kind === new VaultConfigField.PendingVaultAdmin().kind) {
410
410
  const newPubkey = new PublicKey(value);
@@ -450,7 +450,7 @@ export class KaminoVaultClient {
450
450
  * @param farm - the farm where the vault shares can be staked
451
451
  * @param [errorOnOverride] - if true, the function will throw an error if the vault already has a farm. If false, it will override the farm
452
452
  */
453
- async setVaultFarm(
453
+ async setVaultFarmIxs(
454
454
  vault: KaminoVault,
455
455
  farm: PublicKey,
456
456
  errorOnOverride: boolean = true
@@ -529,7 +529,7 @@ export class KaminoVaultClient {
529
529
  (account) => !account.equals(vaultState.adminAuthority)
530
530
  );
531
531
 
532
- const LUTIxs = [];
532
+ const LUTIxs: TransactionInstruction[] = [];
533
533
  const [initNewLUTIx, newLUT] = initLookupTableIx(vaultState.pendingAdmin, await this.getConnection().getSlot());
534
534
 
535
535
  const insertIntoLUTIxs = await this.insertIntoLookupTableIxs(
@@ -648,7 +648,7 @@ export class KaminoVaultClient {
648
648
  const reserveState = reserveStates[index]!;
649
649
  const marketAddress = reserveState.lendingMarket;
650
650
 
651
- return this.withdrawPendingFeesIxn(
651
+ return this.withdrawPendingFeesIx(
652
652
  vault,
653
653
  vaultState,
654
654
  marketAddress,
@@ -884,7 +884,7 @@ export class KaminoVaultClient {
884
884
  ]);
885
885
 
886
886
  const shareLamportsToWithdraw = collToLamportsDecimal(shareAmount, vaultState.sharesMintDecimals.toNumber());
887
- const withdrawFromAvailableIxn = await this.withdrawFromAvailableIxn(
887
+ const withdrawFromAvailableIxn = await this.withdrawFromAvailableIx(
888
888
  user,
889
889
  kaminoVault,
890
890
  vaultState,
@@ -980,7 +980,7 @@ export class KaminoVaultClient {
980
980
  sharesToWithdraw = reserveWithTokens.shares;
981
981
  }
982
982
 
983
- const withdrawFromReserveIx = this.withdrawIxn(
983
+ const withdrawFromReserveIx = this.withdrawIx(
984
984
  user,
985
985
  vault,
986
986
  vaultState,
@@ -1005,7 +1005,7 @@ export class KaminoVaultClient {
1005
1005
  */
1006
1006
  async investAllReservesIxs(payer: PublicKey, vault: KaminoVault): Promise<TransactionInstruction[]> {
1007
1007
  const vaultState = await vault.getState(this.getConnection());
1008
- const allReserves = this.getAllVaultReserves(vaultState);
1008
+ const allReserves = this.getVaultReserves(vaultState);
1009
1009
  if (allReserves.length === 0) {
1010
1010
  throw new Error('No reserves found for the vault, please select at least one reserve for the vault');
1011
1011
  }
@@ -1178,7 +1178,7 @@ export class KaminoVaultClient {
1178
1178
  return decodeVaultName(token);
1179
1179
  }
1180
1180
 
1181
- private withdrawIxn(
1181
+ private withdrawIx(
1182
1182
  user: PublicKey,
1183
1183
  vault: KaminoVault,
1184
1184
  vaultState: VaultState,
@@ -1248,7 +1248,7 @@ export class KaminoVaultClient {
1248
1248
  return withdrawIxn;
1249
1249
  }
1250
1250
 
1251
- private async withdrawFromAvailableIxn(
1251
+ private async withdrawFromAvailableIx(
1252
1252
  user: PublicKey,
1253
1253
  vault: KaminoVault,
1254
1254
  vaultState: VaultState,
@@ -1277,7 +1277,7 @@ export class KaminoVaultClient {
1277
1277
  return withdrawFromAvailable(withdrawFromAvailableArgs, withdrawFromAvailableAccounts, this._kaminoVaultProgramId);
1278
1278
  }
1279
1279
 
1280
- private async withdrawPendingFeesIxn(
1280
+ private async withdrawPendingFeesIx(
1281
1281
  vault: KaminoVault,
1282
1282
  vaultState: VaultState,
1283
1283
  marketAddress: PublicKey,
@@ -1488,7 +1488,7 @@ export class KaminoVaultClient {
1488
1488
  const holdings = await this.getVaultHoldings(vaultState);
1489
1489
  const initialVaultAllocations = this.getVaultAllocations(vaultState);
1490
1490
 
1491
- const allReserves = this.getAllVaultReserves(vaultState);
1491
+ const allReserves = this.getVaultReserves(vaultState);
1492
1492
 
1493
1493
  let totalAllocation = new Decimal(0);
1494
1494
  initialVaultAllocations.forEach((allocation) => {
@@ -1496,7 +1496,7 @@ export class KaminoVaultClient {
1496
1496
  });
1497
1497
  const expectedHoldingsDistribution = new PubkeyHashMap<PublicKey, Decimal>();
1498
1498
 
1499
- let totalLeftToInvest = holdings.total;
1499
+ let totalLeftToInvest = holdings.totalAUMIncludingFees.sub(holdings.pendingFees);
1500
1500
  let currentAllocationSum = totalAllocation;
1501
1501
  const ZERO = new Decimal(0);
1502
1502
  while (totalLeftToInvest.gt(ZERO)) {
@@ -1671,8 +1671,9 @@ export class KaminoVaultClient {
1671
1671
  );
1672
1672
 
1673
1673
  const holdings = await this.getVaultHoldings(vaultState, slot, vaultReservesState);
1674
+ const netAUM = holdings.totalAUMIncludingFees.sub(holdings.pendingFees);
1674
1675
 
1675
- return holdings.total.div(sharesDecimal);
1676
+ return netAUM.div(sharesDecimal);
1676
1677
  }
1677
1678
 
1678
1679
  /**
@@ -1746,14 +1747,16 @@ export class KaminoVaultClient {
1746
1747
  * @returns vault amount supplied in reserve in decimal
1747
1748
  */
1748
1749
  getSuppliedInReserve(vaultState: VaultState, slot: number, reserve: KaminoReserve): Decimal {
1749
- const reserveCollExchangeRate = reserve.getEstimatedCollateralExchangeRate(
1750
- slot,
1751
- new Fraction(reserve.state.liquidity.absoluteReferralRateSf)
1750
+ let referralFeeBps = 0;
1751
+ const denominator = reserve.state.config.protocolTakeRatePct / 100;
1752
+ if (denominator > 0) {
1753
+ referralFeeBps = new Fraction(reserve.state.liquidity.absoluteReferralRateSf)
1752
1754
  .toDecimal()
1753
- .div(reserve.state.config.protocolTakeRatePct / 100)
1755
+ .div(denominator)
1754
1756
  .floor()
1755
- .toNumber()
1756
- );
1757
+ .toNumber();
1758
+ }
1759
+ const reserveCollExchangeRate = reserve.getEstimatedCollateralExchangeRate(slot, referralFeeBps);
1757
1760
 
1758
1761
  const reserveAllocation = vaultState.vaultAllocationStrategy.find((allocation) =>
1759
1762
  allocation.reserve.equals(reserve.address)
@@ -1868,19 +1871,6 @@ export class KaminoVaultClient {
1868
1871
  return reserveAllocationAvailableLiquidityToWithdraw;
1869
1872
  }
1870
1873
 
1871
- /**
1872
- * This will get the list of all reserve pubkeys that the vault has allocations for
1873
- * @param vault - the vault state to load reserves for
1874
- * @returns a hashmap from each reserve pubkey to the reserve state
1875
- */
1876
- getAllVaultReserves(vault: VaultState): PublicKey[] {
1877
- return vault.vaultAllocationStrategy
1878
- .map((vaultAllocation) => vaultAllocation.reserve)
1879
- .filter((reserve) => {
1880
- return !reserve.equals(PublicKey.default);
1881
- });
1882
- }
1883
-
1884
1874
  /**
1885
1875
  * This will get the list of all reserve pubkeys that the vault has allocations for ex
1886
1876
  * @param vault - the vault state to load reserves for
@@ -2012,20 +2002,24 @@ export class KaminoVaultClient {
2012
2002
  * @param vault - the kamino vault to get available liquidity to withdraw for
2013
2003
  * @param [slot] - the slot for which to calculate the holdings. Optional. If not provided the function will fetch the current slot
2014
2004
  * @param [vaultReserves] - a hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
2005
+ * @param [currentSlot] - the latest confirmed slot. Optional. If provided the function will be faster as it will not have to fetch the latest slot
2015
2006
  * @returns an VaultHoldings object representing the amount available (uninvested) in vault, total amount invested in reseves and a breakdown of the amount invested in each reserve
2016
2007
  */
2017
2008
  async getVaultHoldings(
2018
2009
  vault: VaultState,
2019
2010
  slot?: number,
2020
- vaultReserves?: PubkeyHashMap<PublicKey, KaminoReserve>
2011
+ vaultReserves?: PubkeyHashMap<PublicKey, KaminoReserve>,
2012
+ currentSlot?: number
2021
2013
  ): Promise<VaultHoldings> {
2022
2014
  const vaultHoldings: VaultHoldings = {
2023
2015
  available: new Decimal(vault.tokenAvailable.toString()),
2024
2016
  invested: new Decimal(0),
2025
2017
  investedInReserves: new PubkeyHashMap<PublicKey, Decimal>(),
2026
- total: new Decimal(0),
2018
+ totalAUMIncludingFees: new Decimal(0),
2019
+ pendingFees: new Decimal(0),
2027
2020
  };
2028
2021
 
2022
+ const currentSlotToUse = currentSlot ? currentSlot : await this.getConnection().getSlot('confirmed');
2029
2023
  const vaultReservesState = vaultReserves ? vaultReserves : await this.loadVaultReserves(vault);
2030
2024
  const decimals = new Decimal(vault.tokenMintDecimals.toString());
2031
2025
 
@@ -2040,6 +2034,7 @@ export class KaminoVaultClient {
2040
2034
  }
2041
2035
 
2042
2036
  let reserveCollExchangeRate: Decimal;
2037
+
2043
2038
  if (slot) {
2044
2039
  reserveCollExchangeRate = reserve.getEstimatedCollateralExchangeRate(slot, 0);
2045
2040
  } else {
@@ -2056,13 +2051,42 @@ export class KaminoVaultClient {
2056
2051
  );
2057
2052
  });
2058
2053
 
2054
+ const currentPendingFees = new Fraction(vault.pendingFeesSf).toDecimal();
2055
+ let totalPendingFees = currentPendingFees;
2056
+
2057
+ // if there is a slot passed and it is in the future we need to estimate the fees from current time until that moment
2058
+ if (slot && slot > currentSlotToUse) {
2059
+ const currentTimestampSec = new Date().getTime() / 1000;
2060
+ const timeAtPassedSlot = currentTimestampSec + (slot - currentSlotToUse) * this.recentSlotDurationMs;
2061
+ const timeUntilPassedSlot = timeAtPassedSlot - currentTimestampSec;
2062
+
2063
+ const managementFeeFactor = new Decimal(timeUntilPassedSlot)
2064
+ .mul(new Decimal(vault.managementFeeBps.toString()))
2065
+ .div(new Decimal(SECONDS_PER_YEAR))
2066
+ .div(FullBPSDecimal);
2067
+ const prevAUM = lamportsToDecimal(new Fraction(vault.prevAumSf).toDecimal(), vault.tokenMintDecimals.toNumber());
2068
+ const simulatedMgmtFee = prevAUM.mul(managementFeeFactor);
2069
+ totalPendingFees = totalPendingFees.add(simulatedMgmtFee);
2070
+
2071
+ const simulatedEarnedInterest = vaultHoldings.invested
2072
+ .add(vaultHoldings.available)
2073
+ .sub(prevAUM)
2074
+ .sub(simulatedMgmtFee);
2075
+ const simulatedPerformanceFee = simulatedEarnedInterest
2076
+ .mul(new Decimal(vault.performanceFeeBps.toString()))
2077
+ .div(FullBPSDecimal);
2078
+ totalPendingFees = totalPendingFees.add(simulatedPerformanceFee);
2079
+ }
2080
+
2059
2081
  const totalAvailableDecimal = lamportsToDecimal(vaultHoldings.available, decimals);
2060
2082
  const totalInvestedDecimal = lamportsToDecimal(vaultHoldings.invested, decimals);
2083
+ const pendingFees = lamportsToDecimal(totalPendingFees, decimals);
2061
2084
  return {
2062
2085
  available: totalAvailableDecimal,
2063
2086
  invested: totalInvestedDecimal,
2064
2087
  investedInReserves: vaultHoldings.investedInReserves,
2065
- total: totalAvailableDecimal.add(totalInvestedDecimal),
2088
+ totalAUMIncludingFees: totalAvailableDecimal.add(totalInvestedDecimal),
2089
+ pendingFees: pendingFees,
2066
2090
  };
2067
2091
  }
2068
2092
 
@@ -2092,7 +2116,8 @@ export class KaminoVaultClient {
2092
2116
  availableUSD: holdings.available.mul(price),
2093
2117
  investedUSD: holdings.invested.mul(price),
2094
2118
  investedInReservesUSD: investedInReservesUSD,
2095
- totalUSD: holdings.total.mul(price),
2119
+ totalUSDIncludingFees: holdings.totalAUMIncludingFees.mul(price),
2120
+ pendingFeesUSD: holdings.pendingFees.mul(price),
2096
2121
  };
2097
2122
  }
2098
2123
 
@@ -2212,6 +2237,7 @@ export class KaminoVaultClient {
2212
2237
  if (!totalInvested.isZero()) {
2213
2238
  utilizationRatio = totalBorrowed.div(totalInvested.add(totalAvailable));
2214
2239
  }
2240
+
2215
2241
  return {
2216
2242
  totalInvested: totalInvested,
2217
2243
  totalBorrowed: totalBorrowed,
@@ -2245,11 +2271,13 @@ export class KaminoVaultClient {
2245
2271
  }
2246
2272
 
2247
2273
  const suppliedInReserve = this.getSuppliedInReserve(vault, slot, reserve);
2274
+ const utilizationRatio = new Decimal(reserve.getEstimatedUtilizationRatio(slot, 0));
2248
2275
  const reserveOverview: ReserveOverview = {
2249
2276
  supplyAPY: new Decimal(reserve.totalSupplyAPY(slot)),
2250
- utilizationRatio: new Decimal(reserve.getEstimatedUtilizationRatio(slot, 0)),
2277
+ utilizationRatio: utilizationRatio,
2251
2278
  liquidationThresholdPct: new Decimal(reserve.state.config.liquidationThresholdPct),
2252
- borrowedAmount: reserve.getBorrowedAmount(),
2279
+ totalBorrowedAmount: reserve.getBorrowedAmount(),
2280
+ amountBorrowedFromSupplied: suppliedInReserve.mul(utilizationRatio),
2253
2281
  market: reserve.state.lendingMarket,
2254
2282
  suppliedAmount: suppliedInReserve,
2255
2283
  };
@@ -2294,17 +2322,26 @@ export class KaminoVaultClient {
2294
2322
  if (totalWeights.isZero()) {
2295
2323
  return new Decimal(0);
2296
2324
  }
2297
- return totalAPY.div(totalWeights);
2325
+
2326
+ const grossAPY = totalAPY.div(totalWeights);
2327
+ const netAPY = grossAPY
2328
+ .mul(new Decimal(1).sub(new Decimal(vault.performanceFeeBps.toString()).div(FullBPSDecimal)))
2329
+ .mul(new Decimal(1).sub(new Decimal(vault.managementFeeBps.toString()).div(FullBPSDecimal)));
2330
+ return netAPY;
2298
2331
  }
2299
2332
 
2300
2333
  /**
2301
- * Retrive the total amount of interest earned by the vault since its inception, including what was charged as fees
2334
+ * Retrive the total amount of interest earned by the vault since its inception, up to the last interaction with the vault on chain, including what was charged as fees
2302
2335
  * @param vaultState the kamino vault state to get total net yield for
2303
- * @returns a Decimal representing the net number of tokens earned by the vault since its inception
2336
+ * @returns a struct containing a Decimal representing the net number of tokens earned by the vault since its inception and the timestamp of the last fee charge
2304
2337
  */
2305
- async getVaultCumulativeInterest(vaultState: VaultState): Promise<Decimal> {
2338
+ async getVaultCumulativeInterest(vaultState: VaultState): Promise<VaultCumulativeInterestWithTimestamp> {
2306
2339
  const netYieldLamports = new Fraction(vaultState.cumulativeEarnedInterestSf).toDecimal();
2307
- return lamportsToDecimal(netYieldLamports, vaultState.tokenMintDecimals.toString());
2340
+ const cumulativeInterest = lamportsToDecimal(netYieldLamports, vaultState.tokenMintDecimals.toString());
2341
+ return {
2342
+ cumulativeInterest: cumulativeInterest,
2343
+ timestamp: vaultState.lastFeeChargeTimestamp.toNumber(),
2344
+ };
2308
2345
  }
2309
2346
 
2310
2347
  /**
@@ -2319,24 +2356,23 @@ export class KaminoVaultClient {
2319
2356
  vaultState: VaultState,
2320
2357
  vaultReservesMap?: PubkeyHashMap<PublicKey, KaminoReserve>,
2321
2358
  currentSlot?: number,
2322
- previousTotalAUM?: Decimal
2359
+ previousNetAUM?: Decimal
2323
2360
  ): Promise<SimulatedVaultHoldingsWithEarnedInterest> {
2324
2361
  let prevAUM: Decimal;
2362
+ let pendingFees = ZERO;
2325
2363
 
2326
- if (previousTotalAUM) {
2327
- prevAUM = previousTotalAUM;
2364
+ if (previousNetAUM) {
2365
+ prevAUM = previousNetAUM;
2328
2366
  } else {
2329
- const latestUpdateTs = vaultState.lastFeeChargeTimestamp.toNumber();
2330
- const lastUpdateSlot = latestUpdateTs / this.recentSlotDurationMs;
2331
-
2332
- const lastUpdateHoldings = await this.getVaultHoldings(vaultState, lastUpdateSlot, vaultReservesMap);
2333
- prevAUM = lastUpdateHoldings.total;
2367
+ const tokenDecimals = vaultState.tokenMintDecimals.toNumber();
2368
+ prevAUM = lamportsToDecimal(new Fraction(vaultState.prevAumSf).toDecimal(), tokenDecimals);
2369
+ pendingFees = lamportsToDecimal(new Fraction(vaultState.pendingFeesSf).toDecimal(), tokenDecimals);
2334
2370
  }
2335
2371
 
2336
2372
  const slot = currentSlot ? currentSlot : await this.getConnection().getSlot('confirmed');
2337
2373
 
2338
2374
  const currentHoldings = await this.getVaultHoldings(vaultState, slot, vaultReservesMap);
2339
- const earnedInterest = currentHoldings.total.sub(prevAUM);
2375
+ const earnedInterest = currentHoldings.totalAUMIncludingFees.sub(prevAUM).sub(pendingFees);
2340
2376
 
2341
2377
  return {
2342
2378
  holdings: currentHoldings,
@@ -2505,9 +2541,13 @@ export type VaultHoldings = {
2505
2541
  available: Decimal;
2506
2542
  invested: Decimal;
2507
2543
  investedInReserves: PubkeyHashMap<PublicKey, Decimal>;
2508
- total: Decimal;
2544
+ pendingFees: Decimal;
2545
+ totalAUMIncludingFees: Decimal;
2509
2546
  };
2510
2547
 
2548
+ /**
2549
+ * earnedInterest represents the interest earned from now until the slot provided in the future
2550
+ */
2511
2551
  export type SimulatedVaultHoldingsWithEarnedInterest = {
2512
2552
  holdings: VaultHoldings;
2513
2553
  earnedInterest: Decimal;
@@ -2518,14 +2558,16 @@ export type VaultHoldingsWithUSDValue = {
2518
2558
  availableUSD: Decimal;
2519
2559
  investedUSD: Decimal;
2520
2560
  investedInReservesUSD: PubkeyHashMap<PublicKey, Decimal>;
2521
- totalUSD: Decimal;
2561
+ totalUSDIncludingFees: Decimal;
2562
+ pendingFeesUSD: Decimal;
2522
2563
  };
2523
2564
 
2524
2565
  export type ReserveOverview = {
2525
2566
  supplyAPY: Decimal;
2526
2567
  utilizationRatio: Decimal;
2527
2568
  liquidationThresholdPct: Decimal;
2528
- borrowedAmount: Decimal;
2569
+ totalBorrowedAmount: Decimal;
2570
+ amountBorrowedFromSupplied: Decimal;
2529
2571
  suppliedAmount: Decimal;
2530
2572
  market: PublicKey;
2531
2573
  };
@@ -2567,3 +2609,8 @@ export type VaultFees = {
2567
2609
  managementFee: Decimal;
2568
2610
  performanceFee: Decimal;
2569
2611
  };
2612
+
2613
+ export type VaultCumulativeInterestWithTimestamp = {
2614
+ cumulativeInterest: Decimal;
2615
+ timestamp: number;
2616
+ };
package/src/client.ts CHANGED
@@ -10,6 +10,8 @@ import {
10
10
  getProgramId,
11
11
  toJson,
12
12
  getAllObligationAccounts,
13
+ getAllReserveAccounts,
14
+ getAllLendingMarketAccounts,
13
15
  } from './lib';
14
16
  import * as fs from 'fs';
15
17
  import { Connection, GetProgramAccountsFilter, Keypair, PublicKey } from '@solana/web3.js';
@@ -54,6 +56,16 @@ async function main() {
54
56
  );
55
57
  });
56
58
 
59
+ commands
60
+ .command('print-all-lending-market-accounts')
61
+ .option(`--rpc <string>`, 'The RPC URL')
62
+ .action(async ({ rpc }) => {
63
+ const connection = new Connection(rpc, {});
64
+ for await (const lendingMarketAccount of getAllLendingMarketAccounts(connection)) {
65
+ console.log(toJson(lendingMarketAccount.toJSON()));
66
+ }
67
+ });
68
+
57
69
  commands
58
70
  .command('print-obligation')
59
71
  .option(`--rpc <string>`, 'The rpc url')
@@ -86,6 +98,16 @@ async function main() {
86
98
  await printReserve(connection, reserve, symbol);
87
99
  });
88
100
 
101
+ commands
102
+ .command('print-all-reserve-accounts')
103
+ .option(`--rpc <string>`, 'The RPC URL')
104
+ .action(async ({ rpc }) => {
105
+ const connection = new Connection(rpc, {});
106
+ for await (const reserveAccount of getAllReserveAccounts(connection)) {
107
+ console.log(toJson(reserveAccount.toJSON()));
108
+ }
109
+ });
110
+
89
111
  commands
90
112
  .command('deposit')
91
113
  .option(`--url <string>`, 'Custom RPC URL')
@@ -737,7 +737,7 @@ async function main() {
737
737
  const kaminoManager = new KaminoManager(env.connection, env.kLendProgramId, env.kVaultProgramId);
738
738
 
739
739
  const kaminoVault = new KaminoVault(vaultAddress, undefined, env.kVaultProgramId);
740
- const instructions = await kaminoManager.investAllReserves(env.payer.publicKey, kaminoVault);
740
+ const instructions = await kaminoManager.investAllReservesIxs(env.payer.publicKey, kaminoVault);
741
741
 
742
742
  for (let i = 0; i < instructions.length; i++) {
743
743
  const txInstructions: TransactionInstruction[] = [];
@@ -779,7 +779,7 @@ async function main() {
779
779
  state: reserveState,
780
780
  };
781
781
 
782
- const instructions = await kaminoManager.investSingleReserve(
782
+ const instructions = await kaminoManager.investSingleReserveIxs(
783
783
  env.payer.publicKey,
784
784
  kaminoVault,
785
785
  reserveWithAddress
@@ -1349,7 +1349,7 @@ function parseReserveConfigFromFile(farmConfigFromFile: any): ReserveConfig {
1349
1349
  elevationGroups: farmConfigFromFile.elevationGroups,
1350
1350
  deleveragingThresholdDecreaseBpsPerDay: new BN(farmConfigFromFile.deleveragingThresholdDecreaseBpsPerDay),
1351
1351
  disableUsageAsCollOutsideEmode: farmConfigFromFile.disableUsageAsCollOutsideEmode,
1352
- utilizationLimitBlockBorrowingAbove: farmConfigFromFile.utilizationLimitBlockBorrowingAbove,
1352
+ utilizationLimitBlockBorrowingAbovePct: farmConfigFromFile.utilizationLimitBlockBorrowingAbovePct,
1353
1353
  hostFixedInterestRateBps: farmConfigFromFile.hostFixedInterestRateBps,
1354
1354
  autodeleverageEnabled: farmConfigFromFile.autodeleverageEnabled,
1355
1355
  borrowLimitOutsideElevationGroup: new BN(farmConfigFromFile.borrowLimitOutsideElevationGroup),
@@ -1469,7 +1469,7 @@ function parseReserveConfigToFile(reserveConfig: ReserveConfig) {
1469
1469
  elevationGroups: reserveConfig.elevationGroups,
1470
1470
  deleveragingThresholdDecreaseBpsPerDay: reserveConfig.deleveragingThresholdDecreaseBpsPerDay.toString(),
1471
1471
  disableUsageAsCollOutsideEmode: reserveConfig.disableUsageAsCollOutsideEmode,
1472
- utilizationLimitBlockBorrowingAbove: reserveConfig.utilizationLimitBlockBorrowingAbove,
1472
+ utilizationLimitBlockBorrowingAbovePct: reserveConfig.utilizationLimitBlockBorrowingAbovePct,
1473
1473
  hostFixedInterestRateBps: reserveConfig.hostFixedInterestRateBps,
1474
1474
  autodeleverageEnabled: reserveConfig.autodeleverageEnabled,
1475
1475
  borrowLimitOutsideElevationGroup: reserveConfig.borrowLimitOutsideElevationGroup.toString(),