@morpho-org/morpho-sdk 6.0.0-next.2 → 6.0.0-next.3

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 (257) hide show
  1. package/MIGRATION-v5-to-v6.md +83 -29
  2. package/README.md +9 -7
  3. package/lib/cjs/abis.d.ts +3 -2844
  4. package/lib/cjs/abis.js +1 -1951
  5. package/lib/cjs/actions/blue/borrow.d.ts +3 -2
  6. package/lib/cjs/actions/blue/borrow.js +3 -2
  7. package/lib/cjs/actions/blue/common.js +1 -9
  8. package/lib/cjs/actions/blue/refinance.d.ts +2 -2
  9. package/lib/cjs/actions/blue/refinance.js +2 -2
  10. package/lib/cjs/actions/blue/repay.d.ts +1 -1
  11. package/lib/cjs/actions/blue/repay.js +1 -1
  12. package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +2 -2
  13. package/lib/cjs/actions/blue/repayWithdrawCollateral.js +2 -2
  14. package/lib/cjs/actions/blue/supply.d.ts +2 -2
  15. package/lib/cjs/actions/blue/supply.js +2 -2
  16. package/lib/cjs/actions/blue/supplyCollateral.d.ts +2 -2
  17. package/lib/cjs/actions/blue/supplyCollateral.js +2 -2
  18. package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +3 -2
  19. package/lib/cjs/actions/blue/supplyCollateralBorrow.js +3 -2
  20. package/lib/cjs/actions/blue/withdraw.d.ts +3 -3
  21. package/lib/cjs/actions/blue/withdraw.js +3 -3
  22. package/lib/cjs/actions/blue/withdrawCollateral.d.ts +2 -2
  23. package/lib/cjs/actions/blue/withdrawCollateral.js +2 -2
  24. package/lib/cjs/actions/bundles/common.d.ts +6 -2
  25. package/lib/cjs/actions/bundles/common.js +23 -5
  26. package/lib/cjs/actions/index.d.ts +0 -1
  27. package/lib/cjs/actions/index.js +0 -1
  28. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +6 -8
  29. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +11 -16
  30. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +5 -6
  31. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +4 -5
  32. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
  33. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +4 -5
  34. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +5 -5
  35. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +6 -11
  36. package/lib/cjs/actions/requirements/encode/index.d.ts +0 -1
  37. package/lib/cjs/actions/requirements/encode/index.js +0 -1
  38. package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +5 -6
  39. package/lib/cjs/actions/requirements/getRequirementsApproval.js +5 -6
  40. package/lib/cjs/actions/requirements/index.d.ts +0 -1
  41. package/lib/cjs/actions/requirements/index.js +0 -1
  42. package/lib/cjs/actions/vaultV1/deposit.d.ts +1 -2
  43. package/lib/cjs/actions/vaultV1/deposit.js +1 -2
  44. package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +6 -5
  45. package/lib/cjs/actions/vaultV1/inKindRedeem.js +10 -7
  46. package/lib/cjs/actions/vaultV2/deposit.d.ts +1 -2
  47. package/lib/cjs/actions/vaultV2/deposit.js +1 -2
  48. package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +1 -1
  49. package/lib/cjs/actions/vaultV2/forceWithdraw.js +3 -3
  50. package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +6 -5
  51. package/lib/cjs/actions/vaultV2/inKindRedeem.js +10 -7
  52. package/lib/cjs/augment.d.ts +0 -1
  53. package/lib/cjs/augment.js +0 -1
  54. package/lib/cjs/blue/abis.d.ts +1 -5
  55. package/lib/cjs/blue/abis.js +1 -7
  56. package/lib/cjs/blue/entities.d.ts +2 -8
  57. package/lib/cjs/blue/entities.js +1 -3
  58. package/lib/cjs/blue/fetch.d.ts +1 -3
  59. package/lib/cjs/blue/fetch.js +1 -3
  60. package/lib/cjs/blue/types.d.ts +2 -4
  61. package/lib/cjs/blue/utils.d.ts +1 -3
  62. package/lib/cjs/blue/utils.js +1 -3
  63. package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
  64. package/lib/cjs/client/morphoViemExtension.js +1 -1
  65. package/lib/cjs/constants.d.ts +3 -37
  66. package/lib/cjs/constants.js +1 -39
  67. package/lib/cjs/entities/blue/blue.d.ts +30 -265
  68. package/lib/cjs/entities/blue/blue.js +1 -205
  69. package/lib/cjs/entities/index.d.ts +3 -66
  70. package/lib/cjs/entities/index.js +1 -21
  71. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +9 -2
  72. package/lib/cjs/entities/vaultV1/vaultV1.js +12 -7
  73. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +22 -9
  74. package/lib/cjs/entities/vaultV2/vaultV2.js +28 -15
  75. package/lib/cjs/entities/vaultV2BlueReallocationData.js +4 -21
  76. package/lib/cjs/errors.d.ts +2 -46
  77. package/lib/cjs/errors.js +1 -46
  78. package/lib/cjs/fetch.d.ts +1 -17
  79. package/lib/cjs/fetch.js +1 -17
  80. package/lib/cjs/helpers/constant.d.ts +0 -2
  81. package/lib/cjs/helpers/constant.js +0 -2
  82. package/lib/cjs/helpers/index.d.ts +2 -3
  83. package/lib/cjs/helpers/index.js +1 -9
  84. package/lib/cjs/helpers/slippage.d.ts +1 -103
  85. package/lib/cjs/helpers/slippage.js +0 -150
  86. package/lib/cjs/helpers/utilization.d.ts +12 -10
  87. package/lib/cjs/helpers/utilization.js +27 -12
  88. package/lib/cjs/helpers/validate.d.ts +1 -24
  89. package/lib/cjs/helpers/validate.js +2 -49
  90. package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
  91. package/lib/cjs/helpers/validateRequirementSpender.js +1 -3
  92. package/lib/cjs/types/action.d.ts +17 -65
  93. package/lib/cjs/types/action.js +11 -4
  94. package/lib/cjs/types/error.d.ts +50 -381
  95. package/lib/cjs/types/error.js +64 -395
  96. package/lib/cjs/types/sharedLiquidity.d.ts +1 -117
  97. package/lib/cjs/types.d.ts +2 -18
  98. package/lib/cjs/utils.d.ts +6 -35
  99. package/lib/cjs/utils.js +2 -36
  100. package/lib/esm/abis.d.ts +3 -2844
  101. package/lib/esm/abis.js +3 -1950
  102. package/lib/esm/actions/blue/borrow.d.ts +3 -2
  103. package/lib/esm/actions/blue/borrow.js +3 -2
  104. package/lib/esm/actions/blue/common.js +1 -9
  105. package/lib/esm/actions/blue/refinance.d.ts +2 -2
  106. package/lib/esm/actions/blue/refinance.js +2 -2
  107. package/lib/esm/actions/blue/repay.d.ts +1 -1
  108. package/lib/esm/actions/blue/repay.js +1 -1
  109. package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +2 -2
  110. package/lib/esm/actions/blue/repayWithdrawCollateral.js +2 -2
  111. package/lib/esm/actions/blue/supply.d.ts +2 -2
  112. package/lib/esm/actions/blue/supply.js +2 -2
  113. package/lib/esm/actions/blue/supplyCollateral.d.ts +2 -2
  114. package/lib/esm/actions/blue/supplyCollateral.js +2 -2
  115. package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +3 -2
  116. package/lib/esm/actions/blue/supplyCollateralBorrow.js +3 -2
  117. package/lib/esm/actions/blue/withdraw.d.ts +3 -3
  118. package/lib/esm/actions/blue/withdraw.js +3 -3
  119. package/lib/esm/actions/blue/withdrawCollateral.d.ts +2 -2
  120. package/lib/esm/actions/blue/withdrawCollateral.js +2 -2
  121. package/lib/esm/actions/bundles/common.d.ts +6 -2
  122. package/lib/esm/actions/bundles/common.js +24 -6
  123. package/lib/esm/actions/index.d.ts +0 -1
  124. package/lib/esm/actions/index.js +0 -1
  125. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +6 -8
  126. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +12 -17
  127. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +5 -6
  128. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +4 -5
  129. package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
  130. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +4 -5
  131. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +5 -5
  132. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +6 -11
  133. package/lib/esm/actions/requirements/encode/index.d.ts +0 -1
  134. package/lib/esm/actions/requirements/encode/index.js +0 -1
  135. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +5 -6
  136. package/lib/esm/actions/requirements/getRequirementsApproval.js +5 -6
  137. package/lib/esm/actions/requirements/index.d.ts +0 -1
  138. package/lib/esm/actions/requirements/index.js +0 -1
  139. package/lib/esm/actions/vaultV1/deposit.d.ts +1 -2
  140. package/lib/esm/actions/vaultV1/deposit.js +1 -2
  141. package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +6 -5
  142. package/lib/esm/actions/vaultV1/inKindRedeem.js +10 -7
  143. package/lib/esm/actions/vaultV2/deposit.d.ts +1 -2
  144. package/lib/esm/actions/vaultV2/deposit.js +1 -2
  145. package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +1 -1
  146. package/lib/esm/actions/vaultV2/forceWithdraw.js +3 -3
  147. package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +6 -5
  148. package/lib/esm/actions/vaultV2/inKindRedeem.js +10 -7
  149. package/lib/esm/augment.d.ts +0 -1
  150. package/lib/esm/augment.js +0 -1
  151. package/lib/esm/blue/abis.d.ts +1 -5
  152. package/lib/esm/blue/abis.js +1 -5
  153. package/lib/esm/blue/entities.d.ts +2 -8
  154. package/lib/esm/blue/entities.js +1 -3
  155. package/lib/esm/blue/fetch.d.ts +1 -3
  156. package/lib/esm/blue/fetch.js +1 -3
  157. package/lib/esm/blue/types.d.ts +2 -4
  158. package/lib/esm/blue/utils.d.ts +1 -3
  159. package/lib/esm/blue/utils.js +1 -3
  160. package/lib/esm/client/morphoViemExtension.d.ts +1 -1
  161. package/lib/esm/client/morphoViemExtension.js +1 -1
  162. package/lib/esm/constants.d.ts +3 -37
  163. package/lib/esm/constants.js +3 -37
  164. package/lib/esm/entities/blue/blue.d.ts +30 -265
  165. package/lib/esm/entities/blue/blue.js +4 -208
  166. package/lib/esm/entities/index.d.ts +3 -66
  167. package/lib/esm/entities/index.js +1 -18
  168. package/lib/esm/entities/vaultV1/vaultV1.d.ts +9 -2
  169. package/lib/esm/entities/vaultV1/vaultV1.js +15 -10
  170. package/lib/esm/entities/vaultV2/vaultV2.d.ts +22 -9
  171. package/lib/esm/entities/vaultV2/vaultV2.js +32 -19
  172. package/lib/esm/entities/vaultV2BlueReallocationData.js +2 -19
  173. package/lib/esm/errors.d.ts +2 -46
  174. package/lib/esm/errors.js +2 -46
  175. package/lib/esm/fetch.d.ts +1 -17
  176. package/lib/esm/fetch.js +1 -17
  177. package/lib/esm/helpers/constant.d.ts +0 -2
  178. package/lib/esm/helpers/constant.js +0 -2
  179. package/lib/esm/helpers/index.d.ts +2 -3
  180. package/lib/esm/helpers/index.js +2 -3
  181. package/lib/esm/helpers/slippage.d.ts +1 -103
  182. package/lib/esm/helpers/slippage.js +1 -147
  183. package/lib/esm/helpers/utilization.d.ts +12 -10
  184. package/lib/esm/helpers/utilization.js +26 -11
  185. package/lib/esm/helpers/validate.d.ts +1 -24
  186. package/lib/esm/helpers/validate.js +2 -48
  187. package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
  188. package/lib/esm/helpers/validateRequirementSpender.js +1 -3
  189. package/lib/esm/types/action.d.ts +17 -65
  190. package/lib/esm/types/action.js +12 -5
  191. package/lib/esm/types/error.d.ts +50 -381
  192. package/lib/esm/types/error.js +58 -377
  193. package/lib/esm/types/sharedLiquidity.d.ts +1 -117
  194. package/lib/esm/types.d.ts +2 -18
  195. package/lib/esm/utils.d.ts +6 -35
  196. package/lib/esm/utils.js +5 -34
  197. package/package.json +5 -13
  198. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -44
  199. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -88
  200. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
  201. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -152
  202. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -40
  203. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -53
  204. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
  205. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -74
  206. package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +0 -3
  207. package/lib/cjs/actions/requirements/generalAdapter/index.js +0 -19
  208. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
  209. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +0 -48
  210. package/lib/cjs/actions/signatures/getTokenRequirementActions.d.ts +0 -58
  211. package/lib/cjs/actions/signatures/getTokenRequirementActions.js +0 -119
  212. package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -50
  213. package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -45
  214. package/lib/cjs/actions/signatures/index.d.ts +0 -3
  215. package/lib/cjs/actions/signatures/index.js +0 -19
  216. package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -11
  217. package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +0 -8
  218. package/lib/cjs/bundler/actions.d.ts +0 -797
  219. package/lib/cjs/bundler/actions.js +0 -1371
  220. package/lib/cjs/bundler/index.d.ts +0 -2
  221. package/lib/cjs/bundler/index.js +0 -18
  222. package/lib/cjs/bundler/types.d.ts +0 -235
  223. package/lib/cjs/bundler/types.js +0 -2
  224. package/lib/cjs/entities/vaultV1ReallocationData.d.ts +0 -332
  225. package/lib/cjs/entities/vaultV1ReallocationData.js +0 -557
  226. package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +0 -80
  227. package/lib/cjs/helpers/computeVaultV1Reallocations.js +0 -245
  228. package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -44
  229. package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -84
  230. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
  231. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -148
  232. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -40
  233. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -49
  234. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
  235. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -70
  236. package/lib/esm/actions/requirements/generalAdapter/index.d.ts +0 -3
  237. package/lib/esm/actions/requirements/generalAdapter/index.js +0 -3
  238. package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
  239. package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +0 -44
  240. package/lib/esm/actions/signatures/getTokenRequirementActions.d.ts +0 -58
  241. package/lib/esm/actions/signatures/getTokenRequirementActions.js +0 -115
  242. package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -50
  243. package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -41
  244. package/lib/esm/actions/signatures/index.d.ts +0 -3
  245. package/lib/esm/actions/signatures/index.js +0 -3
  246. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -11
  247. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +0 -7
  248. package/lib/esm/bundler/actions.d.ts +0 -797
  249. package/lib/esm/bundler/actions.js +0 -1368
  250. package/lib/esm/bundler/index.d.ts +0 -2
  251. package/lib/esm/bundler/index.js +0 -2
  252. package/lib/esm/bundler/types.d.ts +0 -235
  253. package/lib/esm/bundler/types.js +0 -1
  254. package/lib/esm/entities/vaultV1ReallocationData.d.ts +0 -332
  255. package/lib/esm/entities/vaultV1ReallocationData.js +0 -559
  256. package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +0 -80
  257. package/lib/esm/helpers/computeVaultV1Reallocations.js +0 -241
@@ -1,797 +0,0 @@
1
- import { type InputMarketParams } from "@morpho-org/blue-sdk";
2
- import { type Address, type Hex, type Signature } from "viem";
3
- import type { Action, Authorization, InputReallocation, Permit2PermitSingle } from "./types.js";
4
- /**
5
- * Encoded low-level call consumed by Bundler3's `multicall`.
6
- */
7
- export interface BundlerCall {
8
- /** Contract or account called by Bundler3. */
9
- readonly to: Address;
10
- /** ABI-encoded calldata sent to `to`. */
11
- readonly data: Hex;
12
- /** Native-token value sent with the call. */
13
- readonly value: bigint;
14
- /** Whether Bundler3 should continue when the call reverts. */
15
- readonly skipRevert: boolean;
16
- /** Expected callback hash for calls that reenter Bundler3, or zero hash. */
17
- readonly callbackHash: Hex;
18
- }
19
- /**
20
- * Encodes the Bundler3 action subset used by `morpho-sdk` transaction builders.
21
- *
22
- * @remarks
23
- * The namespace covers only the Bundler3 actions required by `morpho-sdk`.
24
- * It does not expose operation population or broad simulation helpers.
25
- */
26
- export declare namespace BundlerAction {
27
- /**
28
- * Encodes a list of Bundler3 actions into a single Bundler3 multicall
29
- * transaction request.
30
- *
31
- * @remarks
32
- * This is a low-level encoding helper, not a safe bundle constructor. It
33
- * does not validate that native-token pre-funding is fully consumed or that
34
- * pre-funding actions are ordered before the value-carrying calls they fund.
35
- *
36
- * When custom actions include `nativeTransfer(externalOwner, bundler3,
37
- * amount)`, no inner Bundler3 call is emitted for that transfer. Consumers
38
- * must ensure those pre-funding actions precede their downstream consumers
39
- * and leave no residual pre-funded native token; otherwise `tx.value` can be
40
- * over-counted or native token can remain stranded on Bundler3. The
41
- * high-level `morpho-sdk` action builders construct actions in that order,
42
- * but this invariant is not checked at runtime by `encodeBundle`.
43
- *
44
- * @param chainId - Chain where the bundle will execute.
45
- * @param actions - Ordered Bundler3 actions to encode.
46
- * @returns Transaction target, calldata, and native value required by the
47
- * bundle.
48
- * @throws {BundlerErrors.MissingSignature} when a signature action is unsigned.
49
- * @throws {BundlerErrors.UnexpectedAction} when an action is unavailable on the chain.
50
- *
51
- * @example
52
- * ```ts
53
- * import { getChainAddresses } from "@morpho-org/morpho-sdk/addresses";
54
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
55
- *
56
- * const { generalAdapter1 } = getChainAddresses(1).bundler3;
57
- * const sender = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
58
- *
59
- * const tx = BundlerAction.encodeBundle(1, [
60
- * {
61
- * type: "nativeTransfer",
62
- * args: [sender, generalAdapter1, 1_000000000000000000n],
63
- * },
64
- * ]);
65
- * ```
66
- */
67
- function encodeBundle(chainId: number, actions: Action[]): {
68
- to: `0x${string}`;
69
- value: bigint;
70
- data: `0x${string}`;
71
- };
72
- /**
73
- * Encodes a single supported Bundler3 action into one or more low-level
74
- * Bundler3 calls.
75
- *
76
- * @param chainId - Chain where the action will execute.
77
- * @param action - Bundler3 action to encode.
78
- * @returns Encoded Bundler3 calls.
79
- * @throws {BundlerErrors.MissingSignature} when a signature action is unsigned.
80
- * @throws {BundlerErrors.UnexpectedAction} when the action is unavailable on the chain.
81
- *
82
- * @example
83
- * ```ts
84
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
85
- *
86
- * const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
87
- *
88
- * const calls = BundlerAction.encode(1, {
89
- * type: "wrapNative",
90
- * args: [1_000000000000000000n, recipient],
91
- * });
92
- * ```
93
- */
94
- function encode(chainId: number, action: Action): BundlerCall[];
95
- /**
96
- * Encodes a native-token transfer for Bundler3 execution.
97
- *
98
- * @remarks
99
- * Transfers to Bundler3 are treated as bundle pre-funding and emit no inner
100
- * call. Transfers whose `owner` is GeneralAdapter1 are encoded as
101
- * `GeneralAdapter1.nativeTransfer(recipient, amount)` and always use
102
- * `skipRevert: false`; the caller-supplied `skipRevert` argument applies
103
- * only to direct native transfers from other owners.
104
- *
105
- * @param chainId - Chain where the action will execute.
106
- * @param owner - Current native-token owner in the bundle.
107
- * @param recipient - Native-token recipient.
108
- * @param amount - Native-token amount in wei.
109
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
110
- * @returns Encoded Bundler3 calls.
111
- *
112
- * @example
113
- * ```ts
114
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
115
- *
116
- * const sender = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
117
- * const recipient = "0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359";
118
- *
119
- * const calls = BundlerAction.nativeTransfer(
120
- * 1,
121
- * sender,
122
- * recipient,
123
- * 1_000000000000000000n,
124
- * );
125
- * ```
126
- */
127
- function nativeTransfer(chainId: number, owner: Address, recipient: Address, amount: bigint, skipRevert?: boolean): BundlerCall[];
128
- /**
129
- * Encodes an ERC20 transfer from the given adapter.
130
- *
131
- * @param asset - ERC20 token to transfer.
132
- * @param recipient - Recipient of the transferred tokens.
133
- * @param amount - Token amount to transfer.
134
- * @param adapter - Adapter that currently holds the tokens.
135
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
136
- * @returns Encoded Bundler3 calls.
137
- *
138
- * @example
139
- * ```ts
140
- * import { getChainAddresses } from "@morpho-org/morpho-sdk/addresses";
141
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
142
- *
143
- * const adapter = getChainAddresses(1).bundler3.generalAdapter1;
144
- * const asset = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
145
- * const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
146
- *
147
- * const calls = BundlerAction.erc20Transfer(
148
- * asset,
149
- * recipient,
150
- * 100n,
151
- * adapter,
152
- * );
153
- * ```
154
- */
155
- function erc20Transfer(asset: Address, recipient: Address, amount: bigint, adapter: Address, skipRevert?: boolean): BundlerCall[];
156
- /**
157
- * Encodes a GeneralAdapter1 ERC20 `transferFrom`.
158
- *
159
- * @param chainId - Chain where the action will execute.
160
- * @param asset - ERC20 token to transfer.
161
- * @param amount - Token amount to transfer.
162
- * @param recipient - Recipient of the transferred tokens.
163
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
164
- * @returns Encoded Bundler3 calls.
165
- *
166
- * @example
167
- * ```ts
168
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
169
- *
170
- * const asset = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
171
- * const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
172
- *
173
- * const calls = BundlerAction.erc20TransferFrom(
174
- * 1,
175
- * asset,
176
- * 100n,
177
- * recipient,
178
- * );
179
- * ```
180
- */
181
- function erc20TransferFrom(chainId: number, asset: Address, amount: bigint, recipient: Address, skipRevert?: boolean): BundlerCall[];
182
- /**
183
- * Encodes an ERC20 permit for GeneralAdapter1 spending.
184
- *
185
- * @param chainId - Chain where the action will execute.
186
- * @param owner - Token owner signing the permit.
187
- * @param asset - ERC20 token being permitted.
188
- * @param amount - Allowance amount.
189
- * @param deadline - Permit deadline timestamp.
190
- * @param signature - Owner signature.
191
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
192
- * @returns Encoded Bundler3 calls.
193
- *
194
- * @example
195
- * ```ts
196
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
197
- *
198
- * const owner = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
199
- * const asset = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
200
- * const signature =
201
- * "0x111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222221b";
202
- *
203
- * const calls = BundlerAction.permit(
204
- * 1,
205
- * owner,
206
- * asset,
207
- * 100n,
208
- * 1_900_000_000n,
209
- * signature,
210
- * );
211
- * ```
212
- */
213
- function permit(chainId: number, owner: Address, asset: Address, amount: bigint, deadline: bigint, signature: Hex | Signature, skipRevert?: boolean): BundlerCall[];
214
- /**
215
- * Encodes a Permit2 approval for GeneralAdapter1 spending.
216
- *
217
- * @param chainId - Chain where the action will execute.
218
- * @param owner - Token owner signing the Permit2 payload.
219
- * @param permitSingle - Permit2 allowance payload.
220
- * @param signature - Owner signature.
221
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
222
- * @returns Encoded Bundler3 calls.
223
- * @throws {BundlerErrors.UnexpectedAction} when Permit2 is unavailable on the chain.
224
- *
225
- * @example
226
- * ```ts
227
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
228
- *
229
- * const owner = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
230
- * const token = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
231
- * const signature =
232
- * "0x111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222221b";
233
- *
234
- * const calls = BundlerAction.approve2(
235
- * 1,
236
- * owner,
237
- * {
238
- * details: {
239
- * token,
240
- * amount: 100n,
241
- * expiration: 1_900_000_000,
242
- * nonce: 0,
243
- * },
244
- * sigDeadline: 1_900_000_000n,
245
- * },
246
- * signature,
247
- * );
248
- * ```
249
- */
250
- function approve2(chainId: number, owner: Address, permitSingle: Permit2PermitSingle, signature: Hex | Signature, skipRevert?: boolean): BundlerCall[];
251
- /**
252
- * Encodes a GeneralAdapter1 Permit2 transfer.
253
- *
254
- * @param chainId - Chain where the action will execute.
255
- * @param asset - ERC20 token to transfer through Permit2.
256
- * @param amount - Token amount to transfer.
257
- * @param recipient - Recipient of the transferred tokens.
258
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
259
- * @returns Encoded Bundler3 calls.
260
- *
261
- * @example
262
- * ```ts
263
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
264
- *
265
- * const asset = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
266
- * const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
267
- *
268
- * const calls = BundlerAction.transferFrom2(
269
- * 1,
270
- * asset,
271
- * 100n,
272
- * recipient,
273
- * );
274
- * ```
275
- */
276
- function transferFrom2(chainId: number, asset: Address, amount: bigint, recipient: Address, skipRevert?: boolean): BundlerCall[];
277
- /**
278
- * Encodes a GeneralAdapter1 ERC4626 deposit.
279
- *
280
- * @param chainId - Chain where the action will execute.
281
- * @param erc4626 - ERC4626 vault address.
282
- * @param assets - Asset amount to deposit.
283
- * @param maxSharePrice - Maximum accepted share price in RAY.
284
- * @param receiver - Recipient of minted vault shares.
285
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
286
- * @returns Encoded Bundler3 calls.
287
- *
288
- * @example
289
- * ```ts
290
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
291
- *
292
- * const vault = "0x186514400e52270cef3D80e1c6F8d10A75d47344";
293
- * const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
294
- *
295
- * const calls = BundlerAction.erc4626Deposit(
296
- * 1,
297
- * vault,
298
- * 100n,
299
- * 1_000000000000000000000000000n,
300
- * recipient,
301
- * );
302
- * ```
303
- */
304
- function erc4626Deposit(chainId: number, erc4626: Address, assets: bigint, maxSharePrice: bigint, receiver: Address, skipRevert?: boolean): BundlerCall[];
305
- /**
306
- * Encodes a GeneralAdapter1 ERC4626 redeem.
307
- *
308
- * @param chainId - Chain where the action will execute.
309
- * @param erc4626 - ERC4626 vault address.
310
- * @param shares - Share amount to redeem.
311
- * @param minSharePrice - Minimum accepted share price in RAY.
312
- * @param receiver - Recipient of redeemed assets.
313
- * @param owner - Owner of the shares being redeemed.
314
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
315
- * @returns Encoded Bundler3 calls.
316
- *
317
- * @example
318
- * ```ts
319
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
320
- *
321
- * const vault = "0x186514400e52270cef3D80e1c6F8d10A75d47344";
322
- * const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
323
- * const owner = recipient;
324
- *
325
- * const calls = BundlerAction.erc4626Redeem(
326
- * 1,
327
- * vault,
328
- * 100n,
329
- * 900000000000000000000000000n,
330
- * recipient,
331
- * owner,
332
- * );
333
- * ```
334
- */
335
- function erc4626Redeem(chainId: number, erc4626: Address, shares: bigint, minSharePrice: bigint, receiver: Address, owner: Address, skipRevert?: boolean): BundlerCall[];
336
- /**
337
- * Encodes a Morpho Blue `setAuthorizationWithSig` call that submits a signed authorization.
338
- *
339
- * Lets a bundle grant `authorization.authorized` (GeneralAdapter1) operator rights on Morpho
340
- * on behalf of `authorization.authorizer` without a separate `setAuthorization` transaction.
341
- *
342
- * @param chainId - Chain where the action will execute.
343
- * @param authorization - The Morpho authorization payload covered by the signature.
344
- * @param signature - The owner's EIP-712 signature over the authorization typed data, as a hex
345
- * string or a viem `Signature` object.
346
- * @param skipRevert - Whether Bundler3 should tolerate a revert. Defaults to `true`, matching
347
- * the convention for already-authorized accounts (the call reverts harmlessly).
348
- * @returns Encoded Bundler3 calls.
349
- * @throws {BundlerErrors.UnexpectedSignature} when `authorization.authorized` is not the chain's
350
- * `GeneralAdapter1` — the only operator this bundled path may grant rights to.
351
- *
352
- * @example
353
- * ```ts
354
- * import { getChainAddresses } from "@morpho-org/morpho-sdk/addresses";
355
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
356
- *
357
- * const { generalAdapter1 } = getChainAddresses(1).bundler3;
358
- * const owner = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
359
- * const signature =
360
- * "0x111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222221b";
361
- *
362
- * const calls = BundlerAction.morphoSetAuthorizationWithSig(
363
- * 1,
364
- * {
365
- * authorizer: owner,
366
- * authorized: generalAdapter1,
367
- * isAuthorized: true,
368
- * nonce: 0n,
369
- * deadline: 1_900_000_000n,
370
- * },
371
- * signature,
372
- * );
373
- * ```
374
- */
375
- function morphoSetAuthorizationWithSig(chainId: number, authorization: Authorization, signature: Hex | Signature, skipRevert?: boolean): BundlerCall[];
376
- /**
377
- * Encodes a GeneralAdapter1 Morpho Blue supply-collateral call.
378
- *
379
- * @param chainId - Chain where the action will execute.
380
- * @param market - Morpho Blue market parameters.
381
- * @param assets - Collateral asset amount to supply.
382
- * @param onBehalf - Account receiving the collateral position.
383
- * @param callbackCalls - Calls executed in Morpho's callback.
384
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
385
- * @returns Encoded Bundler3 calls.
386
- *
387
- * @example
388
- * ```ts
389
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
390
- *
391
- * const loanToken = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
392
- * const collateralToken = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
393
- * const oracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
394
- * const irm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
395
- * const onBehalf = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
396
- * const marketParams = {
397
- * loanToken,
398
- * collateralToken,
399
- * oracle,
400
- * irm,
401
- * lltv: 860_000000000000000000n,
402
- * };
403
- *
404
- * const calls = BundlerAction.morphoSupplyCollateral(
405
- * 1,
406
- * marketParams,
407
- * 100n,
408
- * onBehalf,
409
- * [],
410
- * );
411
- * ```
412
- */
413
- function morphoSupplyCollateral(chainId: number, market: InputMarketParams, assets: bigint, onBehalf: Address, callbackCalls: BundlerCall[], skipRevert?: boolean): BundlerCall[];
414
- /**
415
- * Encodes a GeneralAdapter1 Morpho Blue supply call.
416
- *
417
- * @param chainId - Chain where the action will execute.
418
- * @param market - Morpho Blue market parameters.
419
- * @param assets - Supply asset amount.
420
- * @param shares - Supply share amount.
421
- * @param slippageAmount - Slippage guard amount (max share price in RAY for share-price slippage).
422
- * @param onBehalf - Account receiving the supply position.
423
- * @param callbackCalls - Calls executed in Morpho's callback.
424
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
425
- * @returns Encoded Bundler3 calls.
426
- *
427
- * @example
428
- * ```ts
429
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
430
- *
431
- * const loanToken = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
432
- * const collateralToken = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
433
- * const oracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
434
- * const irm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
435
- * const onBehalf = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
436
- * const marketParams = {
437
- * loanToken,
438
- * collateralToken,
439
- * oracle,
440
- * irm,
441
- * lltv: 860_000000000000000000n,
442
- * };
443
- *
444
- * const calls = BundlerAction.morphoSupply(
445
- * 1,
446
- * marketParams,
447
- * 100n,
448
- * 0n,
449
- * 1_010000000000000000000000000n,
450
- * onBehalf,
451
- * [],
452
- * );
453
- * ```
454
- */
455
- function morphoSupply(chainId: number, market: InputMarketParams, assets: bigint, shares: bigint, slippageAmount: bigint, onBehalf: Address, callbackCalls: BundlerCall[], skipRevert?: boolean): BundlerCall[];
456
- /**
457
- * Encodes a GeneralAdapter1 Morpho Blue borrow call.
458
- *
459
- * @param chainId - Chain where the action will execute.
460
- * @param market - Morpho Blue market parameters.
461
- * @param assets - Borrow asset amount.
462
- * @param shares - Borrow share amount.
463
- * @param minSharePrice - Minimum amount of borrowed assets per borrow share minted, scaled by 1e27.
464
- * @param receiver - Recipient of borrowed assets.
465
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
466
- * @returns Encoded Bundler3 calls.
467
- *
468
- * @example
469
- * ```ts
470
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
471
- *
472
- * const loanToken = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
473
- * const collateralToken = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
474
- * const oracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
475
- * const irm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
476
- * const receiver = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
477
- * const marketParams = {
478
- * loanToken,
479
- * collateralToken,
480
- * oracle,
481
- * irm,
482
- * lltv: 860_000000000000000000n,
483
- * };
484
- *
485
- * const calls = BundlerAction.morphoBorrow(
486
- * 1,
487
- * marketParams,
488
- * 100n,
489
- * 0n,
490
- * 1_000000000000000000000000000n,
491
- * receiver,
492
- * );
493
- * ```
494
- */
495
- function morphoBorrow(chainId: number, market: InputMarketParams, assets: bigint, shares: bigint, minSharePrice: bigint, receiver: Address, skipRevert?: boolean): BundlerCall[];
496
- /**
497
- * Encodes a GeneralAdapter1 Morpho Blue repay call.
498
- *
499
- * @param chainId - Chain where the action will execute.
500
- * @param market - Morpho Blue market parameters.
501
- * @param assets - Repay asset amount.
502
- * @param shares - Repay share amount.
503
- * @param maxSharePrice - Maximum amount of repaid assets per borrow share redeemed, scaled by 1e27.
504
- * @param onBehalf - Account whose borrow is repaid.
505
- * @param callbackCalls - Calls executed in Morpho's callback.
506
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
507
- * @returns Encoded Bundler3 calls.
508
- *
509
- * @example
510
- * ```ts
511
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
512
- *
513
- * const loanToken = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
514
- * const collateralToken = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
515
- * const oracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
516
- * const irm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
517
- * const onBehalf = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
518
- * const marketParams = {
519
- * loanToken,
520
- * collateralToken,
521
- * oracle,
522
- * irm,
523
- * lltv: 860_000000000000000000n,
524
- * };
525
- *
526
- * const calls = BundlerAction.morphoRepay(
527
- * 1,
528
- * marketParams,
529
- * 100n,
530
- * 0n,
531
- * 1_000000000000000000000000000n,
532
- * onBehalf,
533
- * [],
534
- * );
535
- * ```
536
- */
537
- function morphoRepay(chainId: number, market: InputMarketParams, assets: bigint, shares: bigint, maxSharePrice: bigint, onBehalf: Address, callbackCalls: BundlerCall[], skipRevert?: boolean): BundlerCall[];
538
- /**
539
- * Encodes a GeneralAdapter1 Morpho Blue withdraw call.
540
- *
541
- * @param chainId - Chain where the action will execute.
542
- * @param market - Morpho Blue market parameters.
543
- * @param assets - Withdraw asset amount.
544
- * @param shares - Withdraw share amount.
545
- * @param slippageAmount - Slippage guard amount (min share price in RAY for share-price slippage).
546
- * @param receiver - Recipient of withdrawn assets.
547
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
548
- * @returns Encoded Bundler3 calls.
549
- *
550
- * @example
551
- * ```ts
552
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
553
- *
554
- * const loanToken = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
555
- * const collateralToken = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
556
- * const oracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
557
- * const irm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
558
- * const receiver = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
559
- * const marketParams = {
560
- * loanToken,
561
- * collateralToken,
562
- * oracle,
563
- * irm,
564
- * lltv: 860_000000000000000000n,
565
- * };
566
- *
567
- * const calls = BundlerAction.morphoWithdraw(
568
- * 1,
569
- * marketParams,
570
- * 100n,
571
- * 0n,
572
- * 990000000000000000000000000n,
573
- * receiver,
574
- * );
575
- * ```
576
- */
577
- function morphoWithdraw(chainId: number, market: InputMarketParams, assets: bigint, shares: bigint, slippageAmount: bigint, receiver: Address, skipRevert?: boolean): BundlerCall[];
578
- /**
579
- * Encodes a GeneralAdapter1 Morpho Blue withdraw-collateral call.
580
- *
581
- * @param chainId - Chain where the action will execute.
582
- * @param market - Morpho Blue market parameters.
583
- * @param assets - Collateral asset amount to withdraw.
584
- * @param receiver - Recipient of withdrawn collateral.
585
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
586
- * @returns Encoded Bundler3 calls.
587
- *
588
- * @example
589
- * ```ts
590
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
591
- *
592
- * const loanToken = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
593
- * const collateralToken = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
594
- * const oracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
595
- * const irm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
596
- * const receiver = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
597
- * const marketParams = {
598
- * loanToken,
599
- * collateralToken,
600
- * oracle,
601
- * irm,
602
- * lltv: 860_000000000000000000n,
603
- * };
604
- *
605
- * const calls = BundlerAction.morphoWithdrawCollateral(
606
- * 1,
607
- * marketParams,
608
- * 100n,
609
- * receiver,
610
- * );
611
- * ```
612
- */
613
- function morphoWithdrawCollateral(chainId: number, market: InputMarketParams, assets: bigint, receiver: Address, skipRevert?: boolean): BundlerCall[];
614
- /**
615
- * Encodes a PublicAllocator reallocation call.
616
- *
617
- * @param chainId - Chain where the action will execute.
618
- * @param vault - Vault to reallocate.
619
- * @param fee - Public allocator fee.
620
- * @param withdrawals - Market withdrawals performed before supply.
621
- * @param supplyMarketParams - Target supply market parameters.
622
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
623
- * @returns Encoded Bundler3 calls.
624
- * @throws {BundlerErrors.UnexpectedAction} when the PublicAllocator is unavailable on the chain.
625
- * @deprecated Vault V1 PublicAllocator composition will be removed in the next major. Use
626
- * `vaultV2BluePublicAllocatorReallocate` or `vaultV2BluePublicAllocatorAllocateFromIdle`.
627
- *
628
- * @example
629
- * ```ts
630
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
631
- *
632
- * const loanToken = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
633
- * const collateralToken = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
634
- * const oracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
635
- * const irm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
636
- * const vault = "0x186514400e52270cef3D80e1c6F8d10A75d47344";
637
- * const marketParams = {
638
- * loanToken,
639
- * collateralToken,
640
- * oracle,
641
- * irm,
642
- * lltv: 860_000000000000000000n,
643
- * };
644
- *
645
- * const calls = BundlerAction.publicAllocatorReallocateTo(
646
- * 1,
647
- * vault,
648
- * 0n,
649
- * [{ marketParams, amount: 100n }],
650
- * marketParams,
651
- * );
652
- * ```
653
- */
654
- function publicAllocatorReallocateTo(chainId: number, vault: Address, fee: bigint, withdrawals: InputReallocation[], supplyMarketParams: InputMarketParams, skipRevert?: boolean): BundlerCall[];
655
- /**
656
- * Encodes a Vault V2 Blue Public Allocator market-to-market reallocation.
657
- *
658
- * @remarks Bundler3 must already hold the computed penalty assets. Explicit low-level
659
- * composition must add the corresponding GeneralAdapter1 transfer.
660
- *
661
- * @param chainId - Chain whose canonical Blue Public Allocator is called.
662
- * @param vault - Vault whose liquidity is reallocated.
663
- * @param deallocateAdapter - Vault V2 adapter supplying the source market.
664
- * @param deallocateMarket - Source Morpho Blue market parameters.
665
- * @param allocateAdapter - Vault V2 adapter supplying the target market.
666
- * @param allocateMarket - Target Morpho Blue market parameters.
667
- * @param assets - Assets to reallocate, bounded by `uint128` by the high-level action.
668
- * @param penalty - Vault-configured proportional penalty, scaled by WAD.
669
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
670
- * @returns A zero reset and exact approval when needed, then the allocator call.
671
- * @throws {BundlerErrors.UnexpectedAction} when the chain has no Blue Public Allocator deployment.
672
- * @throws {BundlerErrors.SkippableAllocatorPenalty} when `skipRevert` is true and a token approval is required.
673
- * @example
674
- * ```ts
675
- * import { ChainId } from "@morpho-org/morpho-sdk/constants";
676
- * import type { BlueInputMarketParams } from "@morpho-org/morpho-sdk/types";
677
- * import {
678
- * BundlerAction,
679
- * type BundlerCall,
680
- * } from "@morpho-org/morpho-sdk/bundler";
681
- * import type { Address } from "viem";
682
- *
683
- * const keyrockUsdcVault =
684
- * "0x04422053aDDbc9bB2759b248B574e3FCA76Bc145" satisfies Address;
685
- * const sourceAdapterFixture =
686
- * "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" satisfies Address;
687
- * const targetAdapterFixture =
688
- * "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" satisfies Address;
689
- * const usdc = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" satisfies Address;
690
- * const weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" satisfies Address;
691
- * const wbtc = "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" satisfies Address;
692
- * const ethUsdOracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" satisfies Address;
693
- * const adaptiveCurveIrm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC" satisfies Address;
694
- * const sourceMarket = {
695
- * loanToken: usdc,
696
- * collateralToken: weth,
697
- * oracle: ethUsdOracle,
698
- * irm: adaptiveCurveIrm,
699
- * lltv: 860_000_000_000_000_000n,
700
- * } satisfies BlueInputMarketParams;
701
- * const targetMarket = {
702
- * ...sourceMarket,
703
- * collateralToken: wbtc,
704
- * } satisfies BlueInputMarketParams;
705
- *
706
- * const calls: BundlerCall[] = BundlerAction.vaultV2BluePublicAllocatorReallocate(
707
- * ChainId.EthMainnet,
708
- * keyrockUsdcVault,
709
- * sourceAdapterFixture,
710
- * sourceMarket,
711
- * targetAdapterFixture,
712
- * targetMarket,
713
- * 1_000_000n,
714
- * 1_000_000_000_000_000n,
715
- * );
716
- * // Bundler3 resets and approves 1_000 USDC units, then calls `reallocate` with zero native value.
717
- * ```
718
- */
719
- function vaultV2BluePublicAllocatorReallocate(chainId: number, vault: Address, deallocateAdapter: Address, deallocateMarket: InputMarketParams, allocateAdapter: Address, allocateMarket: InputMarketParams, assets: bigint, penalty: bigint, skipRevert?: boolean): BundlerCall[];
720
- /**
721
- * Encodes a Vault V2 Blue Public Allocator allocation from vault idle liquidity.
722
- *
723
- * @remarks Bundler3 must already hold the computed penalty assets. Explicit low-level
724
- * composition must add the corresponding GeneralAdapter1 transfer.
725
- *
726
- * @param chainId - Chain whose canonical Blue Public Allocator is called.
727
- * @param vault - Vault whose idle liquidity is allocated.
728
- * @param adapter - Vault V2 adapter supplying the target market.
729
- * @param market - Target Morpho Blue market parameters.
730
- * @param assets - Assets to allocate, bounded by `uint128` by the high-level action.
731
- * @param penalty - Vault-configured proportional penalty, scaled by WAD.
732
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
733
- * @returns A zero reset and exact approval when needed, then the allocator call.
734
- * @throws {BundlerErrors.UnexpectedAction} when the chain has no Blue Public Allocator deployment.
735
- * @throws {BundlerErrors.SkippableAllocatorPenalty} when `skipRevert` is true and a token approval is required.
736
- * @example
737
- * ```ts
738
- * import { ChainId } from "@morpho-org/morpho-sdk/constants";
739
- * import type { BlueInputMarketParams } from "@morpho-org/morpho-sdk/types";
740
- * import {
741
- * BundlerAction,
742
- * type BundlerCall,
743
- * } from "@morpho-org/morpho-sdk/bundler";
744
- * import type { Address } from "viem";
745
- *
746
- * const keyrockUsdcVault =
747
- * "0x04422053aDDbc9bB2759b248B574e3FCA76Bc145" satisfies Address;
748
- * const targetAdapterFixture =
749
- * "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" satisfies Address;
750
- * const usdc = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" satisfies Address;
751
- * const weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" satisfies Address;
752
- * const ethUsdOracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" satisfies Address;
753
- * const adaptiveCurveIrm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC" satisfies Address;
754
- * const targetMarket = {
755
- * loanToken: usdc,
756
- * collateralToken: weth,
757
- * oracle: ethUsdOracle,
758
- * irm: adaptiveCurveIrm,
759
- * lltv: 860_000_000_000_000_000n,
760
- * } satisfies BlueInputMarketParams;
761
- *
762
- * const calls: BundlerCall[] = BundlerAction.vaultV2BluePublicAllocatorAllocateFromIdle(
763
- * ChainId.EthMainnet,
764
- * keyrockUsdcVault,
765
- * targetAdapterFixture,
766
- * targetMarket,
767
- * 1_000_000n,
768
- * 1_000_000_000_000_000n,
769
- * );
770
- * // Bundler3 resets and approves 1_000 USDC units, then calls `allocateFromIdle` with zero native value.
771
- * ```
772
- */
773
- function vaultV2BluePublicAllocatorAllocateFromIdle(chainId: number, vault: Address, adapter: Address, market: InputMarketParams, assets: bigint, penalty: bigint, skipRevert?: boolean): BundlerCall[];
774
- /**
775
- * Encodes a GeneralAdapter1 native-token wrap call.
776
- *
777
- * @param chainId - Chain where the action will execute.
778
- * @param amount - Native-token amount to wrap.
779
- * @param recipient - Recipient of wrapped native tokens.
780
- * @param skipRevert - Whether Bundler3 should tolerate a revert.
781
- * @returns Encoded Bundler3 calls.
782
- *
783
- * @example
784
- * ```ts
785
- * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
786
- *
787
- * const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
788
- *
789
- * const calls = BundlerAction.wrapNative(
790
- * 1,
791
- * 1_000000000000000000n,
792
- * recipient,
793
- * );
794
- * ```
795
- */
796
- function wrapNative(chainId: number, amount: bigint, recipient: Address, skipRevert?: boolean): BundlerCall[];
797
- }