@morpho-org/morpho-sdk 9.4.0 → 9.5.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 +7 -0
- package/MIGRATION-v7-to-v8.md +7 -0
- package/MIGRATION-v8-to-v9.md +7 -0
- package/README.md +6 -4
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +1 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +4 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +4 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +5 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +1 -0
- package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
- package/lib/cjs/client/morphoViemExtension.js +1 -1
- package/lib/cjs/entities/blue/blue.d.ts +7 -21
- package/lib/cjs/entities/blue/blue.js +4 -22
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +21 -26
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +42 -80
- package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.d.ts +6 -3
- package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.js +2 -2
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +5 -11
- package/lib/cjs/entities/vaultV1/vaultV1.js +3 -11
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +5 -11
- package/lib/cjs/entities/vaultV2/vaultV2.js +3 -11
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +3 -0
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +40 -4
- package/lib/cjs/types/action.d.ts +11 -4
- package/lib/cjs/types/action.js +1 -0
- package/lib/cjs/types/error.d.ts +8 -2
- package/lib/cjs/types/error.js +8 -2
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +1 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +4 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +4 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +5 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +1 -0
- package/lib/esm/client/morphoViemExtension.d.ts +1 -1
- package/lib/esm/client/morphoViemExtension.js +1 -1
- package/lib/esm/entities/blue/blue.d.ts +7 -21
- package/lib/esm/entities/blue/blue.js +4 -22
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +21 -26
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +44 -82
- package/lib/esm/entities/requirements/getUnusedPermit2Nonce.d.ts +6 -3
- package/lib/esm/entities/requirements/getUnusedPermit2Nonce.js +2 -2
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +5 -11
- package/lib/esm/entities/vaultV1/vaultV1.js +4 -12
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +5 -11
- package/lib/esm/entities/vaultV2/vaultV2.js +4 -12
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +3 -0
- package/lib/esm/entities/vaultV2BlueReallocationData.js +40 -4
- package/lib/esm/types/action.d.ts +11 -4
- package/lib/esm/types/action.js +1 -0
- package/lib/esm/types/error.d.ts +8 -2
- package/lib/esm/types/error.js +8 -2
- package/package.json +3 -3
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type Address, type Client } from "viem";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for {@link getUnusedPermit2Nonce}.
|
|
4
|
+
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
5
|
+
*/
|
|
3
6
|
export interface GetUnusedPermit2NonceParams {
|
|
4
7
|
/** Account that will sign the Permit2 SignatureTransfer. */
|
|
5
8
|
readonly owner: Address;
|
|
@@ -9,8 +12,7 @@ export interface GetUnusedPermit2NonceParams {
|
|
|
9
12
|
readonly startNonce?: bigint;
|
|
10
13
|
}
|
|
11
14
|
/**
|
|
12
|
-
* Finds the lowest unused Permit2 unordered nonce for
|
|
13
|
-
* {@link getBundlesTokenRequirements} or as `nonce` to {@link encodeErc20Permit2SignatureTransfer}.
|
|
15
|
+
* Finds the lowest unused Permit2 unordered nonce for legacy SignatureTransfer integrations.
|
|
14
16
|
*
|
|
15
17
|
* Permit2 SignatureTransfer consumes an unordered 256-bit nonce; a nonce is free when its bit in
|
|
16
18
|
* `nonceBitmap(owner, word)` is unset. This scans consecutive bitmap words starting at `startNonce`
|
|
@@ -45,5 +47,6 @@ export interface GetUnusedPermit2NonceParams {
|
|
|
45
47
|
* });
|
|
46
48
|
* // permit2Nonce satisfies bigint
|
|
47
49
|
* ```
|
|
50
|
+
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
48
51
|
*/
|
|
49
52
|
export declare const getUnusedPermit2Nonce: (viemClient: Client, params: GetUnusedPermit2NonceParams) => Promise<bigint>;
|
|
@@ -12,8 +12,7 @@ const index_js_2 = require("../../types/index.js");
|
|
|
12
12
|
/** Highest Permit2 nonce-bitmap word index; each word covers 256 unordered nonces. */
|
|
13
13
|
const MAX_PERMIT2_NONCE_WORD = viem_1.maxUint256 >> 8n;
|
|
14
14
|
/**
|
|
15
|
-
* Finds the lowest unused Permit2 unordered nonce for
|
|
16
|
-
* {@link getBundlesTokenRequirements} or as `nonce` to {@link encodeErc20Permit2SignatureTransfer}.
|
|
15
|
+
* Finds the lowest unused Permit2 unordered nonce for legacy SignatureTransfer integrations.
|
|
17
16
|
*
|
|
18
17
|
* Permit2 SignatureTransfer consumes an unordered 256-bit nonce; a nonce is free when its bit in
|
|
19
18
|
* `nonceBitmap(owner, word)` is unset. This scans consecutive bitmap words starting at `startNonce`
|
|
@@ -48,6 +47,7 @@ const MAX_PERMIT2_NONCE_WORD = viem_1.maxUint256 >> 8n;
|
|
|
48
47
|
* });
|
|
49
48
|
* // permit2Nonce satisfies bigint
|
|
50
49
|
* ```
|
|
50
|
+
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
51
51
|
*/
|
|
52
52
|
const getUnusedPermit2Nonce = async (viemClient, params) => {
|
|
53
53
|
(0, index_js_1.validateChainId)(viemClient.chain?.id, params.chainId);
|
|
@@ -27,8 +27,8 @@ export interface VaultV1Actions {
|
|
|
27
27
|
* Prepares a Vault V1 deposit through the registered VaultBundlesV1 contract.
|
|
28
28
|
*
|
|
29
29
|
* Uses the supplied vault snapshot to compute the deadline-accrued `maxSharePrice`.
|
|
30
|
-
* `getRequirements()` reads the asset allowance and, when enabled, the selected ERC-2612
|
|
31
|
-
*
|
|
30
|
+
* `getRequirements()` reads the asset allowance and, when enabled, the selected ERC-2612
|
|
31
|
+
* nonce state. Native funding is exclusive and skips token requirements. Shares are
|
|
32
32
|
* always minted to the transaction sender, which must be `userAddress`.
|
|
33
33
|
* Concurrent requirement reads share the first caller's options; later calls refresh on-chain
|
|
34
34
|
* state using their own options.
|
|
@@ -53,19 +53,14 @@ export interface VaultV1Actions {
|
|
|
53
53
|
* @throws {VaultAddressMismatchError} when `vaultData` belongs to another vault.
|
|
54
54
|
* @throws {ExpiredDeadlineError} when the deadline is stale at creation or requirement resolution.
|
|
55
55
|
* @throws {MixedBundlesFundingError} when ERC-20 and native funding are both supplied.
|
|
56
|
-
* @throws {NegativeInputError} when funding, slippage, the referral fee
|
|
56
|
+
* @throws {NegativeInputError} when funding, slippage, or the referral fee is negative.
|
|
57
57
|
* @throws {NonPositiveInputError} when funding or the previewed vault shares are not positive.
|
|
58
58
|
* @throws {ExcessiveSlippageToleranceError} when slippage tolerance exceeds the SDK maximum.
|
|
59
59
|
* @throws {ReferralFeePctExceededError} when the referral fee is at least WAD.
|
|
60
60
|
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no recipient.
|
|
61
61
|
* @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
|
|
62
62
|
* @throws {NativeAmountOnNonWNativeVaultError} when native funding targets a non-wNative vault.
|
|
63
|
-
* @throws {
|
|
64
|
-
* owner is consumed and none was passed explicitly.
|
|
65
|
-
* @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the
|
|
66
|
-
* explicit Permit2 nonce is consumed.
|
|
67
|
-
* @throws {InputExceedsMaxError} when funding or the deadline exceeds uint256, or from
|
|
68
|
-
* `getRequirements()` when the Permit2 nonce exceeds uint256.
|
|
63
|
+
* @throws {InputExceedsMaxError} when funding or the deadline exceeds uint256.
|
|
69
64
|
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
|
|
70
65
|
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an unsupported signature is supplied.
|
|
71
66
|
* @throws {BundlesPermitMismatchError} from `buildTx()` when the signature's spender, amount or
|
|
@@ -481,8 +476,7 @@ export declare class MorphoVaultV1 implements VaultV1Actions {
|
|
|
481
476
|
* before any other requirement read. This VaultV1 `inKindRedeem` path validates the client chain
|
|
482
477
|
* before this code check.
|
|
483
478
|
*
|
|
484
|
-
* @param roles - Registry labels to resolve and check
|
|
485
|
-
* chain registers none.
|
|
479
|
+
* @param roles - Registry labels to resolve and check.
|
|
486
480
|
*/
|
|
487
481
|
private assertWriteTargets;
|
|
488
482
|
/** {@inheritDoc VaultV1Actions.deposit} */
|
|
@@ -39,17 +39,12 @@ class MorphoVaultV1 {
|
|
|
39
39
|
* before any other requirement read. This VaultV1 `inKindRedeem` path validates the client chain
|
|
40
40
|
* before this code check.
|
|
41
41
|
*
|
|
42
|
-
* @param roles - Registry labels to resolve and check
|
|
43
|
-
* chain registers none.
|
|
42
|
+
* @param roles - Registry labels to resolve and check.
|
|
44
43
|
*/
|
|
45
44
|
async assertWriteTargets(roles) {
|
|
46
45
|
const targets = [];
|
|
47
46
|
for (const role of roles) {
|
|
48
|
-
const address =
|
|
49
|
-
? (0, morpho_ts_1.getChainAddresses)(this.chainId).permit2
|
|
50
|
-
: (0, morpho_ts_1.getChainAddress)(this.chainId, role);
|
|
51
|
-
if (address == null)
|
|
52
|
-
continue;
|
|
47
|
+
const address = (0, morpho_ts_1.getChainAddress)(this.chainId, role);
|
|
53
48
|
targets.push({ role, address });
|
|
54
49
|
}
|
|
55
50
|
await (0, assertContractCode_js_1.assertRegistryTargetsHaveCode)(this.client.viemClient, this.chainId, targets);
|
|
@@ -97,9 +92,7 @@ class MorphoVaultV1 {
|
|
|
97
92
|
// Memoize the in-flight promise so concurrent callers share one round of
|
|
98
93
|
// allowance/nonce reads.
|
|
99
94
|
const pending = (async () => {
|
|
100
|
-
await this.assertWriteTargets(
|
|
101
|
-
? ["bundles.vaultBundlesV1", "permit2"]
|
|
102
|
-
: ["bundles.vaultBundlesV1"]);
|
|
95
|
+
await this.assertWriteTargets(["bundles.vaultBundlesV1"]);
|
|
103
96
|
return funding.value > 0n
|
|
104
97
|
? []
|
|
105
98
|
: (0, index_js_4.getBundlesTokenRequirements)(this.client.viemClient, {
|
|
@@ -112,7 +105,6 @@ class MorphoVaultV1 {
|
|
|
112
105
|
supportSignature: this.client.options.supportSignature,
|
|
113
106
|
supportDeployless: this.client.options.supportDeployless,
|
|
114
107
|
useSimplePermit: requirementOptions?.useSimplePermit,
|
|
115
|
-
permit2Nonce: requirementOptions?.permit2Nonce,
|
|
116
108
|
now,
|
|
117
109
|
});
|
|
118
110
|
})();
|
|
@@ -32,8 +32,8 @@ export interface VaultV2Actions {
|
|
|
32
32
|
* Prepares a Vault V2 deposit through the registered VaultBundlesV1 contract.
|
|
33
33
|
*
|
|
34
34
|
* Uses the supplied vault snapshot to compute the deadline-accrued `maxSharePrice`.
|
|
35
|
-
* `getRequirements()` reads the asset allowance and, when enabled, the selected ERC-2612
|
|
36
|
-
*
|
|
35
|
+
* `getRequirements()` reads the asset allowance and, when enabled, the selected ERC-2612
|
|
36
|
+
* nonce state. Native funding is exclusive and skips token requirements. Shares are
|
|
37
37
|
* always minted to the transaction sender, which must be `userAddress`.
|
|
38
38
|
* Concurrent requirement reads share the first caller's options; later calls refresh on-chain
|
|
39
39
|
* state using their own options.
|
|
@@ -58,19 +58,14 @@ export interface VaultV2Actions {
|
|
|
58
58
|
* @throws {VaultAddressMismatchError} when `vaultData` belongs to another vault.
|
|
59
59
|
* @throws {ExpiredDeadlineError} when the deadline is stale at creation or requirement resolution.
|
|
60
60
|
* @throws {MixedBundlesFundingError} when ERC-20 and native funding are both supplied.
|
|
61
|
-
* @throws {NegativeInputError} when funding, slippage, the referral fee
|
|
61
|
+
* @throws {NegativeInputError} when funding, slippage, or the referral fee is negative.
|
|
62
62
|
* @throws {NonPositiveInputError} when funding or the previewed vault shares are not positive.
|
|
63
63
|
* @throws {ExcessiveSlippageToleranceError} when slippage tolerance exceeds the SDK maximum.
|
|
64
64
|
* @throws {ReferralFeePctExceededError} when the referral fee is at least WAD.
|
|
65
65
|
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no recipient.
|
|
66
66
|
* @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
|
|
67
67
|
* @throws {NativeAmountOnNonWNativeVaultError} when native funding targets a non-wNative vault.
|
|
68
|
-
* @throws {
|
|
69
|
-
* owner is consumed and none was passed explicitly.
|
|
70
|
-
* @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the
|
|
71
|
-
* explicit Permit2 nonce is consumed.
|
|
72
|
-
* @throws {InputExceedsMaxError} when funding or the deadline exceeds uint256, or from
|
|
73
|
-
* `getRequirements()` when the Permit2 nonce exceeds uint256.
|
|
68
|
+
* @throws {InputExceedsMaxError} when funding or the deadline exceeds uint256.
|
|
74
69
|
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
|
|
75
70
|
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an unsupported signature is supplied.
|
|
76
71
|
* @throws {BundlesPermitMismatchError} from `buildTx()` when the signature's spender, amount or
|
|
@@ -555,8 +550,7 @@ export declare class MorphoVaultV2 implements VaultV2Actions {
|
|
|
555
550
|
* before any other requirement read. The `inKindRedeem` and `forceWithdraw` paths validate the
|
|
556
551
|
* client chain before this code check.
|
|
557
552
|
*
|
|
558
|
-
* @param roles - Registry labels to resolve and check
|
|
559
|
-
* chain registers none.
|
|
553
|
+
* @param roles - Registry labels to resolve and check.
|
|
560
554
|
*/
|
|
561
555
|
private assertWriteTargets;
|
|
562
556
|
/** {@inheritDoc VaultV2Actions.deposit} */
|
|
@@ -42,17 +42,12 @@ class MorphoVaultV2 {
|
|
|
42
42
|
* before any other requirement read. The `inKindRedeem` and `forceWithdraw` paths validate the
|
|
43
43
|
* client chain before this code check.
|
|
44
44
|
*
|
|
45
|
-
* @param roles - Registry labels to resolve and check
|
|
46
|
-
* chain registers none.
|
|
45
|
+
* @param roles - Registry labels to resolve and check.
|
|
47
46
|
*/
|
|
48
47
|
async assertWriteTargets(roles) {
|
|
49
48
|
const targets = [];
|
|
50
49
|
for (const role of roles) {
|
|
51
|
-
const address =
|
|
52
|
-
? (0, morpho_ts_1.getChainAddresses)(this.chainId).permit2
|
|
53
|
-
: (0, morpho_ts_1.getChainAddress)(this.chainId, role);
|
|
54
|
-
if (address == null)
|
|
55
|
-
continue;
|
|
50
|
+
const address = (0, morpho_ts_1.getChainAddress)(this.chainId, role);
|
|
56
51
|
targets.push({ role, address });
|
|
57
52
|
}
|
|
58
53
|
await (0, assertContractCode_js_1.assertRegistryTargetsHaveCode)(this.client.viemClient, this.chainId, targets);
|
|
@@ -100,9 +95,7 @@ class MorphoVaultV2 {
|
|
|
100
95
|
// Memoize the in-flight promise so concurrent callers share one round of
|
|
101
96
|
// allowance/nonce reads.
|
|
102
97
|
const pending = (async () => {
|
|
103
|
-
await this.assertWriteTargets(
|
|
104
|
-
? ["bundles.vaultBundlesV1", "permit2"]
|
|
105
|
-
: ["bundles.vaultBundlesV1"]);
|
|
98
|
+
await this.assertWriteTargets(["bundles.vaultBundlesV1"]);
|
|
106
99
|
return funding.value > 0n
|
|
107
100
|
? []
|
|
108
101
|
: (0, index_js_4.getBundlesTokenRequirements)(this.client.viemClient, {
|
|
@@ -115,7 +108,6 @@ class MorphoVaultV2 {
|
|
|
115
108
|
supportSignature: this.client.options.supportSignature,
|
|
116
109
|
supportDeployless: this.client.options.supportDeployless,
|
|
117
110
|
useSimplePermit: requirementOptions?.useSimplePermit,
|
|
118
|
-
permit2Nonce: requirementOptions?.permit2Nonce,
|
|
119
111
|
now,
|
|
120
112
|
});
|
|
121
113
|
})();
|
|
@@ -450,6 +450,9 @@ export declare class VaultV2BlueReallocationData implements InputVaultV2BlueReal
|
|
|
450
450
|
* Full-liquidity discovery omits a candidate when its non-shared maximum
|
|
451
451
|
* violates a shared cap instead of scanning smaller base-unit amounts. These
|
|
452
452
|
* bounds can understate executable liquidity in rounding-only edge cases.
|
|
453
|
+
* With an explicit Blue balance, a paid operation may retry the same search
|
|
454
|
+
* from a physical-funding budget and keep a strictly cheaper feasible plan.
|
|
455
|
+
* This bounded refinement does not guarantee globally minimal penalties.
|
|
453
456
|
*
|
|
454
457
|
* @param marketId - Target Blue market id.
|
|
455
458
|
* @param options - Optional discovery controls and operation to support.
|
|
@@ -654,6 +654,9 @@ class VaultV2BlueReallocationData {
|
|
|
654
654
|
* Full-liquidity discovery omits a candidate when its non-shared maximum
|
|
655
655
|
* violates a shared cap instead of scanning smaller base-unit amounts. These
|
|
656
656
|
* bounds can understate executable liquidity in rounding-only edge cases.
|
|
657
|
+
* With an explicit Blue balance, a paid operation may retry the same search
|
|
658
|
+
* from a physical-funding budget and keep a strictly cheaper feasible plan.
|
|
659
|
+
* This bounded refinement does not guarantee globally minimal penalties.
|
|
657
660
|
*
|
|
658
661
|
* @param marketId - Target Blue market id.
|
|
659
662
|
* @param options - Optional discovery controls and operation to support.
|
|
@@ -808,7 +811,7 @@ class VaultV2BlueReallocationData {
|
|
|
808
811
|
? [config.penalty]
|
|
809
812
|
: [])),
|
|
810
813
|
].sort((0, morpho_ts_1.bigIntComparator)((tier) => tier));
|
|
811
|
-
const plan = (maxAssets, headroom) => {
|
|
814
|
+
const plan = (maxAssets, { headroom, usePhysicalBalance = false, }) => {
|
|
812
815
|
let reserves = createCapReserveState(this.mutableMarkets);
|
|
813
816
|
const reallocations = [];
|
|
814
817
|
let data = this.clone();
|
|
@@ -832,6 +835,19 @@ class VaultV2BlueReallocationData {
|
|
|
832
835
|
: isFreeFriendlyPass
|
|
833
836
|
? maxAssets
|
|
834
837
|
: remainingShortfall;
|
|
838
|
+
if (usePhysicalBalance && penalty > 0n) {
|
|
839
|
+
const penaltyMultiplier = type === "refinance" ? 2n : 1n;
|
|
840
|
+
const physicalPenalty = penaltyMultiplier * penalty;
|
|
841
|
+
if (physicalPenalty < blue_sdk_1.MathLib.WAD) {
|
|
842
|
+
const idleAssets = reallocations.reduce((total, { from, assets }) => from.type === "idle" ? total + assets : total, 0n);
|
|
843
|
+
// Idle must fund both the operation and its penalty flash loan.
|
|
844
|
+
const physicalShortfall = blue_sdk_1.MathLib.zeroFloorSub(amount +
|
|
845
|
+
feeAssets +
|
|
846
|
+
penaltyMultiplier *
|
|
847
|
+
(0, common_js_1.getBlueBundlesV1PenaltyAssets)(reallocations), blueBalance + idleAssets);
|
|
848
|
+
passMaxAssets = blue_sdk_1.MathLib.max(passMaxAssets, blue_sdk_1.MathLib.mulDivUp(physicalShortfall, blue_sdk_1.MathLib.WAD, blue_sdk_1.MathLib.WAD - physicalPenalty));
|
|
849
|
+
}
|
|
850
|
+
}
|
|
835
851
|
const retryPaidPass = penalty > 0n;
|
|
836
852
|
let lo = retryPaidPass ? passMaxAssets - 1n : 0n;
|
|
837
853
|
let tryFullCapacityAttempt = false;
|
|
@@ -1022,6 +1038,8 @@ class VaultV2BlueReallocationData {
|
|
|
1022
1038
|
? reallocatedAssets >= absoluteShortfall + penaltyAssets
|
|
1023
1039
|
: reallocatedAssets >= absoluteShortfall;
|
|
1024
1040
|
return {
|
|
1041
|
+
maxAssets,
|
|
1042
|
+
headroom,
|
|
1025
1043
|
reallocations,
|
|
1026
1044
|
data,
|
|
1027
1045
|
liquidityBound: allocatorCapBoundTargets.size > 0 || idleBoundVaults.size > 0,
|
|
@@ -1038,12 +1056,12 @@ class VaultV2BlueReallocationData {
|
|
|
1038
1056
|
// (nearly) all of a source vault's starting idle, revert once another
|
|
1039
1057
|
// allocation lands first. A bound plan therefore moves only the operation's
|
|
1040
1058
|
// shortfall, or what unbound legs moved.
|
|
1041
|
-
const target = plan(requiredAssets, allocatorCapHeadroom);
|
|
1059
|
+
const target = plan(requiredAssets, { headroom: allocatorCapHeadroom });
|
|
1042
1060
|
let selected = target;
|
|
1043
1061
|
if (allocatorCapHeadroom > 0n && target.liquidityBound) {
|
|
1044
1062
|
selected = plan(absoluteShortfall > target.unboundAssets
|
|
1045
1063
|
? absoluteShortfall
|
|
1046
|
-
: target.unboundAssets, allocatorCapHeadroom);
|
|
1064
|
+
: target.unboundAssets, { headroom: allocatorCapHeadroom });
|
|
1047
1065
|
// Shared-cap fitting is not monotonic in the budget.
|
|
1048
1066
|
if (!selected.coversShortfall && target.coversShortfall)
|
|
1049
1067
|
selected = target;
|
|
@@ -1054,7 +1072,7 @@ class VaultV2BlueReallocationData {
|
|
|
1054
1072
|
for (const maxAssets of fullCapBudgets) {
|
|
1055
1073
|
if (selected.coversShortfall)
|
|
1056
1074
|
break;
|
|
1057
|
-
selected = plan(maxAssets, 0n);
|
|
1075
|
+
selected = plan(maxAssets, { headroom: 0n });
|
|
1058
1076
|
if (selected.reallocatedAssets > available)
|
|
1059
1077
|
available = selected.reallocatedAssets;
|
|
1060
1078
|
}
|
|
@@ -1086,6 +1104,24 @@ class VaultV2BlueReallocationData {
|
|
|
1086
1104
|
available,
|
|
1087
1105
|
});
|
|
1088
1106
|
}
|
|
1107
|
+
const selectedPenaltyAssets = (0, common_js_1.getBlueBundlesV1PenaltyAssets)(selected.reallocations);
|
|
1108
|
+
if (hasExplicitBlueBalance &&
|
|
1109
|
+
selectedPenaltyAssets > 1n &&
|
|
1110
|
+
blueBalance <
|
|
1111
|
+
amount +
|
|
1112
|
+
feeAssets +
|
|
1113
|
+
(type === "refinance" ? 2n : 1n) * selectedPenaltyAssets) {
|
|
1114
|
+
// Amount feasibility is not monotonic: retain the original plan unless
|
|
1115
|
+
// the physical-balance seed finds a fully funded, strictly cheaper one.
|
|
1116
|
+
const alternative = plan(selected.maxAssets, {
|
|
1117
|
+
headroom: selected.headroom,
|
|
1118
|
+
usePhysicalBalance: true,
|
|
1119
|
+
});
|
|
1120
|
+
if (alternative.coversShortfall &&
|
|
1121
|
+
(0, common_js_1.getBlueBundlesV1PenaltyAssets)(alternative.reallocations) <
|
|
1122
|
+
(0, common_js_1.getBlueBundlesV1PenaltyAssets)(selected.reallocations))
|
|
1123
|
+
selected = alternative;
|
|
1124
|
+
}
|
|
1089
1125
|
return { reallocations: selected.reallocations, data: selected.data };
|
|
1090
1126
|
}
|
|
1091
1127
|
computeVaultV2BlueReallocationsAtUtilizationInPlace({ context, reserves, marketId, maxWithdrawalUtilization, maxAssets, capAccrualBuffer, allocatorCapHeadroom = 0n, penalty, options = {}, }) {
|
|
@@ -548,9 +548,9 @@ export type BundlesFundingArgs = {
|
|
|
548
548
|
};
|
|
549
549
|
/** Controls token requirements generated for a bundles-funded action. */
|
|
550
550
|
export interface BundlesTokenRequirementsOptions {
|
|
551
|
-
/** Prefer ERC-2612 when the funded token exposes a compatible nonce. */
|
|
551
|
+
/** Prefer ERC-2612 when the funded token exposes a compatible nonce; defaults to true when signatures are supported. */
|
|
552
552
|
readonly useSimplePermit?: boolean;
|
|
553
|
-
/**
|
|
553
|
+
/** @deprecated Ignored. The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals. */
|
|
554
554
|
readonly permit2Nonce?: bigint;
|
|
555
555
|
}
|
|
556
556
|
/** Mutually exclusive source amount accepted by a Vault V1 to Vault V2 migration. */
|
|
@@ -612,7 +612,10 @@ export interface PermitAction extends BaseAction<"permit", {
|
|
|
612
612
|
*/
|
|
613
613
|
readonly typedData?: RequirementTypedData;
|
|
614
614
|
}
|
|
615
|
-
/**
|
|
615
|
+
/**
|
|
616
|
+
* Signable Permit2 SignatureTransfer requirement for a fixed bundles token pull.
|
|
617
|
+
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
618
|
+
*/
|
|
616
619
|
export interface Permit2SignatureTransferAction extends BaseAction<"permit2SignatureTransfer", {
|
|
617
620
|
readonly spender: Address;
|
|
618
621
|
readonly amount: bigint;
|
|
@@ -644,7 +647,10 @@ export interface Erc2612RequirementSignature {
|
|
|
644
647
|
}
|
|
645
648
|
/** A signed ERC-2612 permit requirement accepted by vault-share bundle calls. */
|
|
646
649
|
export type PermitRequirementSignature = Erc2612RequirementSignature;
|
|
647
|
-
/**
|
|
650
|
+
/**
|
|
651
|
+
* A signed Permit2 SignatureTransfer requirement used by fixed bundles contracts.
|
|
652
|
+
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
653
|
+
*/
|
|
648
654
|
export interface Permit2SignatureTransferRequirementSignature {
|
|
649
655
|
readonly args: Readonly<PermitArgs>;
|
|
650
656
|
readonly action: Permit2SignatureTransferAction;
|
|
@@ -874,6 +880,7 @@ export declare function isPermitSignature(signature: RequirementSignature): sign
|
|
|
874
880
|
* const getPermit2Nonce = (signature: RequirementSignature): bigint | undefined =>
|
|
875
881
|
* isPermit2SignatureTransferSignature(signature) ? signature.args.nonce : undefined;
|
|
876
882
|
* ```
|
|
883
|
+
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
877
884
|
*/
|
|
878
885
|
export declare function isPermit2SignatureTransferSignature(signature: RequirementSignature): signature is Permit2SignatureTransferRequirementSignature;
|
|
879
886
|
/**
|
package/lib/cjs/types/action.js
CHANGED
|
@@ -165,6 +165,7 @@ function isPermitSignature(signature) {
|
|
|
165
165
|
* const getPermit2Nonce = (signature: RequirementSignature): bigint | undefined =>
|
|
166
166
|
* isPermit2SignatureTransferSignature(signature) ? signature.args.nonce : undefined;
|
|
167
167
|
* ```
|
|
168
|
+
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
168
169
|
*/
|
|
169
170
|
function isPermit2SignatureTransferSignature(signature) {
|
|
170
171
|
return signature.action.type === "permit2SignatureTransfer";
|
package/lib/cjs/types/error.d.ts
CHANGED
|
@@ -538,7 +538,10 @@ export declare class BundlesRequirementSignatureMismatchError extends Error {
|
|
|
538
538
|
cause?: unknown;
|
|
539
539
|
});
|
|
540
540
|
}
|
|
541
|
-
/**
|
|
541
|
+
/**
|
|
542
|
+
* Thrown when an explicit Permit2 SignatureTransfer unordered nonce is already consumed.
|
|
543
|
+
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
544
|
+
*/
|
|
542
545
|
export declare class Permit2SignatureTransferNonceAlreadyUsedError extends Error {
|
|
543
546
|
readonly owner: Address;
|
|
544
547
|
readonly nonce: bigint;
|
|
@@ -548,7 +551,10 @@ export declare class Permit2SignatureTransferNonceAlreadyUsedError extends Error
|
|
|
548
551
|
*/
|
|
549
552
|
constructor(owner: Address, nonce: bigint);
|
|
550
553
|
}
|
|
551
|
-
/**
|
|
554
|
+
/**
|
|
555
|
+
* Thrown when no unused Permit2 unordered nonce exists at or after the requested start nonce.
|
|
556
|
+
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
557
|
+
*/
|
|
552
558
|
export declare class NoUnusedPermit2NonceError extends Error {
|
|
553
559
|
readonly owner: Address;
|
|
554
560
|
readonly startNonce: bigint;
|
package/lib/cjs/types/error.js
CHANGED
|
@@ -627,7 +627,10 @@ class BundlesRequirementSignatureMismatchError extends Error {
|
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
629
|
exports.BundlesRequirementSignatureMismatchError = BundlesRequirementSignatureMismatchError;
|
|
630
|
-
/**
|
|
630
|
+
/**
|
|
631
|
+
* Thrown when an explicit Permit2 SignatureTransfer unordered nonce is already consumed.
|
|
632
|
+
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
633
|
+
*/
|
|
631
634
|
class Permit2SignatureTransferNonceAlreadyUsedError extends Error {
|
|
632
635
|
owner;
|
|
633
636
|
nonce;
|
|
@@ -643,7 +646,10 @@ class Permit2SignatureTransferNonceAlreadyUsedError extends Error {
|
|
|
643
646
|
}
|
|
644
647
|
}
|
|
645
648
|
exports.Permit2SignatureTransferNonceAlreadyUsedError = Permit2SignatureTransferNonceAlreadyUsedError;
|
|
646
|
-
/**
|
|
649
|
+
/**
|
|
650
|
+
* Thrown when no unused Permit2 unordered nonce exists at or after the requested start nonce.
|
|
651
|
+
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
652
|
+
*/
|
|
647
653
|
class NoUnusedPermit2NonceError extends Error {
|
|
648
654
|
owner;
|
|
649
655
|
startNonce;
|
|
@@ -6,6 +6,7 @@ export type BundlesTokenRequirementsState = {
|
|
|
6
6
|
/** Current allowance of the funding token for `spender`. */
|
|
7
7
|
readonly allowance: bigint;
|
|
8
8
|
} | {
|
|
9
|
+
/** @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals. */
|
|
9
10
|
readonly type: "permit2SignatureTransfer";
|
|
10
11
|
readonly permit2Allowance: bigint;
|
|
11
12
|
readonly permit2Nonce: bigint;
|
|
@@ -51,6 +51,9 @@ interface EncodeErc20PermitParams {
|
|
|
51
51
|
* @throws {MalformedTokenMetadataError} when the token's `eip712Domain()` or
|
|
52
52
|
* `bytes32` `name`/`symbol` retry returns non-empty data that does not decode, or when the
|
|
53
53
|
* deployless query reports malformed `name()`/`symbol()`/`eip712Domain()` returndata (no fallback).
|
|
54
|
+
* @throws {InvalidPermitDomainChainIdError} when the EIP-5267 domain names another chain.
|
|
55
|
+
* @throws {InvalidPermitDomainVerifyingContractError} when the EIP-5267 domain names another token.
|
|
56
|
+
* @throws {UnsupportedPermitDomainExtensionsError} when the EIP-5267 domain has extensions.
|
|
54
57
|
* @throws {MissingPermitDomainNameError} when the token exposes neither `name()` nor
|
|
55
58
|
* `eip712Domain()`, so its permit domain is unknown.
|
|
56
59
|
* @throws {viem.BaseError} when the `eth_chainId` request or a token metadata read fails at the
|
|
@@ -67,7 +70,7 @@ interface EncodeErc20PermitParams {
|
|
|
67
70
|
*
|
|
68
71
|
* const client = createWalletClient({ chain: mainnet, transport: http() });
|
|
69
72
|
* const requirement = await encodeErc20Permit(client, {
|
|
70
|
-
* token: USDC, // Must implement standard ERC-2612. DAI
|
|
73
|
+
* token: USDC, // Must implement standard ERC-2612. DAI falls back to a direct ERC-20 approval in requirement helpers.
|
|
71
74
|
* owner,
|
|
72
75
|
* spender: blueBundlesV1,
|
|
73
76
|
* amount: 1_000_000n,
|
|
@@ -41,6 +41,9 @@ import { validateClientChainId } from "../validateClientChainId.js";
|
|
|
41
41
|
* @throws {MalformedTokenMetadataError} when the token's `eip712Domain()` or
|
|
42
42
|
* `bytes32` `name`/`symbol` retry returns non-empty data that does not decode, or when the
|
|
43
43
|
* deployless query reports malformed `name()`/`symbol()`/`eip712Domain()` returndata (no fallback).
|
|
44
|
+
* @throws {InvalidPermitDomainChainIdError} when the EIP-5267 domain names another chain.
|
|
45
|
+
* @throws {InvalidPermitDomainVerifyingContractError} when the EIP-5267 domain names another token.
|
|
46
|
+
* @throws {UnsupportedPermitDomainExtensionsError} when the EIP-5267 domain has extensions.
|
|
44
47
|
* @throws {MissingPermitDomainNameError} when the token exposes neither `name()` nor
|
|
45
48
|
* `eip712Domain()`, so its permit domain is unknown.
|
|
46
49
|
* @throws {viem.BaseError} when the `eth_chainId` request or a token metadata read fails at the
|
|
@@ -57,7 +60,7 @@ import { validateClientChainId } from "../validateClientChainId.js";
|
|
|
57
60
|
*
|
|
58
61
|
* const client = createWalletClient({ chain: mainnet, transport: http() });
|
|
59
62
|
* const requirement = await encodeErc20Permit(client, {
|
|
60
|
-
* token: USDC, // Must implement standard ERC-2612. DAI
|
|
63
|
+
* token: USDC, // Must implement standard ERC-2612. DAI falls back to a direct ERC-20 approval in requirement helpers.
|
|
61
64
|
* owner,
|
|
62
65
|
* spender: blueBundlesV1,
|
|
63
66
|
* amount: 1_000_000n,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Address } from "@morpho-org/blue-sdk";
|
|
2
2
|
import { type Permit2SignatureTransferRequirementSignature, type Requirement } from "../../../types/index.js";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Parameters for {@link encodeErc20Permit2SignatureTransfer}.
|
|
5
|
+
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
6
|
+
*/
|
|
4
7
|
export interface EncodeErc20Permit2SignatureTransferParams {
|
|
5
8
|
/** ERC-20 token pulled through Permit2. */
|
|
6
9
|
readonly token: Address;
|
|
@@ -62,5 +65,6 @@ export interface EncodeErc20Permit2SignatureTransferParams {
|
|
|
62
65
|
* });
|
|
63
66
|
* // requirement satisfies Requirement<Permit2SignatureTransferRequirementSignature>
|
|
64
67
|
* ```
|
|
68
|
+
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
65
69
|
*/
|
|
66
70
|
export declare const encodeErc20Permit2SignatureTransfer: (params: EncodeErc20Permit2SignatureTransferParams) => Requirement<Permit2SignatureTransferRequirementSignature>;
|
|
@@ -50,6 +50,7 @@ import { ExpiredDeadlineError, InputExceedsMaxError, NonPositiveInputError, } fr
|
|
|
50
50
|
* });
|
|
51
51
|
* // requirement satisfies Requirement<Permit2SignatureTransferRequirementSignature>
|
|
52
52
|
* ```
|
|
53
|
+
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
53
54
|
*/
|
|
54
55
|
export const encodeErc20Permit2SignatureTransfer = (params) => {
|
|
55
56
|
const { token, spender, amount, chainId, nonce, deadline } = params;
|
|
@@ -12,7 +12,7 @@ import type { Metadata, MorphoClientType } from "../types/index.js";
|
|
|
12
12
|
* @param _options.metadata - Optional analytics metadata applied to every transaction the
|
|
13
13
|
* `morpho` namespace builds.
|
|
14
14
|
* @param _options.supportSignature - Whether the integrator can collect EIP-712 signatures for
|
|
15
|
-
* ERC-2612
|
|
15
|
+
* ERC-2612 and Morpho authorization.
|
|
16
16
|
* Defaults to `false` (standalone approvals and authorization calls only).
|
|
17
17
|
* @param _options.supportDeployless - Whether entity fetchers may use deployless multicall.
|
|
18
18
|
* @returns A viem extension function — `client.extend(morphoViemExtension(...))` adds
|
|
@@ -46,7 +46,7 @@ function createMorphoNamespace(viemClient, options) {
|
|
|
46
46
|
* @param _options.metadata - Optional analytics metadata applied to every transaction the
|
|
47
47
|
* `morpho` namespace builds.
|
|
48
48
|
* @param _options.supportSignature - Whether the integrator can collect EIP-712 signatures for
|
|
49
|
-
* ERC-2612
|
|
49
|
+
* ERC-2612 and Morpho authorization.
|
|
50
50
|
* Defaults to `false` (standalone approvals and authorization calls only).
|
|
51
51
|
* @param _options.supportDeployless - Whether entity fetchers may use deployless multicall.
|
|
52
52
|
* @returns A viem extension function — `client.extend(morphoViemExtension(...))` adds
|
|
@@ -18,9 +18,9 @@ type VaultV2BlueReallocationsParams = {
|
|
|
18
18
|
};
|
|
19
19
|
/** Options for resolving token-backed BlueBundlesV1 approval or signature prerequisites. */
|
|
20
20
|
export interface BlueTokenRequirementsParams {
|
|
21
|
-
/** Prefer ERC-2612 when the funded token exposes a compatible nonce. */
|
|
21
|
+
/** Prefer ERC-2612 when the funded token exposes a compatible nonce; defaults to true when signatures are supported. */
|
|
22
22
|
readonly useSimplePermit?: boolean;
|
|
23
|
-
/**
|
|
23
|
+
/** @deprecated Ignored. The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals. */
|
|
24
24
|
readonly permit2Nonce?: bigint;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -95,8 +95,6 @@ export interface BlueActions {
|
|
|
95
95
|
* @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
|
|
96
96
|
* @throws {InputExceedsMaxError} when the referral fee is at least WAD.
|
|
97
97
|
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
98
|
-
* @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
|
|
99
|
-
* @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
|
|
100
98
|
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
|
|
101
99
|
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an unsupported signature is supplied.
|
|
102
100
|
* @throws {DepositOwnerMismatchError} from `buildTx()` when the signed owner differs from `userAddress`.
|
|
@@ -144,10 +142,9 @@ export interface BlueActions {
|
|
|
144
142
|
/**
|
|
145
143
|
* Prepares a direct BlueBundlesV1 loan-asset supply.
|
|
146
144
|
*
|
|
147
|
-
* `getRequirements()` first checks that BlueBundlesV1
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
* BlueBundlesV1 as spender; Permit2 keeps its ERC-20 approval on canonical Permit2. Native
|
|
145
|
+
* `getRequirements()` first checks that BlueBundlesV1 and Blue hold code, then
|
|
146
|
+
* reads the loan-token allowance and selected ERC-2612 nonce state. Direct approvals and
|
|
147
|
+
* ERC-2612 name BlueBundlesV1 as spender. Native
|
|
151
148
|
* funding is exclusive and skips token requirements (the code check still runs).
|
|
152
149
|
* The referral fee is deducted from the gross `assets` supplied. This route exposes no
|
|
153
150
|
* share-price bound or `slippageTolerance`.
|
|
@@ -166,14 +163,12 @@ export interface BlueActions {
|
|
|
166
163
|
* `getRequirements()` when the RPC reports another chain via `eth_chainId`.
|
|
167
164
|
* @throws {ExpiredDeadlineError} when the deadline is not in the future at creation or requirement resolution.
|
|
168
165
|
* @throws {NonPositiveInputError} when `assets` is not positive.
|
|
169
|
-
* @throws {NegativeInputError} when native funding or the referral fee is negative
|
|
166
|
+
* @throws {NegativeInputError} when native funding or the referral fee is negative.
|
|
170
167
|
* @throws {NativeFundingAmountMismatchError} when native funding is partial or mixed.
|
|
171
168
|
* @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
|
|
172
169
|
* @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
|
|
173
|
-
* @throws {InputExceedsMaxError} when `assets` or `deadline` exceeds `uint256`, when the referral fee is at least WAD
|
|
170
|
+
* @throws {InputExceedsMaxError} when `assets` or `deadline` exceeds `uint256`, when the referral fee is at least WAD.
|
|
174
171
|
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
175
|
-
* @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
|
|
176
|
-
* @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
|
|
177
172
|
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
|
|
178
173
|
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when the route cannot consume a supplied signature.
|
|
179
174
|
* @throws {DepositOwnerMismatchError} from `buildTx()` when the signed owner differs from `userAddress`.
|
|
@@ -500,8 +495,6 @@ export interface BlueActions {
|
|
|
500
495
|
* @throws {NativeFundingAmountMismatchError} when native funding is partial or mixed.
|
|
501
496
|
* @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
|
|
502
497
|
* @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
|
|
503
|
-
* @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
|
|
504
|
-
* @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
|
|
505
498
|
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
|
|
506
499
|
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an authorization signature is supplied.
|
|
507
500
|
* @throws {DepositOwnerMismatchError} from `buildTx()` when the signed owner differs from `userAddress`.
|
|
@@ -675,8 +668,6 @@ export interface BlueActions {
|
|
|
675
668
|
* @throws {NativeFundingAmountMismatchError} when native funding is partial or mixed.
|
|
676
669
|
* @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
|
|
677
670
|
* @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
|
|
678
|
-
* @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
|
|
679
|
-
* @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
|
|
680
671
|
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple signatures of one kind are supplied.
|
|
681
672
|
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an inactive leg cannot consume a supplied signature.
|
|
682
673
|
* @throws {DepositOwnerMismatchError} from `buildTx()` when a signed owner differs from `userAddress`.
|
|
@@ -782,8 +773,6 @@ export interface BlueActions {
|
|
|
782
773
|
* @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
|
|
783
774
|
* @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
|
|
784
775
|
* @throws {ReallocationLoanTokenMismatchError} when a source uses another loan token.
|
|
785
|
-
* @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
|
|
786
|
-
* @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
|
|
787
776
|
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple signatures of one kind are supplied.
|
|
788
777
|
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an inactive leg cannot consume a supplied signature.
|
|
789
778
|
* @throws {DepositOwnerMismatchError} from `buildTx()` when a signed owner differs from `userAddress`.
|
|
@@ -1051,9 +1040,6 @@ export declare class MorphoBlue implements BlueActions {
|
|
|
1051
1040
|
* spender/authorized operator holds code, with one `eth_getCode` per distinct address
|
|
1052
1041
|
* before any other requirement read. Blue write flows probe `eth_chainId` only after a target
|
|
1053
1042
|
* has no code and report a chain mismatch when the RPC serves another chain.
|
|
1054
|
-
*
|
|
1055
|
-
* @param params.erc20Funding - Whether the flow resolves an ERC-20 funding leg, which
|
|
1056
|
-
* may name canonical Permit2 when signatures are supported.
|
|
1057
1043
|
*/
|
|
1058
1044
|
private assertWriteTargets;
|
|
1059
1045
|
private getMaxLtv;
|