@morpho-org/morpho-sdk 5.4.1 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -7
- package/lib/cjs/abis.d.ts +314 -1
- package/lib/cjs/abis.js +169 -1
- package/lib/cjs/actions/blue/borrow.d.ts +21 -15
- package/lib/cjs/actions/blue/borrow.js +25 -18
- package/lib/cjs/actions/blue/buildAssetFundingActions.d.ts +1 -1
- package/lib/cjs/actions/blue/buildAssetFundingActions.js +1 -1
- package/lib/cjs/actions/blue/buildReallocationActions.d.ts +62 -19
- package/lib/cjs/actions/blue/buildReallocationActions.js +123 -27
- package/lib/cjs/actions/blue/refinance.d.ts +14 -7
- package/lib/cjs/actions/blue/refinance.js +18 -10
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +28 -19
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +39 -23
- package/lib/cjs/actions/blue/withdraw.d.ts +20 -13
- package/lib/cjs/actions/blue/withdraw.js +23 -18
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +1 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +9 -2
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +64 -0
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +131 -0
- package/lib/cjs/actions/requirements/encode/index.d.ts +1 -0
- package/lib/cjs/actions/requirements/encode/index.js +1 -0
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +3 -2
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +5 -3
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +52 -0
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +91 -0
- package/lib/cjs/actions/signatures/index.d.ts +1 -0
- package/lib/cjs/actions/signatures/index.js +1 -0
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +54 -0
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +96 -0
- package/lib/cjs/actions/vaultV1/index.d.ts +1 -0
- package/lib/cjs/actions/vaultV1/index.js +1 -0
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +56 -0
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +97 -0
- package/lib/cjs/actions/vaultV2/index.d.ts +1 -0
- package/lib/cjs/actions/vaultV2/index.js +1 -0
- package/lib/cjs/bundler/actions.d.ts +118 -2
- package/lib/cjs/bundler/actions.js +212 -6
- package/lib/cjs/bundler/types.d.ts +20 -0
- package/lib/cjs/constants.d.ts +1 -1
- package/lib/cjs/constants.js +3 -1
- package/lib/cjs/entities/blue/blue.d.ts +365 -76
- package/lib/cjs/entities/blue/blue.js +285 -52
- package/lib/cjs/entities/index.d.ts +2 -1
- package/lib/cjs/entities/index.js +6 -3
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +82 -4
- package/lib/cjs/entities/vaultV1/vaultV1.js +164 -0
- package/lib/cjs/entities/{reallocationData.d.ts → vaultV1ReallocationData.d.ts} +41 -17
- package/lib/cjs/entities/{reallocationData.js → vaultV1ReallocationData.js} +30 -18
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +89 -3
- package/lib/cjs/entities/vaultV2/vaultV2.js +181 -0
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +511 -0
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +1311 -0
- package/lib/{esm/helpers/computeReallocations.d.ts → cjs/helpers/computeVaultV1Reallocations.d.ts} +14 -8
- package/lib/cjs/helpers/{computeReallocations.js → computeVaultV1Reallocations.js} +27 -13
- package/lib/cjs/helpers/constant.d.ts +5 -3
- package/lib/cjs/helpers/constant.js +6 -4
- package/lib/cjs/helpers/index.d.ts +3 -2
- package/lib/cjs/helpers/index.js +8 -3
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.d.ts +49 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +73 -0
- package/lib/cjs/helpers/validate.d.ts +31 -15
- package/lib/cjs/helpers/validate.js +140 -27
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/cjs/helpers/validateRequirementSpender.js +2 -1
- package/lib/cjs/types/action.d.ts +33 -1
- package/lib/cjs/types/error.d.ts +363 -5
- package/lib/cjs/types/error.js +455 -6
- package/lib/cjs/types/sharedLiquidity.d.ts +72 -8
- package/lib/cjs/utils.d.ts +2 -2
- package/lib/cjs/utils.js +6 -4
- package/lib/esm/abis.d.ts +314 -1
- package/lib/esm/abis.js +167 -1
- package/lib/esm/actions/blue/borrow.d.ts +21 -15
- package/lib/esm/actions/blue/borrow.js +26 -19
- package/lib/esm/actions/blue/buildAssetFundingActions.d.ts +1 -1
- package/lib/esm/actions/blue/buildAssetFundingActions.js +1 -1
- package/lib/esm/actions/blue/buildReallocationActions.d.ts +62 -19
- package/lib/esm/actions/blue/buildReallocationActions.js +119 -25
- package/lib/esm/actions/blue/refinance.d.ts +14 -7
- package/lib/esm/actions/blue/refinance.js +19 -11
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +28 -19
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +40 -24
- package/lib/esm/actions/blue/withdraw.d.ts +20 -13
- package/lib/esm/actions/blue/withdraw.js +24 -19
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +1 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +9 -2
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +64 -0
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +127 -0
- package/lib/esm/actions/requirements/encode/index.d.ts +1 -0
- package/lib/esm/actions/requirements/encode/index.js +1 -0
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +3 -2
- package/lib/esm/actions/requirements/getRequirementsApproval.js +5 -3
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +52 -0
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +87 -0
- package/lib/esm/actions/signatures/index.d.ts +1 -0
- package/lib/esm/actions/signatures/index.js +1 -0
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +54 -0
- package/lib/esm/actions/vaultV1/inKindRedeem.js +92 -0
- package/lib/esm/actions/vaultV1/index.d.ts +1 -0
- package/lib/esm/actions/vaultV1/index.js +1 -0
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +56 -0
- package/lib/esm/actions/vaultV2/inKindRedeem.js +93 -0
- package/lib/esm/actions/vaultV2/index.d.ts +1 -0
- package/lib/esm/actions/vaultV2/index.js +1 -0
- package/lib/esm/bundler/actions.d.ts +118 -2
- package/lib/esm/bundler/actions.js +215 -9
- package/lib/esm/bundler/types.d.ts +20 -0
- package/lib/esm/constants.d.ts +1 -1
- package/lib/esm/constants.js +1 -1
- package/lib/esm/entities/blue/blue.d.ts +362 -73
- package/lib/esm/entities/blue/blue.js +288 -55
- package/lib/esm/entities/index.d.ts +2 -1
- package/lib/esm/entities/index.js +2 -1
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +80 -2
- package/lib/esm/entities/vaultV1/vaultV1.js +170 -6
- package/lib/esm/entities/{reallocationData.d.ts → vaultV1ReallocationData.d.ts} +41 -17
- package/lib/esm/entities/{reallocationData.js → vaultV1ReallocationData.js} +33 -16
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +88 -2
- package/lib/esm/entities/vaultV2/vaultV2.js +187 -6
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +511 -0
- package/lib/esm/entities/vaultV2BlueReallocationData.js +1307 -0
- package/lib/{cjs/helpers/computeReallocations.d.ts → esm/helpers/computeVaultV1Reallocations.d.ts} +14 -8
- package/lib/esm/helpers/{computeReallocations.js → computeVaultV1Reallocations.js} +25 -11
- package/lib/esm/helpers/constant.d.ts +5 -3
- package/lib/esm/helpers/constant.js +5 -3
- package/lib/esm/helpers/index.d.ts +3 -2
- package/lib/esm/helpers/index.js +3 -2
- package/lib/esm/helpers/previewVaultV2InKindRedeem.d.ts +49 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.js +70 -0
- package/lib/esm/helpers/validate.d.ts +31 -15
- package/lib/esm/helpers/validate.js +141 -30
- package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/esm/helpers/validateRequirementSpender.js +2 -1
- package/lib/esm/types/action.d.ts +33 -1
- package/lib/esm/types/error.d.ts +363 -5
- package/lib/esm/types/error.js +428 -4
- package/lib/esm/types/sharedLiquidity.d.ts +72 -8
- package/lib/esm/utils.d.ts +2 -2
- package/lib/esm/utils.js +2 -2
- package/package.json +9 -11
package/README.md
CHANGED
|
@@ -23,18 +23,28 @@ Each entity exposes a set of actions. Bundled actions route through bundler3 (vi
|
|
|
23
23
|
| --- | --- | --- |
|
|
24
24
|
| **VaultV1** (MetaMorpho) | `deposit`, `migrateToV2` | Bundler |
|
|
25
25
|
| | `withdraw`, `redeem` | Direct call |
|
|
26
|
+
| | `inKindRedeem` | VaultExitBundlesV1 |
|
|
26
27
|
| **VaultV2** | `deposit` | Bundler |
|
|
27
28
|
| | `withdraw`, `redeem` | Direct call |
|
|
28
29
|
| | `forceWithdraw`, `forceRedeem` | Vault multicall |
|
|
30
|
+
| | `inKindRedeem` | VaultExitBundlesV1 |
|
|
29
31
|
| **Blue** | `supply`, `supplyCollateral`, `borrow`, `supplyCollateralBorrow`, `repay`, `withdraw`, `repayWithdrawCollateral`, `refinance` | Bundler |
|
|
30
32
|
| | `withdrawCollateral` | Direct call |
|
|
31
33
|
| **Midnight** | `takeLend`, `takeBorrow`, `supplyCollateralTakeBorrow`, `repayWithdrawCollateral` | Midnight Bundles |
|
|
32
34
|
| | `makeLend`, `makeBorrow` | Midnight mempool |
|
|
33
35
|
| | `supplyCollateral`, `redeem`, `cancelOffer` | Direct call |
|
|
34
36
|
|
|
37
|
+
`VaultExitBundlesV1` is registered on Ethereum, Base, Arbitrum, Optimism, Polygon, World Chain,
|
|
38
|
+
Unichain, HyperEVM, Katana, Monad, Stable, Tempo, and Robinhood Chain. Custom deployments can still
|
|
39
|
+
be configured with `registerCustomAddresses`.
|
|
40
|
+
|
|
35
41
|
## How it works
|
|
36
42
|
|
|
37
|
-
Actions that pull tokens or touch a position return `{ buildTx, getRequirements }`.
|
|
43
|
+
Actions that pull tokens or touch a position return `{ buildTx, getRequirements }`. Vault
|
|
44
|
+
`inKindRedeem` uses this shape so callers can await `getRequirements()` to check live Blue liquidity
|
|
45
|
+
and share authorization before invoking `buildTx()`. Calling `buildTx()` directly skips those
|
|
46
|
+
RPC-backed pre-flight checks. Other direct calls — vault `withdraw` / `redeem`, `forceWithdraw` /
|
|
47
|
+
`forceRedeem`, and Blue `withdrawCollateral` — have no prerequisites and return only `{ buildTx }`.
|
|
38
48
|
|
|
39
49
|
- **`getRequirements()`** — async; the on-chain prerequisites to satisfy first: ERC-20 approvals, permit / Permit2 signatures, Morpho authorization, or (for Midnight) operator authorization and offer-root signatures.
|
|
40
50
|
- **`buildTx(signatures?)`** — synchronous; the final, deep-frozen viem transaction. Pass any signatures collected from the requirements.
|
|
@@ -186,11 +196,13 @@ graph LR
|
|
|
186
196
|
MV1 --> V1D[vaultV1Deposit]
|
|
187
197
|
MV1 --> V1W[vaultV1Withdraw]
|
|
188
198
|
MV1 --> V1R[vaultV1Redeem]
|
|
199
|
+
MV1 --> V1IKR[vaultV1InKindRedeem]
|
|
189
200
|
MV1 --> V1M[vaultV1MigrateToV2]
|
|
190
201
|
|
|
191
202
|
V1D -->|nativeTransfer + wrapNative + erc4626Deposit| B1[Bundler3]
|
|
192
203
|
V1W -->|direct call| MM[MetaMorpho]
|
|
193
204
|
V1R -->|direct call| MM
|
|
205
|
+
V1IKR -->|direct call| VEB[VaultExitBundlesV1]
|
|
194
206
|
V1M -->|erc20TransferFrom + erc4626Redeem + erc4626Deposit| B1
|
|
195
207
|
end
|
|
196
208
|
|
|
@@ -199,12 +211,14 @@ graph LR
|
|
|
199
211
|
MV2 --> V2D[vaultV2Deposit]
|
|
200
212
|
MV2 --> V2W[vaultV2Withdraw]
|
|
201
213
|
MV2 --> V2R[vaultV2Redeem]
|
|
214
|
+
MV2 --> V2IKR[vaultV2InKindRedeem]
|
|
202
215
|
MV2 --> V2FW[vaultV2ForceWithdraw]
|
|
203
216
|
MV2 --> V2FR[vaultV2ForceRedeem]
|
|
204
217
|
|
|
205
218
|
V2D -->|nativeTransfer + wrapNative + erc4626Deposit| B2[Bundler3]
|
|
206
219
|
V2W -->|direct call| V2C[VaultV2 Contract]
|
|
207
220
|
V2R -->|direct call| V2C
|
|
221
|
+
V2IKR -->|direct call| VEB
|
|
208
222
|
V2FW -->|multicall| V2C
|
|
209
223
|
V2FR -->|multicall| V2C
|
|
210
224
|
end
|
|
@@ -220,12 +234,13 @@ graph LR
|
|
|
220
234
|
|
|
221
235
|
M1S -->|nativeWrap? + erc20TransferFrom + morphoSupply| B3[Bundler3]
|
|
222
236
|
M1SC -->|erc20TransferFrom + morphoSupplyCollateral| B3
|
|
223
|
-
M1B -->|
|
|
224
|
-
M1SCB -->|transfer + supplyCollateral +
|
|
225
|
-
M1W -->|
|
|
226
|
-
M1RF -->|
|
|
237
|
+
M1B -->|allocator reallocation? + morphoBorrow| B3
|
|
238
|
+
M1SCB -->|transfer + supplyCollateral + allocator reallocation? + borrow| B3
|
|
239
|
+
M1W -->|allocator reallocation? + morphoWithdraw| B3
|
|
240
|
+
M1RF -->|allocator reallocation? + supplyCollateral callback: borrow + repay + withdrawCollateral| B3
|
|
227
241
|
|
|
228
|
-
B3 -.->|reallocateTo|
|
|
242
|
+
B3 -.->|reallocateTo| PA1[PublicAllocator V1]
|
|
243
|
+
B3 -.->|reallocate / allocateFromIdle| BPA[Blue Public Allocator]
|
|
229
244
|
end
|
|
230
245
|
|
|
231
246
|
subgraph Midnight Flow
|
|
@@ -254,7 +269,8 @@ graph LR
|
|
|
254
269
|
style MM fill:#fff3e0,stroke:#ff9800
|
|
255
270
|
style V2C fill:#e3f2fd,stroke:#2196f3
|
|
256
271
|
style REQ fill:#f3e5f5,stroke:#9c27b0
|
|
257
|
-
style
|
|
272
|
+
style PA1 fill:#fff9c4,stroke:#f9a825
|
|
273
|
+
style BPA fill:#fff9c4,stroke:#f9a825
|
|
258
274
|
```
|
|
259
275
|
|
|
260
276
|
## Development
|
package/lib/cjs/abis.d.ts
CHANGED
|
@@ -1,6 +1,319 @@
|
|
|
1
1
|
export { marketParamsAbi } from "@morpho-org/blue-sdk";
|
|
2
|
-
export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi, preLiquidationAbi, preLiquidationFactoryAbi, publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi, vaultV2Abi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
|
|
2
|
+
export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi, preLiquidationAbi, preLiquidationFactoryAbi, publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi, vaultV1PublicAllocatorAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
|
|
3
3
|
export { ecrecoverRatifierAbi, midnightAbi, midnightBundlesAbi, setterRatifierAbi, } from "@morpho-org/midnight-sdk";
|
|
4
|
+
/** ABI for the VaultExitBundlesV1 periphery contract. */
|
|
5
|
+
export declare const vaultExitBundlesV1Abi: readonly [{
|
|
6
|
+
readonly type: "constructor";
|
|
7
|
+
readonly inputs: readonly [{
|
|
8
|
+
readonly name: "_blue";
|
|
9
|
+
readonly type: "address";
|
|
10
|
+
readonly internalType: "address";
|
|
11
|
+
}];
|
|
12
|
+
readonly stateMutability: "nonpayable";
|
|
13
|
+
}, {
|
|
14
|
+
readonly type: "error";
|
|
15
|
+
readonly name: "AdapterNotPartOfVault";
|
|
16
|
+
readonly inputs: readonly [];
|
|
17
|
+
}, {
|
|
18
|
+
readonly type: "error";
|
|
19
|
+
readonly name: "AlreadyInitiated";
|
|
20
|
+
readonly inputs: readonly [];
|
|
21
|
+
}, {
|
|
22
|
+
readonly type: "error";
|
|
23
|
+
readonly name: "ApproveReturnedFalse";
|
|
24
|
+
readonly inputs: readonly [];
|
|
25
|
+
}, {
|
|
26
|
+
readonly type: "error";
|
|
27
|
+
readonly name: "DeadlinePassed";
|
|
28
|
+
readonly inputs: readonly [];
|
|
29
|
+
}, {
|
|
30
|
+
readonly type: "error";
|
|
31
|
+
readonly name: "InvalidAdaptersLength";
|
|
32
|
+
readonly inputs: readonly [];
|
|
33
|
+
}, {
|
|
34
|
+
readonly type: "error";
|
|
35
|
+
readonly name: "MorphoMismatch";
|
|
36
|
+
readonly inputs: readonly [];
|
|
37
|
+
}, {
|
|
38
|
+
readonly type: "error";
|
|
39
|
+
readonly name: "NoCode";
|
|
40
|
+
readonly inputs: readonly [];
|
|
41
|
+
}, {
|
|
42
|
+
readonly type: "error";
|
|
43
|
+
readonly name: "PctExceeded";
|
|
44
|
+
readonly inputs: readonly [];
|
|
45
|
+
}, {
|
|
46
|
+
readonly type: "error";
|
|
47
|
+
readonly name: "SlippageExceeded";
|
|
48
|
+
readonly inputs: readonly [];
|
|
49
|
+
}, {
|
|
50
|
+
readonly type: "error";
|
|
51
|
+
readonly name: "TransferReturnedFalse";
|
|
52
|
+
readonly inputs: readonly [];
|
|
53
|
+
}, {
|
|
54
|
+
readonly type: "error";
|
|
55
|
+
readonly name: "UnauthorizedCallback";
|
|
56
|
+
readonly inputs: readonly [];
|
|
57
|
+
}, {
|
|
58
|
+
readonly type: "function";
|
|
59
|
+
readonly name: "BLUE";
|
|
60
|
+
readonly inputs: readonly [];
|
|
61
|
+
readonly outputs: readonly [{
|
|
62
|
+
readonly name: "";
|
|
63
|
+
readonly type: "address";
|
|
64
|
+
readonly internalType: "address";
|
|
65
|
+
}];
|
|
66
|
+
readonly stateMutability: "view";
|
|
67
|
+
}, {
|
|
68
|
+
readonly type: "function";
|
|
69
|
+
readonly name: "initiator";
|
|
70
|
+
readonly inputs: readonly [];
|
|
71
|
+
readonly outputs: readonly [{
|
|
72
|
+
readonly name: "";
|
|
73
|
+
readonly type: "address";
|
|
74
|
+
readonly internalType: "address";
|
|
75
|
+
}];
|
|
76
|
+
readonly stateMutability: "view";
|
|
77
|
+
}, {
|
|
78
|
+
readonly type: "function";
|
|
79
|
+
readonly name: "onMorphoFlashLoan";
|
|
80
|
+
readonly inputs: readonly [{
|
|
81
|
+
readonly name: "exitAssets";
|
|
82
|
+
readonly type: "uint256";
|
|
83
|
+
readonly internalType: "uint256";
|
|
84
|
+
}, {
|
|
85
|
+
readonly name: "data";
|
|
86
|
+
readonly type: "bytes";
|
|
87
|
+
readonly internalType: "bytes";
|
|
88
|
+
}];
|
|
89
|
+
readonly outputs: readonly [];
|
|
90
|
+
readonly stateMutability: "nonpayable";
|
|
91
|
+
}, {
|
|
92
|
+
readonly type: "function";
|
|
93
|
+
readonly name: "onMorphoSupply";
|
|
94
|
+
readonly inputs: readonly [{
|
|
95
|
+
readonly name: "assets";
|
|
96
|
+
readonly type: "uint256";
|
|
97
|
+
readonly internalType: "uint256";
|
|
98
|
+
}, {
|
|
99
|
+
readonly name: "data";
|
|
100
|
+
readonly type: "bytes";
|
|
101
|
+
readonly internalType: "bytes";
|
|
102
|
+
}];
|
|
103
|
+
readonly outputs: readonly [];
|
|
104
|
+
readonly stateMutability: "nonpayable";
|
|
105
|
+
}, {
|
|
106
|
+
readonly type: "function";
|
|
107
|
+
readonly name: "vaultExitBundlesV1ForceWithdrawVaultV2";
|
|
108
|
+
readonly inputs: readonly [{
|
|
109
|
+
readonly name: "vault";
|
|
110
|
+
readonly type: "address";
|
|
111
|
+
readonly internalType: "address";
|
|
112
|
+
}, {
|
|
113
|
+
readonly name: "adapter";
|
|
114
|
+
readonly type: "address";
|
|
115
|
+
readonly internalType: "address";
|
|
116
|
+
}, {
|
|
117
|
+
readonly name: "exitAssets";
|
|
118
|
+
readonly type: "uint256";
|
|
119
|
+
readonly internalType: "uint256";
|
|
120
|
+
}, {
|
|
121
|
+
readonly name: "minSharePriceE27";
|
|
122
|
+
readonly type: "uint256";
|
|
123
|
+
readonly internalType: "uint256";
|
|
124
|
+
}, {
|
|
125
|
+
readonly name: "sharesPermit";
|
|
126
|
+
readonly type: "tuple";
|
|
127
|
+
readonly internalType: "struct Permit";
|
|
128
|
+
readonly components: readonly [{
|
|
129
|
+
readonly name: "value";
|
|
130
|
+
readonly type: "uint256";
|
|
131
|
+
readonly internalType: "uint256";
|
|
132
|
+
}, {
|
|
133
|
+
readonly name: "nonce";
|
|
134
|
+
readonly type: "uint256";
|
|
135
|
+
readonly internalType: "uint256";
|
|
136
|
+
}, {
|
|
137
|
+
readonly name: "deadline";
|
|
138
|
+
readonly type: "uint256";
|
|
139
|
+
readonly internalType: "uint256";
|
|
140
|
+
}, {
|
|
141
|
+
readonly name: "v";
|
|
142
|
+
readonly type: "uint8";
|
|
143
|
+
readonly internalType: "uint8";
|
|
144
|
+
}, {
|
|
145
|
+
readonly name: "r";
|
|
146
|
+
readonly type: "bytes32";
|
|
147
|
+
readonly internalType: "bytes32";
|
|
148
|
+
}, {
|
|
149
|
+
readonly name: "s";
|
|
150
|
+
readonly type: "bytes32";
|
|
151
|
+
readonly internalType: "bytes32";
|
|
152
|
+
}];
|
|
153
|
+
}, {
|
|
154
|
+
readonly name: "referralFeePct";
|
|
155
|
+
readonly type: "uint256";
|
|
156
|
+
readonly internalType: "uint256";
|
|
157
|
+
}, {
|
|
158
|
+
readonly name: "referralFeeRecipient";
|
|
159
|
+
readonly type: "address";
|
|
160
|
+
readonly internalType: "address";
|
|
161
|
+
}, {
|
|
162
|
+
readonly name: "deadline";
|
|
163
|
+
readonly type: "uint256";
|
|
164
|
+
readonly internalType: "uint256";
|
|
165
|
+
}];
|
|
166
|
+
readonly outputs: readonly [];
|
|
167
|
+
readonly stateMutability: "nonpayable";
|
|
168
|
+
}, {
|
|
169
|
+
readonly type: "function";
|
|
170
|
+
readonly name: "vaultExitBundlesV1InKindRedemptionVaultV1";
|
|
171
|
+
readonly inputs: readonly [{
|
|
172
|
+
readonly name: "vault";
|
|
173
|
+
readonly type: "address";
|
|
174
|
+
readonly internalType: "address";
|
|
175
|
+
}, {
|
|
176
|
+
readonly name: "marketParamsList";
|
|
177
|
+
readonly type: "tuple[]";
|
|
178
|
+
readonly internalType: "struct MarketParams[]";
|
|
179
|
+
readonly components: readonly [{
|
|
180
|
+
readonly name: "loanToken";
|
|
181
|
+
readonly type: "address";
|
|
182
|
+
readonly internalType: "address";
|
|
183
|
+
}, {
|
|
184
|
+
readonly name: "collateralToken";
|
|
185
|
+
readonly type: "address";
|
|
186
|
+
readonly internalType: "address";
|
|
187
|
+
}, {
|
|
188
|
+
readonly name: "oracle";
|
|
189
|
+
readonly type: "address";
|
|
190
|
+
readonly internalType: "address";
|
|
191
|
+
}, {
|
|
192
|
+
readonly name: "irm";
|
|
193
|
+
readonly type: "address";
|
|
194
|
+
readonly internalType: "address";
|
|
195
|
+
}, {
|
|
196
|
+
readonly name: "lltv";
|
|
197
|
+
readonly type: "uint256";
|
|
198
|
+
readonly internalType: "uint256";
|
|
199
|
+
}];
|
|
200
|
+
}, {
|
|
201
|
+
readonly name: "exitAssets";
|
|
202
|
+
readonly type: "uint256";
|
|
203
|
+
readonly internalType: "uint256";
|
|
204
|
+
}, {
|
|
205
|
+
readonly name: "sharesPermit";
|
|
206
|
+
readonly type: "tuple";
|
|
207
|
+
readonly internalType: "struct Permit";
|
|
208
|
+
readonly components: readonly [{
|
|
209
|
+
readonly name: "value";
|
|
210
|
+
readonly type: "uint256";
|
|
211
|
+
readonly internalType: "uint256";
|
|
212
|
+
}, {
|
|
213
|
+
readonly name: "nonce";
|
|
214
|
+
readonly type: "uint256";
|
|
215
|
+
readonly internalType: "uint256";
|
|
216
|
+
}, {
|
|
217
|
+
readonly name: "deadline";
|
|
218
|
+
readonly type: "uint256";
|
|
219
|
+
readonly internalType: "uint256";
|
|
220
|
+
}, {
|
|
221
|
+
readonly name: "v";
|
|
222
|
+
readonly type: "uint8";
|
|
223
|
+
readonly internalType: "uint8";
|
|
224
|
+
}, {
|
|
225
|
+
readonly name: "r";
|
|
226
|
+
readonly type: "bytes32";
|
|
227
|
+
readonly internalType: "bytes32";
|
|
228
|
+
}, {
|
|
229
|
+
readonly name: "s";
|
|
230
|
+
readonly type: "bytes32";
|
|
231
|
+
readonly internalType: "bytes32";
|
|
232
|
+
}];
|
|
233
|
+
}, {
|
|
234
|
+
readonly name: "deadline";
|
|
235
|
+
readonly type: "uint256";
|
|
236
|
+
readonly internalType: "uint256";
|
|
237
|
+
}];
|
|
238
|
+
readonly outputs: readonly [];
|
|
239
|
+
readonly stateMutability: "nonpayable";
|
|
240
|
+
}, {
|
|
241
|
+
readonly type: "function";
|
|
242
|
+
readonly name: "vaultExitBundlesV1InKindRedemptionVaultV2";
|
|
243
|
+
readonly inputs: readonly [{
|
|
244
|
+
readonly name: "vault";
|
|
245
|
+
readonly type: "address";
|
|
246
|
+
readonly internalType: "address";
|
|
247
|
+
}, {
|
|
248
|
+
readonly name: "adapter";
|
|
249
|
+
readonly type: "address";
|
|
250
|
+
readonly internalType: "address";
|
|
251
|
+
}, {
|
|
252
|
+
readonly name: "marketParamsList";
|
|
253
|
+
readonly type: "tuple[]";
|
|
254
|
+
readonly internalType: "struct MarketParams[]";
|
|
255
|
+
readonly components: readonly [{
|
|
256
|
+
readonly name: "loanToken";
|
|
257
|
+
readonly type: "address";
|
|
258
|
+
readonly internalType: "address";
|
|
259
|
+
}, {
|
|
260
|
+
readonly name: "collateralToken";
|
|
261
|
+
readonly type: "address";
|
|
262
|
+
readonly internalType: "address";
|
|
263
|
+
}, {
|
|
264
|
+
readonly name: "oracle";
|
|
265
|
+
readonly type: "address";
|
|
266
|
+
readonly internalType: "address";
|
|
267
|
+
}, {
|
|
268
|
+
readonly name: "irm";
|
|
269
|
+
readonly type: "address";
|
|
270
|
+
readonly internalType: "address";
|
|
271
|
+
}, {
|
|
272
|
+
readonly name: "lltv";
|
|
273
|
+
readonly type: "uint256";
|
|
274
|
+
readonly internalType: "uint256";
|
|
275
|
+
}];
|
|
276
|
+
}, {
|
|
277
|
+
readonly name: "exitAssets";
|
|
278
|
+
readonly type: "uint256";
|
|
279
|
+
readonly internalType: "uint256";
|
|
280
|
+
}, {
|
|
281
|
+
readonly name: "sharesPermit";
|
|
282
|
+
readonly type: "tuple";
|
|
283
|
+
readonly internalType: "struct Permit";
|
|
284
|
+
readonly components: readonly [{
|
|
285
|
+
readonly name: "value";
|
|
286
|
+
readonly type: "uint256";
|
|
287
|
+
readonly internalType: "uint256";
|
|
288
|
+
}, {
|
|
289
|
+
readonly name: "nonce";
|
|
290
|
+
readonly type: "uint256";
|
|
291
|
+
readonly internalType: "uint256";
|
|
292
|
+
}, {
|
|
293
|
+
readonly name: "deadline";
|
|
294
|
+
readonly type: "uint256";
|
|
295
|
+
readonly internalType: "uint256";
|
|
296
|
+
}, {
|
|
297
|
+
readonly name: "v";
|
|
298
|
+
readonly type: "uint8";
|
|
299
|
+
readonly internalType: "uint8";
|
|
300
|
+
}, {
|
|
301
|
+
readonly name: "r";
|
|
302
|
+
readonly type: "bytes32";
|
|
303
|
+
readonly internalType: "bytes32";
|
|
304
|
+
}, {
|
|
305
|
+
readonly name: "s";
|
|
306
|
+
readonly type: "bytes32";
|
|
307
|
+
readonly internalType: "bytes32";
|
|
308
|
+
}];
|
|
309
|
+
}, {
|
|
310
|
+
readonly name: "deadline";
|
|
311
|
+
readonly type: "uint256";
|
|
312
|
+
readonly internalType: "uint256";
|
|
313
|
+
}];
|
|
314
|
+
readonly outputs: readonly [];
|
|
315
|
+
readonly stateMutability: "nonpayable";
|
|
316
|
+
}];
|
|
4
317
|
/** ABI for the Bundler3 multicall contract. */
|
|
5
318
|
export declare const bundler3Abi: readonly [{
|
|
6
319
|
readonly type: "function";
|
package/lib/cjs/abis.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compoundV3MigrationAdapterAbi = exports.compoundV2MigrationAdapterAbi = exports.aaveV3OptimizerMigrationAdapterAbi = exports.aaveV3MigrationAdapterAbi = exports.aaveV2MigrationAdapterAbi = exports.erc20WrapperAdapterAbi = exports.paraswapAdapterAbi = exports.ethereumGeneralAdapter1Abi = exports.generalAdapter1Abi = exports.coreAdapterAbi = exports.bundler3Abi = exports.setterRatifierAbi = exports.midnightBundlesAbi = exports.midnightAbi = exports.ecrecoverRatifierAbi = exports.wstEthAbi = exports.wrappedBackedTokenAbi = exports.whitelistControllerAggregatorV2Abi = exports.vaultV2FactoryAbi = exports.vaultV2Abi = exports.vaultV1AdapterFactoryAbi = exports.vaultV1AdapterAbi = exports.publicAllocatorAbi = exports.preLiquidationFactoryAbi = exports.preLiquidationAbi = exports.permit2Abi = exports.permissionedErc20WrapperAbi = exports.morphoVaultV1AdapterFactoryAbi = exports.morphoVaultV1AdapterAbi = exports.morphoMarketV1AdapterV2FactoryAbi = exports.morphoMarketV1AdapterV2Abi = exports.morphoMarketV1AdapterFactoryAbi = exports.morphoMarketV1AdapterAbi = exports.metaMorphoFactoryAbi = exports.metaMorphoAbi = exports.erc5267Abi = exports.erc2612Abi = exports.blueOracleAbi = exports.blueAbi = exports.adaptiveCurveIrmAbi = exports.marketParamsAbi = void 0;
|
|
3
|
+
exports.compoundV3MigrationAdapterAbi = exports.compoundV2MigrationAdapterAbi = exports.aaveV3OptimizerMigrationAdapterAbi = exports.aaveV3MigrationAdapterAbi = exports.aaveV2MigrationAdapterAbi = exports.erc20WrapperAdapterAbi = exports.paraswapAdapterAbi = exports.ethereumGeneralAdapter1Abi = exports.generalAdapter1Abi = exports.coreAdapterAbi = exports.bundler3Abi = exports.vaultExitBundlesV1Abi = exports.setterRatifierAbi = exports.midnightBundlesAbi = exports.midnightAbi = exports.ecrecoverRatifierAbi = exports.wstEthAbi = exports.wrappedBackedTokenAbi = exports.whitelistControllerAggregatorV2Abi = exports.vaultV2FactoryAbi = exports.vaultV2BluePublicAllocatorAbi = exports.vaultV2Abi = exports.vaultV1PublicAllocatorAbi = exports.vaultV1AdapterFactoryAbi = exports.vaultV1AdapterAbi = exports.publicAllocatorAbi = exports.preLiquidationFactoryAbi = exports.preLiquidationAbi = exports.permit2Abi = exports.permissionedErc20WrapperAbi = exports.morphoVaultV1AdapterFactoryAbi = exports.morphoVaultV1AdapterAbi = exports.morphoMarketV1AdapterV2FactoryAbi = exports.morphoMarketV1AdapterV2Abi = exports.morphoMarketV1AdapterFactoryAbi = exports.morphoMarketV1AdapterAbi = exports.metaMorphoFactoryAbi = exports.metaMorphoAbi = exports.erc5267Abi = exports.erc2612Abi = exports.blueOracleAbi = exports.blueAbi = exports.adaptiveCurveIrmAbi = exports.marketParamsAbi = void 0;
|
|
4
4
|
var blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
5
|
Object.defineProperty(exports, "marketParamsAbi", { enumerable: true, get: function () { return blue_sdk_1.marketParamsAbi; } });
|
|
6
6
|
var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
@@ -24,7 +24,9 @@ Object.defineProperty(exports, "preLiquidationFactoryAbi", { enumerable: true, g
|
|
|
24
24
|
Object.defineProperty(exports, "publicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.publicAllocatorAbi; } });
|
|
25
25
|
Object.defineProperty(exports, "vaultV1AdapterAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1AdapterAbi; } });
|
|
26
26
|
Object.defineProperty(exports, "vaultV1AdapterFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1AdapterFactoryAbi; } });
|
|
27
|
+
Object.defineProperty(exports, "vaultV1PublicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1PublicAllocatorAbi; } });
|
|
27
28
|
Object.defineProperty(exports, "vaultV2Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV2Abi; } });
|
|
29
|
+
Object.defineProperty(exports, "vaultV2BluePublicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV2BluePublicAllocatorAbi; } });
|
|
28
30
|
Object.defineProperty(exports, "vaultV2FactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV2FactoryAbi; } });
|
|
29
31
|
Object.defineProperty(exports, "whitelistControllerAggregatorV2Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.whitelistControllerAggregatorV2Abi; } });
|
|
30
32
|
Object.defineProperty(exports, "wrappedBackedTokenAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.wrappedBackedTokenAbi; } });
|
|
@@ -34,6 +36,172 @@ Object.defineProperty(exports, "ecrecoverRatifierAbi", { enumerable: true, get:
|
|
|
34
36
|
Object.defineProperty(exports, "midnightAbi", { enumerable: true, get: function () { return midnight_sdk_1.midnightAbi; } });
|
|
35
37
|
Object.defineProperty(exports, "midnightBundlesAbi", { enumerable: true, get: function () { return midnight_sdk_1.midnightBundlesAbi; } });
|
|
36
38
|
Object.defineProperty(exports, "setterRatifierAbi", { enumerable: true, get: function () { return midnight_sdk_1.setterRatifierAbi; } });
|
|
39
|
+
/** ABI for the VaultExitBundlesV1 periphery contract. */
|
|
40
|
+
exports.vaultExitBundlesV1Abi = [
|
|
41
|
+
{
|
|
42
|
+
type: "constructor",
|
|
43
|
+
inputs: [{ name: "_blue", type: "address", internalType: "address" }],
|
|
44
|
+
stateMutability: "nonpayable",
|
|
45
|
+
},
|
|
46
|
+
{ type: "error", name: "AdapterNotPartOfVault", inputs: [] },
|
|
47
|
+
{ type: "error", name: "AlreadyInitiated", inputs: [] },
|
|
48
|
+
{ type: "error", name: "ApproveReturnedFalse", inputs: [] },
|
|
49
|
+
{ type: "error", name: "DeadlinePassed", inputs: [] },
|
|
50
|
+
{ type: "error", name: "InvalidAdaptersLength", inputs: [] },
|
|
51
|
+
{ type: "error", name: "MorphoMismatch", inputs: [] },
|
|
52
|
+
{ type: "error", name: "NoCode", inputs: [] },
|
|
53
|
+
{ type: "error", name: "PctExceeded", inputs: [] },
|
|
54
|
+
{ type: "error", name: "SlippageExceeded", inputs: [] },
|
|
55
|
+
{ type: "error", name: "TransferReturnedFalse", inputs: [] },
|
|
56
|
+
{ type: "error", name: "UnauthorizedCallback", inputs: [] },
|
|
57
|
+
{
|
|
58
|
+
type: "function",
|
|
59
|
+
name: "BLUE",
|
|
60
|
+
inputs: [],
|
|
61
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
62
|
+
stateMutability: "view",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: "function",
|
|
66
|
+
name: "initiator",
|
|
67
|
+
inputs: [],
|
|
68
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
69
|
+
stateMutability: "view",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: "function",
|
|
73
|
+
name: "onMorphoFlashLoan",
|
|
74
|
+
inputs: [
|
|
75
|
+
{ name: "exitAssets", type: "uint256", internalType: "uint256" },
|
|
76
|
+
{ name: "data", type: "bytes", internalType: "bytes" },
|
|
77
|
+
],
|
|
78
|
+
outputs: [],
|
|
79
|
+
stateMutability: "nonpayable",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
type: "function",
|
|
83
|
+
name: "onMorphoSupply",
|
|
84
|
+
inputs: [
|
|
85
|
+
{ name: "assets", type: "uint256", internalType: "uint256" },
|
|
86
|
+
{ name: "data", type: "bytes", internalType: "bytes" },
|
|
87
|
+
],
|
|
88
|
+
outputs: [],
|
|
89
|
+
stateMutability: "nonpayable",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: "function",
|
|
93
|
+
name: "vaultExitBundlesV1ForceWithdrawVaultV2",
|
|
94
|
+
inputs: [
|
|
95
|
+
{ name: "vault", type: "address", internalType: "address" },
|
|
96
|
+
{ name: "adapter", type: "address", internalType: "address" },
|
|
97
|
+
{ name: "exitAssets", type: "uint256", internalType: "uint256" },
|
|
98
|
+
{ name: "minSharePriceE27", type: "uint256", internalType: "uint256" },
|
|
99
|
+
{
|
|
100
|
+
name: "sharesPermit",
|
|
101
|
+
type: "tuple",
|
|
102
|
+
internalType: "struct Permit",
|
|
103
|
+
components: [
|
|
104
|
+
{ name: "value", type: "uint256", internalType: "uint256" },
|
|
105
|
+
{ name: "nonce", type: "uint256", internalType: "uint256" },
|
|
106
|
+
{ name: "deadline", type: "uint256", internalType: "uint256" },
|
|
107
|
+
{ name: "v", type: "uint8", internalType: "uint8" },
|
|
108
|
+
{ name: "r", type: "bytes32", internalType: "bytes32" },
|
|
109
|
+
{ name: "s", type: "bytes32", internalType: "bytes32" },
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
{ name: "referralFeePct", type: "uint256", internalType: "uint256" },
|
|
113
|
+
{
|
|
114
|
+
name: "referralFeeRecipient",
|
|
115
|
+
type: "address",
|
|
116
|
+
internalType: "address",
|
|
117
|
+
},
|
|
118
|
+
{ name: "deadline", type: "uint256", internalType: "uint256" },
|
|
119
|
+
],
|
|
120
|
+
outputs: [],
|
|
121
|
+
stateMutability: "nonpayable",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
type: "function",
|
|
125
|
+
name: "vaultExitBundlesV1InKindRedemptionVaultV1",
|
|
126
|
+
inputs: [
|
|
127
|
+
{ name: "vault", type: "address", internalType: "address" },
|
|
128
|
+
{
|
|
129
|
+
name: "marketParamsList",
|
|
130
|
+
type: "tuple[]",
|
|
131
|
+
internalType: "struct MarketParams[]",
|
|
132
|
+
components: [
|
|
133
|
+
{ name: "loanToken", type: "address", internalType: "address" },
|
|
134
|
+
{
|
|
135
|
+
name: "collateralToken",
|
|
136
|
+
type: "address",
|
|
137
|
+
internalType: "address",
|
|
138
|
+
},
|
|
139
|
+
{ name: "oracle", type: "address", internalType: "address" },
|
|
140
|
+
{ name: "irm", type: "address", internalType: "address" },
|
|
141
|
+
{ name: "lltv", type: "uint256", internalType: "uint256" },
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
{ name: "exitAssets", type: "uint256", internalType: "uint256" },
|
|
145
|
+
{
|
|
146
|
+
name: "sharesPermit",
|
|
147
|
+
type: "tuple",
|
|
148
|
+
internalType: "struct Permit",
|
|
149
|
+
components: [
|
|
150
|
+
{ name: "value", type: "uint256", internalType: "uint256" },
|
|
151
|
+
{ name: "nonce", type: "uint256", internalType: "uint256" },
|
|
152
|
+
{ name: "deadline", type: "uint256", internalType: "uint256" },
|
|
153
|
+
{ name: "v", type: "uint8", internalType: "uint8" },
|
|
154
|
+
{ name: "r", type: "bytes32", internalType: "bytes32" },
|
|
155
|
+
{ name: "s", type: "bytes32", internalType: "bytes32" },
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
{ name: "deadline", type: "uint256", internalType: "uint256" },
|
|
159
|
+
],
|
|
160
|
+
outputs: [],
|
|
161
|
+
stateMutability: "nonpayable",
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
type: "function",
|
|
165
|
+
name: "vaultExitBundlesV1InKindRedemptionVaultV2",
|
|
166
|
+
inputs: [
|
|
167
|
+
{ name: "vault", type: "address", internalType: "address" },
|
|
168
|
+
{ name: "adapter", type: "address", internalType: "address" },
|
|
169
|
+
{
|
|
170
|
+
name: "marketParamsList",
|
|
171
|
+
type: "tuple[]",
|
|
172
|
+
internalType: "struct MarketParams[]",
|
|
173
|
+
components: [
|
|
174
|
+
{ name: "loanToken", type: "address", internalType: "address" },
|
|
175
|
+
{
|
|
176
|
+
name: "collateralToken",
|
|
177
|
+
type: "address",
|
|
178
|
+
internalType: "address",
|
|
179
|
+
},
|
|
180
|
+
{ name: "oracle", type: "address", internalType: "address" },
|
|
181
|
+
{ name: "irm", type: "address", internalType: "address" },
|
|
182
|
+
{ name: "lltv", type: "uint256", internalType: "uint256" },
|
|
183
|
+
],
|
|
184
|
+
},
|
|
185
|
+
{ name: "exitAssets", type: "uint256", internalType: "uint256" },
|
|
186
|
+
{
|
|
187
|
+
name: "sharesPermit",
|
|
188
|
+
type: "tuple",
|
|
189
|
+
internalType: "struct Permit",
|
|
190
|
+
components: [
|
|
191
|
+
{ name: "value", type: "uint256", internalType: "uint256" },
|
|
192
|
+
{ name: "nonce", type: "uint256", internalType: "uint256" },
|
|
193
|
+
{ name: "deadline", type: "uint256", internalType: "uint256" },
|
|
194
|
+
{ name: "v", type: "uint8", internalType: "uint8" },
|
|
195
|
+
{ name: "r", type: "bytes32", internalType: "bytes32" },
|
|
196
|
+
{ name: "s", type: "bytes32", internalType: "bytes32" },
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
{ name: "deadline", type: "uint256", internalType: "uint256" },
|
|
200
|
+
],
|
|
201
|
+
outputs: [],
|
|
202
|
+
stateMutability: "nonpayable",
|
|
203
|
+
},
|
|
204
|
+
];
|
|
37
205
|
/** ABI for the Bundler3 multicall contract. */
|
|
38
206
|
exports.bundler3Abi = [
|
|
39
207
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MarketParams } from "@morpho-org/blue-sdk";
|
|
2
2
|
import type { Address } from "viem";
|
|
3
|
-
import { type AuthorizationRequirementSignature, type BlueBorrowAction, type
|
|
3
|
+
import { type AuthorizationRequirementSignature, type BlueBorrowAction, type BlueReallocationPlan, type Metadata, type Transaction } from "../../types/index.js";
|
|
4
4
|
/** Parameters for {@link blueBorrow}. */
|
|
5
5
|
export interface BlueBorrowParams {
|
|
6
6
|
market: {
|
|
@@ -14,8 +14,8 @@ export interface BlueBorrowParams {
|
|
|
14
14
|
receiver: Address;
|
|
15
15
|
/** Minimum borrow share price (in ray). Protects against share price manipulation. */
|
|
16
16
|
minSharePrice: bigint;
|
|
17
|
-
/** Vault reallocations to execute before borrowing
|
|
18
|
-
reallocations?:
|
|
17
|
+
/** Homogeneous Vault V1 or Vault V2 reallocations to execute before borrowing. */
|
|
18
|
+
reallocations?: BlueReallocationPlan;
|
|
19
19
|
/**
|
|
20
20
|
* Optional signed Morpho authorization. When provided, a `setAuthorizationWithSig` call is
|
|
21
21
|
* prepended to the bundle so GeneralAdapter1 is authorized in-bundle instead of via a
|
|
@@ -32,17 +32,18 @@ export interface BlueBorrowParams {
|
|
|
32
32
|
* `onBehalf`. Uses `minSharePrice` to protect against share price manipulation between
|
|
33
33
|
* transaction construction and execution.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* accumulate in `tx.value
|
|
35
|
+
* A `reallocations` plan contains either PublicAllocator V1 entries or Vault V2
|
|
36
|
+
* BluePublicAllocator entries, never both. The calls run before the borrow.
|
|
37
|
+
* V1 fees accumulate in `tx.value`; V2 penalties are paid in the target loan
|
|
38
|
+
* token and donated directly to each vault.
|
|
38
39
|
*
|
|
39
40
|
* @param params.market.chainId - The chain the market lives on.
|
|
40
41
|
* @param params.market.marketParams - Market params (loanToken, collateralToken, oracle, irm, lltv).
|
|
41
42
|
* @param params.args.amount - Loan asset amount to borrow, in the loan token's smallest unit.
|
|
42
43
|
* @param params.args.receiver - Address that receives the borrowed assets.
|
|
43
44
|
* @param params.args.minSharePrice - Minimum borrow share price (in ray). Slippage protection.
|
|
44
|
-
* @param params.args.reallocations - Optional
|
|
45
|
-
*
|
|
45
|
+
* @param params.args.reallocations - Optional homogeneous Vault V1 or Vault V2 reallocations to
|
|
46
|
+
* execute before borrowing.
|
|
46
47
|
* @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
|
|
47
48
|
* a `setAuthorizationWithSig` call is prepended to the bundle.
|
|
48
49
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
@@ -50,13 +51,18 @@ export interface BlueBorrowParams {
|
|
|
50
51
|
* typed `action` discriminator the simulation layer consumes.
|
|
51
52
|
* @throws {NonPositiveInputError} when `amount <= 0n` or any reallocation withdrawal amount
|
|
52
53
|
* is non-positive.
|
|
53
|
-
* @throws {
|
|
54
|
-
* @throws {
|
|
55
|
-
*
|
|
56
|
-
* @throws {
|
|
57
|
-
*
|
|
58
|
-
* @throws {
|
|
59
|
-
*
|
|
54
|
+
* @throws {InputExceedsMaxError} when a V2 reallocation asset amount exceeds `uint128` or its penalty exceeds WAD.
|
|
55
|
+
* @throws {InconsistentReallocationPenaltyError} when V2 entries for one vault use different penalties.
|
|
56
|
+
* @throws {InvalidReallocationAddressError} when a V2 vault or adapter address is malformed.
|
|
57
|
+
* @throws {InvalidReallocationSourceTypeError} when a V2 source is absent, incomplete, or has an unknown discriminator.
|
|
58
|
+
* @throws {InvalidReallocationShapeError} when an entry matches both or neither V1/V2 shape.
|
|
59
|
+
* @throws {MixedReallocationVersionsError} when one plan contains both V1 and V2 entries.
|
|
60
|
+
* @throws {NegativeInputError} when `minSharePrice < 0n`, a V1 fee, or a V2 penalty is negative.
|
|
61
|
+
* @throws {EmptyReallocationWithdrawalsError} when any `reallocation.withdrawals` is empty.
|
|
62
|
+
* @throws {ReallocationWithdrawalOnTargetMarketError} when any reallocation withdrawal references
|
|
63
|
+
* the target market.
|
|
64
|
+
* @throws {UnsortedReallocationWithdrawalsError} when reallocation withdrawals are not strictly
|
|
65
|
+
* sorted by market id.
|
|
60
66
|
* @example
|
|
61
67
|
* ```ts
|
|
62
68
|
* import { blueBorrow } from "@morpho-org/morpho-sdk";
|