@morpho-org/morpho-sdk 5.9.0 → 6.0.0-next.1
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/MIGRATION-v5-to-v6.md +404 -0
- package/README.md +127 -69
- package/lib/cjs/abis.d.ts +210 -0
- package/lib/cjs/abis.js +142 -2
- package/lib/cjs/actions/blue/borrow.d.ts +62 -61
- package/lib/cjs/actions/blue/borrow.js +48 -80
- package/lib/cjs/actions/blue/common.d.ts +86 -0
- package/lib/cjs/actions/blue/common.js +205 -0
- package/lib/cjs/actions/blue/refinance.d.ts +72 -112
- package/lib/cjs/actions/blue/refinance.js +97 -199
- package/lib/cjs/actions/blue/repay.d.ts +72 -68
- package/lib/cjs/actions/blue/repay.js +56 -118
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +85 -90
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +148 -137
- package/lib/cjs/actions/blue/supply.d.ts +62 -45
- package/lib/cjs/actions/blue/supply.js +94 -70
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +63 -40
- package/lib/cjs/actions/blue/supplyCollateral.js +52 -69
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +82 -90
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +133 -120
- package/lib/cjs/actions/blue/withdraw.d.ts +68 -79
- package/lib/cjs/actions/blue/withdraw.js +101 -97
- package/lib/cjs/actions/blue/withdrawCollateral.d.ts +56 -28
- package/lib/cjs/actions/blue/withdrawCollateral.js +45 -50
- package/lib/cjs/actions/bundles/common.d.ts +200 -0
- package/lib/cjs/actions/bundles/common.js +469 -0
- package/lib/cjs/actions/bundles/index.d.ts +3 -0
- package/lib/cjs/actions/bundles/index.js +23 -0
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +76 -0
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +125 -0
- package/lib/cjs/actions/index.d.ts +2 -1
- package/lib/cjs/actions/index.js +1 -0
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +2 -2
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +2 -2
- package/lib/cjs/actions/midnight/takeBorrow.d.ts +2 -2
- package/lib/cjs/actions/midnight/takeBorrow.js +2 -2
- package/lib/cjs/actions/midnight/takeLend.d.ts +2 -2
- package/lib/cjs/actions/midnight/takeLend.js +2 -2
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +29 -17
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +60 -19
- package/lib/cjs/actions/requirements/blue/getUnusedPermit2Nonce.d.ts +48 -0
- package/lib/cjs/actions/requirements/blue/getUnusedPermit2Nonce.js +72 -0
- package/lib/cjs/actions/requirements/blue/index.d.ts +1 -0
- package/lib/cjs/actions/requirements/blue/index.js +1 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +10 -7
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +30 -5
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +2 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +8 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +16 -7
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +39 -6
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +61 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +123 -0
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +4 -4
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +6 -5
- 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/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +1 -1
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +6 -4
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +6 -4
- package/lib/cjs/actions/signatures/getTokenRequirementActions.d.ts +1 -0
- package/lib/cjs/actions/signatures/getTokenRequirementActions.js +4 -0
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +22 -30
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +18 -66
- package/lib/cjs/actions/vaultV1/deposit.d.ts +73 -57
- package/lib/cjs/actions/vaultV1/deposit.js +110 -109
- package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +43 -66
- package/lib/cjs/actions/vaultV1/migrateToV2.js +91 -104
- package/lib/cjs/actions/vaultV1/redeem.d.ts +30 -23
- package/lib/cjs/actions/vaultV1/redeem.js +56 -33
- package/lib/cjs/actions/vaultV1/withdraw.d.ts +58 -24
- package/lib/cjs/actions/vaultV1/withdraw.js +86 -34
- package/lib/cjs/actions/vaultV2/deposit.d.ts +74 -57
- package/lib/cjs/actions/vaultV2/deposit.js +111 -109
- package/lib/cjs/actions/vaultV2/redeem.d.ts +30 -24
- package/lib/cjs/actions/vaultV2/redeem.js +56 -34
- package/lib/cjs/actions/vaultV2/withdraw.d.ts +58 -25
- package/lib/cjs/actions/vaultV2/withdraw.js +86 -35
- package/lib/cjs/bundler/actions.d.ts +4 -4
- package/lib/cjs/bundler/actions.js +4 -4
- package/lib/cjs/client/morphoViemExtension.d.ts +2 -1
- package/lib/cjs/client/morphoViemExtension.js +2 -1
- package/lib/cjs/entities/blue/blue.d.ts +806 -374
- package/lib/cjs/entities/blue/blue.js +449 -696
- package/lib/cjs/entities/index.d.ts +2 -0
- package/lib/cjs/entities/index.js +15 -0
- package/lib/cjs/entities/midnight/midnight.d.ts +2 -2
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +87 -0
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +203 -0
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +28 -0
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +74 -0
- package/lib/cjs/entities/requirements/index.d.ts +1 -0
- package/lib/cjs/entities/requirements/index.js +17 -0
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +348 -98
- package/lib/cjs/entities/vaultV1/vaultV1.js +322 -120
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +221 -68
- package/lib/cjs/entities/vaultV2/vaultV2.js +219 -77
- package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +3 -9
- package/lib/cjs/helpers/computeVaultV1Reallocations.js +3 -9
- package/lib/cjs/helpers/index.d.ts +2 -1
- package/lib/cjs/helpers/index.js +5 -1
- package/lib/cjs/helpers/referralFee.d.ts +21 -0
- package/lib/cjs/helpers/referralFee.js +35 -0
- package/lib/cjs/helpers/slippage.d.ts +90 -1
- package/lib/cjs/helpers/slippage.js +123 -0
- package/lib/cjs/helpers/validate.d.ts +16 -23
- package/lib/cjs/helpers/validate.js +41 -48
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +2 -1
- package/lib/cjs/helpers/validateRequirementSpender.js +3 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/types/action.d.ts +303 -210
- package/lib/cjs/types/action.js +29 -2
- package/lib/cjs/types/client.d.ts +9 -0
- package/lib/cjs/types/error.d.ts +193 -18
- package/lib/cjs/types/error.js +267 -24
- package/lib/cjs/types/sharedLiquidity.d.ts +0 -7
- package/lib/esm/abis.d.ts +210 -0
- package/lib/esm/abis.js +140 -0
- package/lib/esm/actions/blue/borrow.d.ts +62 -61
- package/lib/esm/actions/blue/borrow.js +48 -80
- package/lib/esm/actions/blue/common.d.ts +86 -0
- package/lib/esm/actions/blue/common.js +193 -0
- package/lib/esm/actions/blue/refinance.d.ts +72 -112
- package/lib/esm/actions/blue/refinance.js +98 -200
- package/lib/esm/actions/blue/repay.d.ts +72 -68
- package/lib/esm/actions/blue/repay.js +56 -118
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +85 -90
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +149 -138
- package/lib/esm/actions/blue/supply.d.ts +62 -45
- package/lib/esm/actions/blue/supply.js +94 -70
- package/lib/esm/actions/blue/supplyCollateral.d.ts +63 -40
- package/lib/esm/actions/blue/supplyCollateral.js +52 -69
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +82 -90
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +134 -121
- package/lib/esm/actions/blue/withdraw.d.ts +68 -79
- package/lib/esm/actions/blue/withdraw.js +100 -96
- package/lib/esm/actions/blue/withdrawCollateral.d.ts +56 -28
- package/lib/esm/actions/blue/withdrawCollateral.js +45 -50
- package/lib/esm/actions/bundles/common.d.ts +200 -0
- package/lib/esm/actions/bundles/common.js +457 -0
- package/lib/esm/actions/bundles/index.d.ts +3 -0
- package/lib/esm/actions/bundles/index.js +2 -0
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +76 -0
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +121 -0
- package/lib/esm/actions/index.d.ts +2 -1
- package/lib/esm/actions/index.js +1 -0
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +2 -2
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +2 -2
- package/lib/esm/actions/midnight/takeBorrow.d.ts +2 -2
- package/lib/esm/actions/midnight/takeBorrow.js +2 -2
- package/lib/esm/actions/midnight/takeLend.d.ts +2 -2
- package/lib/esm/actions/midnight/takeLend.js +2 -2
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +29 -17
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +63 -22
- package/lib/esm/actions/requirements/blue/getUnusedPermit2Nonce.d.ts +48 -0
- package/lib/esm/actions/requirements/blue/getUnusedPermit2Nonce.js +68 -0
- package/lib/esm/actions/requirements/blue/index.d.ts +1 -0
- package/lib/esm/actions/requirements/blue/index.js +1 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +10 -7
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +31 -6
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +2 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +9 -3
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +16 -7
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +40 -7
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +61 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +119 -0
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +4 -4
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +6 -5
- 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/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +1 -1
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +6 -4
- package/lib/esm/actions/requirements/getRequirementsApproval.js +6 -4
- package/lib/esm/actions/signatures/getTokenRequirementActions.d.ts +1 -0
- package/lib/esm/actions/signatures/getTokenRequirementActions.js +5 -1
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +22 -30
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +19 -67
- package/lib/esm/actions/vaultV1/deposit.d.ts +73 -57
- package/lib/esm/actions/vaultV1/deposit.js +112 -111
- package/lib/esm/actions/vaultV1/migrateToV2.d.ts +43 -66
- package/lib/esm/actions/vaultV1/migrateToV2.js +93 -106
- package/lib/esm/actions/vaultV1/redeem.d.ts +30 -23
- package/lib/esm/actions/vaultV1/redeem.js +56 -33
- package/lib/esm/actions/vaultV1/withdraw.d.ts +58 -24
- package/lib/esm/actions/vaultV1/withdraw.js +86 -34
- package/lib/esm/actions/vaultV2/deposit.d.ts +74 -57
- package/lib/esm/actions/vaultV2/deposit.js +113 -111
- package/lib/esm/actions/vaultV2/redeem.d.ts +30 -24
- package/lib/esm/actions/vaultV2/redeem.js +56 -34
- package/lib/esm/actions/vaultV2/withdraw.d.ts +58 -25
- package/lib/esm/actions/vaultV2/withdraw.js +86 -35
- package/lib/esm/bundler/actions.d.ts +4 -4
- package/lib/esm/bundler/actions.js +4 -4
- package/lib/esm/client/morphoViemExtension.d.ts +2 -1
- package/lib/esm/client/morphoViemExtension.js +2 -1
- package/lib/esm/entities/blue/blue.d.ts +806 -374
- package/lib/esm/entities/blue/blue.js +455 -702
- package/lib/esm/entities/index.d.ts +2 -0
- package/lib/esm/entities/index.js +1 -0
- package/lib/esm/entities/midnight/midnight.d.ts +2 -2
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +87 -0
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +199 -0
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +28 -0
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +70 -0
- package/lib/esm/entities/requirements/index.d.ts +1 -0
- package/lib/esm/entities/requirements/index.js +1 -0
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +348 -98
- package/lib/esm/entities/vaultV1/vaultV1.js +326 -124
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +221 -68
- package/lib/esm/entities/vaultV2/vaultV2.js +222 -80
- package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +3 -9
- package/lib/esm/helpers/computeVaultV1Reallocations.js +3 -9
- package/lib/esm/helpers/index.d.ts +2 -1
- package/lib/esm/helpers/index.js +2 -1
- package/lib/esm/helpers/referralFee.d.ts +21 -0
- package/lib/esm/helpers/referralFee.js +31 -0
- package/lib/esm/helpers/slippage.d.ts +90 -1
- package/lib/esm/helpers/slippage.js +122 -2
- package/lib/esm/helpers/validate.d.ts +16 -23
- package/lib/esm/helpers/validate.js +40 -48
- package/lib/esm/helpers/validateRequirementSpender.d.ts +2 -1
- package/lib/esm/helpers/validateRequirementSpender.js +3 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/types/action.d.ts +303 -210
- package/lib/esm/types/action.js +28 -2
- package/lib/esm/types/client.d.ts +9 -0
- package/lib/esm/types/error.d.ts +193 -18
- package/lib/esm/types/error.js +252 -21
- package/lib/esm/types/sharedLiquidity.d.ts +0 -7
- package/package.json +6 -5
- package/lib/cjs/actions/blue/buildAssetFundingActions.d.ts +0 -47
- package/lib/cjs/actions/blue/buildAssetFundingActions.js +0 -63
- package/lib/cjs/actions/blue/buildReallocationActions.d.ts +0 -69
- package/lib/cjs/actions/blue/buildReallocationActions.js +0 -141
- package/lib/cjs/actions/blue/resolveRepayFunding.d.ts +0 -66
- package/lib/cjs/actions/blue/resolveRepayFunding.js +0 -85
- package/lib/esm/actions/blue/buildAssetFundingActions.d.ts +0 -47
- package/lib/esm/actions/blue/buildAssetFundingActions.js +0 -59
- package/lib/esm/actions/blue/buildReallocationActions.d.ts +0 -69
- package/lib/esm/actions/blue/buildReallocationActions.js +0 -135
- package/lib/esm/actions/blue/resolveRepayFunding.d.ts +0 -66
- package/lib/esm/actions/blue/resolveRepayFunding.js +0 -81
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
# Migrating `@morpho-org/morpho-sdk` from v5 to v6
|
|
2
|
+
|
|
3
|
+
Version 6 keeps the Blue entity at `client.morpho.blue(marketParams, chainId)` and preserves its
|
|
4
|
+
write-method names while routing them through five direct BlueBundlesV1 entrypoints. Blue reads and
|
|
5
|
+
versioned reallocation-data helpers remain on the same entity. There is no parallel BlueBundlesV1
|
|
6
|
+
extension or automatic fallback to the v5 route.
|
|
7
|
+
|
|
8
|
+
## Vault V1 and Vault V2 deposits
|
|
9
|
+
|
|
10
|
+
`MorphoVaultV1.deposit`, `MorphoVaultV2.deposit`, `vaultV1Deposit`, and `vaultV2Deposit` keep their
|
|
11
|
+
names but now route through the chain's registered VaultBundlesV1 contract instead of Bundler3 and
|
|
12
|
+
GeneralAdapter1.
|
|
13
|
+
|
|
14
|
+
> **Chain availability.** Vault deposits and withdrawals require the `bundles.vaultBundlesV1`
|
|
15
|
+
> deployment on the target chain. On a registered chain without it, including Fraxtal,
|
|
16
|
+
> `MorphoVaultV1.deposit()`, `MorphoVaultV2.deposit()`, `MorphoVaultV1.withdraw()`, and
|
|
17
|
+
> `MorphoVaultV2.withdraw()` throw `UnknownAddressError` synchronously at handle creation,
|
|
18
|
+
> before `getRequirements()` or `buildTx()` can be called. This is a breaking loss of deposit
|
|
19
|
+
> and withdrawal functionality on chains previously supported through Bundler3/GeneralAdapter1
|
|
20
|
+
> deposits and direct vault withdrawals; there is no automatic fallback. Confirm coverage before
|
|
21
|
+
> upgrading with `getChainAddresses(chainId).bundles?.vaultBundlesV1 != null`. Stay on v5 if your
|
|
22
|
+
> application needs deposits or withdrawals on an affected chain until VaultBundlesV1 is deployed
|
|
23
|
+
> and registered in the SDK.
|
|
24
|
+
|
|
25
|
+
As checked on 2026-09-07, the [official deployment list](https://docs.morpho.org/developers/contracts/addresses/#bundles)
|
|
26
|
+
and the [SDK registry](../morpho-ts/src/addresses.ts) list VaultBundlesV1 on 13 chains: Ethereum,
|
|
27
|
+
Arbitrum, Base, HyperEVM, Katana, Monad, Optimism, Polygon, Robinhood, Stable, Tempo, Unichain, and
|
|
28
|
+
World Chain. Bundler3 availability alone does not imply support for v6 vault deposits or withdrawals.
|
|
29
|
+
|
|
30
|
+
Update deposit inputs as follows:
|
|
31
|
+
|
|
32
|
+
| v5 | v6 |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| `amount` plus optional additive `nativeAmount` | Choose exactly one positive `amount` or `nativeAmount`. |
|
|
35
|
+
| Low-level `args.recipient` | Remove it. VaultBundlesV1 mints shares to `msg.sender`; `userAddress` must be the signing and submitting account. |
|
|
36
|
+
| Optional Bundler3 `PermitRequirementSignature` | Use an ERC-2612 or Permit2 SignatureTransfer requirement returned by the prepared entity handle. |
|
|
37
|
+
| No deadline or referral fee | Entity methods accept an optional `deadline` that defaults to two hours from preparation; low-level builders require it. Both surfaces accept optional `referralFeePct` and `referralFeeRecipient`. |
|
|
38
|
+
|
|
39
|
+
For ERC-20 funding, approvals and ERC-2612 permits now name VaultBundlesV1 as spender. Permit2
|
|
40
|
+
keeps its ERC-20 approval on canonical Permit2, while its one-time SignatureTransfer payload names
|
|
41
|
+
VaultBundlesV1. Resolve requirements and build from the same prepared handle so its captured nonce,
|
|
42
|
+
deadline, asset, owner, amount, and spender remain consistent:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
const deposit = vault.deposit({
|
|
46
|
+
amount: 1_000_000n,
|
|
47
|
+
userAddress,
|
|
48
|
+
vaultData,
|
|
49
|
+
referralFeePct,
|
|
50
|
+
referralFeeRecipient,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const requirements = await deposit.getRequirements({ permit2Nonce });
|
|
54
|
+
// Submit approval transactions or sign the returned token requirement first.
|
|
55
|
+
const tx = deposit.buildTx(requirementSignature ? [requirementSignature] : undefined);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Deposit action metadata no longer contains `recipient`. It now reports the gross `amount`, optional
|
|
59
|
+
`nativeAmount`, `maxSharePrice`, `referralFeePct`, `referralFeeRecipient`, exact
|
|
60
|
+
`referralFeeAssets`, resulting `netAssets`, and `deadline`.
|
|
61
|
+
|
|
62
|
+
## Blue write routing
|
|
63
|
+
|
|
64
|
+
> **Chain availability.** The direct BlueBundlesV1 route requires the `bundles.blueBundlesV1`
|
|
65
|
+
> deployment on the target chain. On a registered chain without it (the previous Bundler3-routed
|
|
66
|
+
> flows covered more chains), **every** Blue write — `supply`, `supplyCollateral`, `borrow`,
|
|
67
|
+
> `supplyCollateralBorrow`, `repay`, `withdrawCollateral`, `repayWithdrawCollateral`, `withdraw`, and
|
|
68
|
+
> `refinance` — throws `UnknownAddressError` synchronously at handle creation (via
|
|
69
|
+
> `validateWriteCommon`). Confirm coverage before upgrading, for example
|
|
70
|
+
> `getChainAddresses(chainId).bundles?.blueBundlesV1 != null`.
|
|
71
|
+
|
|
72
|
+
Version 6 also preserves the Vault V1 and Vault V2 method and builder names while routing `deposit`,
|
|
73
|
+
`withdraw`, and `redeem` through VaultBundlesV1. Vault V1 `migrateToV2` uses the same fixed route.
|
|
74
|
+
|
|
75
|
+
> **Chain availability.** The VaultBundlesV1 route requires the `bundles.vaultBundlesV1` deployment
|
|
76
|
+
> on the target chain. On a registered chain without it (Celo, for example, still registers
|
|
77
|
+
> MetaMorpho and Vault V2 deployments), **every** routed vault write — Vault V1 `deposit`,
|
|
78
|
+
> `withdraw`, `redeem`, and `migrateToV2`, and Vault V2 `deposit`, `withdraw`, and `redeem` — throws
|
|
79
|
+
> `UnknownAddressError` synchronously at handle creation, where v5 built a direct vault or Bundler3
|
|
80
|
+
> call. Confirm coverage before upgrading, for example
|
|
81
|
+
> `getChainAddresses(chainId).bundles?.vaultBundlesV1 != null`. Vault `inKindRedeem` is unaffected:
|
|
82
|
+
> it already routed through `bundles.vaultExitBundlesV1` in v5, and its chain coverage is unchanged.
|
|
83
|
+
|
|
84
|
+
## Update Vault V1 and Vault V2 methods
|
|
85
|
+
|
|
86
|
+
| Stable method | v5 input/workflow | v6 input/workflow |
|
|
87
|
+
| --- | --- | --- |
|
|
88
|
+
| `deposit` | Additive `amount` and `nativeAmount`; Bundler3/GeneralAdapter1 requirements. | Supply exactly one of `amount` or `nativeAmount`; optionally set `deadline`, `referralFeePct`, and `referralFeeRecipient`. Token requirements authorize VaultBundlesV1 and may return Permit2 SignatureTransfer. |
|
|
89
|
+
| `withdraw` | Direct vault withdrawal with no share requirement. | Exact-assets VaultBundlesV1 exit. Optionally set `slippageTolerance`, `deadline`, and referral fields; resolve a vault-share approval or ERC-2612 permit before building. |
|
|
90
|
+
| `redeem` | Direct vault redemption with no share requirement. | Exact-shares VaultBundlesV1 exit. Optionally set `deadline` and referral fields; resolve a vault-share approval or ERC-2612 permit before building. |
|
|
91
|
+
| `migrateToV2` (Vault V1 only) | Share-denominated Bundler3 migration with a source `minSharePriceVaultV1`. | Keep the existing `shares` mode or supply the new `assets` alternative; remove the source share-price bound; optionally set `slippageTolerance`, `deadline`, and referral fields. Resolve source-vault share authorization before building. The destination deposit retains its onchain maximum-share-price bound. |
|
|
92
|
+
|
|
93
|
+
`userAddress` now means the account that will submit the transaction. VaultBundlesV1 always deposits
|
|
94
|
+
for, burns shares from, and pays `msg.sender`; arbitrary `recipient` and `onBehalf` values are no
|
|
95
|
+
longer supported. Keep `userAddress` equal to the eventual signer, including when preparing a
|
|
96
|
+
transaction with a public client.
|
|
97
|
+
|
|
98
|
+
The lazy workflow now applies to Vault V1 exits as well as deposits: await `getRequirements()`, send
|
|
99
|
+
any returned approval transactions or collect the returned signature, and pass collected signatures
|
|
100
|
+
to `buildTx(signatures)`. Deposit requirement options accept `useSimplePermit` and an explicit
|
|
101
|
+
`permit2Nonce`; exit requirements use the vault share token's ERC-2612 permit. The built transaction
|
|
102
|
+
targets VaultBundlesV1 rather than Bundler3 or the vault itself.
|
|
103
|
+
|
|
104
|
+
Pure builder names remain stable, but their `args` objects change:
|
|
105
|
+
|
|
106
|
+
| Stable builder | v6 `args` fields |
|
|
107
|
+
| --- | --- |
|
|
108
|
+
| `vaultV1Deposit` | Exclusive `amount`/`nativeAmount`, `maxSharePrice`, `userAddress`, optional bundles token `requirementSignature`, required `deadline`, and optional referral fields. |
|
|
109
|
+
| `vaultV1Withdraw` | `amount`, `userAddress`, optional vault-share `requirementSignature`, required `deadline`, and optional referral fields. |
|
|
110
|
+
| `vaultV1Redeem` | `shares`, `userAddress`, optional vault-share `requirementSignature`, required `deadline`, and optional referral fields. |
|
|
111
|
+
| `vaultV1MigrateToV2` | Exclusive `assets`/`shares`, `targetVault`, `targetAsset`, `maxSharePriceVaultV2`, `userAddress`, optional vault-share `requirementSignature`, required `deadline`, and optional referral fields. |
|
|
112
|
+
| `vaultV2Deposit` | Exclusive `amount`/`nativeAmount`, `maxSharePrice`, `userAddress`, optional bundles token `requirementSignature`, required `deadline`, and optional referral fields. |
|
|
113
|
+
| `vaultV2Withdraw` | `amount`, `userAddress`, optional vault-share `requirementSignature`, required `deadline`, and optional referral fields. |
|
|
114
|
+
| `vaultV2Redeem` | `shares`, `userAddress`, optional vault-share `requirementSignature`, required `deadline`, and optional referral fields. |
|
|
115
|
+
|
|
116
|
+
Every vault builder replaces v5's `recipient` and `onBehalf` with a single `userAddress` that must be
|
|
117
|
+
the eventual `msg.sender`, and `vault` now takes `{ chainId, address }` (plus `asset` on the deposit
|
|
118
|
+
and migration builders) so the builder can resolve the VaultBundlesV1 address for the target chain.
|
|
119
|
+
|
|
120
|
+
Vault V1 deposit and migration destination bounds are forecast through the selected deadline, so an
|
|
121
|
+
explicit deadline beyond the two-hour default remains covered by the computed maximum share price.
|
|
122
|
+
|
|
123
|
+
## Update Blue methods
|
|
124
|
+
|
|
125
|
+
| Stable method | v5 input | v6 input |
|
|
126
|
+
| --- | --- | --- |
|
|
127
|
+
| `supply` | `amount`/`nativeAmount`, `marketData`, `slippageTolerance` | Rename gross `amount` to `assets`; remove `marketData` and slippage; add required `deadline` plus optional `referralFeePct` and `referralFeeRecipient`. ERC-20 and native funding are now exclusive. |
|
|
128
|
+
| `withdraw` | `assets` or `shares`, optional `receiver`, `slippageTolerance`, mixed-version `reallocations` | Keep `assets`/`shares`; remove `receiver` and slippage; use only `VaultV2BlueReallocation`; add `deadline`, `referralFeePct`, and `referralFeeRecipient`. |
|
|
129
|
+
| `supplyCollateral` | `amount` plus optional additive `nativeAmount` | Rename `amount` to `collateralAssets`; make native and ERC-20 funding exclusive; add `deadline`, `referralFeePct`, and `referralFeeRecipient`. |
|
|
130
|
+
| `borrow` | `amount`, `slippageTolerance`, mixed-version `reallocations` | Rename `amount` to `borrowAssets`; remove slippage; use only `VaultV2BlueReallocation`; add `deadline`, `referralFeePct`, and `referralFeeRecipient`. |
|
|
131
|
+
| `supplyCollateralBorrow` | `amount`, `borrowAmount`, required `positionData`, `slippageTolerance`, mixed-version `reallocations` | Rename the legs to `collateralAssets` and `borrowAssets`; `positionData` is required only when borrowing; use exclusive native funding and V2-only reallocations; add `deadline`, `referralFeePct`, and `referralFeeRecipient`. |
|
|
132
|
+
| `repay` | `amount` or `shares`, optional additive `nativeAmount`, `slippageTolerance` | Rename the modes to `repayAssets` or `repayShares`; use `maxUint256` shares for a full close; remove slippage; add `deadline`, `referralFeePct`, and `referralFeeRecipient`. Native funding must cover the full derived cap. |
|
|
133
|
+
| `withdrawCollateral` | `amount` | Rename `amount` to `collateralAssets`; add `deadline`, `referralFeePct`, and `referralFeeRecipient`. |
|
|
134
|
+
| `repayWithdrawCollateral` | `amount` or `shares`, `withdrawAmount`, optional additive `nativeAmount`, `slippageTolerance` | Rename the repay modes to `repayAssets`/`repayShares` and `withdrawAmount` to `collateralAssets`; remove slippage; add `deadline`, `referralFeePct`, and `referralFeeRecipient`. |
|
|
135
|
+
| `refinance` | `target`, `collateralAmount`, `borrowAssets`/`borrowShares`, `slippageTolerance`, `targetReallocations` | Rename `target` to `destination`; remove partial-leg amounts and share-price inputs; rename V2-only `targetReallocations` to `reallocations`; add `deadline`, `referralFeePct`, and `referralFeeRecipient`. The full live position always moves. |
|
|
136
|
+
|
|
137
|
+
The two combined methods require at least one non-zero leg. See the dedicated **Blue refinance**
|
|
138
|
+
section below for that method's larger shape change.
|
|
139
|
+
|
|
140
|
+
## Vault V1 and V2 withdrawals
|
|
141
|
+
|
|
142
|
+
The established `withdraw` methods and the `vaultV1Withdraw` / `vaultV2Withdraw` builder names stay
|
|
143
|
+
stable, but now encode one direct VaultBundlesV1 call instead of a direct vault call.
|
|
144
|
+
|
|
145
|
+
> **Chain availability.** Both entity `withdraw()` methods require `bundles.vaultBundlesV1` and
|
|
146
|
+
> throw `UnknownAddressError` synchronously at handle creation on registered chains without it,
|
|
147
|
+
> including Fraxtal. Stay on v5 if your application needs withdrawals on an affected chain until
|
|
148
|
+
> VaultBundlesV1 is deployed and registered in the SDK, even if your application makes no deposits.
|
|
149
|
+
|
|
150
|
+
| Flow | v5 input | v6 input |
|
|
151
|
+
| --- | --- | --- |
|
|
152
|
+
| `withdraw` | `amount`, `userAddress` | Keep `amount` and `userAddress`; remove the implicit `recipient` / `onBehalf` (VaultBundlesV1 burns `msg.sender`'s shares and pays `msg.sender`); add optional `slippageTolerance`, `deadline`, and referral-fee fields. |
|
|
153
|
+
|
|
154
|
+
`withdraw` now returns `{ buildTx, getRequirements }` instead of `{ buildTx }`. VaultBundlesV1 spends
|
|
155
|
+
the caller's vault shares, so the withdrawal needs a vault-share allowance for VaultBundlesV1 — a
|
|
156
|
+
prerequisite v5 withdrawals did not have. Await `getRequirements()` and satisfy it before calling
|
|
157
|
+
`buildTx()`, or the withdrawal reverts:
|
|
158
|
+
|
|
159
|
+
- Without signature support, it returns one ERC-20 approval transaction to send first.
|
|
160
|
+
- With `supportSignature: true`, it returns one signable ERC-2612 shares permit; pass the signature
|
|
161
|
+
to `buildTx([sharesPermit])` and it is folded into the VaultBundlesV1 call.
|
|
162
|
+
|
|
163
|
+
The allowance is the only cap on the burn, since asset-mode calldata carries no maximum-shares
|
|
164
|
+
argument. `getRequirements()` therefore derives an exact cap from the vault snapshot, the deadline,
|
|
165
|
+
and `slippageTolerance` (default 0.03%), and returns an approval or permit for exactly that amount
|
|
166
|
+
whenever the current allowance differs — including when a larger leftover approval already exists.
|
|
167
|
+
|
|
168
|
+
`getRequirements()` re-validates the deadline on every call, so a prepared withdrawal reused after
|
|
169
|
+
its deadline throws `ExpiredDeadlineError` rather than returning cached prerequisites.
|
|
170
|
+
|
|
171
|
+
## Blue pure action builder inputs and metadata
|
|
172
|
+
|
|
173
|
+
Direct action consumers keep the root-barrel builder and parameter-type names, but must replace
|
|
174
|
+
their `args` objects as follows. `metadata` is unchanged.
|
|
175
|
+
|
|
176
|
+
| Stable builder / params | v6 `args` fields |
|
|
177
|
+
| --- | --- |
|
|
178
|
+
| `blueSupply` / `BlueSupplyParams` | `userAddress`, `assets`, optional `nativeAmount`, required `deadline`, optional `referralFeePct`, `referralFeeRecipient`, and `requirementSignature`. |
|
|
179
|
+
| `blueWithdraw` / `BlueWithdrawParams` | `userAddress`, `withdrawAssets`, `withdrawShares`, optional V2 `reallocations`, required `deadline`, optional `referralFeePct`, `referralFeeRecipient`, and `authorizationSignature`. |
|
|
180
|
+
| `blueSupplyCollateral` / `BlueSupplyCollateralParams` | `userAddress`, `collateralAssets`, optional `nativeAmount`, required `deadline`, optional `referralFeePct`, `referralFeeRecipient`, and `requirementSignature`. |
|
|
181
|
+
| `blueBorrow` / `BlueBorrowParams` | `userAddress`, `borrowAssets`, `maxLtv`, optional V2 `reallocations`, required `deadline`, optional `referralFeePct`, `referralFeeRecipient`, and `authorizationSignature`. |
|
|
182
|
+
| `blueSupplyCollateralBorrow` / `BlueSupplyCollateralBorrowParams` | `userAddress`, `collateralAssets`, `borrowAssets`, `maxLtv`, optional `nativeAmount`/V2 `reallocations`, required `deadline`, optional `referralFeePct`, `referralFeeRecipient`, `requirementSignature`, and `authorizationSignature`. |
|
|
183
|
+
| `blueRepay` / `BlueRepayParams` | `userAddress`, `repayAssets`, `repayShares`, `maxRepayAssets`, optional `nativeAmount`, required `deadline`, optional `referralFeePct`, `referralFeeRecipient`, and `requirementSignature`. |
|
|
184
|
+
| `blueWithdrawCollateral` / `BlueWithdrawCollateralParams` | `userAddress`, `collateralAssets`, `maxLtv`, required `deadline`, optional `referralFeePct`, `referralFeeRecipient`, and `authorizationSignature`. |
|
|
185
|
+
| `blueRepayWithdrawCollateral` / `BlueRepayWithdrawCollateralParams` | `userAddress`, `repayAssets`, `repayShares`, `maxRepayAssets`, `collateralAssets`, `maxLtv`, optional `nativeAmount`, required `deadline`, optional `referralFeePct`, `referralFeeRecipient`, `requirementSignature`, and `authorizationSignature`. |
|
|
186
|
+
| `blueRefinance` / `BlueRefinanceParams` | `userAddress`, `maxLtv`, optional V2 `reallocations`, required `deadline`, optional `referralFeePct`, `referralFeeRecipient`, and `authorizationSignature`; replace `source`/`target` with `market: { chainId, sourceMarketParams, destinationMarketParams }`. |
|
|
187
|
+
|
|
188
|
+
The transaction metadata exports and discriminator strings stay stable; their argument fields change
|
|
189
|
+
as below. The table lists only the delta: unchanged fields are retained and omitted. In particular
|
|
190
|
+
every Blue action keeps its `market` (`Hex` market id) field, so a strict decoder must keep matching
|
|
191
|
+
it alongside the added fields.
|
|
192
|
+
|
|
193
|
+
| Stable action type / discriminator | Removed v5 `action.args` fields | Changed / added v6 `action.args` fields |
|
|
194
|
+
| --- | --- | --- |
|
|
195
|
+
| `BlueSupplyAction` / `"blueSupply"` | `amount`, `maxSharePrice` | `assets`, `onBehalf`, optional `nativeAmount`, `referralFeePct`, `referralFeeRecipient`, `deadline`. |
|
|
196
|
+
| `BlueWithdrawAction` / `"blueWithdraw"` | `assets`, `shares`, `receiver`, `minSharePrice`, `reallocationFee` | `withdrawAssets`, `withdrawShares`, `onBehalf`, `reallocations`, `reallocationPenaltyAssets`, `referralFeePct`, `referralFeeRecipient`, `deadline`. |
|
|
197
|
+
| `BlueSupplyCollateralAction`, `BlueBorrowAction`, `BlueSupplyCollateralBorrowAction` | `amount`, `collateralAmount`, `borrowAmount`, `receiver`, `minSharePrice`, `reallocationFee` | All three use the combined shape: `collateralAssets`, `borrowAssets`, `maxLtv`, `onBehalf`, optional `nativeAmount`, `reallocations`, `reallocationPenaltyAssets`, `referralFeePct`, `referralFeeRecipient`, `deadline`; an inactive simple-method leg is zero. |
|
|
198
|
+
| `BlueRepayAction`, `BlueWithdrawCollateralAction`, `BlueRepayWithdrawCollateralAction` | `amount`, `shares`, `transferAmount`, `withdrawAmount`, `receiver`, `maxSharePrice` | All three use the combined shape: `repayAssets`, `repayShares`, `maxRepayAssets`, `collateralAssets`, `maxLtv`, `onBehalf`, optional `nativeAmount`, `referralFeePct`, `referralFeeRecipient`, `deadline`; inactive simple-method legs are zero. |
|
|
199
|
+
| `BlueRefinanceAction` / `"blueRefinance"` | `targetMarket`, `collateralAmount`, `borrowAssets`, `borrowShares`, borrow/repay share-price bounds, `user`, `reallocationFee` | `sourceMarket`, `destinationMarket`, `maxLtv`, `onBehalf`, `reallocations`, `reallocationPenaltyAssets`, `referralFeePct`, `referralFeeRecipient`, `deadline`. |
|
|
200
|
+
|
|
201
|
+
`RepayAmountArgs` and `RepayActionAmountArgs` are removed. Use the mutually exclusive
|
|
202
|
+
`repayAssets` / `repayShares` fields on the replacement method or builder instead.
|
|
203
|
+
|
|
204
|
+
## Update write inputs
|
|
205
|
+
|
|
206
|
+
- Remove Blue `slippageTolerance`, `minSharePrice`, and `maxSharePrice` inputs. BlueBundlesV1 does
|
|
207
|
+
not expose the Bundler3 share-price checks. Vault deposit slippage protection is unchanged.
|
|
208
|
+
- Remove Blue `receiver`, `to`, and arbitrary `onBehalf` overrides. BlueBundlesV1 operates on the
|
|
209
|
+
transaction sender and sends proceeds and refunds back to that sender; `userAddress` must be the
|
|
210
|
+
eventual sender used to resolve requirements and position snapshots.
|
|
211
|
+
- Replace PublicAllocator V1 or mixed-version reallocation write inputs with Vault V2
|
|
212
|
+
`VaultV2BlueReallocation` inputs. All Vault V1 reallocation planning, data, input, validation,
|
|
213
|
+
and explicit low-level Bundler3-composition surfaces remain available only as deprecated
|
|
214
|
+
compatibility surfaces and will be removed in the next major; the high-level Blue writes do not
|
|
215
|
+
accept their outputs.
|
|
216
|
+
- Provide the BlueBundlesV1 execution deadline and any optional referral-fee configuration through
|
|
217
|
+
the new typed method inputs. Share-mode repayment deadlines are limited to two hours so the SDK's
|
|
218
|
+
derived `maxRepayAssets` remains sufficient through execution.
|
|
219
|
+
- Treat `supply` assets as gross funding: referral fees reduce assets supplied. Allocator penalties
|
|
220
|
+
and referral fees similarly affect proceeds or destination debt on the other operations.
|
|
221
|
+
- For native funding, the funded token must be the chain's wNative. Native and ERC-20 funding are
|
|
222
|
+
not additive on the direct BlueBundlesV1 call.
|
|
223
|
+
|
|
224
|
+
Borrow, collateral-withdraw, and migration legs retain the SDK's buffered LLTV validation. Pure
|
|
225
|
+
collateral supply and pure repay intentionally disable the onchain LTV cap so they can improve an
|
|
226
|
+
already-unhealthy position.
|
|
227
|
+
|
|
228
|
+
## Update requirements and transaction handling
|
|
229
|
+
|
|
230
|
+
The lazy workflow is unchanged: await `getRequirements()`, satisfy approval transactions, collect
|
|
231
|
+
signatures, then pass the signatures to synchronous `buildTx(signatures)`.
|
|
232
|
+
|
|
233
|
+
The destinations are different:
|
|
234
|
+
|
|
235
|
+
- Classic ERC-20 approvals and ERC-2612 permits now authorize BlueBundlesV1.
|
|
236
|
+
- Permit2 keeps its ERC-20 approval on canonical Permit2, but the SignatureTransfer payload names
|
|
237
|
+
BlueBundlesV1 as spender. Explicit Permit2 nonces are now required — see the subsection below.
|
|
238
|
+
- Morpho authorization now grants BlueBundlesV1 operator rights instead of GeneralAdapter1.
|
|
239
|
+
- Without signature support, saturated full-repay requirements use the token's reusable maximum
|
|
240
|
+
allowance so a later bounded debt quote remains covered; BlueBundlesV1 still refunds unused
|
|
241
|
+
transaction funding.
|
|
242
|
+
- The built transaction's `to` is BlueBundlesV1, not Bundler3, and calldata contains one fixed
|
|
243
|
+
BlueBundlesV1 entrypoint rather than a `BundlerAction[]` multicall.
|
|
244
|
+
|
|
245
|
+
Update simulations and analytics for the v6 action-field changes. Do not assert
|
|
246
|
+
Bundler3/GeneralAdapter1 destinations or inspect Bundler3 sub-actions for these
|
|
247
|
+
high-level writes.
|
|
248
|
+
|
|
249
|
+
### Permit2 SignatureTransfer requires an explicit nonce
|
|
250
|
+
|
|
251
|
+
SignatureTransfer consumes an owner-global unordered nonce rather than an allowance, so the SDK no
|
|
252
|
+
longer allocates one implicitly. For a client with `supportSignature: true`, the default supply
|
|
253
|
+
requirement path selects Permit2 and `supply(...).getRequirements()` now throws
|
|
254
|
+
`MissingPermit2SignatureTransferNonceError` when no nonce is supplied. Pass an unused nonce explicitly:
|
|
255
|
+
|
|
256
|
+
```ts
|
|
257
|
+
const requirements = await market
|
|
258
|
+
.supply({ userAddress, assets, deadline })
|
|
259
|
+
.getRequirements({ permit2Nonce });
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Allocate any `uint256` whose Permit2 `nonceBitmap` bit is still unset for `userAddress` (each nonce
|
|
263
|
+
is single-use; a consumed one throws `Permit2SignatureTransferNonceAlreadyUsedError`). To skip Permit2
|
|
264
|
+
for ERC-2612 tokens, pass `getRequirements({ useSimplePermit: true })`, which prefers a one-signature
|
|
265
|
+
ERC-2612 permit and needs no nonce.
|
|
266
|
+
|
|
267
|
+
## Blue refinance
|
|
268
|
+
|
|
269
|
+
The `refinance` entity method and the `blueRefinance` pure builder keep their names but now call
|
|
270
|
+
BlueBundlesV1's full-position migration entrypoint. Both drop partial and collateral-only migration:
|
|
271
|
+
the full live source debt and collateral always move, the source and destination markets must use the
|
|
272
|
+
same loan and collateral tokens and must not be the same market, and Morpho authorization targets
|
|
273
|
+
BlueBundlesV1.
|
|
274
|
+
|
|
275
|
+
`userAddress` must be the account that sends the transaction and, when used, signs the Morpho
|
|
276
|
+
authorization. BlueBundlesV1 migration calldata carries no owner field and always migrates
|
|
277
|
+
`msg.sender`; a supplied authorization signature is likewise bound to that sender. Unlike the v5
|
|
278
|
+
Bundler3 route (where `args.user` was encoded as `onBehalf` in every leg), a relayer can no longer
|
|
279
|
+
migrate a third party's position. Builders cannot enforce that `userAddress` matches the sender; a
|
|
280
|
+
mismatch does not itself revert, and BlueBundlesV1 still migrates `msg.sender`. The SDK uses
|
|
281
|
+
`userAddress` only to validate snapshots, build the authorization requirement, and populate action
|
|
282
|
+
metadata.
|
|
283
|
+
|
|
284
|
+
`market.refinance(...)` (entity method):
|
|
285
|
+
|
|
286
|
+
- Rename `target` to `destination`.
|
|
287
|
+
- Remove `collateralAmount`, `borrowAssets`, `borrowShares`, slippage, and share-price bounds.
|
|
288
|
+
- Rename V2-only `targetReallocations` to `reallocations`.
|
|
289
|
+
- Add `deadline` and optional referral-fee fields.
|
|
290
|
+
- Pass source and destination position snapshots.
|
|
291
|
+
|
|
292
|
+
`blueRefinance(...)` (pure builder):
|
|
293
|
+
|
|
294
|
+
- Replace the top-level `{ source: { chainId, marketParams }, target: { marketParams } }` shape with
|
|
295
|
+
`{ market: { chainId, sourceMarketParams, destinationMarketParams } }`.
|
|
296
|
+
- Rename `args.user` to `args.userAddress` and supply `args.maxLtv` (the buffered destination LTV).
|
|
297
|
+
- Remove `args.collateralAmount`, `args.borrowAssets`, `args.borrowShares`,
|
|
298
|
+
`args.minBorrowSharePrice`, and `args.maxRepaySharePrice`.
|
|
299
|
+
- Rename `args.targetReallocations` to `args.reallocations`.
|
|
300
|
+
- Add `args.deadline` and optional referral-fee fields.
|
|
301
|
+
|
|
302
|
+
The action metadata replaces `targetMarket`, partial-leg amounts, user, share-price bounds, and the
|
|
303
|
+
V1 fee with `destinationMarket`, `maxLtv`, `onBehalf`, a reallocation count and penalty total,
|
|
304
|
+
referral-fee fields, and `deadline`.
|
|
305
|
+
|
|
306
|
+
Stay on v5 if the product requires partial or collateral-only refinance behavior.
|
|
307
|
+
|
|
308
|
+
The partial-migration error classes `BorrowAmountAndSharesExclusiveError`,
|
|
309
|
+
`RefinanceExceedsCollateralError`, `RefinanceExceedsBorrowSharesError`,
|
|
310
|
+
`RefinanceExceedsBorrowAssetsError`, and `RefinanceSharesMissingBorrowAssetsError` are **deprecated,
|
|
311
|
+
not removed**: they stay exported through v6 (marked `@deprecated`) for consumers pattern-matching on
|
|
312
|
+
the v5 surface, are never thrown by the full-position route, and are removed in the next major. The
|
|
313
|
+
full-position route validates snapshot ownership and token/market compatibility, accounts for
|
|
314
|
+
reallocation penalties in destination debt, then checks the combined destination position against
|
|
315
|
+
the buffered LLTV (`BorrowExceedsSafeLtvError`); `RefinanceSameMarketError` and
|
|
316
|
+
`RefinanceTokenMismatchError` stay.
|
|
317
|
+
|
|
318
|
+
## Removed action-output field: `reallocationFee`
|
|
319
|
+
|
|
320
|
+
`BlueBorrowAction`, `BlueWithdrawAction`, `BlueSupplyCollateralBorrowAction`, and
|
|
321
|
+
`BlueRefinanceAction` no longer expose `reallocationFee` in `action.args`. That field only ever
|
|
322
|
+
carried Vault V1 native PublicAllocator fees, which high-level writes no longer emit. Read
|
|
323
|
+
`reallocationPenaltyAssets` for the loan-token penalty donated by Vault V2 BluePublicAllocator
|
|
324
|
+
reallocations.
|
|
325
|
+
|
|
326
|
+
## Removed type: `BlueReallocationPlan`
|
|
327
|
+
|
|
328
|
+
The `BlueReallocationPlan` union is removed. High-level Blue write inputs accept
|
|
329
|
+
`Iterable<VaultV2BlueReallocation>` directly; for explicit low-level Vault V1 composition, use
|
|
330
|
+
`VaultV1Reallocation[]`.
|
|
331
|
+
|
|
332
|
+
## Update Vault V1 and Vault V2 writes
|
|
333
|
+
|
|
334
|
+
Vault V1 and Vault V2 keep their existing `deposit`, `withdraw`, and `redeem` names, while Vault V1
|
|
335
|
+
keeps `migrateToV2`. In v6 these methods encode one direct `VaultBundlesV1` call instead of a direct
|
|
336
|
+
ERC-4626 call or Bundler3 multicall.
|
|
337
|
+
|
|
338
|
+
- Deposits accept exactly one of `amount` and `nativeAmount`. Split a former additive ETH + WETH
|
|
339
|
+
deposit into two transactions. Classic approvals and ERC-2612 permits now authorize
|
|
340
|
+
VaultBundlesV1; Permit2 uses SignatureTransfer and requires an explicit unused `permit2Nonce`.
|
|
341
|
+
- Remove `recipient` from deposits and remove `recipient` and `onBehalf` from exits. VaultBundlesV1
|
|
342
|
+
always operates for and pays `msg.sender`. `userAddress` now means the account that must submit the
|
|
343
|
+
transaction. A connected builder account may prepare a transaction for a different submitter;
|
|
344
|
+
identity-bound signature helpers still enforce `userAddress` when signing.
|
|
345
|
+
- `withdraw` and `redeem` now return a full `ActionOutput`. Call `getRequirements()` and satisfy the
|
|
346
|
+
exact vault-share approval or ERC-2612 permit before calling `buildTx(signatures)`.
|
|
347
|
+
- Vault calls gain `deadline`, `referralFeePct`, and `referralFeeRecipient`. Entity deadlines default
|
|
348
|
+
to two hours; pure builder callers provide them explicitly. Amounts remain gross, and fixed-asset
|
|
349
|
+
action metadata reports `referralFeeAssets` and `netAssets`.
|
|
350
|
+
- `migrateToV2` accepts exactly one of `assets` and `shares`, removes `recipient` and source
|
|
351
|
+
`minSharePriceVaultV1`, and retains only the destination `maxSharePriceVaultV2` bound.
|
|
352
|
+
|
|
353
|
+
VaultBundlesV1 permits only one call to itself in a transaction. Do not put two vault calls into one
|
|
354
|
+
Safe multisend or EIP-5792 batch; use `migrateToV2` for an atomic V1-to-V2 move. Permissioned Vault
|
|
355
|
+
V2 deployments must allow VaultBundlesV1 in both send-assets and receive-assets gates. Because gates
|
|
356
|
+
can inspect the bundle's transient initiator, validate them by simulating the finalized transaction
|
|
357
|
+
after satisfying requirements rather than by pre-reading the gate.
|
|
358
|
+
|
|
359
|
+
```ts
|
|
360
|
+
const withdrawal = vault.withdraw({ amount, userAddress });
|
|
361
|
+
const signatures = [];
|
|
362
|
+
for (const requirement of await withdrawal.getRequirements()) {
|
|
363
|
+
if ("sign" in requirement) {
|
|
364
|
+
signatures.push(await requirement.sign(walletClient, userAddress));
|
|
365
|
+
} else {
|
|
366
|
+
const hash = await walletClient.sendTransaction(requirement);
|
|
367
|
+
await publicClient.waitForTransactionReceipt({ hash });
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
const transaction = withdrawal.buildTx(signatures);
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
## Upgrade checklist
|
|
374
|
+
|
|
375
|
+
- Confirm `bundles.vaultBundlesV1` coverage for vault deposits and withdrawals and
|
|
376
|
+
`bundles.blueBundlesV1` coverage for Blue writes on every chain your application supports.
|
|
377
|
+
Stay on v5 if you need vault deposits or withdrawals on a chain without VaultBundlesV1.
|
|
378
|
+
- Update every Blue write call using the table above; method names remain stable.
|
|
379
|
+
- Remove Blue slippage and PublicAllocator V1 write inputs.
|
|
380
|
+
- Re-run approval and Morpho-authorization setup against the new spender/operator.
|
|
381
|
+
- Update transaction decoding, simulation fixtures, and action metadata fields; discriminator
|
|
382
|
+
names remain stable.
|
|
383
|
+
- Test native funding, full repay, and full-position migration paths used by the application.
|
|
384
|
+
|
|
385
|
+
## Fixed-bundles token requirement APIs
|
|
386
|
+
|
|
387
|
+
The Blue-only fixed-bundles requirement surface is generalized into a shared surface used by both
|
|
388
|
+
BlueBundlesV1 and VaultBundlesV1.
|
|
389
|
+
|
|
390
|
+
| v5 symbol | v6 replacement |
|
|
391
|
+
| --- | --- |
|
|
392
|
+
| `getBlueBundlesV1TokenRequirements` (action-layer) | `getBundlesTokenRequirements` (entity-layer; reads state, so it now lives under `entities/requirements` instead of `actions/requirements/blue`). Takes the same funding parameters plus a `spender` naming the registered fixed bundles deployment (BlueBundlesV1 or VaultBundlesV1). |
|
|
393
|
+
| `BlueBundlesV1TokenSignatureRequirement` / `BlueBundlesV1TokenRequirementSignature` | `BundlesTokenSignatureRequirement` / `BundlesTokenRequirementSignature` |
|
|
394
|
+
| `encodeErc20Permit2TransferFrom` | `encodeErc20Permit2SignatureTransfer` |
|
|
395
|
+
| Action discriminator `"permit2TransferFrom"` | `"permit2SignatureTransfer"` |
|
|
396
|
+
| `Permit2TransferFromAction` / `Permit2TransferFromRequirementSignature` | `Permit2SignatureTransferAction` / `Permit2SignatureTransferRequirementSignature` |
|
|
397
|
+
| `isPermit2TransferFromSignature` | `isPermit2SignatureTransferSignature` |
|
|
398
|
+
| `selectRequirementSignatures` option and result field `permit2TransferFrom` | `permit2SignatureTransfer` |
|
|
399
|
+
| `MissingPermit2TransferFromNonceError` | `MissingPermit2SignatureTransferNonceError` (old name kept as a `@deprecated` alias) |
|
|
400
|
+
| `Permit2TransferFromNonceAlreadyUsedError` | `Permit2SignatureTransferNonceAlreadyUsedError` (old name kept as a `@deprecated` alias) |
|
|
401
|
+
|
|
402
|
+
Update call sites and `switch`/discriminated-union checks on `action.type` to the new
|
|
403
|
+
`"permit2SignatureTransfer"` tag; the signed payload shape (`nonce`, `deadline`, `signature`) is
|
|
404
|
+
unchanged.
|