@kamino-finance/klend-sdk 7.4.0-beta.0 → 7.4.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/dist/@codegen/kvault/accounts/LendingMarket.d.ts +480 -0
  2. package/dist/@codegen/kvault/accounts/LendingMarket.d.ts.map +1 -0
  3. package/dist/@codegen/kvault/accounts/LendingMarket.js +480 -0
  4. package/dist/@codegen/kvault/accounts/LendingMarket.js.map +1 -0
  5. package/dist/@codegen/kvault/accounts/Obligation.d.ts +208 -0
  6. package/dist/@codegen/kvault/accounts/Obligation.d.ts.map +1 -0
  7. package/dist/@codegen/kvault/accounts/Obligation.js +298 -0
  8. package/dist/@codegen/kvault/accounts/Obligation.js.map +1 -0
  9. package/dist/@codegen/kvault/accounts/ReferrerTokenState.d.ts +51 -0
  10. package/dist/@codegen/kvault/accounts/ReferrerTokenState.d.ts.map +1 -0
  11. package/dist/@codegen/kvault/accounts/ReferrerTokenState.js +137 -0
  12. package/dist/@codegen/kvault/accounts/ReferrerTokenState.js.map +1 -0
  13. package/dist/@codegen/kvault/accounts/Reserve.d.ts +6 -0
  14. package/dist/@codegen/kvault/accounts/Reserve.d.ts.map +1 -1
  15. package/dist/@codegen/kvault/accounts/Reserve.js +9 -2
  16. package/dist/@codegen/kvault/accounts/Reserve.js.map +1 -1
  17. package/dist/@codegen/kvault/accounts/VaultState.d.ts +45 -3
  18. package/dist/@codegen/kvault/accounts/VaultState.d.ts.map +1 -1
  19. package/dist/@codegen/kvault/accounts/VaultState.js +28 -4
  20. package/dist/@codegen/kvault/accounts/VaultState.js.map +1 -1
  21. package/dist/@codegen/kvault/accounts/WithdrawTicket.d.ts +144 -0
  22. package/dist/@codegen/kvault/accounts/WithdrawTicket.d.ts.map +1 -0
  23. package/dist/@codegen/kvault/accounts/WithdrawTicket.js +205 -0
  24. package/dist/@codegen/kvault/accounts/WithdrawTicket.js.map +1 -0
  25. package/dist/@codegen/kvault/accounts/index.d.ts +8 -0
  26. package/dist/@codegen/kvault/accounts/index.d.ts.map +1 -1
  27. package/dist/@codegen/kvault/accounts/index.js +9 -1
  28. package/dist/@codegen/kvault/accounts/index.js.map +1 -1
  29. package/dist/@codegen/kvault/errors/custom.d.ts +81 -1
  30. package/dist/@codegen/kvault/errors/custom.d.ts.map +1 -1
  31. package/dist/@codegen/kvault/errors/custom.js +141 -1
  32. package/dist/@codegen/kvault/errors/custom.js.map +1 -1
  33. package/dist/@codegen/kvault/instructions/index.d.ts +4 -0
  34. package/dist/@codegen/kvault/instructions/index.d.ts.map +1 -1
  35. package/dist/@codegen/kvault/instructions/index.js +5 -1
  36. package/dist/@codegen/kvault/instructions/index.js.map +1 -1
  37. package/dist/@codegen/kvault/instructions/invest.d.ts +9 -0
  38. package/dist/@codegen/kvault/instructions/invest.d.ts.map +1 -1
  39. package/dist/@codegen/kvault/instructions/invest.js +7 -0
  40. package/dist/@codegen/kvault/instructions/invest.js.map +1 -1
  41. package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillOrder.d.ts +51 -0
  42. package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillOrder.d.ts.map +1 -0
  43. package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillOrder.js +154 -0
  44. package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillOrder.js.map +1 -0
  45. package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillWithdrawalTicket.d.ts +54 -0
  46. package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillWithdrawalTicket.d.ts.map +1 -0
  47. package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillWithdrawalTicket.js +166 -0
  48. package/dist/@codegen/kvault/instructions/investInVirtualReserveAndFillWithdrawalTicket.js.map +1 -0
  49. package/dist/@codegen/kvault/instructions/updateKlendQueueAccounting.d.ts +1 -0
  50. package/dist/@codegen/kvault/instructions/updateKlendQueueAccounting.d.ts.map +1 -0
  51. package/dist/@codegen/kvault/instructions/updateKlendQueueAccounting.js +72 -0
  52. package/dist/@codegen/kvault/instructions/updateKlendQueueAccounting.js.map +1 -0
  53. package/dist/@codegen/kvault/instructions/updateReserveAllocation.d.ts +3 -1
  54. package/dist/@codegen/kvault/instructions/updateReserveAllocation.d.ts.map +1 -1
  55. package/dist/@codegen/kvault/instructions/updateReserveAllocation.js +3 -0
  56. package/dist/@codegen/kvault/instructions/updateReserveAllocation.js.map +1 -1
  57. package/dist/@codegen/kvault/types/BorrowOrder.d.ts +192 -0
  58. package/dist/@codegen/kvault/types/BorrowOrder.d.ts.map +1 -0
  59. package/dist/@codegen/kvault/types/BorrowOrder.js +194 -0
  60. package/dist/@codegen/kvault/types/BorrowOrder.js.map +1 -0
  61. package/dist/@codegen/kvault/types/ElevationGroup.d.ts +67 -0
  62. package/dist/@codegen/kvault/types/ElevationGroup.d.ts.map +1 -0
  63. package/dist/@codegen/kvault/types/ElevationGroup.js +137 -0
  64. package/dist/@codegen/kvault/types/ElevationGroup.js.map +1 -0
  65. package/dist/@codegen/kvault/types/FixedTermBorrowRolloverConfig.d.ts +145 -0
  66. package/dist/@codegen/kvault/types/FixedTermBorrowRolloverConfig.d.ts.map +1 -0
  67. package/dist/@codegen/kvault/types/FixedTermBorrowRolloverConfig.js +144 -0
  68. package/dist/@codegen/kvault/types/FixedTermBorrowRolloverConfig.js.map +1 -0
  69. package/dist/@codegen/kvault/types/ObligationCollateral.d.ts +72 -0
  70. package/dist/@codegen/kvault/types/ObligationCollateral.d.ts.map +1 -0
  71. package/dist/@codegen/kvault/types/ObligationCollateral.js +119 -0
  72. package/dist/@codegen/kvault/types/ObligationCollateral.js.map +1 -0
  73. package/dist/@codegen/kvault/types/ObligationLiquidity.d.ts +143 -0
  74. package/dist/@codegen/kvault/types/ObligationLiquidity.d.ts.map +1 -0
  75. package/dist/@codegen/kvault/types/ObligationLiquidity.js +165 -0
  76. package/dist/@codegen/kvault/types/ObligationLiquidity.js.map +1 -0
  77. package/dist/@codegen/kvault/types/ObligationOrder.d.ts +284 -0
  78. package/dist/@codegen/kvault/types/ObligationOrder.d.ts.map +1 -0
  79. package/dist/@codegen/kvault/types/ObligationOrder.js +205 -0
  80. package/dist/@codegen/kvault/types/ObligationOrder.js.map +1 -0
  81. package/dist/@codegen/kvault/types/ReserveConfig.d.ts +60 -5
  82. package/dist/@codegen/kvault/types/ReserveConfig.d.ts.map +1 -1
  83. package/dist/@codegen/kvault/types/ReserveConfig.js +36 -7
  84. package/dist/@codegen/kvault/types/ReserveConfig.js.map +1 -1
  85. package/dist/@codegen/kvault/types/ReserveLiquidity.d.ts +26 -8
  86. package/dist/@codegen/kvault/types/ReserveLiquidity.d.ts.map +1 -1
  87. package/dist/@codegen/kvault/types/ReserveLiquidity.js +14 -8
  88. package/dist/@codegen/kvault/types/ReserveLiquidity.js.map +1 -1
  89. package/dist/@codegen/kvault/types/ReserveType.d.ts +32 -0
  90. package/dist/@codegen/kvault/types/ReserveType.d.ts.map +1 -0
  91. package/dist/@codegen/kvault/types/ReserveType.js +108 -0
  92. package/dist/@codegen/kvault/types/ReserveType.js.map +1 -0
  93. package/dist/@codegen/kvault/types/VaultAllocation.d.ts +60 -0
  94. package/dist/@codegen/kvault/types/VaultAllocation.d.ts.map +1 -1
  95. package/dist/@codegen/kvault/types/VaultAllocation.js +38 -2
  96. package/dist/@codegen/kvault/types/VaultAllocation.js.map +1 -1
  97. package/dist/@codegen/kvault/types/WithdrawQueue.d.ts +64 -0
  98. package/dist/@codegen/kvault/types/WithdrawQueue.d.ts.map +1 -0
  99. package/dist/@codegen/kvault/types/WithdrawQueue.js +104 -0
  100. package/dist/@codegen/kvault/types/WithdrawQueue.js.map +1 -0
  101. package/dist/@codegen/kvault/types/WithdrawTicketProgressEvent.d.ts +19 -0
  102. package/dist/@codegen/kvault/types/WithdrawTicketProgressEvent.d.ts.map +1 -0
  103. package/dist/@codegen/kvault/types/WithdrawTicketProgressEvent.js +82 -0
  104. package/dist/@codegen/kvault/types/WithdrawTicketProgressEvent.js.map +1 -0
  105. package/dist/@codegen/kvault/types/index.d.ts +34 -0
  106. package/dist/@codegen/kvault/types/index.d.ts.map +1 -1
  107. package/dist/@codegen/kvault/types/index.js +19 -1
  108. package/dist/@codegen/kvault/types/index.js.map +1 -1
  109. package/dist/classes/action.d.ts +21 -91
  110. package/dist/classes/action.d.ts.map +1 -1
  111. package/dist/classes/action.js +141 -119
  112. package/dist/classes/action.js.map +1 -1
  113. package/dist/classes/actionTypes.d.ts +310 -0
  114. package/dist/classes/actionTypes.d.ts.map +1 -0
  115. package/dist/classes/actionTypes.js +3 -0
  116. package/dist/classes/actionTypes.js.map +1 -0
  117. package/dist/classes/market.d.ts +109 -15
  118. package/dist/classes/market.d.ts.map +1 -1
  119. package/dist/classes/market.js +186 -26
  120. package/dist/classes/market.js.map +1 -1
  121. package/dist/classes/obligation.d.ts +11 -11
  122. package/dist/classes/obligation.d.ts.map +1 -1
  123. package/dist/classes/obligation.js +56 -56
  124. package/dist/classes/obligation.js.map +1 -1
  125. package/dist/classes/obligationOrder.d.ts.map +1 -1
  126. package/dist/classes/obligationOrder.js +6 -3
  127. package/dist/classes/obligationOrder.js.map +1 -1
  128. package/dist/classes/reserve.d.ts +9 -1
  129. package/dist/classes/reserve.d.ts.map +1 -1
  130. package/dist/classes/reserve.js +20 -0
  131. package/dist/classes/reserve.js.map +1 -1
  132. package/dist/classes/shared.d.ts +1 -0
  133. package/dist/classes/shared.d.ts.map +1 -1
  134. package/dist/classes/utils.d.ts +2 -0
  135. package/dist/classes/utils.d.ts.map +1 -1
  136. package/dist/classes/utils.js +12 -1
  137. package/dist/classes/utils.js.map +1 -1
  138. package/dist/classes/vault.d.ts +4 -2
  139. package/dist/classes/vault.d.ts.map +1 -1
  140. package/dist/classes/vault.js +12 -2
  141. package/dist/classes/vault.js.map +1 -1
  142. package/dist/client/commands/borrow.d.ts +1 -1
  143. package/dist/client/commands/borrow.d.ts.map +1 -1
  144. package/dist/client/commands/borrow.js +11 -2
  145. package/dist/client/commands/borrow.js.map +1 -1
  146. package/dist/client/commands/deposit.d.ts +1 -1
  147. package/dist/client/commands/deposit.d.ts.map +1 -1
  148. package/dist/client/commands/deposit.js +11 -2
  149. package/dist/client/commands/deposit.js.map +1 -1
  150. package/dist/client/commands/printReserve.d.ts +1 -1
  151. package/dist/client/commands/printReserve.d.ts.map +1 -1
  152. package/dist/client/commands/printReserve.js +2 -4
  153. package/dist/client/commands/printReserve.js.map +1 -1
  154. package/dist/client/commands/repay.d.ts +1 -1
  155. package/dist/client/commands/repay.d.ts.map +1 -1
  156. package/dist/client/commands/repay.js +12 -2
  157. package/dist/client/commands/repay.js.map +1 -1
  158. package/dist/client/commands/withdraw.d.ts +1 -1
  159. package/dist/client/commands/withdraw.d.ts.map +1 -1
  160. package/dist/client/commands/withdraw.js +11 -2
  161. package/dist/client/commands/withdraw.js.map +1 -1
  162. package/dist/lending_operations/repay_with_collateral_calcs.d.ts +1 -1
  163. package/dist/lending_operations/repay_with_collateral_calcs.d.ts.map +1 -1
  164. package/dist/lending_operations/repay_with_collateral_calcs.js +2 -2
  165. package/dist/lending_operations/repay_with_collateral_calcs.js.map +1 -1
  166. package/dist/lending_operations/repay_with_collateral_operations.d.ts +4 -4
  167. package/dist/lending_operations/repay_with_collateral_operations.d.ts.map +1 -1
  168. package/dist/lending_operations/repay_with_collateral_operations.js +43 -10
  169. package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
  170. package/dist/lending_operations/swap_collateral_operations.d.ts +4 -4
  171. package/dist/lending_operations/swap_collateral_operations.d.ts.map +1 -1
  172. package/dist/lending_operations/swap_collateral_operations.js +40 -21
  173. package/dist/lending_operations/swap_collateral_operations.js.map +1 -1
  174. package/dist/leverage/operations.d.ts +6 -6
  175. package/dist/leverage/operations.d.ts.map +1 -1
  176. package/dist/leverage/operations.js +167 -52
  177. package/dist/leverage/operations.js.map +1 -1
  178. package/dist/leverage/types.d.ts +2 -2
  179. package/dist/leverage/types.d.ts.map +1 -1
  180. package/dist/manager/client_kamino_manager.js +0 -2
  181. package/dist/manager/client_kamino_manager.js.map +1 -1
  182. package/dist/obligation_orders/price_based.js +5 -3
  183. package/dist/obligation_orders/price_based.js.map +1 -1
  184. package/dist/utils/ObligationType.d.ts +33 -1
  185. package/dist/utils/ObligationType.d.ts.map +1 -1
  186. package/dist/utils/ObligationType.js +81 -2
  187. package/dist/utils/ObligationType.js.map +1 -1
  188. package/dist/utils/ReserveKind.d.ts +57 -0
  189. package/dist/utils/ReserveKind.d.ts.map +1 -0
  190. package/dist/utils/ReserveKind.js +76 -0
  191. package/dist/utils/ReserveKind.js.map +1 -0
  192. package/dist/utils/index.d.ts +1 -0
  193. package/dist/utils/index.d.ts.map +1 -1
  194. package/dist/utils/index.js +1 -0
  195. package/dist/utils/index.js.map +1 -1
  196. package/dist/utils/userMetadata.d.ts +2 -2
  197. package/dist/utils/userMetadata.d.ts.map +1 -1
  198. package/dist/utils/userMetadata.js +49 -25
  199. package/dist/utils/userMetadata.js.map +1 -1
  200. package/dist/utils/validations.d.ts +1 -0
  201. package/dist/utils/validations.d.ts.map +1 -1
  202. package/dist/utils/validations.js +5 -0
  203. package/dist/utils/validations.js.map +1 -1
  204. package/dist/utils/vault.d.ts.map +1 -1
  205. package/dist/utils/vault.js +2 -0
  206. package/dist/utils/vault.js.map +1 -1
  207. package/package.json +1 -1
  208. package/src/@codegen/kvault/accounts/LendingMarket.ts +837 -0
  209. package/src/@codegen/kvault/accounts/Obligation.ts +459 -0
  210. package/src/@codegen/kvault/accounts/ReferrerTokenState.ts +160 -0
  211. package/src/@codegen/kvault/accounts/Reserve.ts +13 -2
  212. package/src/@codegen/kvault/accounts/VaultState.ts +59 -7
  213. package/src/@codegen/kvault/accounts/WithdrawTicket.ts +280 -0
  214. package/src/@codegen/kvault/accounts/index.ts +11 -0
  215. package/src/@codegen/kvault/errors/custom.ts +152 -0
  216. package/src/@codegen/kvault/instructions/index.ts +10 -0
  217. package/src/@codegen/kvault/instructions/invest.ts +16 -0
  218. package/src/@codegen/kvault/instructions/investInVirtualReserveAndFillOrder.ts +189 -0
  219. package/src/@codegen/kvault/instructions/investInVirtualReserveAndFillWithdrawalTicket.ts +205 -0
  220. package/src/@codegen/kvault/instructions/updateKlendQueueAccounting.ts +76 -0
  221. package/src/@codegen/kvault/instructions/updateReserveAllocation.ts +4 -1
  222. package/src/@codegen/kvault/types/BorrowOrder.ts +267 -0
  223. package/src/@codegen/kvault/types/ElevationGroup.ts +134 -0
  224. package/src/@codegen/kvault/types/FixedTermBorrowRolloverConfig.ts +199 -0
  225. package/src/@codegen/kvault/types/ObligationCollateral.ts +129 -0
  226. package/src/@codegen/kvault/types/ObligationLiquidity.ts +226 -0
  227. package/src/@codegen/kvault/types/ObligationOrder.ts +348 -0
  228. package/src/@codegen/kvault/types/ReserveConfig.ts +72 -9
  229. package/src/@codegen/kvault/types/ReserveLiquidity.ts +30 -12
  230. package/src/@codegen/kvault/types/ReserveType.ts +89 -0
  231. package/src/@codegen/kvault/types/VaultAllocation.ts +74 -2
  232. package/src/@codegen/kvault/types/WithdrawQueue.ts +117 -0
  233. package/src/@codegen/kvault/types/WithdrawTicketProgressEvent.ts +59 -0
  234. package/src/@codegen/kvault/types/index.ts +52 -0
  235. package/src/classes/action.ts +321 -347
  236. package/src/classes/actionTypes.ts +295 -0
  237. package/src/classes/manager.ts +1 -1
  238. package/src/classes/market.ts +232 -30
  239. package/src/classes/obligation.ts +62 -59
  240. package/src/classes/obligationOrder.ts +6 -3
  241. package/src/classes/reserve.ts +24 -0
  242. package/src/classes/shared.ts +2 -0
  243. package/src/classes/utils.ts +8 -0
  244. package/src/classes/vault.ts +35 -4
  245. package/src/client/client.ts +17 -18
  246. package/src/client/commands/borrow.ts +10 -9
  247. package/src/client/commands/deposit.ts +10 -9
  248. package/src/client/commands/printReserve.ts +2 -4
  249. package/src/client/commands/repay.ts +11 -10
  250. package/src/client/commands/withdraw.ts +15 -9
  251. package/src/idl/kvault.json +2336 -299
  252. package/src/lending_operations/repay_with_collateral_calcs.ts +3 -4
  253. package/src/lending_operations/repay_with_collateral_operations.ts +40 -38
  254. package/src/lending_operations/swap_collateral_operations.ts +47 -41
  255. package/src/leverage/operations.ts +168 -129
  256. package/src/leverage/types.ts +2 -2
  257. package/src/manager/client_kamino_manager.ts +0 -2
  258. package/src/obligation_orders/price_based.ts +7 -5
  259. package/src/utils/ObligationType.ts +92 -1
  260. package/src/utils/ReserveKind.ts +94 -0
  261. package/src/utils/index.ts +1 -0
  262. package/src/utils/userMetadata.ts +64 -30
  263. package/src/utils/validations.ts +5 -0
  264. package/src/utils/vault.ts +2 -0
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.0",
2
+ "version": "2.0.0",
3
3
  "name": "kamino_vault",
4
4
  "instructions": [
5
5
  {
@@ -126,6 +126,12 @@
126
126
  {
127
127
  "name": "cap",
128
128
  "type": "u64"
129
+ },
130
+ {
131
+ "name": "reserveType",
132
+ "type": {
133
+ "defined": "ReserveType"
134
+ }
129
135
  }
130
136
  ]
131
137
  },
@@ -663,11 +669,95 @@
663
669
  {
664
670
  "name": "instructionSysvarAccount",
665
671
  "isMut": false,
672
+ "isSigner": false,
673
+ "docs": [
674
+ "Required by the klend CPI."
675
+ ]
676
+ },
677
+ {
678
+ "name": "reserveWithdrawTicket",
679
+ "isMut": true,
680
+ "isSigner": false,
681
+ "isOptional": true,
682
+ "docs": [
683
+ "The ticket to be initialized, if the klend's withdraw queue should be used for uninvesting."
684
+ ]
685
+ },
686
+ {
687
+ "name": "ownerQueuedCollateralVault",
688
+ "isMut": true,
689
+ "isSigner": false,
690
+ "isOptional": true,
691
+ "docs": [
692
+ "The ctokens vault expected by the klend's withdraw queue.",
693
+ "Must be present together with the `reserve_withdraw_ticket`."
694
+ ]
695
+ },
696
+ {
697
+ "name": "systemProgram",
698
+ "isMut": false,
666
699
  "isSigner": false
667
700
  }
668
701
  ],
669
702
  "args": []
670
703
  },
704
+ {
705
+ "name": "updateKlendQueueAccounting",
706
+ "accounts": [
707
+ {
708
+ "name": "withdrawTicket",
709
+ "isMut": false,
710
+ "isSigner": true
711
+ },
712
+ {
713
+ "name": "reserve",
714
+ "isMut": false,
715
+ "isSigner": false
716
+ },
717
+ {
718
+ "name": "lendingMarket",
719
+ "isMut": false,
720
+ "isSigner": false
721
+ },
722
+ {
723
+ "name": "ownerQueuedCollateralVault",
724
+ "isMut": false,
725
+ "isSigner": false,
726
+ "docs": [
727
+ "The vault (managed by the klend's withdraw queue) holding the still-queued ctokens."
728
+ ]
729
+ },
730
+ {
731
+ "name": "tokenVault",
732
+ "isMut": false,
733
+ "isSigner": false,
734
+ "docs": [
735
+ "The token account holding the vault's available tokens."
736
+ ]
737
+ },
738
+ {
739
+ "name": "vault",
740
+ "isMut": true,
741
+ "isSigner": false
742
+ }
743
+ ],
744
+ "args": [
745
+ {
746
+ "name": "progressEventType",
747
+ "type": {
748
+ "defined": "WithdrawTicketProgressEvent"
749
+ }
750
+ },
751
+ {
752
+ "name": "burntCtokens",
753
+ "type": "u64"
754
+ },
755
+ {
756
+ "name": "receivedLiquidity",
757
+ "type": "u64"
758
+ }
759
+ ]
760
+ },
671
761
  {
672
762
  "name": "updateVaultConfig",
673
763
  "accounts": [
@@ -1148,441 +1238,2205 @@
1148
1238
  }
1149
1239
  }
1150
1240
  ]
1151
- }
1152
- ],
1153
- "accounts": [
1154
- {
1155
- "name": "Reserve",
1156
- "type": {
1157
- "kind": "struct",
1158
- "fields": [
1159
- {
1160
- "name": "version",
1161
- "docs": [
1162
- "Version of the reserve"
1163
- ],
1164
- "type": "u64"
1165
- },
1166
- {
1167
- "name": "lastUpdate",
1168
- "docs": [
1169
- "Last slot when supply and rates updated"
1170
- ],
1171
- "type": {
1172
- "defined": "LastUpdate"
1173
- }
1174
- },
1175
- {
1176
- "name": "lendingMarket",
1177
- "docs": [
1178
- "Lending market address"
1179
- ],
1180
- "type": "publicKey"
1181
- },
1182
- {
1183
- "name": "farmCollateral",
1184
- "type": "publicKey"
1185
- },
1186
- {
1187
- "name": "farmDebt",
1188
- "type": "publicKey"
1189
- },
1190
- {
1191
- "name": "liquidity",
1192
- "docs": [
1193
- "Reserve liquidity"
1194
- ],
1195
- "type": {
1196
- "defined": "ReserveLiquidity"
1197
- }
1198
- },
1199
- {
1200
- "name": "reserveLiquidityPadding",
1201
- "type": {
1202
- "array": [
1203
- "u64",
1204
- 150
1205
- ]
1206
- }
1207
- },
1208
- {
1209
- "name": "collateral",
1210
- "docs": [
1211
- "Reserve collateral"
1212
- ],
1213
- "type": {
1214
- "defined": "ReserveCollateral"
1215
- }
1216
- },
1217
- {
1218
- "name": "reserveCollateralPadding",
1219
- "type": {
1220
- "array": [
1221
- "u64",
1222
- 150
1223
- ]
1224
- }
1225
- },
1226
- {
1227
- "name": "config",
1228
- "docs": [
1229
- "Reserve configuration values"
1230
- ],
1231
- "type": {
1232
- "defined": "ReserveConfig"
1233
- }
1234
- },
1235
- {
1236
- "name": "configPadding",
1237
- "type": {
1238
- "array": [
1239
- "u64",
1240
- 116
1241
- ]
1242
- }
1243
- },
1244
- {
1245
- "name": "borrowedAmountOutsideElevationGroup",
1246
- "type": "u64"
1247
- },
1248
- {
1249
- "name": "borrowedAmountsAgainstThisReserveInElevationGroups",
1250
- "docs": [
1251
- "Amount of token borrowed in lamport of debt asset in the given",
1252
- "elevation group when this reserve is part of the collaterals."
1253
- ],
1254
- "type": {
1255
- "array": [
1256
- "u64",
1257
- 32
1258
- ]
1259
- }
1260
- },
1261
- {
1262
- "name": "padding",
1263
- "type": {
1264
- "array": [
1265
- "u64",
1266
- 207
1267
- ]
1268
- }
1269
- }
1270
- ]
1271
- }
1272
- },
1273
- {
1274
- "name": "GlobalConfig",
1275
- "type": {
1276
- "kind": "struct",
1277
- "fields": [
1278
- {
1279
- "name": "globalAdmin",
1280
- "type": "publicKey"
1281
- },
1282
- {
1283
- "name": "pendingAdmin",
1284
- "type": "publicKey"
1285
- },
1286
- {
1287
- "name": "withdrawalPenaltyLamports",
1288
- "type": "u64"
1289
- },
1290
- {
1291
- "name": "withdrawalPenaltyBps",
1292
- "type": "u64"
1293
- },
1294
- {
1295
- "name": "padding",
1296
- "type": {
1297
- "array": [
1298
- "u8",
1299
- 944
1300
- ]
1301
- }
1302
- }
1303
- ]
1304
- }
1305
1241
  },
1306
1242
  {
1307
- "name": "ReserveWhitelistEntry",
1308
- "type": {
1309
- "kind": "struct",
1310
- "fields": [
1311
- {
1312
- "name": "tokenMint",
1313
- "docs": [
1314
- "The token mint is stored to solve the problem of finding all the whitelisted reserves for a particular token mint:",
1315
- "when storing the token mint inside the PDA, finding all the whitelisted reserves becomes a `getProgramAccounts` with",
1316
- "a filter on discriminator + the mint field",
1317
- "The reserve pubkey, as seed of the reserve whitelist PDA account, it stored so you can link back the PDA to its seeds",
1318
- "(for instance, in the operation above we easily find the reserve corresponding to the PDA)"
1319
- ],
1320
- "type": "publicKey"
1321
- },
1322
- {
1323
- "name": "reserve",
1324
- "type": "publicKey"
1325
- },
1326
- {
1327
- "name": "whitelistAddAllocation",
1328
- "type": "u8"
1329
- },
1330
- {
1331
- "name": "whitelistInvest",
1332
- "type": "u8"
1333
- },
1334
- {
1335
- "name": "padding",
1336
- "type": {
1337
- "array": [
1338
- "u8",
1339
- 62
1340
- ]
1243
+ "name": "investInVirtualReserveAndFillOrder",
1244
+ "accounts": [
1245
+ {
1246
+ "name": "investInVirtualReserve",
1247
+ "accounts": [
1248
+ {
1249
+ "name": "payer",
1250
+ "isMut": true,
1251
+ "isSigner": true
1252
+ },
1253
+ {
1254
+ "name": "payerTokenAccount",
1255
+ "isMut": true,
1256
+ "isSigner": false
1257
+ },
1258
+ {
1259
+ "name": "vaultState",
1260
+ "isMut": true,
1261
+ "isSigner": false
1262
+ },
1263
+ {
1264
+ "name": "tokenVault",
1265
+ "isMut": true,
1266
+ "isSigner": false
1267
+ },
1268
+ {
1269
+ "name": "tokenMint",
1270
+ "isMut": true,
1271
+ "isSigner": false
1272
+ },
1273
+ {
1274
+ "name": "baseVaultAuthority",
1275
+ "isMut": true,
1276
+ "isSigner": false
1277
+ },
1278
+ {
1279
+ "name": "srcCtokenVault",
1280
+ "isMut": true,
1281
+ "isSigner": false,
1282
+ "isOptional": true
1283
+ },
1284
+ {
1285
+ "name": "srcReserve",
1286
+ "isMut": true,
1287
+ "isSigner": false,
1288
+ "isOptional": true
1289
+ },
1290
+ {
1291
+ "name": "srcLendingMarket",
1292
+ "isMut": false,
1293
+ "isSigner": false,
1294
+ "isOptional": true
1295
+ },
1296
+ {
1297
+ "name": "srcLendingMarketAuthority",
1298
+ "isMut": false,
1299
+ "isSigner": false,
1300
+ "isOptional": true
1301
+ },
1302
+ {
1303
+ "name": "srcReserveLiquiditySupply",
1304
+ "isMut": true,
1305
+ "isSigner": false,
1306
+ "isOptional": true
1307
+ },
1308
+ {
1309
+ "name": "srcReserveCollateralMint",
1310
+ "isMut": true,
1311
+ "isSigner": false,
1312
+ "isOptional": true
1313
+ },
1314
+ {
1315
+ "name": "dstCtokenVault",
1316
+ "isMut": true,
1317
+ "isSigner": false
1318
+ },
1319
+ {
1320
+ "name": "dstReserve",
1321
+ "isMut": true,
1322
+ "isSigner": false
1323
+ },
1324
+ {
1325
+ "name": "dstLendingMarket",
1326
+ "isMut": false,
1327
+ "isSigner": false
1328
+ },
1329
+ {
1330
+ "name": "dstLendingMarketAuthority",
1331
+ "isMut": false,
1332
+ "isSigner": false
1333
+ },
1334
+ {
1335
+ "name": "dstReserveLiquiditySupply",
1336
+ "isMut": true,
1337
+ "isSigner": false
1338
+ },
1339
+ {
1340
+ "name": "dstReserveCollateralMint",
1341
+ "isMut": true,
1342
+ "isSigner": false
1343
+ },
1344
+ {
1345
+ "name": "reserveWhitelistEntry",
1346
+ "isMut": false,
1347
+ "isSigner": false,
1348
+ "isOptional": true
1349
+ },
1350
+ {
1351
+ "name": "klendProgram",
1352
+ "isMut": false,
1353
+ "isSigner": false
1354
+ },
1355
+ {
1356
+ "name": "reserveCtokenProgram",
1357
+ "isMut": false,
1358
+ "isSigner": false
1359
+ },
1360
+ {
1361
+ "name": "tokenProgram",
1362
+ "isMut": false,
1363
+ "isSigner": false
1364
+ },
1365
+ {
1366
+ "name": "instructionSysvarAccount",
1367
+ "isMut": false,
1368
+ "isSigner": false
1369
+ }
1370
+ ]
1371
+ },
1372
+ {
1373
+ "name": "fillBorrowOrder",
1374
+ "accounts": [
1375
+ {
1376
+ "name": "vaultState",
1377
+ "isMut": false,
1378
+ "isSigner": false
1379
+ },
1380
+ {
1381
+ "name": "reserve",
1382
+ "isMut": true,
1383
+ "isSigner": false
1384
+ },
1385
+ {
1386
+ "name": "tokenMint",
1387
+ "isMut": false,
1388
+ "isSigner": false
1389
+ },
1390
+ {
1391
+ "name": "obligation",
1392
+ "isMut": true,
1393
+ "isSigner": false
1394
+ },
1395
+ {
1396
+ "name": "borrowReserveLiquidityFeeReceiver",
1397
+ "isMut": true,
1398
+ "isSigner": false
1399
+ },
1400
+ {
1401
+ "name": "userDestinationLiquidity",
1402
+ "isMut": true,
1403
+ "isSigner": false
1404
+ },
1405
+ {
1406
+ "name": "referrerTokenState",
1407
+ "isMut": true,
1408
+ "isSigner": false,
1409
+ "isOptional": true
1410
+ },
1411
+ {
1412
+ "name": "obligationFarmUserState",
1413
+ "isMut": true,
1414
+ "isSigner": false,
1415
+ "isOptional": true
1416
+ },
1417
+ {
1418
+ "name": "reserveFarmState",
1419
+ "isMut": true,
1420
+ "isSigner": false,
1421
+ "isOptional": true
1422
+ },
1423
+ {
1424
+ "name": "farmProgram",
1425
+ "isMut": false,
1426
+ "isSigner": false
1427
+ },
1428
+ {
1429
+ "name": "eventAuthority",
1430
+ "isMut": false,
1431
+ "isSigner": false
1432
+ }
1433
+ ]
1434
+ },
1435
+ {
1436
+ "name": "eventAuthority",
1437
+ "isMut": false,
1438
+ "isSigner": false
1439
+ },
1440
+ {
1441
+ "name": "program",
1442
+ "isMut": false,
1443
+ "isSigner": false
1444
+ }
1445
+ ],
1446
+ "args": [
1447
+ {
1448
+ "name": "softMaxLiquidityToInvest",
1449
+ "type": "u64"
1450
+ }
1451
+ ]
1452
+ },
1453
+ {
1454
+ "name": "investInVirtualReserveAndFillWithdrawalTicket",
1455
+ "accounts": [
1456
+ {
1457
+ "name": "investInVirtualReserve",
1458
+ "accounts": [
1459
+ {
1460
+ "name": "payer",
1461
+ "isMut": true,
1462
+ "isSigner": true
1463
+ },
1464
+ {
1465
+ "name": "payerTokenAccount",
1466
+ "isMut": true,
1467
+ "isSigner": false
1468
+ },
1469
+ {
1470
+ "name": "vaultState",
1471
+ "isMut": true,
1472
+ "isSigner": false
1473
+ },
1474
+ {
1475
+ "name": "tokenVault",
1476
+ "isMut": true,
1477
+ "isSigner": false
1478
+ },
1479
+ {
1480
+ "name": "tokenMint",
1481
+ "isMut": true,
1482
+ "isSigner": false
1483
+ },
1484
+ {
1485
+ "name": "baseVaultAuthority",
1486
+ "isMut": true,
1487
+ "isSigner": false
1488
+ },
1489
+ {
1490
+ "name": "srcCtokenVault",
1491
+ "isMut": true,
1492
+ "isSigner": false,
1493
+ "isOptional": true
1494
+ },
1495
+ {
1496
+ "name": "srcReserve",
1497
+ "isMut": true,
1498
+ "isSigner": false,
1499
+ "isOptional": true
1500
+ },
1501
+ {
1502
+ "name": "srcLendingMarket",
1503
+ "isMut": false,
1504
+ "isSigner": false,
1505
+ "isOptional": true
1506
+ },
1507
+ {
1508
+ "name": "srcLendingMarketAuthority",
1509
+ "isMut": false,
1510
+ "isSigner": false,
1511
+ "isOptional": true
1512
+ },
1513
+ {
1514
+ "name": "srcReserveLiquiditySupply",
1515
+ "isMut": true,
1516
+ "isSigner": false,
1517
+ "isOptional": true
1518
+ },
1519
+ {
1520
+ "name": "srcReserveCollateralMint",
1521
+ "isMut": true,
1522
+ "isSigner": false,
1523
+ "isOptional": true
1524
+ },
1525
+ {
1526
+ "name": "dstCtokenVault",
1527
+ "isMut": true,
1528
+ "isSigner": false
1529
+ },
1530
+ {
1531
+ "name": "dstReserve",
1532
+ "isMut": true,
1533
+ "isSigner": false
1534
+ },
1535
+ {
1536
+ "name": "dstLendingMarket",
1537
+ "isMut": false,
1538
+ "isSigner": false
1539
+ },
1540
+ {
1541
+ "name": "dstLendingMarketAuthority",
1542
+ "isMut": false,
1543
+ "isSigner": false
1544
+ },
1545
+ {
1546
+ "name": "dstReserveLiquiditySupply",
1547
+ "isMut": true,
1548
+ "isSigner": false
1549
+ },
1550
+ {
1551
+ "name": "dstReserveCollateralMint",
1552
+ "isMut": true,
1553
+ "isSigner": false
1554
+ },
1555
+ {
1556
+ "name": "reserveWhitelistEntry",
1557
+ "isMut": false,
1558
+ "isSigner": false,
1559
+ "isOptional": true
1560
+ },
1561
+ {
1562
+ "name": "klendProgram",
1563
+ "isMut": false,
1564
+ "isSigner": false
1565
+ },
1566
+ {
1567
+ "name": "reserveCtokenProgram",
1568
+ "isMut": false,
1569
+ "isSigner": false
1570
+ },
1571
+ {
1572
+ "name": "tokenProgram",
1573
+ "isMut": false,
1574
+ "isSigner": false
1575
+ },
1576
+ {
1577
+ "name": "instructionSysvarAccount",
1578
+ "isMut": false,
1579
+ "isSigner": false
1580
+ }
1581
+ ]
1582
+ },
1583
+ {
1584
+ "name": "fillWithdrawalTicket",
1585
+ "accounts": [
1586
+ {
1587
+ "name": "vaultState",
1588
+ "isMut": false,
1589
+ "isSigner": false
1590
+ },
1591
+ {
1592
+ "name": "reserve",
1593
+ "isMut": true,
1594
+ "isSigner": false
1595
+ },
1596
+ {
1597
+ "name": "lendingMarketAuthority",
1598
+ "isMut": false,
1599
+ "isSigner": false
1600
+ },
1601
+ {
1602
+ "name": "withdrawTicket",
1603
+ "isMut": true,
1604
+ "isSigner": false
1605
+ },
1606
+ {
1607
+ "name": "withdrawTicketOwner",
1608
+ "isMut": true,
1609
+ "isSigner": false
1610
+ },
1611
+ {
1612
+ "name": "userDestinationLiquidity",
1613
+ "isMut": true,
1614
+ "isSigner": false
1615
+ },
1616
+ {
1617
+ "name": "ownerQueuedCollateralVault",
1618
+ "isMut": true,
1619
+ "isSigner": false
1620
+ },
1621
+ {
1622
+ "name": "referrerTokenState",
1623
+ "isMut": true,
1624
+ "isSigner": false,
1625
+ "isOptional": true
1626
+ },
1627
+ {
1628
+ "name": "obligationFarmUserState",
1629
+ "isMut": true,
1630
+ "isSigner": false,
1631
+ "isOptional": true
1632
+ },
1633
+ {
1634
+ "name": "reserveFarmState",
1635
+ "isMut": true,
1636
+ "isSigner": false,
1637
+ "isOptional": true
1638
+ },
1639
+ {
1640
+ "name": "farmProgram",
1641
+ "isMut": false,
1642
+ "isSigner": false
1643
+ },
1644
+ {
1645
+ "name": "eventAuthority",
1646
+ "isMut": false,
1647
+ "isSigner": false
1648
+ },
1649
+ {
1650
+ "name": "associatedTokenProgram",
1651
+ "isMut": false,
1652
+ "isSigner": false
1653
+ },
1654
+ {
1655
+ "name": "systemProgram",
1656
+ "isMut": false,
1657
+ "isSigner": false
1658
+ }
1659
+ ]
1660
+ },
1661
+ {
1662
+ "name": "eventAuthority",
1663
+ "isMut": false,
1664
+ "isSigner": false
1665
+ },
1666
+ {
1667
+ "name": "program",
1668
+ "isMut": false,
1669
+ "isSigner": false
1670
+ }
1671
+ ],
1672
+ "args": [
1673
+ {
1674
+ "name": "softMaxLiquidityToInvest",
1675
+ "type": "u64"
1676
+ }
1677
+ ]
1678
+ }
1679
+ ],
1680
+ "accounts": [
1681
+ {
1682
+ "name": "LendingMarket",
1683
+ "type": {
1684
+ "kind": "struct",
1685
+ "fields": [
1686
+ {
1687
+ "name": "version",
1688
+ "docs": [
1689
+ "Version of lending market"
1690
+ ],
1691
+ "type": "u64"
1692
+ },
1693
+ {
1694
+ "name": "bumpSeed",
1695
+ "docs": [
1696
+ "Bump seed for derived authority address"
1697
+ ],
1698
+ "type": "u64"
1699
+ },
1700
+ {
1701
+ "name": "lendingMarketOwner",
1702
+ "docs": [
1703
+ "Owner authority which can add new reserves"
1704
+ ],
1705
+ "type": "publicKey"
1706
+ },
1707
+ {
1708
+ "name": "lendingMarketOwnerCached",
1709
+ "docs": [
1710
+ "Temporary cache of the lending market owner, used in update_lending_market_owner"
1711
+ ],
1712
+ "type": "publicKey"
1713
+ },
1714
+ {
1715
+ "name": "quoteCurrency",
1716
+ "docs": [
1717
+ "Currency market prices are quoted in",
1718
+ "e.g. \"USD\" null padded (`*b\"USD\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"`) or a SPL token mint pubkey"
1719
+ ],
1720
+ "type": {
1721
+ "array": [
1722
+ "u8",
1723
+ 32
1724
+ ]
1725
+ }
1726
+ },
1727
+ {
1728
+ "name": "referralFeeBps",
1729
+ "docs": [
1730
+ "Referral fee for the lending market, as bps out of the total protocol fee"
1731
+ ],
1732
+ "type": "u16"
1733
+ },
1734
+ {
1735
+ "name": "emergencyMode",
1736
+ "type": "u8"
1737
+ },
1738
+ {
1739
+ "name": "autodeleverageEnabled",
1740
+ "docs": [
1741
+ "Whether the obligations on this market should be subject to auto-deleveraging after deposit",
1742
+ "or borrow limit is crossed.",
1743
+ "Besides this flag, the particular reserve's flag also needs to be enabled (logical `AND`).",
1744
+ "**NOTE:** this also affects the individual \"target LTV\" deleveraging."
1745
+ ],
1746
+ "type": "u8"
1747
+ },
1748
+ {
1749
+ "name": "borrowDisabled",
1750
+ "type": "u8"
1751
+ },
1752
+ {
1753
+ "name": "priceRefreshTriggerToMaxAgePct",
1754
+ "docs": [
1755
+ "Refresh price from oracle only if it's older than this percentage of the price max age.",
1756
+ "e.g. if the max age is set to 100s and this is set to 80%, the price will be refreshed if it's older than 80s.",
1757
+ "Price is always refreshed if this set to 0."
1758
+ ],
1759
+ "type": "u8"
1760
+ },
1761
+ {
1762
+ "name": "liquidationMaxDebtCloseFactorPct",
1763
+ "docs": [
1764
+ "Percentage of the total borrowed value in an obligation available for liquidation"
1765
+ ],
1766
+ "type": "u8"
1767
+ },
1768
+ {
1769
+ "name": "insolvencyRiskUnhealthyLtvPct",
1770
+ "docs": [
1771
+ "Minimum acceptable unhealthy LTV before max_debt_close_factor_pct becomes 100%"
1772
+ ],
1773
+ "type": "u8"
1774
+ },
1775
+ {
1776
+ "name": "minFullLiquidationValueThreshold",
1777
+ "docs": [
1778
+ "Minimum liquidation value threshold triggering full liquidation for an obligation, in full",
1779
+ "units of the quote currency (e.g. `2` means \"$2\", not \"2 lamports of USDC\")."
1780
+ ],
1781
+ "type": "u64"
1782
+ },
1783
+ {
1784
+ "name": "maxLiquidatableDebtMarketValueAtOnce",
1785
+ "docs": [
1786
+ "Max allowed liquidation value in one ix call"
1787
+ ],
1788
+ "type": "u64"
1789
+ },
1790
+ {
1791
+ "name": "reserved0",
1792
+ "docs": [
1793
+ "[DEPRECATED] Global maximum unhealthy borrow value allowed for any obligation"
1794
+ ],
1795
+ "type": {
1796
+ "array": [
1797
+ "u8",
1798
+ 8
1799
+ ]
1800
+ }
1801
+ },
1802
+ {
1803
+ "name": "globalAllowedBorrowValue",
1804
+ "docs": [
1805
+ "Global maximum allowed borrow value allowed for any obligation"
1806
+ ],
1807
+ "type": "u64"
1808
+ },
1809
+ {
1810
+ "name": "riskCouncil",
1811
+ "docs": [
1812
+ "The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol"
1813
+ ],
1814
+ "type": "publicKey"
1815
+ },
1816
+ {
1817
+ "name": "reserved1",
1818
+ "docs": [
1819
+ "[DEPRECATED] Reward points multiplier per obligation type"
1820
+ ],
1821
+ "type": {
1822
+ "array": [
1823
+ "u8",
1824
+ 8
1825
+ ]
1826
+ }
1827
+ },
1828
+ {
1829
+ "name": "elevationGroups",
1830
+ "docs": [
1831
+ "Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold"
1832
+ ],
1833
+ "type": {
1834
+ "array": [
1835
+ {
1836
+ "defined": "ElevationGroup"
1837
+ },
1838
+ 32
1839
+ ]
1840
+ }
1841
+ },
1842
+ {
1843
+ "name": "elevationGroupPadding",
1844
+ "type": {
1845
+ "array": [
1846
+ "u64",
1847
+ 90
1848
+ ]
1849
+ }
1850
+ },
1851
+ {
1852
+ "name": "minNetValueInObligationSf",
1853
+ "docs": [
1854
+ "Min net value accepted to be found in a position after any lending action in an obligation (scaled by quote currency decimals)"
1855
+ ],
1856
+ "type": "u128"
1857
+ },
1858
+ {
1859
+ "name": "minValueSkipLiquidationLtvChecks",
1860
+ "docs": [
1861
+ "Minimum value to enforce smallest ltv priority checks on the collateral reserves on liquidation"
1862
+ ],
1863
+ "type": "u64"
1864
+ },
1865
+ {
1866
+ "name": "name",
1867
+ "docs": [
1868
+ "Market name, zero-padded."
1869
+ ],
1870
+ "type": {
1871
+ "array": [
1872
+ "u8",
1873
+ 32
1874
+ ]
1875
+ }
1876
+ },
1877
+ {
1878
+ "name": "minValueSkipLiquidationBfChecks",
1879
+ "docs": [
1880
+ "Minimum value to enforce highest borrow factor priority checks on the debt reserves on liquidation"
1881
+ ],
1882
+ "type": "u64"
1883
+ },
1884
+ {
1885
+ "name": "individualAutodeleverageMarginCallPeriodSecs",
1886
+ "docs": [
1887
+ "Time (in seconds) that must pass before liquidation is allowed on an obligation that has",
1888
+ "been individually marked for auto-deleveraging (by the risk council)."
1889
+ ],
1890
+ "type": "u64"
1891
+ },
1892
+ {
1893
+ "name": "minInitialDepositAmount",
1894
+ "docs": [
1895
+ "Minimum amount of deposit at creation of a reserve to prevent artificial inflation",
1896
+ "Note: this amount cannot be recovered, the ctoken associated are never minted"
1897
+ ],
1898
+ "type": "u64"
1899
+ },
1900
+ {
1901
+ "name": "obligationOrderExecutionEnabled",
1902
+ "docs": [
1903
+ "Whether the obligation orders should be evaluated during liquidations."
1904
+ ],
1905
+ "type": "u8"
1906
+ },
1907
+ {
1908
+ "name": "immutable",
1909
+ "docs": [
1910
+ "Whether the lending market is set as immutable."
1911
+ ],
1912
+ "type": "u8"
1913
+ },
1914
+ {
1915
+ "name": "obligationOrderCreationEnabled",
1916
+ "docs": [
1917
+ "Whether new obligation orders can be created.",
1918
+ "Note: updating or cancelling existing orders is *not* affected by this flag."
1919
+ ],
1920
+ "type": "u8"
1921
+ },
1922
+ {
1923
+ "name": "priceTriggeredLiquidationDisabled",
1924
+ "docs": [
1925
+ "Whether the liquidation operations that are triggered by price changes should be disabled.",
1926
+ "This includes regular liquidation (i.e. LTV exceeding the unhealthy threshold) and some",
1927
+ "obligation orders' execution.",
1928
+ "",
1929
+ "*Caution:* this flag is *disabling* the liquidations when `1` - contrary to all the other",
1930
+ "liquidation-driving flags (see e.g. [Self::autodeleverage_enabled])."
1931
+ ],
1932
+ "type": "u8"
1933
+ },
1934
+ {
1935
+ "name": "matureReserveDebtLiquidationEnabled",
1936
+ "docs": [
1937
+ "Whether the debts that reached their reserve's [ReserveConfig::debt_maturity_timestamp] can",
1938
+ "be liquidated."
1939
+ ],
1940
+ "type": "u8"
1941
+ },
1942
+ {
1943
+ "name": "obligationBorrowDebtTermLiquidationEnabled",
1944
+ "docs": [
1945
+ "Whether the [Obligation::borrows] that reached their [ReserveConfig::debt_term_seconds] can",
1946
+ "be liquidated."
1947
+ ],
1948
+ "type": "u8"
1949
+ },
1950
+ {
1951
+ "name": "borrowOrderCreationEnabled",
1952
+ "docs": [
1953
+ "Whether new borrow orders can be created.",
1954
+ "Note: updating or cancelling existing orders is *not* affected by this flag."
1955
+ ],
1956
+ "type": "u8"
1957
+ },
1958
+ {
1959
+ "name": "borrowOrderExecutionEnabled",
1960
+ "docs": [
1961
+ "Whether the existing borrow orders can be filled."
1962
+ ],
1963
+ "type": "u8"
1964
+ },
1965
+ {
1966
+ "name": "proposerAuthority",
1967
+ "docs": [
1968
+ "Authority that can propose creating of new reserves but cannot enable them."
1969
+ ],
1970
+ "type": "publicKey"
1971
+ },
1972
+ {
1973
+ "name": "withdrawTicketIssuanceEnabled",
1974
+ "docs": [
1975
+ "Whether any new withdraw tickets can be issued (i.e. whether new requests can enter the",
1976
+ "withdraw queue)."
1977
+ ],
1978
+ "type": "u8"
1979
+ },
1980
+ {
1981
+ "name": "withdrawTicketRedemptionEnabled",
1982
+ "docs": [
1983
+ "Whether the existing withdraw tickets can be redeemed (i.e. whether the tickets can be used",
1984
+ "to transfer accumulated pending liquidity to destination accounts)."
1985
+ ],
1986
+ "type": "u8"
1987
+ },
1988
+ {
1989
+ "name": "obligationBorrowRolloverConfigurationEnabled",
1990
+ "docs": [
1991
+ "Whether the owners can enable the \"fixed term borrow rollover\" on their obligations.",
1992
+ "",
1993
+ "*Note 1:* the actual execution of (different kinds of) rollovers can be disabled by zeroing",
1994
+ "[Self::fixed_rollover_window_duration_seconds] and",
1995
+ "[Self::variable_rollover_window_duration_seconds].",
1996
+ "",
1997
+ "*Note 2:* when this configuration is disabled, the obligation owners can still disable their",
1998
+ "rollover (i.e. set the obligation's flags to zeroes)."
1999
+ ],
2000
+ "type": "u8"
2001
+ },
2002
+ {
2003
+ "name": "padding2",
2004
+ "type": {
2005
+ "array": [
2006
+ "u8",
2007
+ 5
2008
+ ]
2009
+ }
2010
+ },
2011
+ {
2012
+ "name": "minWithdrawQueuedLiquidityValue",
2013
+ "docs": [
2014
+ "Minimum value that can be withdrawn in a single `withdraw_queued_liquidity()` call, in full",
2015
+ "units of the quote currency (e.g. `2` means \"$2\", not \"2 lamports of USDC\")."
2016
+ ],
2017
+ "type": "u64"
2018
+ },
2019
+ {
2020
+ "name": "fixedRolloverWindowDurationSeconds",
2021
+ "docs": [
2022
+ "A configurable time window (right before the end of a fixed debt term) during which an",
2023
+ "auto-rollover into another *fixed* rate/term can happen.",
2024
+ "",
2025
+ "When zeroed, this rollover mode is effectively disabled.",
2026
+ "",
2027
+ "See [FixedTermBorrowRolloverConfig]."
2028
+ ],
2029
+ "type": "u64"
2030
+ },
2031
+ {
2032
+ "name": "variableRolloverWindowDurationSeconds",
2033
+ "docs": [
2034
+ "A configurable time window (right before the end of a fixed debt term) during which an",
2035
+ "auto-rollover into a *variable* (indefinite) rate/term can happen.",
2036
+ "",
2037
+ "When zeroed, this rollover mode is effectively disabled.",
2038
+ "",
2039
+ "This will typically be shorter than [Self::fixed_rollover_window_duration_seconds], acting",
2040
+ "as a fallback if a fixed reserve liquidity remains unavailable for considerable time."
2041
+ ],
2042
+ "type": "u64"
2043
+ },
2044
+ {
2045
+ "name": "padding1",
2046
+ "type": {
2047
+ "array": [
2048
+ "u64",
2049
+ 161
2050
+ ]
2051
+ }
2052
+ }
2053
+ ]
2054
+ }
2055
+ },
2056
+ {
2057
+ "name": "Obligation",
2058
+ "docs": [
2059
+ "Lending market obligation state"
2060
+ ],
2061
+ "type": {
2062
+ "kind": "struct",
2063
+ "fields": [
2064
+ {
2065
+ "name": "tag",
2066
+ "docs": [
2067
+ "Version of the struct"
2068
+ ],
2069
+ "type": "u64"
2070
+ },
2071
+ {
2072
+ "name": "lastUpdate",
2073
+ "docs": [
2074
+ "Last update to collateral, liquidity, or their market values"
2075
+ ],
2076
+ "type": {
2077
+ "defined": "LastUpdate"
2078
+ }
2079
+ },
2080
+ {
2081
+ "name": "lendingMarket",
2082
+ "docs": [
2083
+ "Lending market address"
2084
+ ],
2085
+ "type": "publicKey"
2086
+ },
2087
+ {
2088
+ "name": "owner",
2089
+ "docs": [
2090
+ "Owner authority which can borrow liquidity"
2091
+ ],
2092
+ "type": "publicKey"
2093
+ },
2094
+ {
2095
+ "name": "deposits",
2096
+ "docs": [
2097
+ "Deposited collateral for the obligation, unique by deposit reserve address"
2098
+ ],
2099
+ "type": {
2100
+ "array": [
2101
+ {
2102
+ "defined": "ObligationCollateral"
2103
+ },
2104
+ 8
2105
+ ]
2106
+ }
2107
+ },
2108
+ {
2109
+ "name": "lowestReserveDepositLiquidationLtv",
2110
+ "docs": [
2111
+ "Worst LTV for the collaterals backing the loan, represented as a percentage"
2112
+ ],
2113
+ "type": "u64"
2114
+ },
2115
+ {
2116
+ "name": "depositedValueSf",
2117
+ "docs": [
2118
+ "Market value of deposits (scaled fraction)"
2119
+ ],
2120
+ "type": "u128"
2121
+ },
2122
+ {
2123
+ "name": "borrows",
2124
+ "docs": [
2125
+ "Borrowed liquidity for the obligation, unique by borrow reserve address"
2126
+ ],
2127
+ "type": {
2128
+ "array": [
2129
+ {
2130
+ "defined": "ObligationLiquidity"
2131
+ },
2132
+ 5
2133
+ ]
2134
+ }
2135
+ },
2136
+ {
2137
+ "name": "borrowFactorAdjustedDebtValueSf",
2138
+ "docs": [
2139
+ "Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction)"
2140
+ ],
2141
+ "type": "u128"
2142
+ },
2143
+ {
2144
+ "name": "borrowedAssetsMarketValueSf",
2145
+ "docs": [
2146
+ "Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction)"
2147
+ ],
2148
+ "type": "u128"
2149
+ },
2150
+ {
2151
+ "name": "allowedBorrowValueSf",
2152
+ "docs": [
2153
+ "The maximum borrow value at the weighted average loan to value ratio (scaled fraction)"
2154
+ ],
2155
+ "type": "u128"
2156
+ },
2157
+ {
2158
+ "name": "unhealthyBorrowValueSf",
2159
+ "docs": [
2160
+ "The dangerous borrow value at the weighted average liquidation threshold (scaled fraction)"
2161
+ ],
2162
+ "type": "u128"
2163
+ },
2164
+ {
2165
+ "name": "paddingDeprecatedAssetTiers",
2166
+ "docs": [
2167
+ "The asset tier of the deposits"
2168
+ ],
2169
+ "type": {
2170
+ "array": [
2171
+ "u8",
2172
+ 13
2173
+ ]
2174
+ }
2175
+ },
2176
+ {
2177
+ "name": "elevationGroup",
2178
+ "docs": [
2179
+ "The elevation group id the obligation opted into."
2180
+ ],
2181
+ "type": "u8"
2182
+ },
2183
+ {
2184
+ "name": "numOfObsoleteDepositReserves",
2185
+ "docs": [
2186
+ "The number of obsolete reserves the obligation has a deposit in"
2187
+ ],
2188
+ "type": "u8"
2189
+ },
2190
+ {
2191
+ "name": "hasDebt",
2192
+ "docs": [
2193
+ "Marked = 1 if borrows array is not empty, 0 = borrows empty"
2194
+ ],
2195
+ "type": "u8"
2196
+ },
2197
+ {
2198
+ "name": "referrer",
2199
+ "docs": [
2200
+ "Wallet address of the referrer"
2201
+ ],
2202
+ "type": "publicKey"
2203
+ },
2204
+ {
2205
+ "name": "borrowingDisabled",
2206
+ "docs": [
2207
+ "Marked = 1 if borrowing disabled, 0 = borrowing enabled"
2208
+ ],
2209
+ "type": "u8"
2210
+ },
2211
+ {
2212
+ "name": "autodeleverageTargetLtvPct",
2213
+ "docs": [
2214
+ "A target LTV set by the risk council when marking this obligation for deleveraging.",
2215
+ "Only effective when `deleveraging_margin_call_started_slot != 0`."
2216
+ ],
2217
+ "type": "u8"
2218
+ },
2219
+ {
2220
+ "name": "lowestReserveDepositMaxLtvPct",
2221
+ "docs": [
2222
+ "The lowest max LTV found amongst the collateral deposits"
2223
+ ],
2224
+ "type": "u8"
2225
+ },
2226
+ {
2227
+ "name": "numOfObsoleteBorrowReserves",
2228
+ "docs": [
2229
+ "The number of obsolete reserves the obligation has a borrow in"
2230
+ ],
2231
+ "type": "u8"
2232
+ },
2233
+ {
2234
+ "name": "reserved",
2235
+ "type": {
2236
+ "array": [
2237
+ "u8",
2238
+ 4
2239
+ ]
2240
+ }
2241
+ },
2242
+ {
2243
+ "name": "highestBorrowFactorPct",
2244
+ "type": "u64"
2245
+ },
2246
+ {
2247
+ "name": "autodeleverageMarginCallStartedTimestamp",
2248
+ "docs": [
2249
+ "A timestamp at which the risk council most-recently marked this obligation for deleveraging.",
2250
+ "Zero if not currently subject to deleveraging."
2251
+ ],
2252
+ "type": "u64"
2253
+ },
2254
+ {
2255
+ "name": "obligationOrders",
2256
+ "docs": [
2257
+ "Owner-defined, permissionlessly-executed repay orders.",
2258
+ "Typical use-cases would be a stop-loss and a take-profit (possibly co-existing)."
2259
+ ],
2260
+ "type": {
2261
+ "array": [
2262
+ {
2263
+ "defined": "ObligationOrder"
2264
+ },
2265
+ 2
2266
+ ]
2267
+ }
2268
+ },
2269
+ {
2270
+ "name": "borrowOrder",
2271
+ "docs": [
2272
+ "Owner-defined, permissionlessly-executed borrow order applicable to this obligation.",
2273
+ "Non-zeroed only on a newly-initialized fixed-rate, fixed-term obligation."
2274
+ ],
2275
+ "type": {
2276
+ "defined": "BorrowOrder"
2277
+ }
2278
+ },
2279
+ {
2280
+ "name": "padding3",
2281
+ "type": {
2282
+ "array": [
2283
+ "u64",
2284
+ 73
2285
+ ]
2286
+ }
2287
+ }
2288
+ ]
2289
+ }
2290
+ },
2291
+ {
2292
+ "name": "ReferrerTokenState",
2293
+ "docs": [
2294
+ "Referrer account -> each owner can have multiple accounts for specific reserves"
2295
+ ],
2296
+ "type": {
2297
+ "kind": "struct",
2298
+ "fields": [
2299
+ {
2300
+ "name": "referrer",
2301
+ "docs": [
2302
+ "Pubkey of the referrer/owner"
2303
+ ],
2304
+ "type": "publicKey"
2305
+ },
2306
+ {
2307
+ "name": "mint",
2308
+ "docs": [
2309
+ "Token mint for the account"
2310
+ ],
2311
+ "type": "publicKey"
2312
+ },
2313
+ {
2314
+ "name": "amountUnclaimedSf",
2315
+ "docs": [
2316
+ "Amount that has been accumulated and not claimed yet -> available to claim (scaled fraction)"
2317
+ ],
2318
+ "type": "u128"
2319
+ },
2320
+ {
2321
+ "name": "amountCumulativeSf",
2322
+ "docs": [
2323
+ "Amount that has been accumulated in total -> both already claimed and unclaimed (scaled fraction)"
2324
+ ],
2325
+ "type": "u128"
2326
+ },
2327
+ {
2328
+ "name": "bump",
2329
+ "docs": [
2330
+ "Referrer token state bump, used for address validation"
2331
+ ],
2332
+ "type": "u64"
2333
+ },
2334
+ {
2335
+ "name": "padding",
2336
+ "type": {
2337
+ "array": [
2338
+ "u64",
2339
+ 31
2340
+ ]
2341
+ }
2342
+ }
2343
+ ]
2344
+ }
2345
+ },
2346
+ {
2347
+ "name": "Reserve",
2348
+ "type": {
2349
+ "kind": "struct",
2350
+ "fields": [
2351
+ {
2352
+ "name": "version",
2353
+ "docs": [
2354
+ "Version of the reserve"
2355
+ ],
2356
+ "type": "u64"
2357
+ },
2358
+ {
2359
+ "name": "lastUpdate",
2360
+ "docs": [
2361
+ "Last slot when supply and rates updated"
2362
+ ],
2363
+ "type": {
2364
+ "defined": "LastUpdate"
2365
+ }
2366
+ },
2367
+ {
2368
+ "name": "lendingMarket",
2369
+ "docs": [
2370
+ "Lending market address"
2371
+ ],
2372
+ "type": "publicKey"
2373
+ },
2374
+ {
2375
+ "name": "farmCollateral",
2376
+ "type": "publicKey"
2377
+ },
2378
+ {
2379
+ "name": "farmDebt",
2380
+ "type": "publicKey"
2381
+ },
2382
+ {
2383
+ "name": "liquidity",
2384
+ "docs": [
2385
+ "Reserve liquidity"
2386
+ ],
2387
+ "type": {
2388
+ "defined": "ReserveLiquidity"
2389
+ }
2390
+ },
2391
+ {
2392
+ "name": "reserveLiquidityPadding",
2393
+ "type": {
2394
+ "array": [
2395
+ "u64",
2396
+ 150
2397
+ ]
2398
+ }
2399
+ },
2400
+ {
2401
+ "name": "collateral",
2402
+ "docs": [
2403
+ "Reserve collateral"
2404
+ ],
2405
+ "type": {
2406
+ "defined": "ReserveCollateral"
2407
+ }
2408
+ },
2409
+ {
2410
+ "name": "reserveCollateralPadding",
2411
+ "type": {
2412
+ "array": [
2413
+ "u64",
2414
+ 150
2415
+ ]
2416
+ }
2417
+ },
2418
+ {
2419
+ "name": "config",
2420
+ "docs": [
2421
+ "Reserve configuration values"
2422
+ ],
2423
+ "type": {
2424
+ "defined": "ReserveConfig"
2425
+ }
2426
+ },
2427
+ {
2428
+ "name": "configPadding",
2429
+ "type": {
2430
+ "array": [
2431
+ "u64",
2432
+ 114
2433
+ ]
2434
+ }
2435
+ },
2436
+ {
2437
+ "name": "borrowedAmountOutsideElevationGroup",
2438
+ "type": "u64"
2439
+ },
2440
+ {
2441
+ "name": "borrowedAmountsAgainstThisReserveInElevationGroups",
2442
+ "docs": [
2443
+ "Amount of token borrowed in lamport of debt asset in the given",
2444
+ "elevation group when this reserve is part of the collaterals."
2445
+ ],
2446
+ "type": {
2447
+ "array": [
2448
+ "u64",
2449
+ 32
2450
+ ]
2451
+ }
2452
+ },
2453
+ {
2454
+ "name": "withdrawQueue",
2455
+ "docs": [
2456
+ "The tracker of ticket-based withdrawals."
2457
+ ],
2458
+ "type": {
2459
+ "defined": "WithdrawQueue"
2460
+ }
2461
+ },
2462
+ {
2463
+ "name": "padding",
2464
+ "type": {
2465
+ "array": [
2466
+ "u64",
2467
+ 204
2468
+ ]
2469
+ }
2470
+ }
2471
+ ]
2472
+ }
2473
+ },
2474
+ {
2475
+ "name": "WithdrawTicket",
2476
+ "docs": [
2477
+ "A finite-lifecycle account representing a specific depositor's place in the withdraw queue of",
2478
+ "a specific reserve.",
2479
+ "",
2480
+ "The lifecycle:",
2481
+ "1. The depositor holding ctokens wants to withdraw funds from the reserve, and finds out that",
2482
+ "the required amount is not available (due to high utilization).",
2483
+ "2. The depositor calls the `enqueue_to_withdraw` handler.",
2484
+ "3. The handler transfers the depositor's ctokens to the reserve's internal \"pending\" vault.",
2485
+ "4. The handler initializes a new [WithdrawTicket] account, with the next available sequence",
2486
+ "number.",
2487
+ "5. The depositor waits until his ticket is the next expected one for actual withdraw, and until",
2488
+ "the reserve has enough liquidity.",
2489
+ "6. Anyone (the depositor or a bot) calls the permissionless `withdraw_queued_liquidity`",
2490
+ "handler. If the ticket became invalid (e.g. destination account no longer exists), then the",
2491
+ "depositor can call the `recover_invalid_ticket_collateral` handler instead.",
2492
+ "7. The handler transfers the liquidity amount according to the current exchange rate.",
2493
+ "8. The handler closes the ticket account."
2494
+ ],
2495
+ "type": {
2496
+ "kind": "struct",
2497
+ "fields": [
2498
+ {
2499
+ "name": "sequenceNumber",
2500
+ "docs": [
2501
+ "This ticket's place in the queue; the same as used for PDA derivation."
2502
+ ],
2503
+ "type": "u64"
2504
+ },
2505
+ {
2506
+ "name": "owner",
2507
+ "docs": [
2508
+ "The funds' owner (the user who called the `enqueue_to_withdraw` handler)."
2509
+ ],
2510
+ "type": "publicKey"
2511
+ },
2512
+ {
2513
+ "name": "reserve",
2514
+ "docs": [
2515
+ "The reserve to withdraw from."
2516
+ ],
2517
+ "type": "publicKey"
2518
+ },
2519
+ {
2520
+ "name": "userDestinationLiquidityTa",
2521
+ "docs": [
2522
+ "The token account to which the finally-available liquidity should be transferred (by the",
2523
+ "`withdraw_queued_liquidity` handler)."
2524
+ ],
2525
+ "type": "publicKey"
2526
+ },
2527
+ {
2528
+ "name": "queuedCollateralAmount",
2529
+ "docs": [
2530
+ "The amount of collateral still waiting to be withdrawn using this ticket."
2531
+ ],
2532
+ "type": "u64"
2533
+ },
2534
+ {
2535
+ "name": "createdAtTimestamp",
2536
+ "docs": [
2537
+ "The timestamp at which the queue was entered.",
2538
+ "",
2539
+ "This is currently only a piece of metadata, not used by the logic."
2540
+ ],
2541
+ "type": "u64"
2542
+ },
2543
+ {
2544
+ "name": "invalid",
2545
+ "docs": [
2546
+ "Whether the ticket has been found to be invalid (e.g. the [Self::user_destination_liquidity]",
2547
+ "has been repurposed) by the `withdraw_queued_liquidity` handler.",
2548
+ "To be specific: valid = `0`, invalid = `1`.",
2549
+ "",
2550
+ "An invalid ticket cannot be made valid again, and can only be passed to the",
2551
+ "`recover_invalid_ticket_collateral` handler."
2552
+ ],
2553
+ "type": "u8"
2554
+ },
2555
+ {
2556
+ "name": "progressCallbackType",
2557
+ "docs": [
2558
+ "One of the valid [ProgressCallbackType] representations."
2559
+ ],
2560
+ "type": "u8"
2561
+ },
2562
+ {
2563
+ "name": "alignmentPadding",
2564
+ "docs": [
2565
+ "Inner padding, for alignment."
2566
+ ],
2567
+ "type": {
2568
+ "array": [
2569
+ "u8",
2570
+ 6
2571
+ ]
2572
+ }
2573
+ },
2574
+ {
2575
+ "name": "progressCallbackCustomAccounts",
2576
+ "docs": [
2577
+ "The (optional) accounts to be used by [Self::progress_callback_type]s."
2578
+ ],
2579
+ "type": {
2580
+ "array": [
2581
+ "publicKey",
2582
+ 2
2583
+ ]
2584
+ }
2585
+ },
2586
+ {
2587
+ "name": "endPadding",
2588
+ "docs": [
2589
+ "Trailing padding, for future developments."
2590
+ ],
2591
+ "type": {
2592
+ "array": [
2593
+ "u64",
2594
+ 40
2595
+ ]
2596
+ }
2597
+ }
2598
+ ]
2599
+ }
2600
+ },
2601
+ {
2602
+ "name": "GlobalConfig",
2603
+ "type": {
2604
+ "kind": "struct",
2605
+ "fields": [
2606
+ {
2607
+ "name": "globalAdmin",
2608
+ "type": "publicKey"
2609
+ },
2610
+ {
2611
+ "name": "pendingAdmin",
2612
+ "type": "publicKey"
2613
+ },
2614
+ {
2615
+ "name": "withdrawalPenaltyLamports",
2616
+ "type": "u64"
2617
+ },
2618
+ {
2619
+ "name": "withdrawalPenaltyBps",
2620
+ "type": "u64"
2621
+ },
2622
+ {
2623
+ "name": "padding",
2624
+ "type": {
2625
+ "array": [
2626
+ "u8",
2627
+ 944
2628
+ ]
2629
+ }
2630
+ }
2631
+ ]
2632
+ }
2633
+ },
2634
+ {
2635
+ "name": "ReserveWhitelistEntry",
2636
+ "type": {
2637
+ "kind": "struct",
2638
+ "fields": [
2639
+ {
2640
+ "name": "tokenMint",
2641
+ "docs": [
2642
+ "The token mint is stored to solve the problem of finding all the whitelisted reserves for a particular token mint:",
2643
+ "when storing the token mint inside the PDA, finding all the whitelisted reserves becomes a `getProgramAccounts` with",
2644
+ "a filter on discriminator + the mint field",
2645
+ "The reserve pubkey, as seed of the reserve whitelist PDA account, it stored so you can link back the PDA to its seeds",
2646
+ "(for instance, in the operation above we easily find the reserve corresponding to the PDA)"
2647
+ ],
2648
+ "type": "publicKey"
2649
+ },
2650
+ {
2651
+ "name": "reserve",
2652
+ "type": "publicKey"
2653
+ },
2654
+ {
2655
+ "name": "whitelistAddAllocation",
2656
+ "type": "u8"
2657
+ },
2658
+ {
2659
+ "name": "whitelistInvest",
2660
+ "type": "u8"
2661
+ },
2662
+ {
2663
+ "name": "padding",
2664
+ "type": {
2665
+ "array": [
2666
+ "u8",
2667
+ 62
2668
+ ]
2669
+ }
2670
+ }
2671
+ ]
2672
+ }
2673
+ },
2674
+ {
2675
+ "name": "VaultState",
2676
+ "type": {
2677
+ "kind": "struct",
2678
+ "fields": [
2679
+ {
2680
+ "name": "vaultAdminAuthority",
2681
+ "type": "publicKey"
2682
+ },
2683
+ {
2684
+ "name": "baseVaultAuthority",
2685
+ "type": "publicKey"
2686
+ },
2687
+ {
2688
+ "name": "baseVaultAuthorityBump",
2689
+ "type": "u64"
2690
+ },
2691
+ {
2692
+ "name": "tokenMint",
2693
+ "type": "publicKey"
2694
+ },
2695
+ {
2696
+ "name": "tokenMintDecimals",
2697
+ "type": "u64"
2698
+ },
2699
+ {
2700
+ "name": "tokenVault",
2701
+ "type": "publicKey"
2702
+ },
2703
+ {
2704
+ "name": "tokenProgram",
2705
+ "type": "publicKey"
2706
+ },
2707
+ {
2708
+ "name": "sharesMint",
2709
+ "type": "publicKey"
2710
+ },
2711
+ {
2712
+ "name": "sharesMintDecimals",
2713
+ "type": "u64"
2714
+ },
2715
+ {
2716
+ "name": "tokenAvailable",
2717
+ "type": "u64"
2718
+ },
2719
+ {
2720
+ "name": "sharesIssued",
2721
+ "type": "u64"
2722
+ },
2723
+ {
2724
+ "name": "availableCrankFunds",
2725
+ "type": "u64"
2726
+ },
2727
+ {
2728
+ "name": "unallocatedWeight",
2729
+ "type": "u64"
2730
+ },
2731
+ {
2732
+ "name": "performanceFeeBps",
2733
+ "type": "u64"
2734
+ },
2735
+ {
2736
+ "name": "managementFeeBps",
2737
+ "type": "u64"
2738
+ },
2739
+ {
2740
+ "name": "lastFeeChargeTimestamp",
2741
+ "type": "u64"
2742
+ },
2743
+ {
2744
+ "name": "prevAumSf",
2745
+ "type": "u128"
2746
+ },
2747
+ {
2748
+ "name": "pendingFeesSf",
2749
+ "type": "u128"
2750
+ },
2751
+ {
2752
+ "name": "vaultAllocationStrategy",
2753
+ "type": {
2754
+ "array": [
2755
+ {
2756
+ "defined": "VaultAllocation"
2757
+ },
2758
+ 25
2759
+ ]
2760
+ }
2761
+ },
2762
+ {
2763
+ "name": "padding1",
2764
+ "type": {
2765
+ "array": [
2766
+ "u128",
2767
+ 256
2768
+ ]
2769
+ }
2770
+ },
2771
+ {
2772
+ "name": "minDepositAmount",
2773
+ "type": "u64"
2774
+ },
2775
+ {
2776
+ "name": "minWithdrawAmount",
2777
+ "type": "u64"
2778
+ },
2779
+ {
2780
+ "name": "minInvestAmount",
2781
+ "type": "u64"
2782
+ },
2783
+ {
2784
+ "name": "minInvestDelaySlots",
2785
+ "type": "u64"
2786
+ },
2787
+ {
2788
+ "name": "crankFundFeePerReserve",
2789
+ "type": "u64"
2790
+ },
2791
+ {
2792
+ "name": "pendingAdmin",
2793
+ "type": "publicKey"
2794
+ },
2795
+ {
2796
+ "name": "cumulativeEarnedInterestSf",
2797
+ "type": "u128"
2798
+ },
2799
+ {
2800
+ "name": "cumulativeMgmtFeesSf",
2801
+ "type": "u128"
2802
+ },
2803
+ {
2804
+ "name": "cumulativePerfFeesSf",
2805
+ "type": "u128"
2806
+ },
2807
+ {
2808
+ "name": "name",
2809
+ "type": {
2810
+ "array": [
2811
+ "u8",
2812
+ 40
2813
+ ]
1341
2814
  }
1342
- }
1343
- ]
1344
- }
1345
- },
1346
- {
1347
- "name": "VaultState",
1348
- "type": {
1349
- "kind": "struct",
1350
- "fields": [
2815
+ },
1351
2816
  {
1352
- "name": "vaultAdminAuthority",
2817
+ "name": "vaultLookupTable",
1353
2818
  "type": "publicKey"
1354
2819
  },
1355
2820
  {
1356
- "name": "baseVaultAuthority",
2821
+ "name": "vaultFarm",
1357
2822
  "type": "publicKey"
1358
2823
  },
1359
2824
  {
1360
- "name": "baseVaultAuthorityBump",
2825
+ "name": "creationTimestamp",
1361
2826
  "type": "u64"
1362
2827
  },
1363
2828
  {
1364
- "name": "tokenMint",
2829
+ "name": "unallocatedTokensCap",
2830
+ "type": "u64"
2831
+ },
2832
+ {
2833
+ "name": "allocationAdmin",
1365
2834
  "type": "publicKey"
1366
2835
  },
1367
2836
  {
1368
- "name": "tokenMintDecimals",
2837
+ "name": "withdrawalPenaltyLamports",
1369
2838
  "type": "u64"
1370
2839
  },
1371
2840
  {
1372
- "name": "tokenVault",
1373
- "type": "publicKey"
2841
+ "name": "withdrawalPenaltyBps",
2842
+ "type": "u64"
1374
2843
  },
1375
2844
  {
1376
- "name": "tokenProgram",
2845
+ "name": "firstLossCapitalFarm",
1377
2846
  "type": "publicKey"
1378
2847
  },
1379
2848
  {
1380
- "name": "sharesMint",
1381
- "type": "publicKey"
2849
+ "name": "allowAllocationsInWhitelistedReservesOnly",
2850
+ "type": "u8"
1382
2851
  },
1383
2852
  {
1384
- "name": "sharesMintDecimals",
2853
+ "name": "allowInvestInWhitelistedReservesOnly",
2854
+ "type": "u8"
2855
+ },
2856
+ {
2857
+ "name": "padding2",
2858
+ "type": {
2859
+ "array": [
2860
+ "u8",
2861
+ 14
2862
+ ]
2863
+ }
2864
+ },
2865
+ {
2866
+ "name": "withdrawTicketRentBudget",
2867
+ "docs": [
2868
+ "The amount of native SOL (in lamports) held by the [Self::base_vault_authority] for Klend's",
2869
+ "withdraw ticket(s) rent purposes.",
2870
+ "",
2871
+ "Context: in order to disinvest from a 100%-utilized reserve, we need to enter the reserve's",
2872
+ "withdraw queue. Klend needs to issue a ticket, and wants to cover its rent from the owner's",
2873
+ "(i.e. vault authority's) account. If the budget is 0, we have to transfer a single ticket's",
2874
+ "rent from the transaction executor (i.e. Kvault's bot). Each ticket's rent is refunded when",
2875
+ "the ticket is closed, so typically this budget should be available - in fact, the total sum",
2876
+ "transferred from the executor here will be equal to the rent for a maximum number of",
2877
+ "tickets that have ever been simultaneously in-flight."
2878
+ ],
1385
2879
  "type": "u64"
1386
2880
  },
1387
2881
  {
1388
- "name": "tokenAvailable",
2882
+ "name": "padding4",
1389
2883
  "type": "u64"
1390
2884
  },
1391
2885
  {
1392
- "name": "sharesIssued",
2886
+ "name": "padding3",
2887
+ "type": {
2888
+ "array": [
2889
+ "u128",
2890
+ 237
2891
+ ]
2892
+ }
2893
+ }
2894
+ ]
2895
+ }
2896
+ }
2897
+ ],
2898
+ "types": [
2899
+ {
2900
+ "name": "LastUpdate",
2901
+ "docs": [
2902
+ "Last update state"
2903
+ ],
2904
+ "type": {
2905
+ "kind": "struct",
2906
+ "fields": [
2907
+ {
2908
+ "name": "slot",
2909
+ "docs": [
2910
+ "Last slot when updated"
2911
+ ],
1393
2912
  "type": "u64"
1394
2913
  },
1395
2914
  {
1396
- "name": "availableCrankFunds",
2915
+ "name": "stale",
2916
+ "docs": [
2917
+ "True when marked stale, false when slot updated"
2918
+ ],
2919
+ "type": "u8"
2920
+ },
2921
+ {
2922
+ "name": "priceStatus",
2923
+ "docs": [
2924
+ "Status of the prices used to calculate the last update"
2925
+ ],
2926
+ "type": "u8"
2927
+ },
2928
+ {
2929
+ "name": "placeholder",
2930
+ "type": {
2931
+ "array": [
2932
+ "u8",
2933
+ 6
2934
+ ]
2935
+ }
2936
+ }
2937
+ ]
2938
+ }
2939
+ },
2940
+ {
2941
+ "name": "ElevationGroup",
2942
+ "type": {
2943
+ "kind": "struct",
2944
+ "fields": [
2945
+ {
2946
+ "name": "maxLiquidationBonusBps",
2947
+ "type": "u16"
2948
+ },
2949
+ {
2950
+ "name": "id",
2951
+ "type": "u8"
2952
+ },
2953
+ {
2954
+ "name": "ltvPct",
2955
+ "type": "u8"
2956
+ },
2957
+ {
2958
+ "name": "liquidationThresholdPct",
2959
+ "type": "u8"
2960
+ },
2961
+ {
2962
+ "name": "allowNewLoans",
2963
+ "type": "u8"
2964
+ },
2965
+ {
2966
+ "name": "maxReservesAsCollateral",
2967
+ "type": "u8"
2968
+ },
2969
+ {
2970
+ "name": "padding0",
2971
+ "type": "u8"
2972
+ },
2973
+ {
2974
+ "name": "debtReserve",
2975
+ "docs": [
2976
+ "Mandatory debt reserve for this elevation group"
2977
+ ],
2978
+ "type": "publicKey"
2979
+ },
2980
+ {
2981
+ "name": "padding1",
2982
+ "type": {
2983
+ "array": [
2984
+ "u64",
2985
+ 4
2986
+ ]
2987
+ }
2988
+ }
2989
+ ]
2990
+ }
2991
+ },
2992
+ {
2993
+ "name": "BorrowOrder",
2994
+ "docs": [
2995
+ "A borrow order.",
2996
+ "",
2997
+ "When the [Obligation::borrow_order] is populated (i.e. non-zeroed) on an Obligation, then the",
2998
+ "permissionless \"fill\" operations may borrow liquidity to the owner according to this",
2999
+ "specification."
3000
+ ],
3001
+ "type": {
3002
+ "kind": "struct",
3003
+ "fields": [
3004
+ {
3005
+ "name": "debtLiquidityMint",
3006
+ "docs": [
3007
+ "The asset to be borrowed.",
3008
+ "The reserves used for [Obligation::borrows] *must* all provide exactly this asset."
3009
+ ],
3010
+ "type": "publicKey"
3011
+ },
3012
+ {
3013
+ "name": "remainingDebtAmount",
3014
+ "docs": [
3015
+ "The amount of debt that still needs to be filled, in lamports."
3016
+ ],
1397
3017
  "type": "u64"
1398
3018
  },
1399
3019
  {
1400
- "name": "unallocatedWeight",
3020
+ "name": "filledDebtDestination",
3021
+ "docs": [
3022
+ "The token account owned by the [Obligation::owner] and holding [Self::debt_liquidity_mint],",
3023
+ "where the filled funds should be transferred to."
3024
+ ],
3025
+ "type": "publicKey"
3026
+ },
3027
+ {
3028
+ "name": "minDebtTermSeconds",
3029
+ "docs": [
3030
+ "The minimum allowed debt term that the obligation owner agrees to.",
3031
+ "The reserves used to fill this order *cannot* define their debt term *lower* than this.",
3032
+ "",
3033
+ "If zeroed, then only open-term reserves may be used."
3034
+ ],
1401
3035
  "type": "u64"
1402
3036
  },
1403
3037
  {
1404
- "name": "performanceFeeBps",
3038
+ "name": "fillableUntilTimestamp",
3039
+ "docs": [
3040
+ "The time until which the borrow order can still be filled."
3041
+ ],
1405
3042
  "type": "u64"
1406
3043
  },
1407
3044
  {
1408
- "name": "managementFeeBps",
3045
+ "name": "placedAtTimestamp",
3046
+ "docs": [
3047
+ "The time at which this order was placed.",
3048
+ "Currently, this is only a piece of metadata."
3049
+ ],
1409
3050
  "type": "u64"
1410
3051
  },
1411
3052
  {
1412
- "name": "lastFeeChargeTimestamp",
3053
+ "name": "lastUpdatedAtTimestamp",
3054
+ "docs": [
3055
+ "The time at which this order was most-recently updated (including: created).",
3056
+ "Currently, this is only a piece of metadata."
3057
+ ],
1413
3058
  "type": "u64"
1414
3059
  },
1415
3060
  {
1416
- "name": "prevAumSf",
1417
- "type": "u128"
3061
+ "name": "requestedDebtAmount",
3062
+ "docs": [
3063
+ "The amount of debt that was originally requested when this order was most-recently updated.",
3064
+ "In other words: this field holds a value of [Self::remaining_debt_amount] captured at",
3065
+ "[Self::last_updated_at_timestamp].",
3066
+ "Currently, this is only a piece of metadata."
3067
+ ],
3068
+ "type": "u64"
1418
3069
  },
1419
3070
  {
1420
- "name": "pendingFeesSf",
1421
- "type": "u128"
3071
+ "name": "maxBorrowRateBps",
3072
+ "docs": [
3073
+ "The maximum borrow rate that the obligation owner agrees to.",
3074
+ "The reserves used for [Obligation::borrows] *cannot* define their maximum borrow rate",
3075
+ "*higher* than this."
3076
+ ],
3077
+ "type": "u32"
1422
3078
  },
1423
3079
  {
1424
- "name": "vaultAllocationStrategy",
3080
+ "name": "padding1",
3081
+ "docs": [
3082
+ "Alignment padding."
3083
+ ],
1425
3084
  "type": {
1426
3085
  "array": [
1427
- {
1428
- "defined": "VaultAllocation"
1429
- },
1430
- 25
3086
+ "u8",
3087
+ 4
1431
3088
  ]
1432
3089
  }
1433
3090
  },
1434
3091
  {
1435
- "name": "padding1",
3092
+ "name": "endPadding",
3093
+ "docs": [
3094
+ "End padding."
3095
+ ],
1436
3096
  "type": {
1437
3097
  "array": [
1438
- "u128",
1439
- 256
3098
+ "u64",
3099
+ 5
1440
3100
  ]
1441
3101
  }
1442
- },
3102
+ }
3103
+ ]
3104
+ }
3105
+ },
3106
+ {
3107
+ "name": "FixedTermBorrowRolloverConfig",
3108
+ "docs": [
3109
+ "Settings driving the auto-rollover of an [ObligationLiquidity] that uses a fixed-term [Reserve]",
3110
+ "and approaches the end of its [ReserveConfig::debt_term_seconds].",
3111
+ "",
3112
+ "By its nature (not a special case), the zeroed struct mean \"no auto-rollover\"."
3113
+ ],
3114
+ "type": {
3115
+ "kind": "struct",
3116
+ "fields": [
1443
3117
  {
1444
- "name": "minDepositAmount",
1445
- "type": "u64"
3118
+ "name": "autoRolloverEnabled",
3119
+ "docs": [
3120
+ "Whether the borrow can be permissionlessly prolonged under the following *joint* conditions:",
3121
+ "",
3122
+ "The reserve used to re-borrow the liquidity must have:",
3123
+ "A) the exact same maximum borrow rate as the current one,",
3124
+ "B) the exact same debt term as the current one,",
3125
+ "C) sufficient available liquidity (including no withdraw tickets waiting in its queue).",
3126
+ "",
3127
+ "The time left until the current debt term expires must be:",
3128
+ "D) less than [LendingMarket::fixed_rollover_window_duration_seconds].",
3129
+ "",
3130
+ "Note: the other settings are only effective when this one is `1`."
3131
+ ],
3132
+ "type": "u8"
1446
3133
  },
1447
3134
  {
1448
- "name": "minWithdrawAmount",
1449
- "type": "u64"
3135
+ "name": "openTermAllowed",
3136
+ "docs": [
3137
+ "When `1`, partially lifts the condition *B* from [Self::auto_rollover_enabled]: additionally",
3138
+ "allows to use a variable (indefinite) debt term if less than",
3139
+ "[LendingMarket::variable_rollover_window_duration_seconds] is left until expiration.",
3140
+ "",
3141
+ "Note: typically this flag should be used together with [Self::max_borrow_rate_bps] set to",
3142
+ "`u32::MAX` (to denote a variable-rate reserve)."
3143
+ ],
3144
+ "type": "u8"
1450
3145
  },
1451
3146
  {
1452
- "name": "minInvestAmount",
1453
- "type": "u64"
3147
+ "name": "alignmentPadding",
3148
+ "docs": [
3149
+ "Internal alignment padding (free to reuse)."
3150
+ ],
3151
+ "type": {
3152
+ "array": [
3153
+ "u8",
3154
+ 2
3155
+ ]
3156
+ }
1454
3157
  },
1455
3158
  {
1456
- "name": "minInvestDelaySlots",
1457
- "type": "u64"
3159
+ "name": "maxBorrowRateBps",
3160
+ "docs": [
3161
+ "A customization setting that can lift the condition *A* from [Self::auto_rollover_enabled]:",
3162
+ "when not zeroed, the rollover may use a reserve with a maximum borrow rate equal or lower",
3163
+ "than the given one."
3164
+ ],
3165
+ "type": "u32"
1458
3166
  },
1459
3167
  {
1460
- "name": "crankFundFeePerReserve",
3168
+ "name": "minDebtTermSeconds",
3169
+ "docs": [
3170
+ "A customization setting that can lift the condition *B* from [Self::auto_rollover_enabled]:",
3171
+ "when not zeroed, the rollover may use a reserve with a *fixed* debt term equal or longer",
3172
+ "than the given one."
3173
+ ],
1461
3174
  "type": "u64"
1462
- },
3175
+ }
3176
+ ]
3177
+ }
3178
+ },
3179
+ {
3180
+ "name": "ObligationCollateral",
3181
+ "docs": [
3182
+ "Obligation collateral state"
3183
+ ],
3184
+ "type": {
3185
+ "kind": "struct",
3186
+ "fields": [
1463
3187
  {
1464
- "name": "pendingAdmin",
3188
+ "name": "depositReserve",
3189
+ "docs": [
3190
+ "Reserve collateral is deposited to"
3191
+ ],
1465
3192
  "type": "publicKey"
1466
3193
  },
1467
3194
  {
1468
- "name": "cumulativeEarnedInterestSf",
1469
- "type": "u128"
3195
+ "name": "depositedAmount",
3196
+ "docs": [
3197
+ "Amount of collateral deposited"
3198
+ ],
3199
+ "type": "u64"
1470
3200
  },
1471
3201
  {
1472
- "name": "cumulativeMgmtFeesSf",
3202
+ "name": "marketValueSf",
3203
+ "docs": [
3204
+ "Collateral market value in quote currency (scaled fraction)"
3205
+ ],
1473
3206
  "type": "u128"
1474
3207
  },
1475
3208
  {
1476
- "name": "cumulativePerfFeesSf",
1477
- "type": "u128"
3209
+ "name": "borrowedAmountAgainstThisCollateralInElevationGroup",
3210
+ "docs": [
3211
+ "Debt amount (lamport) taken against this collateral.",
3212
+ "(only meaningful if this obligation is part of an elevation group, otherwise 0)",
3213
+ "This is only indicative of the debt computed on the last refresh obligation.",
3214
+ "If the obligation have multiple collateral this value is the same for all of them."
3215
+ ],
3216
+ "type": "u64"
1478
3217
  },
1479
3218
  {
1480
- "name": "name",
3219
+ "name": "padding",
1481
3220
  "type": {
1482
3221
  "array": [
1483
- "u8",
1484
- 40
3222
+ "u64",
3223
+ 9
1485
3224
  ]
1486
3225
  }
1487
- },
3226
+ }
3227
+ ]
3228
+ }
3229
+ },
3230
+ {
3231
+ "name": "ObligationLiquidity",
3232
+ "docs": [
3233
+ "Obligation liquidity state"
3234
+ ],
3235
+ "type": {
3236
+ "kind": "struct",
3237
+ "fields": [
1488
3238
  {
1489
- "name": "vaultLookupTable",
3239
+ "name": "borrowReserve",
3240
+ "docs": [
3241
+ "Reserve liquidity is borrowed from"
3242
+ ],
1490
3243
  "type": "publicKey"
1491
3244
  },
1492
3245
  {
1493
- "name": "vaultFarm",
1494
- "type": "publicKey"
3246
+ "name": "cumulativeBorrowRateBsf",
3247
+ "docs": [
3248
+ "Borrow rate used for calculating interest (big scaled fraction)"
3249
+ ],
3250
+ "type": {
3251
+ "defined": "BigFractionBytes"
3252
+ }
1495
3253
  },
1496
3254
  {
1497
- "name": "creationTimestamp",
3255
+ "name": "firstBorrowedAtTimestamp",
3256
+ "docs": [
3257
+ "The timestamp at which this debt was taken.",
3258
+ "More specifically: when the *first* borrow operation from this reserve happened.",
3259
+ "This means that:",
3260
+ "- adding debt of the same reserve does *not* change this timestamp,",
3261
+ "- repaying the entire debt of this reserve *does* reset this timestamp.",
3262
+ "",
3263
+ "Note: this field is *not* only metadata: it is used in the logic, e.g. for enforcing the",
3264
+ "fixed-term borrows (i.e. those induced by [ReserveConfig::debt_term_seconds])."
3265
+ ],
1498
3266
  "type": "u64"
1499
3267
  },
1500
3268
  {
1501
- "name": "unallocatedTokensCap",
1502
- "type": "u64"
3269
+ "name": "borrowedAmountSf",
3270
+ "docs": [
3271
+ "Amount of liquidity borrowed plus interest (scaled fraction)"
3272
+ ],
3273
+ "type": "u128"
1503
3274
  },
1504
3275
  {
1505
- "name": "allocationAdmin",
1506
- "type": "publicKey"
3276
+ "name": "marketValueSf",
3277
+ "docs": [
3278
+ "Liquidity market value in quote currency (scaled fraction)"
3279
+ ],
3280
+ "type": "u128"
1507
3281
  },
1508
3282
  {
1509
- "name": "withdrawalPenaltyLamports",
1510
- "type": "u64"
3283
+ "name": "borrowFactorAdjustedMarketValueSf",
3284
+ "docs": [
3285
+ "Risk adjusted liquidity market value in quote currency - DEBUG ONLY - use market_value instead"
3286
+ ],
3287
+ "type": "u128"
1511
3288
  },
1512
3289
  {
1513
- "name": "withdrawalPenaltyBps",
3290
+ "name": "borrowedAmountOutsideElevationGroups",
3291
+ "docs": [
3292
+ "Amount of liquidity borrowed outside of an elevation group"
3293
+ ],
1514
3294
  "type": "u64"
1515
3295
  },
1516
3296
  {
1517
- "name": "firstLossCapitalFarm",
1518
- "type": "publicKey"
1519
- },
1520
- {
1521
- "name": "allowAllocationsInWhitelistedReservesOnly",
1522
- "type": "u8"
1523
- },
1524
- {
1525
- "name": "allowInvestInWhitelistedReservesOnly",
1526
- "type": "u8"
1527
- },
1528
- {
1529
- "name": "padding4",
3297
+ "name": "fixedTermBorrowRolloverConfig",
3298
+ "docs": [
3299
+ "The user's auto-rollover opt-ins - only effective when this borrow is fixed-term (i.e. its",
3300
+ "reserve has a non-zero [ReserveConfig::debt_term_seconds])."
3301
+ ],
1530
3302
  "type": {
1531
- "array": [
1532
- "u8",
1533
- 14
1534
- ]
3303
+ "defined": "FixedTermBorrowRolloverConfig"
1535
3304
  }
1536
3305
  },
1537
3306
  {
1538
- "name": "padding3",
3307
+ "name": "padding2",
1539
3308
  "type": {
1540
3309
  "array": [
1541
- "u128",
1542
- 238
3310
+ "u64",
3311
+ 5
1543
3312
  ]
1544
3313
  }
1545
3314
  }
1546
3315
  ]
1547
3316
  }
1548
- }
1549
- ],
1550
- "types": [
3317
+ },
1551
3318
  {
1552
- "name": "LastUpdate",
3319
+ "name": "ObligationOrder",
1553
3320
  "docs": [
1554
- "Last update state"
3321
+ "A single obligation order.",
3322
+ "See [Obligation::obligation_orders]."
1555
3323
  ],
1556
3324
  "type": {
1557
3325
  "kind": "struct",
1558
3326
  "fields": [
1559
3327
  {
1560
- "name": "slot",
3328
+ "name": "conditionThresholdSf",
1561
3329
  "docs": [
1562
- "Last slot when updated"
3330
+ "A threshold value used by the condition (scaled [Fraction]).",
3331
+ "The exact meaning depends on the specific [Self::condition_type].",
3332
+ "",
3333
+ "Examples:",
3334
+ "- when `condition_type == 2 (UserLtvBelow)`:",
3335
+ "then a value of `0.455` here means that the order is active only when the obligation's",
3336
+ "user LTV is less than `0.455` (i.e. < 45.5%).",
3337
+ "- when `condition_type == 3 (DebtCollPriceRatioAbove)`:",
3338
+ "assuming the obligation uses BTC collateral for SOL debt, then a value of `491.3` here",
3339
+ "means that the order is active only when the BTC-SOL price is greater than `491.3` (i.e.",
3340
+ "> 491.3 SOL per BTC)."
1563
3341
  ],
1564
- "type": "u64"
3342
+ "type": "u128"
1565
3343
  },
1566
3344
  {
1567
- "name": "stale",
3345
+ "name": "opportunityParameterSf",
1568
3346
  "docs": [
1569
- "True when marked stale, false when slot updated"
3347
+ "A configuration parameter used by the opportunity (scaled [Fraction]).",
3348
+ "The exact meaning depends on the specific [Self::opportunity_type].",
3349
+ "",
3350
+ "Examples:",
3351
+ "- when `opportunity_type == 0 (DeleverageSingleDebtAmount)`:",
3352
+ "Assuming the obligation uses BTC collateral for SOL debt, then a value of `1_234_000_000`",
3353
+ "here means that a liquidator may repay up to 1234000000 lamports (i.e. 1.234 SOL) on this",
3354
+ "obligation.",
3355
+ "Note: the special value of [Fraction::MAX] is *not* allowed in this case.",
3356
+ "- when `opportunity_type == 1 (DeleverageAllDebtAmount)`:",
3357
+ "The only allowed value in this case is [Fraction::MAX] (to emphasize that *all* debt",
3358
+ "should be repaid)."
3359
+ ],
3360
+ "type": "u128"
3361
+ },
3362
+ {
3363
+ "name": "minExecutionBonusBps",
3364
+ "docs": [
3365
+ "A *minimum* additional fraction of collateral transferred to the liquidator, in bps.",
3366
+ "",
3367
+ "The minimum bonus is applied exactly when the [Self::condition_threshold_sf] is met, and",
3368
+ "grows linearly towards the [Self::max_execution_bonus_bps].",
3369
+ "",
3370
+ "Example: a value of `50` here means 50bps == 0.5% bonus for an \"LTV > 65%\" order, when",
3371
+ "executed precisely at the moment LTV exceeds 65%."
3372
+ ],
3373
+ "type": "u16"
3374
+ },
3375
+ {
3376
+ "name": "maxExecutionBonusBps",
3377
+ "docs": [
3378
+ "A *maximum* additional fraction of collateral transferred to the liquidator, in bps.",
3379
+ "",
3380
+ "The maximum bonus is applied at the relevant \"extreme\" state of the obligation, i.e.:",
3381
+ "- for a stop-loss condition, it is a point at which the obligation becomes liquidatable;",
3382
+ "- for a take-profit condition, it is a point at which obligation has 0% LTV.",
3383
+ "",
3384
+ "In non-extreme states, the actual bonus value is interpolated linearly, starting from",
3385
+ "[Self::min_execution_bonus_bps] (at the point specified by the order's condition).",
3386
+ "",
3387
+ "Example: a value of `300` here means 300bps == 3.0% bonus for a \"debt/coll price > 140\"",
3388
+ "order, when executed at a higher price = 200, at which the obligation's LTV happens to",
3389
+ "be equal to its liquidation LTV."
3390
+ ],
3391
+ "type": "u16"
3392
+ },
3393
+ {
3394
+ "name": "conditionType",
3395
+ "docs": [
3396
+ "Serialized [ConditionType].",
3397
+ "The entire order is void when this is zeroed (i.e. representing [ConditionType::Never]).",
3398
+ "",
3399
+ "Example: a value of `2` here denotes `UserLtvBelow` condition type. Of course, to",
3400
+ "interpret this condition, we also need to take the [Self::condition_threshold_sf] into",
3401
+ "account."
1570
3402
  ],
1571
3403
  "type": "u8"
1572
3404
  },
1573
3405
  {
1574
- "name": "priceStatus",
3406
+ "name": "opportunityType",
1575
3407
  "docs": [
1576
- "Status of the prices used to calculate the last update"
3408
+ "Serialized [OpportunityType].",
3409
+ "",
3410
+ "Example: a value of `0` here denotes `DeleverageSingleDebtAmount` opportunity. Of course, to",
3411
+ "interpret this opportunity, we also need to take the [Self::opportunity_parameter_sf] into",
3412
+ "account."
1577
3413
  ],
1578
3414
  "type": "u8"
1579
3415
  },
1580
3416
  {
1581
- "name": "placeholder",
3417
+ "name": "padding1",
3418
+ "docs": [
3419
+ "Alignment padding.",
3420
+ "The fields above take up 2+2+1+1 bytes = 48 bits, which means we need 80 bits = 10 bytes to",
3421
+ "align with `u128`s."
3422
+ ],
1582
3423
  "type": {
1583
3424
  "array": [
1584
3425
  "u8",
1585
- 6
3426
+ 10
3427
+ ]
3428
+ }
3429
+ },
3430
+ {
3431
+ "name": "padding2",
3432
+ "docs": [
3433
+ "End padding.",
3434
+ "The total size of a single instance is 8*u128 = 128 bytes."
3435
+ ],
3436
+ "type": {
3437
+ "array": [
3438
+ "u128",
3439
+ 5
1586
3440
  ]
1587
3441
  }
1588
3442
  }
@@ -1681,7 +3535,7 @@
1681
3535
  "type": "u8"
1682
3536
  },
1683
3537
  {
1684
- "name": "assetTier",
3538
+ "name": "paddingDeprecatedAssetTier",
1685
3539
  "docs": [
1686
3540
  "Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt"
1687
3541
  ],
@@ -1935,6 +3789,29 @@
1935
3789
  "Only relevant when `autodeleverage_enabled == 1`, and must not be 0 in such case."
1936
3790
  ],
1937
3791
  "type": "u64"
3792
+ },
3793
+ {
3794
+ "name": "debtMaturityTimestamp",
3795
+ "docs": [
3796
+ "The timestamp at which all [Obligation::borrows] using this reserve become liquidatable",
3797
+ "(on the same terms as reserve-wide deleveraging).",
3798
+ "Inactive when zeroed (i.e. debt never matures).",
3799
+ "",
3800
+ "Note: this feature is independent of [Self::debt_term_seconds] - the liquidation mechanism",
3801
+ "is based directly on the timestamp defined here, on Reserve's level."
3802
+ ],
3803
+ "type": "u64"
3804
+ },
3805
+ {
3806
+ "name": "debtTermSeconds",
3807
+ "docs": [
3808
+ "The duration after which any debt coming from this Reserve must be repaid.",
3809
+ "Inactive when zeroed (i.e. funds can be borrowed indefinitely).",
3810
+ "",
3811
+ "Note: this feature is independent of [Self::debt_maturity_timestamp] - the liquidation",
3812
+ "mechanism is based on the [ObligationLiquidity::first_borrowed_at_timestamp]."
3813
+ ],
3814
+ "type": "u64"
1938
3815
  }
1939
3816
  ]
1940
3817
  }
@@ -2016,9 +3893,13 @@
2016
3893
  "type": "publicKey"
2017
3894
  },
2018
3895
  {
2019
- "name": "availableAmount",
3896
+ "name": "totalAvailableAmount",
2020
3897
  "docs": [
2021
- "Reserve liquidity available"
3898
+ "Total reserve liquidity available.",
3899
+ "",
3900
+ "Note: not all of this liquidity can be freely used for any purpose. Production code should",
3901
+ "use the specialized getters - see e.g. [Reserve::total_available_liquidity_amount()],",
3902
+ "[Reserve::freely_available_liquidity_amount()]."
2022
3903
  ],
2023
3904
  "type": "u64"
2024
3905
  },
@@ -2131,6 +4012,41 @@
2131
4012
  ]
2132
4013
  }
2133
4014
  },
4015
+ {
4016
+ "name": "WithdrawQueue",
4017
+ "docs": [
4018
+ "A tracker of ticket-based withdrawals."
4019
+ ],
4020
+ "type": {
4021
+ "kind": "struct",
4022
+ "fields": [
4023
+ {
4024
+ "name": "queuedCollateralAmount",
4025
+ "docs": [
4026
+ "The part of [ReserveLiquidity::total_available_amount] locked for ticketed withdrawals."
4027
+ ],
4028
+ "type": "u64"
4029
+ },
4030
+ {
4031
+ "name": "nextIssuedTicketSequenceNumber",
4032
+ "docs": [
4033
+ "The sequence number of the next ticket to be issued when enqueueing to withdraw.",
4034
+ "Note: it is also a number of tickets issued so far."
4035
+ ],
4036
+ "type": "u64"
4037
+ },
4038
+ {
4039
+ "name": "nextWithdrawableTicketSequenceNumber",
4040
+ "docs": [
4041
+ "The sequence number of the next ticket to be used for actually transferring the withdrawn",
4042
+ "liquidity (assuming it is available in the reserve).",
4043
+ "Note: it is also a number of fully-consumed tickets so far."
4044
+ ],
4045
+ "type": "u64"
4046
+ }
4047
+ ]
4048
+ }
4049
+ },
2134
4050
  {
2135
4051
  "name": "WithdrawalCaps",
2136
4052
  "docs": [
@@ -2353,6 +4269,17 @@
2353
4269
  ]
2354
4270
  }
2355
4271
  },
4272
+ {
4273
+ "name": "WithdrawTicketProgressEvent",
4274
+ "type": {
4275
+ "kind": "enum",
4276
+ "variants": [
4277
+ {
4278
+ "name": "QueuedLiquidityWithdrawn"
4279
+ }
4280
+ ]
4281
+ }
4282
+ },
2356
4283
  {
2357
4284
  "name": "BorrowRateCurve",
2358
4285
  "type": {
@@ -2501,17 +4428,40 @@
2501
4428
  "name": "ctokenVaultBump",
2502
4429
  "type": "u64"
2503
4430
  },
4431
+ {
4432
+ "name": "reserveType",
4433
+ "docs": [
4434
+ "should match the ReserveType enum"
4435
+ ],
4436
+ "type": "u8"
4437
+ },
4438
+ {
4439
+ "name": "padding0",
4440
+ "type": {
4441
+ "array": [
4442
+ "u8",
4443
+ 7
4444
+ ]
4445
+ }
4446
+ },
2504
4447
  {
2505
4448
  "name": "configPadding",
2506
4449
  "type": {
2507
4450
  "array": [
2508
4451
  "u64",
2509
- 127
4452
+ 126
2510
4453
  ]
2511
4454
  }
2512
4455
  },
2513
4456
  {
2514
4457
  "name": "ctokenAllocation",
4458
+ "docs": [
4459
+ "The amount of ctokens that currently earns yield for the vault.",
4460
+ "",
4461
+ "Please note that these ctokens are *not* necessarily all in the [Self::ctoken_vault] - they",
4462
+ "may also be e.g. queued for withdrawal (and held by the corresponding Klend queue vault),",
4463
+ "see [Self::klend_queued_ctokens]."
4464
+ ],
2515
4465
  "type": "u64"
2516
4466
  },
2517
4467
  {
@@ -2522,12 +4472,23 @@
2522
4472
  "name": "tokenTargetAllocationSf",
2523
4473
  "type": "u128"
2524
4474
  },
4475
+ {
4476
+ "name": "klendQueuedCtokens",
4477
+ "docs": [
4478
+ "The ctokens that are still locked in the [Self::reserve]'s \"queued collateral vault\" on the",
4479
+ "Klend's withdraw queue side.",
4480
+ "",
4481
+ "Please note that - since such queued ctokens still earn yield for the vault - this amount is",
4482
+ "also included in the [Self::ctoken_allocation]."
4483
+ ],
4484
+ "type": "u64"
4485
+ },
2525
4486
  {
2526
4487
  "name": "statePadding",
2527
4488
  "type": {
2528
4489
  "array": [
2529
4490
  "u64",
2530
- 128
4491
+ 127
2531
4492
  ]
2532
4493
  }
2533
4494
  }
@@ -2559,6 +4520,32 @@
2559
4520
  }
2560
4521
  ]
2561
4522
  }
4523
+ },
4524
+ {
4525
+ "name": "ReserveType",
4526
+ "docs": [
4527
+ "The type of the reserve determine how investing and uninvesting (mechanisms + the way to compute how much should be invested/uninvested) works",
4528
+ "",
4529
+ "Standard:",
4530
+ "- investing happens through the `invest` handler and the amount invested is computed based on the weight of the reserve, from the vault AUM - the amount invested in virtual reserves",
4531
+ "",
4532
+ "Virtual (i.e. the allocation can be moved to that reserve if needed, so it is virtually there but will be allocated only if needed by a borrow order or reserve withdrawal ticket):",
4533
+ "- investing in a virtual reserve doesn't happen through the `invest` handler but using a dedicated handler which ensures that the amount to be invested fills (fully or partially) a borrow order or a reserve withdrawal ticket",
4534
+ "- has a higher allocation priority comparing to the Standard reserves and can disinvest from a Standard reserve and invest into the Virtual one if needed",
4535
+ "-the weight is not used for virtual reserves, only the cap is limiting the amount that can be invested in the reserve, and calling `invest` on a virtual reserve will disinvest if the amount invested exceeds the cap",
4536
+ "- current main use case is for fixed term reserves, such that the manager decides their desired max exposure to a fixed term reserve and anytime there is an order or withdrawal ticket we invest into the fixed term reserve until the cap is reached or the order/ticket is filled"
4537
+ ],
4538
+ "type": {
4539
+ "kind": "enum",
4540
+ "variants": [
4541
+ {
4542
+ "name": "Standard"
4543
+ },
4544
+ {
4545
+ "name": "Virtual"
4546
+ }
4547
+ ]
4548
+ }
2562
4549
  }
2563
4550
  ],
2564
4551
  "events": [
@@ -2913,6 +4900,56 @@
2913
4900
  "code": 7055,
2914
4901
  "name": "InvalidBoolLikeValue",
2915
4902
  "msg": "Invalid bool-like value passed in (should be 0 or 1)"
4903
+ },
4904
+ {
4905
+ "code": 7056,
4906
+ "name": "MissingWithdrawQueueAccounts",
4907
+ "msg": "Withdraw queue accounts must be present when reserve has not enough freely-available liquidity"
4908
+ },
4909
+ {
4910
+ "code": 7057,
4911
+ "name": "WithdrawTicketCallbackAccountingMismatch",
4912
+ "msg": "Accounting updated by withdraw ticket callback does not match actual vault balance"
4913
+ },
4914
+ {
4915
+ "code": 7058,
4916
+ "name": "NotEnoughAvailableLiquidityToInvestIntoVirtual",
4917
+ "msg": "Insufficient available liquidity and no source reserve provided"
4918
+ },
4919
+ {
4920
+ "code": 7059,
4921
+ "name": "NotEnoughCTokensToWithdrawFromReserve",
4922
+ "msg": "Reserve allocation is lower than requested ctokens"
4923
+ },
4924
+ {
4925
+ "code": 7060,
4926
+ "name": "ReserveTokenAllocationCapExceeded",
4927
+ "msg": "Cannot invest tokens that would exceed the reserve allocation cap"
4928
+ },
4929
+ {
4930
+ "code": 7061,
4931
+ "name": "AUMDecreasedAfterInvestInVirtualReserve",
4932
+ "msg": "AUM decreased after invest in virtual reserve"
4933
+ },
4934
+ {
4935
+ "code": 7062,
4936
+ "name": "DestinationReserveIsNotVirtual",
4937
+ "msg": "Destination reserve is not virtual"
4938
+ },
4939
+ {
4940
+ "code": 7063,
4941
+ "name": "AllSourceAccountsMustBeProvided",
4942
+ "msg": "All source accounts must be provided"
4943
+ },
4944
+ {
4945
+ "code": 7064,
4946
+ "name": "InvestAndFillVaultStateMismatch",
4947
+ "msg": "Invest and fill vault state mismatch"
4948
+ },
4949
+ {
4950
+ "code": 7065,
4951
+ "name": "InvestDstAndFillReserveMismatch",
4952
+ "msg": "Invest dst and fill reserve mismatch"
2916
4953
  }
2917
4954
  ]
2918
4955
  }