@morpho-org/morpho-sdk 10.1.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/actions/blue/borrow.d.ts +11 -3
- package/lib/cjs/actions/blue/borrow.internal.js +1 -0
- package/lib/cjs/actions/blue/borrow.js +8 -2
- package/lib/cjs/actions/blue/common.d.ts +4 -1
- package/lib/cjs/actions/blue/common.js +17 -3
- package/lib/cjs/actions/blue/refinance.d.ts +11 -3
- package/lib/cjs/actions/blue/refinance.internal.js +4 -1
- package/lib/cjs/actions/blue/refinance.js +8 -2
- package/lib/cjs/actions/blue/refinanceValidation.d.ts +3 -2
- package/lib/cjs/actions/blue/refinanceValidation.js +10 -6
- package/lib/cjs/actions/blue/repay.d.ts +4 -3
- package/lib/cjs/actions/blue/repay.js +3 -2
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +4 -3
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +3 -2
- package/lib/cjs/actions/blue/supply.d.ts +5 -3
- package/lib/cjs/actions/blue/supply.js +4 -2
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +4 -3
- package/lib/cjs/actions/blue/supplyCollateral.js +3 -2
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +11 -3
- package/lib/cjs/actions/blue/supplyCollateralBorrow.internal.d.ts +2 -0
- package/lib/cjs/actions/blue/supplyCollateralBorrow.internal.js +5 -1
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +8 -2
- package/lib/cjs/actions/blue/withdraw.d.ts +11 -3
- package/lib/cjs/actions/blue/withdraw.internal.js +4 -1
- package/lib/cjs/actions/blue/withdraw.js +8 -2
- package/lib/cjs/actions/blue/withdrawCollateral.d.ts +4 -3
- package/lib/cjs/actions/blue/withdrawCollateral.js +3 -2
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +0 -1
- package/lib/cjs/actions/midnight/takeBorrow.js +0 -1
- package/lib/cjs/actions/midnight/takeLend.js +0 -1
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +0 -1
- package/lib/cjs/actions/midnight/takeWithdraw.js +0 -1
- package/lib/cjs/actions/vaultV1/deposit.d.ts +2 -1
- package/lib/cjs/actions/vaultV1/deposit.js +2 -1
- package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +3 -2
- package/lib/cjs/actions/vaultV1/migrateToV2.js +2 -1
- package/lib/cjs/actions/vaultV1/redeem.d.ts +3 -2
- package/lib/cjs/actions/vaultV1/redeem.js +2 -1
- package/lib/cjs/actions/vaultV1/withdraw.d.ts +2 -1
- package/lib/cjs/actions/vaultV1/withdraw.js +2 -1
- package/lib/cjs/actions/vaultV2/deposit.d.ts +2 -1
- package/lib/cjs/actions/vaultV2/deposit.js +2 -1
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +2 -1
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +2 -1
- package/lib/cjs/actions/vaultV2/redeem.d.ts +3 -2
- package/lib/cjs/actions/vaultV2/redeem.js +2 -1
- package/lib/cjs/actions/vaultV2/withdraw.d.ts +2 -1
- package/lib/cjs/actions/vaultV2/withdraw.js +2 -1
- package/lib/cjs/constants.d.ts +1 -1
- package/lib/cjs/constants.js +2 -0
- package/lib/cjs/entities/blue/blue.d.ts +83 -20
- package/lib/cjs/entities/blue/blue.js +38 -12
- package/lib/cjs/entities/vaultV1/migrateToV2Quote.d.ts +2 -0
- package/lib/cjs/entities/vaultV1/migrateToV2Quote.js +5 -0
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +12 -6
- package/lib/cjs/entities/vaultV1/vaultV1.js +6 -0
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +12 -7
- package/lib/cjs/entities/vaultV2/vaultV2.js +4 -0
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +11 -2
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +19 -21
- package/lib/cjs/helpers/constant.d.ts +2 -0
- package/lib/cjs/helpers/constant.js +3 -1
- package/lib/cjs/helpers/getBlueBundlesV1QuoteTimestamp.d.ts +10 -0
- package/lib/cjs/helpers/getBlueBundlesV1QuoteTimestamp.js +18 -0
- package/lib/cjs/helpers/index.d.ts +1 -1
- package/lib/cjs/helpers/index.js +2 -1
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.d.ts +3 -3
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +4 -5
- package/lib/cjs/helpers/quoteBlueRepay.d.ts +7 -3
- package/lib/cjs/helpers/quoteBlueRepay.js +20 -7
- package/lib/cjs/helpers/reallocationPenalty.d.ts +10 -0
- package/lib/cjs/helpers/reallocationPenalty.js +32 -0
- package/lib/cjs/helpers/referralFee.d.ts +2 -1
- package/lib/cjs/helpers/referralFee.js +5 -1
- package/lib/cjs/helpers/validate.d.ts +31 -4
- package/lib/cjs/helpers/validate.js +48 -9
- package/lib/cjs/helpers/validateMidnightBounds.d.ts +1 -2
- package/lib/cjs/helpers/validateMidnightBounds.js +1 -2
- package/lib/cjs/helpers/validateMidnightTakeFeasibility.d.ts +2 -2
- package/lib/cjs/helpers/validateMidnightTakeFeasibility.js +1 -1
- package/lib/cjs/transactionPlan/blue/borrow.d.ts +11 -5
- package/lib/cjs/transactionPlan/blue/borrow.js +26 -8
- package/lib/cjs/transactionPlan/blue/refinance.d.ts +9 -2
- package/lib/cjs/transactionPlan/blue/refinance.js +20 -3
- package/lib/cjs/transactionPlan/blue/repay.d.ts +1 -2
- package/lib/cjs/transactionPlan/blue/repay.js +1 -2
- package/lib/cjs/transactionPlan/blue/repayWithdrawCollateral.d.ts +4 -3
- package/lib/cjs/transactionPlan/blue/repayWithdrawCollateral.js +13 -4
- package/lib/cjs/transactionPlan/blue/supply.d.ts +1 -2
- package/lib/cjs/transactionPlan/blue/supply.js +1 -2
- package/lib/cjs/transactionPlan/blue/supplyCollateral.d.ts +2 -3
- package/lib/cjs/transactionPlan/blue/supplyCollateral.js +2 -3
- package/lib/cjs/transactionPlan/blue/supplyCollateralBorrow.d.ts +10 -4
- package/lib/cjs/transactionPlan/blue/supplyCollateralBorrow.js +23 -6
- package/lib/cjs/transactionPlan/blue/withdraw.d.ts +15 -5
- package/lib/cjs/transactionPlan/blue/withdraw.js +25 -6
- package/lib/cjs/transactionPlan/blue/withdrawCollateral.d.ts +5 -5
- package/lib/cjs/transactionPlan/blue/withdrawCollateral.js +11 -7
- package/lib/cjs/transactionPlan/deposit.js +4 -0
- package/lib/cjs/transactionPlan/intent.d.ts +1 -1
- package/lib/cjs/transactionPlan/intent.js +4 -2
- package/lib/cjs/transactionPlan/plan.d.ts +8 -4
- package/lib/cjs/transactionPlan/plan.js +8 -4
- package/lib/cjs/transactionPlan/types.d.ts +6 -0
- package/lib/cjs/transactionPlan/vaultv1/deposit.d.ts +3 -3
- package/lib/cjs/transactionPlan/vaultv1/deposit.js +3 -3
- package/lib/cjs/transactionPlan/vaultv1/migrateToV2.d.ts +3 -3
- package/lib/cjs/transactionPlan/vaultv1/migrateToV2.js +7 -3
- package/lib/cjs/transactionPlan/vaultv1/redeem.d.ts +1 -2
- package/lib/cjs/transactionPlan/vaultv1/redeem.js +1 -2
- package/lib/cjs/transactionPlan/vaultv1/withdraw.d.ts +2 -3
- package/lib/cjs/transactionPlan/vaultv1/withdraw.js +2 -3
- package/lib/cjs/transactionPlan/vaultv2/deposit.d.ts +3 -3
- package/lib/cjs/transactionPlan/vaultv2/deposit.js +3 -3
- package/lib/cjs/transactionPlan/vaultv2/forceWithdraw.d.ts +3 -3
- package/lib/cjs/transactionPlan/vaultv2/forceWithdraw.js +3 -3
- package/lib/cjs/transactionPlan/vaultv2/redeem.d.ts +2 -3
- package/lib/cjs/transactionPlan/vaultv2/redeem.js +2 -3
- package/lib/cjs/transactionPlan/vaultv2/withdraw.d.ts +2 -3
- package/lib/cjs/transactionPlan/vaultv2/withdraw.js +2 -3
- package/lib/cjs/types/error.d.ts +7 -6
- package/lib/cjs/types/error.js +10 -9
- package/lib/cjs/types/sharedLiquidity.d.ts +7 -2
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/actions/blue/borrow.d.ts +11 -3
- package/lib/esm/actions/blue/borrow.internal.js +1 -0
- package/lib/esm/actions/blue/borrow.js +8 -2
- package/lib/esm/actions/blue/common.d.ts +4 -1
- package/lib/esm/actions/blue/common.js +17 -3
- package/lib/esm/actions/blue/refinance.d.ts +11 -3
- package/lib/esm/actions/blue/refinance.internal.js +4 -1
- package/lib/esm/actions/blue/refinance.js +8 -2
- package/lib/esm/actions/blue/refinanceValidation.d.ts +3 -2
- package/lib/esm/actions/blue/refinanceValidation.js +10 -6
- package/lib/esm/actions/blue/repay.d.ts +4 -3
- package/lib/esm/actions/blue/repay.js +3 -2
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +4 -3
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +3 -2
- package/lib/esm/actions/blue/supply.d.ts +5 -3
- package/lib/esm/actions/blue/supply.js +4 -2
- package/lib/esm/actions/blue/supplyCollateral.d.ts +4 -3
- package/lib/esm/actions/blue/supplyCollateral.js +3 -2
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +11 -3
- package/lib/esm/actions/blue/supplyCollateralBorrow.internal.d.ts +2 -0
- package/lib/esm/actions/blue/supplyCollateralBorrow.internal.js +5 -1
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +8 -2
- package/lib/esm/actions/blue/withdraw.d.ts +11 -3
- package/lib/esm/actions/blue/withdraw.internal.js +4 -1
- package/lib/esm/actions/blue/withdraw.js +8 -2
- package/lib/esm/actions/blue/withdrawCollateral.d.ts +4 -3
- package/lib/esm/actions/blue/withdrawCollateral.js +3 -2
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +1 -2
- package/lib/esm/actions/midnight/takeBorrow.js +1 -2
- package/lib/esm/actions/midnight/takeLend.js +1 -2
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +1 -2
- package/lib/esm/actions/midnight/takeWithdraw.js +1 -2
- package/lib/esm/actions/vaultV1/deposit.d.ts +2 -1
- package/lib/esm/actions/vaultV1/deposit.js +2 -1
- package/lib/esm/actions/vaultV1/migrateToV2.d.ts +3 -2
- package/lib/esm/actions/vaultV1/migrateToV2.js +2 -1
- package/lib/esm/actions/vaultV1/redeem.d.ts +3 -2
- package/lib/esm/actions/vaultV1/redeem.js +2 -1
- package/lib/esm/actions/vaultV1/withdraw.d.ts +2 -1
- package/lib/esm/actions/vaultV1/withdraw.js +2 -1
- package/lib/esm/actions/vaultV2/deposit.d.ts +2 -1
- package/lib/esm/actions/vaultV2/deposit.js +2 -1
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +2 -1
- package/lib/esm/actions/vaultV2/forceWithdraw.js +2 -1
- package/lib/esm/actions/vaultV2/redeem.d.ts +3 -2
- package/lib/esm/actions/vaultV2/redeem.js +2 -1
- package/lib/esm/actions/vaultV2/withdraw.d.ts +2 -1
- package/lib/esm/actions/vaultV2/withdraw.js +2 -1
- package/lib/esm/constants.d.ts +1 -1
- package/lib/esm/constants.js +1 -1
- package/lib/esm/entities/blue/blue.d.ts +83 -20
- package/lib/esm/entities/blue/blue.js +38 -12
- package/lib/esm/entities/vaultV1/migrateToV2Quote.d.ts +2 -0
- package/lib/esm/entities/vaultV1/migrateToV2Quote.js +5 -0
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +12 -6
- package/lib/esm/entities/vaultV1/vaultV1.js +7 -1
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +12 -7
- package/lib/esm/entities/vaultV2/vaultV2.js +5 -1
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +11 -2
- package/lib/esm/entities/vaultV2BlueReallocationData.js +17 -19
- package/lib/esm/helpers/constant.d.ts +2 -0
- package/lib/esm/helpers/constant.js +2 -0
- package/lib/esm/helpers/getBlueBundlesV1QuoteTimestamp.d.ts +10 -0
- package/lib/esm/helpers/getBlueBundlesV1QuoteTimestamp.js +15 -0
- package/lib/esm/helpers/index.d.ts +1 -1
- package/lib/esm/helpers/index.js +1 -1
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.d.ts +3 -3
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +4 -5
- package/lib/esm/helpers/quoteBlueRepay.d.ts +7 -3
- package/lib/esm/helpers/quoteBlueRepay.js +21 -8
- package/lib/esm/helpers/reallocationPenalty.d.ts +10 -0
- package/lib/esm/helpers/reallocationPenalty.js +28 -0
- package/lib/esm/helpers/referralFee.d.ts +2 -1
- package/lib/esm/helpers/referralFee.js +5 -1
- package/lib/esm/helpers/validate.d.ts +31 -4
- package/lib/esm/helpers/validate.js +48 -11
- package/lib/esm/helpers/validateMidnightBounds.d.ts +1 -2
- package/lib/esm/helpers/validateMidnightBounds.js +1 -2
- package/lib/esm/helpers/validateMidnightTakeFeasibility.d.ts +2 -2
- package/lib/esm/helpers/validateMidnightTakeFeasibility.js +1 -1
- package/lib/esm/transactionPlan/blue/borrow.d.ts +11 -5
- package/lib/esm/transactionPlan/blue/borrow.js +27 -9
- package/lib/esm/transactionPlan/blue/refinance.d.ts +9 -2
- package/lib/esm/transactionPlan/blue/refinance.js +20 -3
- package/lib/esm/transactionPlan/blue/repay.d.ts +1 -2
- package/lib/esm/transactionPlan/blue/repay.js +1 -2
- package/lib/esm/transactionPlan/blue/repayWithdrawCollateral.d.ts +4 -3
- package/lib/esm/transactionPlan/blue/repayWithdrawCollateral.js +13 -4
- package/lib/esm/transactionPlan/blue/supply.d.ts +1 -2
- package/lib/esm/transactionPlan/blue/supply.js +1 -2
- package/lib/esm/transactionPlan/blue/supplyCollateral.d.ts +2 -3
- package/lib/esm/transactionPlan/blue/supplyCollateral.js +2 -3
- package/lib/esm/transactionPlan/blue/supplyCollateralBorrow.d.ts +10 -4
- package/lib/esm/transactionPlan/blue/supplyCollateralBorrow.js +23 -6
- package/lib/esm/transactionPlan/blue/withdraw.d.ts +15 -5
- package/lib/esm/transactionPlan/blue/withdraw.js +25 -6
- package/lib/esm/transactionPlan/blue/withdrawCollateral.d.ts +5 -5
- package/lib/esm/transactionPlan/blue/withdrawCollateral.js +11 -7
- package/lib/esm/transactionPlan/deposit.js +5 -1
- package/lib/esm/transactionPlan/intent.d.ts +1 -1
- package/lib/esm/transactionPlan/intent.js +4 -2
- package/lib/esm/transactionPlan/plan.d.ts +8 -4
- package/lib/esm/transactionPlan/plan.js +8 -4
- package/lib/esm/transactionPlan/types.d.ts +6 -0
- package/lib/esm/transactionPlan/vaultv1/deposit.d.ts +3 -3
- package/lib/esm/transactionPlan/vaultv1/deposit.js +3 -3
- package/lib/esm/transactionPlan/vaultv1/migrateToV2.d.ts +3 -3
- package/lib/esm/transactionPlan/vaultv1/migrateToV2.js +8 -4
- package/lib/esm/transactionPlan/vaultv1/redeem.d.ts +1 -2
- package/lib/esm/transactionPlan/vaultv1/redeem.js +1 -2
- package/lib/esm/transactionPlan/vaultv1/withdraw.d.ts +2 -3
- package/lib/esm/transactionPlan/vaultv1/withdraw.js +2 -3
- package/lib/esm/transactionPlan/vaultv2/deposit.d.ts +3 -3
- package/lib/esm/transactionPlan/vaultv2/deposit.js +3 -3
- package/lib/esm/transactionPlan/vaultv2/forceWithdraw.d.ts +3 -3
- package/lib/esm/transactionPlan/vaultv2/forceWithdraw.js +3 -3
- package/lib/esm/transactionPlan/vaultv2/redeem.d.ts +2 -3
- package/lib/esm/transactionPlan/vaultv2/redeem.js +2 -3
- package/lib/esm/transactionPlan/vaultv2/withdraw.d.ts +2 -3
- package/lib/esm/transactionPlan/vaultv2/withdraw.js +2 -3
- package/lib/esm/types/error.d.ts +7 -6
- package/lib/esm/types/error.js +11 -10
- package/lib/esm/types/sharedLiquidity.d.ts +7 -2
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +3 -3
|
@@ -52,9 +52,8 @@ export function validateBlueSupplyPlanAction(action, path) {
|
|
|
52
52
|
* @throws {NonPositiveInputError} when `expiresAt`, `assets` or the deadline is not positive.
|
|
53
53
|
* @throws {ExpiredDeadlineError} when `expiresAt` is at or before `now` (device clock when `now` is omitted).
|
|
54
54
|
* @throws {NegativeInputError} when `referralFee.bps` is negative.
|
|
55
|
-
* @throws {InputExceedsMaxError} when `referralFee.bps` exceeds
|
|
55
|
+
* @throws {InputExceedsMaxError} when `referralFee.bps` exceeds 1,000 or `assets` exceeds uint256.
|
|
56
56
|
* @throws {InvalidCalldataOriginError} when `calldataOrigin` is empty, malformed or has an odd number of hex digits.
|
|
57
|
-
* @throws {ReferralFeePctExceededError} when `referralFee.bps` equals 10,000; the normalized fee must be below WAD.
|
|
58
57
|
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no recipient or a zero recipient.
|
|
59
58
|
* @throws {MarketIdMismatchError} When the snapshot describes another market.
|
|
60
59
|
* @throws {BlueSnapshotChainMismatchError} When the snapshot describes another chain.
|
|
@@ -40,7 +40,7 @@ export interface BlueSupplyCollateralPlanParams extends IntentParams, ReferenceT
|
|
|
40
40
|
* @param params.marketData - Caller-fetched snapshot of the selected market and chain.
|
|
41
41
|
* @param params.collateralAssets - Positive gross collateral amount in token base units.
|
|
42
42
|
* @param params.funding.type - `"erc20"` (default) or `"native"` for wNative collateral.
|
|
43
|
-
* @param params.referralFee.bps - Optional fee in integer basis points,
|
|
43
|
+
* @param params.referralFee.bps - Optional fee in integer basis points, at most 1,000.
|
|
44
44
|
* @param params.referralFee.recipient - Non-zero recipient required for a positive fee.
|
|
45
45
|
* @param params.supportSignature - Prefer an ERC-2612 permit where available; defaults to false.
|
|
46
46
|
* @param params.now - Reference Unix timestamp in seconds; defaults to the device clock.
|
|
@@ -55,10 +55,9 @@ export interface BlueSupplyCollateralPlanParams extends IntentParams, ReferenceT
|
|
|
55
55
|
* @throws {NonPositiveInputError} when the collateral amount or expiry is zero.
|
|
56
56
|
* @throws {ExpiredDeadlineError} when expiry is at or before the reference time.
|
|
57
57
|
* @throws {NegativeInputError} when the collateral amount or fee basis points are negative.
|
|
58
|
-
* @throws {InputExceedsMaxError} when collateral exceeds uint256 or
|
|
58
|
+
* @throws {InputExceedsMaxError} when collateral exceeds uint256 or `referralFee.bps` exceeds 1,000.
|
|
59
59
|
* @throws {InvalidCalldataOriginError} when attribution bytes are empty or malformed.
|
|
60
60
|
* @throws {InvalidTransactionPlanError} when `calldataOrigin` exceeds 1 MiB.
|
|
61
|
-
* @throws {ReferralFeePctExceededError} when the referral fee is 100%.
|
|
62
61
|
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no non-zero recipient.
|
|
63
62
|
* @throws {ChainWNativeMissingError} when native funding is requested on a chain with no wNative.
|
|
64
63
|
* @throws {NativeAmountOnNonWNativeAssetError} when native funding targets non-wNative collateral.
|
|
@@ -23,7 +23,7 @@ const actionId = "blueSupplyCollateral";
|
|
|
23
23
|
* @param params.marketData - Caller-fetched snapshot of the selected market and chain.
|
|
24
24
|
* @param params.collateralAssets - Positive gross collateral amount in token base units.
|
|
25
25
|
* @param params.funding.type - `"erc20"` (default) or `"native"` for wNative collateral.
|
|
26
|
-
* @param params.referralFee.bps - Optional fee in integer basis points,
|
|
26
|
+
* @param params.referralFee.bps - Optional fee in integer basis points, at most 1,000.
|
|
27
27
|
* @param params.referralFee.recipient - Non-zero recipient required for a positive fee.
|
|
28
28
|
* @param params.supportSignature - Prefer an ERC-2612 permit where available; defaults to false.
|
|
29
29
|
* @param params.now - Reference Unix timestamp in seconds; defaults to the device clock.
|
|
@@ -38,10 +38,9 @@ const actionId = "blueSupplyCollateral";
|
|
|
38
38
|
* @throws {NonPositiveInputError} when the collateral amount or expiry is zero.
|
|
39
39
|
* @throws {ExpiredDeadlineError} when expiry is at or before the reference time.
|
|
40
40
|
* @throws {NegativeInputError} when the collateral amount or fee basis points are negative.
|
|
41
|
-
* @throws {InputExceedsMaxError} when collateral exceeds uint256 or
|
|
41
|
+
* @throws {InputExceedsMaxError} when collateral exceeds uint256 or `referralFee.bps` exceeds 1,000.
|
|
42
42
|
* @throws {InvalidCalldataOriginError} when attribution bytes are empty or malformed.
|
|
43
43
|
* @throws {InvalidTransactionPlanError} when `calldataOrigin` exceeds 1 MiB.
|
|
44
|
-
* @throws {ReferralFeePctExceededError} when the referral fee is 100%.
|
|
45
44
|
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no non-zero recipient.
|
|
46
45
|
* @throws {ChainWNativeMissingError} when native funding is requested on a chain with no wNative.
|
|
47
46
|
* @throws {NativeAmountOnNonWNativeAssetError} when native funding targets non-wNative collateral.
|
|
@@ -22,15 +22,20 @@ export interface BlueSupplyCollateralBorrowPlanParams extends IntentParams, Refe
|
|
|
22
22
|
readonly borrowAssets: bigint;
|
|
23
23
|
readonly funding?: Funding;
|
|
24
24
|
readonly reallocations?: Iterable<VaultV2BlueReallocation>;
|
|
25
|
+
/** Maximum WAD-scaled penalty rate per reallocation in [0, WAD], defaulting to zero. Each rate applies to that reallocation's assets, so it does not bound total proceeds lost. */
|
|
26
|
+
readonly maxPenalty?: bigint;
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
29
|
* Prepares collateral funding and Morpho authorization for one BlueBundlesV1 call. Snapshots
|
|
28
|
-
* are validated before reads; the
|
|
29
|
-
*
|
|
30
|
+
* are validated before reads; health uses the expiry floored at max(now, lastUpdate).
|
|
31
|
+
* Expiries more than 365 days out retain the legacy +2h projection, like the entity handle.
|
|
32
|
+
* The SDK never signs. Native funding is exclusive and
|
|
30
33
|
* only supports the chain's wrapped native collateral token. Reallocation penalties reduce proceeds.
|
|
31
34
|
* @param client - Viem client used for prerequisite and registered-contract reads.
|
|
32
35
|
* @param params - Intent, amounts and caller-fetched market/position snapshots.
|
|
36
|
+
* @param params.maxPenalty - Maximum WAD-scaled penalty rate per reallocation in [0, WAD], defaulting to zero. Each rate applies to that reallocation's assets, so it does not bound total proceeds lost.
|
|
33
37
|
* @returns A data-only plan with approvals, authorization and the combined operation.
|
|
38
|
+
* @throws {InvalidBigIntInputError} when a supplied maxPenalty is not a bigint.
|
|
34
39
|
* @throws {ZeroAccountError} when the account is zero.
|
|
35
40
|
* @throws {NonIntegerInputError} when expiry or referral basis points are not safe integers.
|
|
36
41
|
* @throws {ExpiredDeadlineError} when expiry is not later than the reference timestamp.
|
|
@@ -41,9 +46,10 @@ export interface BlueSupplyCollateralBorrowPlanParams extends IntentParams, Refe
|
|
|
41
46
|
* @throws {MissingAccrualPositionError} when a borrow has no position snapshot.
|
|
42
47
|
* @throws {MissingMarketPriceError} when the position snapshot has no usable oracle price.
|
|
43
48
|
* @throws {BorrowExceedsSafeLtvError} when the quoted debt exceeds the buffered LLTV bound.
|
|
44
|
-
* @throws {NegativeInputError} when an amount or referral fee is negative.
|
|
49
|
+
* @throws {NegativeInputError} when an amount, maxPenalty or referral fee is negative.
|
|
45
50
|
* @throws {NonPositiveInputError} when both legs are zero, or a reallocation amount is not positive.
|
|
46
51
|
* @throws {InputExceedsMaxError} when an amount exceeds its ABI bound or aggregate penalties exceed borrowing.
|
|
52
|
+
* Also thrown when maxPenalty exceeds WAD or a penalty exceeds maxPenalty (zero by default).
|
|
47
53
|
* @throws {ReallocationsRequireBorrowError} when reallocations accompany no borrow.
|
|
48
54
|
* @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
|
|
49
55
|
* @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation has an invalid shape.
|
|
@@ -51,7 +57,7 @@ export interface BlueSupplyCollateralBorrowPlanParams extends IntentParams, Refe
|
|
|
51
57
|
* @throws {InconsistentReallocationPenaltyError} when one vault has conflicting penalties.
|
|
52
58
|
* @throws {ReallocationWithdrawalOnTargetMarketError} when the source equals the target market.
|
|
53
59
|
* @throws {ReallocationLoanTokenMismatchError} when a source has another loan token.
|
|
54
|
-
* @throws {
|
|
60
|
+
* @throws {InputExceedsMaxError} when `referralFee.bps` exceeds 1,000.
|
|
55
61
|
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no nonzero recipient.
|
|
56
62
|
* @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
|
|
57
63
|
* @throws {ChainWNativeMissingError} when native funding has no registered wrapped native token.
|
|
@@ -3,6 +3,7 @@ import { deepFreeze, Time } from "@morpho-org/morpho-ts";
|
|
|
3
3
|
import { maxUint256 } from "viem";
|
|
4
4
|
import { blueSupplyCollateralBorrow } from "../../actions/blue/supplyCollateralBorrow.js";
|
|
5
5
|
import { validateClientChainId } from "../../actions/requirements/validateClientChainId.js";
|
|
6
|
+
import { getBlueBundlesV1QuoteTimestamp } from "../../helpers/getBlueBundlesV1QuoteTimestamp.js";
|
|
6
7
|
import { DEFAULT_LLTV_BUFFER, validatePositionHealth, } from "../../helpers/index.js";
|
|
7
8
|
import { parseNativeFunding } from "../../helpers/parse.js";
|
|
8
9
|
import { MissingAccrualPositionError, } from "../../types/index.js";
|
|
@@ -13,12 +14,15 @@ import { validateMorphoAuthorizationRequest } from "./authorization.js";
|
|
|
13
14
|
import { prepareBlue, } from "./prepare.js";
|
|
14
15
|
/**
|
|
15
16
|
* Prepares collateral funding and Morpho authorization for one BlueBundlesV1 call. Snapshots
|
|
16
|
-
* are validated before reads; the
|
|
17
|
-
*
|
|
17
|
+
* are validated before reads; health uses the expiry floored at max(now, lastUpdate).
|
|
18
|
+
* Expiries more than 365 days out retain the legacy +2h projection, like the entity handle.
|
|
19
|
+
* The SDK never signs. Native funding is exclusive and
|
|
18
20
|
* only supports the chain's wrapped native collateral token. Reallocation penalties reduce proceeds.
|
|
19
21
|
* @param client - Viem client used for prerequisite and registered-contract reads.
|
|
20
22
|
* @param params - Intent, amounts and caller-fetched market/position snapshots.
|
|
23
|
+
* @param params.maxPenalty - Maximum WAD-scaled penalty rate per reallocation in [0, WAD], defaulting to zero. Each rate applies to that reallocation's assets, so it does not bound total proceeds lost.
|
|
21
24
|
* @returns A data-only plan with approvals, authorization and the combined operation.
|
|
25
|
+
* @throws {InvalidBigIntInputError} when a supplied maxPenalty is not a bigint.
|
|
22
26
|
* @throws {ZeroAccountError} when the account is zero.
|
|
23
27
|
* @throws {NonIntegerInputError} when expiry or referral basis points are not safe integers.
|
|
24
28
|
* @throws {ExpiredDeadlineError} when expiry is not later than the reference timestamp.
|
|
@@ -29,9 +33,10 @@ import { prepareBlue, } from "./prepare.js";
|
|
|
29
33
|
* @throws {MissingAccrualPositionError} when a borrow has no position snapshot.
|
|
30
34
|
* @throws {MissingMarketPriceError} when the position snapshot has no usable oracle price.
|
|
31
35
|
* @throws {BorrowExceedsSafeLtvError} when the quoted debt exceeds the buffered LLTV bound.
|
|
32
|
-
* @throws {NegativeInputError} when an amount or referral fee is negative.
|
|
36
|
+
* @throws {NegativeInputError} when an amount, maxPenalty or referral fee is negative.
|
|
33
37
|
* @throws {NonPositiveInputError} when both legs are zero, or a reallocation amount is not positive.
|
|
34
38
|
* @throws {InputExceedsMaxError} when an amount exceeds its ABI bound or aggregate penalties exceed borrowing.
|
|
39
|
+
* Also thrown when maxPenalty exceeds WAD or a penalty exceeds maxPenalty (zero by default).
|
|
35
40
|
* @throws {ReallocationsRequireBorrowError} when reallocations accompany no borrow.
|
|
36
41
|
* @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
|
|
37
42
|
* @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation has an invalid shape.
|
|
@@ -39,7 +44,7 @@ import { prepareBlue, } from "./prepare.js";
|
|
|
39
44
|
* @throws {InconsistentReallocationPenaltyError} when one vault has conflicting penalties.
|
|
40
45
|
* @throws {ReallocationWithdrawalOnTargetMarketError} when the source equals the target market.
|
|
41
46
|
* @throws {ReallocationLoanTokenMismatchError} when a source has another loan token.
|
|
42
|
-
* @throws {
|
|
47
|
+
* @throws {InputExceedsMaxError} when `referralFee.bps` exceeds 1,000.
|
|
43
48
|
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no nonzero recipient.
|
|
44
49
|
* @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
|
|
45
50
|
* @throws {ChainWNativeMissingError} when native funding has no registered wrapped native token.
|
|
@@ -81,6 +86,7 @@ export async function prepareBlueSupplyCollateralBorrow(client, params) {
|
|
|
81
86
|
const preparedParams = captureSupplyBorrowIntent(params);
|
|
82
87
|
const { chainId, account, marketId, marketData, positionData, now } = preparedParams;
|
|
83
88
|
const { collateralAssets, borrowAssets } = params;
|
|
89
|
+
const { maxPenalty } = params;
|
|
84
90
|
const id = "blueSupplyCollateralBorrow";
|
|
85
91
|
let label = "Supply collateral and borrow on Blue";
|
|
86
92
|
if (borrowAssets === 0n) {
|
|
@@ -106,6 +112,7 @@ export async function prepareBlueSupplyCollateralBorrow(client, params) {
|
|
|
106
112
|
maxLtv,
|
|
107
113
|
nativeAmount,
|
|
108
114
|
reallocations,
|
|
115
|
+
maxPenalty,
|
|
109
116
|
...intent,
|
|
110
117
|
},
|
|
111
118
|
});
|
|
@@ -115,7 +122,11 @@ export async function prepareBlueSupplyCollateralBorrow(client, params) {
|
|
|
115
122
|
throw new MissingAccrualPositionError(marketId);
|
|
116
123
|
}
|
|
117
124
|
validatePositionHealth({
|
|
118
|
-
positionData: position.accrueInterest(
|
|
125
|
+
positionData: position.accrueInterest(getBlueBundlesV1QuoteTimestamp({
|
|
126
|
+
lastUpdate: position.market.lastUpdate,
|
|
127
|
+
now,
|
|
128
|
+
deadline: intent.deadline,
|
|
129
|
+
})),
|
|
119
130
|
additionalCollateral: collateralAssets,
|
|
120
131
|
borrowAmount: borrowAssets,
|
|
121
132
|
marketId,
|
|
@@ -168,6 +179,7 @@ export async function prepareBlueSupplyCollateralBorrow(client, params) {
|
|
|
168
179
|
borrowAssets,
|
|
169
180
|
maxLtv,
|
|
170
181
|
nativeAssets: nativeAmount,
|
|
182
|
+
...(maxPenalty !== undefined && { maxPenalty }),
|
|
171
183
|
reallocations: reallocations.map((entry) => ({
|
|
172
184
|
...entry,
|
|
173
185
|
from: entry.from.type === "market"
|
|
@@ -315,7 +327,12 @@ export function validateSupplyCollateralBorrowPlanAction(action, path) {
|
|
|
315
327
|
reallocations: "array",
|
|
316
328
|
},
|
|
317
329
|
});
|
|
318
|
-
for (const key of [
|
|
330
|
+
for (const key of [
|
|
331
|
+
"nativeAssets",
|
|
332
|
+
"referralFeePct",
|
|
333
|
+
"authorizationNonce",
|
|
334
|
+
"maxPenalty",
|
|
335
|
+
]) {
|
|
319
336
|
if (inputs[key] !== undefined) {
|
|
320
337
|
validatePlanField(inputs[key], {
|
|
321
338
|
path: `${path}.inputs.${key}`,
|
|
@@ -33,6 +33,8 @@ export type BlueWithdrawPlanParams = IntentParams & AssetsOrSharesArgs & {
|
|
|
33
33
|
/** Caller-fetched position used to validate the available supply balance. */
|
|
34
34
|
readonly positionData: BluePositionSnapshot;
|
|
35
35
|
readonly reallocations?: readonly VaultV2BlueReallocation[];
|
|
36
|
+
/** Maximum WAD-scaled penalty rate per reallocation in [0, WAD], defaulting to zero. Each rate applies to that reallocation's assets, so it does not bound total proceeds lost. */
|
|
37
|
+
readonly maxPenalty?: bigint;
|
|
36
38
|
readonly now?: bigint;
|
|
37
39
|
};
|
|
38
40
|
/**
|
|
@@ -50,6 +52,7 @@ export type BlueWithdrawPlanParams = IntentParams & AssetsOrSharesArgs & {
|
|
|
50
52
|
* @param params.assets - Exact positive gross loan assets withdrawn in base units; exclusive with `shares`.
|
|
51
53
|
* @param params.shares - Exact positive supply shares burned; exclusive with `assets`, with no full-close sentinel or minimum-proceeds guarantee.
|
|
52
54
|
* @param params.reallocations - Optional ordered Vault V2 BluePublicAllocator inputs; defaults to an empty list. Penalties reduce withdrawal proceeds.
|
|
55
|
+
* @param params.maxPenalty - Maximum WAD-scaled penalty rate per reallocation in [0, WAD], defaulting to zero. Each rate applies to that reallocation's assets, so it does not bound total proceeds lost.
|
|
53
56
|
* @param params.reallocations[].vault - Vault whose liquidity the allocator moves.
|
|
54
57
|
* @param params.reallocations[].from.type - Source discriminator: `market` or `idle`.
|
|
55
58
|
* @param params.reallocations[].from.adapter - Source adapter, required only for a `market` source.
|
|
@@ -61,7 +64,7 @@ export type BlueWithdrawPlanParams = IntentParams & AssetsOrSharesArgs & {
|
|
|
61
64
|
* @param params.reallocations[].to.adapter - Target adapter supplying the enclosing withdrawal market.
|
|
62
65
|
* @param params.reallocations[].assets - Positive reallocated assets in loan-token base units, bounded by uint128.
|
|
63
66
|
* @param params.reallocations[].penalty - Vault-configured WAD-scaled penalty, bounded by uint64 and applied with upward rounding per allocation.
|
|
64
|
-
* @param params.referralFee.bps - Optional integer referral fee in basis points of gross proceeds after allocator penalties; defaults to zero and must be
|
|
67
|
+
* @param params.referralFee.bps - Optional integer referral fee in basis points of gross proceeds after allocator penalties; defaults to zero and must be at most 1,000.
|
|
65
68
|
* @param params.referralFee.recipient - Optional fee recipient; required and non-zero when `referralFee.bps` is positive.
|
|
66
69
|
* @param params.supportSignature - Optional Morpho authorization signature preference; defaults to `false`, selecting a direct authorization transaction when needed. Neither mode requests a token allowance or Permit2 signature.
|
|
67
70
|
* @param params.now - Optional reference timestamp in seconds, normally the latest block timestamp; defaults to the device clock.
|
|
@@ -69,6 +72,7 @@ export type BlueWithdrawPlanParams = IntentParams & AssetsOrSharesArgs & {
|
|
|
69
72
|
* @param params.calldataOrigin - Optional non-empty, even-length hex bytes appended to every built transaction; omitted by default.
|
|
70
73
|
* @param params.deployless - Optional shared intent field; unused because withdrawal reads no token metadata.
|
|
71
74
|
* @returns A deep-frozen, data-only `{ version, chainId, account, expiresAt, steps, signatureRequests, calldataOrigin? }` plan with a withdrawal step. Direct Morpho authorization is a preceding step; signed authorization is consumed inline by the withdrawal. Attach signatures before building.
|
|
75
|
+
* @throws {InvalidBigIntInputError} when a supplied maxPenalty is not a bigint.
|
|
72
76
|
* @throws {ChainIdMismatchError} when the client declares or its transport serves another chain.
|
|
73
77
|
* @throws {UnsupportedChainIdError} when `chainId` is absent from the registry.
|
|
74
78
|
* @throws {UnknownAddressError} when Blue or BlueBundlesV1 is not registered on `chainId`.
|
|
@@ -79,8 +83,9 @@ export type BlueWithdrawPlanParams = IntentParams & AssetsOrSharesArgs & {
|
|
|
79
83
|
* @throws {NonIntegerInputError} when `expiresAt` or `referralFee.bps` is not a safe integer.
|
|
80
84
|
* @throws {NonPositiveInputError} when expiry, the selected withdrawal amount, or a reallocation amount is not positive.
|
|
81
85
|
* @throws {ExpiredDeadlineError} when `expiresAt` is at or before `now`.
|
|
82
|
-
* @throws {NegativeInputError} when the referral fee, a withdrawal amount, or a reallocation penalty is negative.
|
|
83
|
-
* @throws {InputExceedsMaxError} when referral basis points exceed
|
|
86
|
+
* @throws {NegativeInputError} when the referral fee, a withdrawal amount, maxPenalty, or a reallocation penalty is negative.
|
|
87
|
+
* @throws {InputExceedsMaxError} when referral basis points exceed 1,000, an encoded amount or penalty exceeds its ABI bound, or aggregate allocator penalties exceed withdrawn assets (the snapshot's downward-rounded asset quote in shares mode).
|
|
88
|
+
* Also thrown when maxPenalty exceeds WAD or a penalty exceeds maxPenalty (zero by default).
|
|
84
89
|
* @throws {InvalidCalldataOriginError} when `calldataOrigin` is empty, malformed or has an odd number of hex digits.
|
|
85
90
|
* @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not an object or has a legacy Vault V1 shape.
|
|
86
91
|
* @throws {InvalidReallocationAddressError} when a reallocation vault or adapter address is malformed.
|
|
@@ -88,7 +93,6 @@ export type BlueWithdrawPlanParams = IntentParams & AssetsOrSharesArgs & {
|
|
|
88
93
|
* @throws {InconsistentReallocationPenaltyError} when allocations from one vault specify different penalties.
|
|
89
94
|
* @throws {ReallocationWithdrawalOnTargetMarketError} when a reallocation source is the withdrawal market.
|
|
90
95
|
* @throws {MutuallyExclusiveWithdrawAmountsError} when both withdrawal modes are nonzero.
|
|
91
|
-
* @throws {ReferralFeePctExceededError} when `referralFee.bps` equals 10,000.
|
|
92
96
|
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no non-zero recipient.
|
|
93
97
|
* @throws {ReallocationLoanTokenMismatchError} when a source market uses another loan token.
|
|
94
98
|
* @throws {MissingAccrualPositionError} when the required position snapshot is missing.
|
|
@@ -128,7 +132,13 @@ export declare function validateBlueWithdrawAuthorizationRequest(request: Extrac
|
|
|
128
132
|
}>, action: Extract<Action, {
|
|
129
133
|
type: "blueWithdraw";
|
|
130
134
|
}>): void;
|
|
131
|
-
/**
|
|
135
|
+
/**
|
|
136
|
+
* @internal Encodes the self-contained withdrawal recipe and its inline authorization, if requested.
|
|
137
|
+
* @param action - Withdrawal recipe with optional WAD-scaled maxPenalty in [0, WAD], defaulting to zero.
|
|
138
|
+
* @param requests - Available authorization signatures.
|
|
139
|
+
* @throws {NegativeInputError} when maxPenalty is negative.
|
|
140
|
+
* @throws {InputExceedsMaxError} when maxPenalty exceeds WAD or a penalty exceeds maxPenalty (zero by default).
|
|
141
|
+
*/
|
|
132
142
|
export declare function buildBlueWithdraw(action: Extract<Action, {
|
|
133
143
|
type: "blueWithdraw";
|
|
134
144
|
}>, requests?: readonly SignatureRequest[]): Readonly<import("../../types/action.js").Transaction<import("../../types/action.js").BlueWithdrawAction>>;
|
|
@@ -25,6 +25,7 @@ import { prepareBlue, } from "./prepare.js";
|
|
|
25
25
|
* @param params.assets - Exact positive gross loan assets withdrawn in base units; exclusive with `shares`.
|
|
26
26
|
* @param params.shares - Exact positive supply shares burned; exclusive with `assets`, with no full-close sentinel or minimum-proceeds guarantee.
|
|
27
27
|
* @param params.reallocations - Optional ordered Vault V2 BluePublicAllocator inputs; defaults to an empty list. Penalties reduce withdrawal proceeds.
|
|
28
|
+
* @param params.maxPenalty - Maximum WAD-scaled penalty rate per reallocation in [0, WAD], defaulting to zero. Each rate applies to that reallocation's assets, so it does not bound total proceeds lost.
|
|
28
29
|
* @param params.reallocations[].vault - Vault whose liquidity the allocator moves.
|
|
29
30
|
* @param params.reallocations[].from.type - Source discriminator: `market` or `idle`.
|
|
30
31
|
* @param params.reallocations[].from.adapter - Source adapter, required only for a `market` source.
|
|
@@ -36,7 +37,7 @@ import { prepareBlue, } from "./prepare.js";
|
|
|
36
37
|
* @param params.reallocations[].to.adapter - Target adapter supplying the enclosing withdrawal market.
|
|
37
38
|
* @param params.reallocations[].assets - Positive reallocated assets in loan-token base units, bounded by uint128.
|
|
38
39
|
* @param params.reallocations[].penalty - Vault-configured WAD-scaled penalty, bounded by uint64 and applied with upward rounding per allocation.
|
|
39
|
-
* @param params.referralFee.bps - Optional integer referral fee in basis points of gross proceeds after allocator penalties; defaults to zero and must be
|
|
40
|
+
* @param params.referralFee.bps - Optional integer referral fee in basis points of gross proceeds after allocator penalties; defaults to zero and must be at most 1,000.
|
|
40
41
|
* @param params.referralFee.recipient - Optional fee recipient; required and non-zero when `referralFee.bps` is positive.
|
|
41
42
|
* @param params.supportSignature - Optional Morpho authorization signature preference; defaults to `false`, selecting a direct authorization transaction when needed. Neither mode requests a token allowance or Permit2 signature.
|
|
42
43
|
* @param params.now - Optional reference timestamp in seconds, normally the latest block timestamp; defaults to the device clock.
|
|
@@ -44,6 +45,7 @@ import { prepareBlue, } from "./prepare.js";
|
|
|
44
45
|
* @param params.calldataOrigin - Optional non-empty, even-length hex bytes appended to every built transaction; omitted by default.
|
|
45
46
|
* @param params.deployless - Optional shared intent field; unused because withdrawal reads no token metadata.
|
|
46
47
|
* @returns A deep-frozen, data-only `{ version, chainId, account, expiresAt, steps, signatureRequests, calldataOrigin? }` plan with a withdrawal step. Direct Morpho authorization is a preceding step; signed authorization is consumed inline by the withdrawal. Attach signatures before building.
|
|
48
|
+
* @throws {InvalidBigIntInputError} when a supplied maxPenalty is not a bigint.
|
|
47
49
|
* @throws {ChainIdMismatchError} when the client declares or its transport serves another chain.
|
|
48
50
|
* @throws {UnsupportedChainIdError} when `chainId` is absent from the registry.
|
|
49
51
|
* @throws {UnknownAddressError} when Blue or BlueBundlesV1 is not registered on `chainId`.
|
|
@@ -54,8 +56,9 @@ import { prepareBlue, } from "./prepare.js";
|
|
|
54
56
|
* @throws {NonIntegerInputError} when `expiresAt` or `referralFee.bps` is not a safe integer.
|
|
55
57
|
* @throws {NonPositiveInputError} when expiry, the selected withdrawal amount, or a reallocation amount is not positive.
|
|
56
58
|
* @throws {ExpiredDeadlineError} when `expiresAt` is at or before `now`.
|
|
57
|
-
* @throws {NegativeInputError} when the referral fee, a withdrawal amount, or a reallocation penalty is negative.
|
|
58
|
-
* @throws {InputExceedsMaxError} when referral basis points exceed
|
|
59
|
+
* @throws {NegativeInputError} when the referral fee, a withdrawal amount, maxPenalty, or a reallocation penalty is negative.
|
|
60
|
+
* @throws {InputExceedsMaxError} when referral basis points exceed 1,000, an encoded amount or penalty exceeds its ABI bound, or aggregate allocator penalties exceed withdrawn assets (the snapshot's downward-rounded asset quote in shares mode).
|
|
61
|
+
* Also thrown when maxPenalty exceeds WAD or a penalty exceeds maxPenalty (zero by default).
|
|
59
62
|
* @throws {InvalidCalldataOriginError} when `calldataOrigin` is empty, malformed or has an odd number of hex digits.
|
|
60
63
|
* @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not an object or has a legacy Vault V1 shape.
|
|
61
64
|
* @throws {InvalidReallocationAddressError} when a reallocation vault or adapter address is malformed.
|
|
@@ -63,7 +66,6 @@ import { prepareBlue, } from "./prepare.js";
|
|
|
63
66
|
* @throws {InconsistentReallocationPenaltyError} when allocations from one vault specify different penalties.
|
|
64
67
|
* @throws {ReallocationWithdrawalOnTargetMarketError} when a reallocation source is the withdrawal market.
|
|
65
68
|
* @throws {MutuallyExclusiveWithdrawAmountsError} when both withdrawal modes are nonzero.
|
|
66
|
-
* @throws {ReferralFeePctExceededError} when `referralFee.bps` equals 10,000.
|
|
67
69
|
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no non-zero recipient.
|
|
68
70
|
* @throws {ReallocationLoanTokenMismatchError} when a source market uses another loan token.
|
|
69
71
|
* @throws {MissingAccrualPositionError} when the required position snapshot is missing.
|
|
@@ -97,6 +99,7 @@ import { prepareBlue, } from "./prepare.js";
|
|
|
97
99
|
* @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
|
|
98
100
|
*/
|
|
99
101
|
export async function prepareBlueWithdraw(client, params) {
|
|
102
|
+
const { maxPenalty } = params;
|
|
100
103
|
await validateClientChainId(client, params.chainId);
|
|
101
104
|
const { positionData: snapshot } = params;
|
|
102
105
|
if (snapshot == null) {
|
|
@@ -117,6 +120,7 @@ export async function prepareBlueWithdraw(client, params) {
|
|
|
117
120
|
withdrawAssets: "assets" in params ? (params.assets ?? 0n) : 0n,
|
|
118
121
|
withdrawShares: "shares" in params ? (params.shares ?? 0n) : 0n,
|
|
119
122
|
reallocations: params.reallocations ?? [],
|
|
123
|
+
...(maxPenalty !== undefined && { maxPenalty }),
|
|
120
124
|
deadline: intent.deadline,
|
|
121
125
|
referralFeePct: intent.referralFeePct,
|
|
122
126
|
referralFeeRecipient: intent.referralFeeRecipient ?? zeroAddress,
|
|
@@ -202,7 +206,13 @@ export function validateBlueWithdrawAuthorizationRequest(request, action) {
|
|
|
202
206
|
deadline: action.inputs.deadline,
|
|
203
207
|
});
|
|
204
208
|
}
|
|
205
|
-
/**
|
|
209
|
+
/**
|
|
210
|
+
* @internal Encodes the self-contained withdrawal recipe and its inline authorization, if requested.
|
|
211
|
+
* @param action - Withdrawal recipe with optional WAD-scaled maxPenalty in [0, WAD], defaulting to zero.
|
|
212
|
+
* @param requests - Available authorization signatures.
|
|
213
|
+
* @throws {NegativeInputError} when maxPenalty is negative.
|
|
214
|
+
* @throws {InputExceedsMaxError} when maxPenalty exceeds WAD or a penalty exceeds maxPenalty (zero by default).
|
|
215
|
+
*/
|
|
206
216
|
export function buildBlueWithdraw(action, requests = []) {
|
|
207
217
|
const { chainId, account, marketParams, authorizationNonce: _authorizationNonce, ...args } = action.inputs;
|
|
208
218
|
let authorizationSignature;
|
|
@@ -236,7 +246,10 @@ export function buildBlueWithdraw(action, requests = []) {
|
|
|
236
246
|
}
|
|
237
247
|
const targetMarketParams = new MarketParams(marketParams);
|
|
238
248
|
// Reject malformed entries with typed errors before reading their source fields.
|
|
239
|
-
validateVaultV2BlueReallocations(args.reallocations,
|
|
249
|
+
validateVaultV2BlueReallocations(args.reallocations, {
|
|
250
|
+
targetMarketId: targetMarketParams.id,
|
|
251
|
+
maxPenalty: args.maxPenalty,
|
|
252
|
+
});
|
|
240
253
|
const reallocations = args.reallocations.map((entry) => ({
|
|
241
254
|
...entry,
|
|
242
255
|
from: entry.from.type === "market"
|
|
@@ -259,6 +272,12 @@ export function buildBlueWithdraw(action, requests = []) {
|
|
|
259
272
|
/** @internal Validates stored withdrawal scalars and allocator input shapes. */
|
|
260
273
|
export function validateBlueWithdrawPlanAction(action, path) {
|
|
261
274
|
const inputs = getPlanObject(action.inputs, `${path}.inputs`);
|
|
275
|
+
if (inputs.maxPenalty !== undefined) {
|
|
276
|
+
validatePlanField(inputs.maxPenalty, {
|
|
277
|
+
path: `${path}.inputs.maxPenalty`,
|
|
278
|
+
type: "uint256 bigint",
|
|
279
|
+
});
|
|
280
|
+
}
|
|
262
281
|
const roles = getPlanObject(action.signatureRequestIds, `${path}.signatureRequestIds`);
|
|
263
282
|
if (roles.morphoAuthorization !== undefined) {
|
|
264
283
|
validatePlanField(roles.morphoAuthorization, {
|
|
@@ -30,7 +30,8 @@ export interface BlueWithdrawCollateralPlanParams extends IntentParams, Referenc
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Prepares a BlueBundlesV1 collateral withdrawal with direct or inline signed Morpho authorization.
|
|
33
|
-
* Health
|
|
33
|
+
* Health uses the expiry floored at max(now, lastUpdate), with the entity's LLTV buffer.
|
|
34
|
+
* Expiries more than 365 days out retain the legacy +2h projection for unlimited sentinels.
|
|
34
35
|
* No token allowance or Permit2 prerequisite is read or produced.
|
|
35
36
|
* @param client - Viem client used for registered contract-code and Morpho authorization reads.
|
|
36
37
|
* @param params - Intent and matching market and account position snapshots.
|
|
@@ -40,9 +41,9 @@ export interface BlueWithdrawCollateralPlanParams extends IntentParams, Referenc
|
|
|
40
41
|
* @param params.marketData.chainId - Chain from which the market snapshot was fetched; must equal `chainId`.
|
|
41
42
|
* @param params.marketData.market - Caller-fetched `Market` providing the market tuple and LLTV.
|
|
42
43
|
* @param params.positionData.chainId - Chain from which the position snapshot was fetched; must equal `chainId`.
|
|
43
|
-
* @param params.positionData.position - Caller-fetched `AccrualPosition` for `account` and `marketId`, used for the
|
|
44
|
+
* @param params.positionData.position - Caller-fetched `AccrualPosition` for `account` and `marketId`, used for the deadline-accrued health check.
|
|
44
45
|
* @param params.collateralAssets - Positive collateral withdrawal in token base units, not exceeding the position's collateral.
|
|
45
|
-
* @param params.referralFee.bps - Optional integer referral fee in basis points; defaults to zero and must be
|
|
46
|
+
* @param params.referralFee.bps - Optional integer referral fee in basis points; defaults to zero and must be at most 1,000.
|
|
46
47
|
* @param params.referralFee.recipient - Non-zero fee recipient required when the optional fee is positive.
|
|
47
48
|
* @param params.supportSignature - Optional Morpho authorization signature preference, defaulting to `false`; otherwise prepares a direct authorization transaction when needed.
|
|
48
49
|
* @param params.now - Optional reference timestamp in Unix seconds, normally the latest block timestamp; defaults to the device clock.
|
|
@@ -59,9 +60,8 @@ export interface BlueWithdrawCollateralPlanParams extends IntentParams, Referenc
|
|
|
59
60
|
* @throws {NonPositiveInputError} when `expiresAt` or `collateralAssets` is not positive.
|
|
60
61
|
* @throws {ExpiredDeadlineError} when `expiresAt` is at or before `now`.
|
|
61
62
|
* @throws {NegativeInputError} when `referralFee.bps` is negative.
|
|
62
|
-
* @throws {InputExceedsMaxError} when `referralFee.bps` exceeds
|
|
63
|
+
* @throws {InputExceedsMaxError} when `referralFee.bps` exceeds 1,000 or `collateralAssets` exceeds uint256.
|
|
63
64
|
* @throws {InvalidCalldataOriginError} when `calldataOrigin` is empty, malformed or has an odd number of hex digits.
|
|
64
|
-
* @throws {ReferralFeePctExceededError} when `referralFee.bps` equals 10,000.
|
|
65
65
|
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no non-zero recipient.
|
|
66
66
|
* @throws {UnsupportedMarketIrmError} when projecting an indebted position requires an unsupported IRM without rate data.
|
|
67
67
|
* @throws {WithdrawExceedsCollateralError} when `collateralAssets` exceeds the position's collateral.
|
|
@@ -3,6 +3,7 @@ import { deepFreeze, Time } from "@morpho-org/morpho-ts";
|
|
|
3
3
|
import { blueWithdrawCollateral } from "../../actions/blue/withdrawCollateral.js";
|
|
4
4
|
import { normalizeBundlesCommonParams } from "../../actions/bundles/common.js";
|
|
5
5
|
import { DEFAULT_LLTV_BUFFER } from "../../helpers/constant.js";
|
|
6
|
+
import { getBlueBundlesV1QuoteTimestamp } from "../../helpers/getBlueBundlesV1QuoteTimestamp.js";
|
|
6
7
|
import { validatePositionHealthAfterWithdraw, validateUint256Field, } from "../../helpers/validate.js";
|
|
7
8
|
import { NonPositiveInputError, } from "../../types/index.js";
|
|
8
9
|
import { IncompleteTransactionPlanError, TransactionPlanSignatureMismatchError, } from "../error.js";
|
|
@@ -11,7 +12,8 @@ import { validateMorphoAuthorizationRequest } from "./authorization.js";
|
|
|
11
12
|
import { prepareBlue, } from "./prepare.js";
|
|
12
13
|
/**
|
|
13
14
|
* Prepares a BlueBundlesV1 collateral withdrawal with direct or inline signed Morpho authorization.
|
|
14
|
-
* Health
|
|
15
|
+
* Health uses the expiry floored at max(now, lastUpdate), with the entity's LLTV buffer.
|
|
16
|
+
* Expiries more than 365 days out retain the legacy +2h projection for unlimited sentinels.
|
|
15
17
|
* No token allowance or Permit2 prerequisite is read or produced.
|
|
16
18
|
* @param client - Viem client used for registered contract-code and Morpho authorization reads.
|
|
17
19
|
* @param params - Intent and matching market and account position snapshots.
|
|
@@ -21,9 +23,9 @@ import { prepareBlue, } from "./prepare.js";
|
|
|
21
23
|
* @param params.marketData.chainId - Chain from which the market snapshot was fetched; must equal `chainId`.
|
|
22
24
|
* @param params.marketData.market - Caller-fetched `Market` providing the market tuple and LLTV.
|
|
23
25
|
* @param params.positionData.chainId - Chain from which the position snapshot was fetched; must equal `chainId`.
|
|
24
|
-
* @param params.positionData.position - Caller-fetched `AccrualPosition` for `account` and `marketId`, used for the
|
|
26
|
+
* @param params.positionData.position - Caller-fetched `AccrualPosition` for `account` and `marketId`, used for the deadline-accrued health check.
|
|
25
27
|
* @param params.collateralAssets - Positive collateral withdrawal in token base units, not exceeding the position's collateral.
|
|
26
|
-
* @param params.referralFee.bps - Optional integer referral fee in basis points; defaults to zero and must be
|
|
28
|
+
* @param params.referralFee.bps - Optional integer referral fee in basis points; defaults to zero and must be at most 1,000.
|
|
27
29
|
* @param params.referralFee.recipient - Non-zero fee recipient required when the optional fee is positive.
|
|
28
30
|
* @param params.supportSignature - Optional Morpho authorization signature preference, defaulting to `false`; otherwise prepares a direct authorization transaction when needed.
|
|
29
31
|
* @param params.now - Optional reference timestamp in Unix seconds, normally the latest block timestamp; defaults to the device clock.
|
|
@@ -40,9 +42,8 @@ import { prepareBlue, } from "./prepare.js";
|
|
|
40
42
|
* @throws {NonPositiveInputError} when `expiresAt` or `collateralAssets` is not positive.
|
|
41
43
|
* @throws {ExpiredDeadlineError} when `expiresAt` is at or before `now`.
|
|
42
44
|
* @throws {NegativeInputError} when `referralFee.bps` is negative.
|
|
43
|
-
* @throws {InputExceedsMaxError} when `referralFee.bps` exceeds
|
|
45
|
+
* @throws {InputExceedsMaxError} when `referralFee.bps` exceeds 1,000 or `collateralAssets` exceeds uint256.
|
|
44
46
|
* @throws {InvalidCalldataOriginError} when `calldataOrigin` is empty, malformed or has an odd number of hex digits.
|
|
45
|
-
* @throws {ReferralFeePctExceededError} when `referralFee.bps` equals 10,000.
|
|
46
47
|
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no non-zero recipient.
|
|
47
48
|
* @throws {UnsupportedMarketIrmError} when projecting an indebted position requires an unsupported IRM without rate data.
|
|
48
49
|
* @throws {WithdrawExceedsCollateralError} when `collateralAssets` exceeds the position's collateral.
|
|
@@ -107,8 +108,11 @@ export async function prepareBlueWithdrawCollateral(client, params) {
|
|
|
107
108
|
validatePositionHealthAfterWithdraw({
|
|
108
109
|
positionData: position.borrowShares === 0n
|
|
109
110
|
? new AccrualPosition(position, position.market)
|
|
110
|
-
: position.accrueInterest(
|
|
111
|
-
|
|
111
|
+
: position.accrueInterest(getBlueBundlesV1QuoteTimestamp({
|
|
112
|
+
lastUpdate: position.market.lastUpdate,
|
|
113
|
+
now,
|
|
114
|
+
deadline: resolvedIntent.deadline,
|
|
115
|
+
})),
|
|
112
116
|
withdrawAmount: collateralAssets,
|
|
113
117
|
lltv,
|
|
114
118
|
marketId,
|
|
@@ -4,7 +4,7 @@ import { getBundlesReferralFeeAssets, normalizeBundlesCommonParams, } from "../a
|
|
|
4
4
|
import { validateClientChainId } from "../actions/requirements/validateClientChainId.js";
|
|
5
5
|
import { assertRegistryTargetsHaveCode } from "../entities/requirements/assertContractCode.js";
|
|
6
6
|
import { computeVaultMaxSharePrice } from "../helpers/index.js";
|
|
7
|
-
import { validateNativeVaultAsset, validateSlippageTolerance, validateUint256Field, } from "../helpers/validate.js";
|
|
7
|
+
import { validateNativeVaultAsset, validateReferenceTime, validateSlippageTolerance, validateUint256Field, validateVaultDepositDeadline, } from "../helpers/validate.js";
|
|
8
8
|
import { NonPositiveInputError, } from "../types/index.js";
|
|
9
9
|
import { InvalidTransactionPlanError } from "./error.js";
|
|
10
10
|
import { resolveIntent } from "./intent.js";
|
|
@@ -32,6 +32,8 @@ export function validateDepositPlanAction(action, path) {
|
|
|
32
32
|
function resolveDepositInputs(params, now) {
|
|
33
33
|
const { vault, chainId, assets } = params;
|
|
34
34
|
const intent = resolveIntent(params, now);
|
|
35
|
+
// Bound forward accrual for both vault deposit plan kinds.
|
|
36
|
+
validateVaultDepositDeadline(intent.deadline, { now, field: "expiresAt" });
|
|
35
37
|
const slippageTolerance = params.slippageTolerance ?? DEFAULT_SLIPPAGE_TOLERANCE;
|
|
36
38
|
validateSlippageTolerance(slippageTolerance);
|
|
37
39
|
const native = (params.funding ?? { type: "erc20" }).type === "native";
|
|
@@ -64,6 +66,8 @@ export async function prepareVaultDeposit(client, params) {
|
|
|
64
66
|
const { chainId, account, assets } = params;
|
|
65
67
|
const vault = params.vault.address;
|
|
66
68
|
const now = params.now ?? Time.timestamp();
|
|
69
|
+
// Reject a non-bigint clock before deriving the default expiry.
|
|
70
|
+
validateReferenceTime(now);
|
|
67
71
|
const { intent, native, common, asset, maxSharePrice } = resolveDepositInputs(params, now);
|
|
68
72
|
const spender = getChainAddress(chainId, "bundles.vaultBundlesV1");
|
|
69
73
|
const tokenPermitRequestId = `${params.type}:tokenPermit`;
|
|
@@ -10,7 +10,7 @@ export type Funding = {
|
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
|
|
13
|
-
* Referral fee in basis points of the gross amount, paid to `recipient`.
|
|
13
|
+
* Referral fee in basis points of the gross amount, paid to `recipient`. At most 1,000 bps (10%).
|
|
14
14
|
*/
|
|
15
15
|
export interface ReferralFee {
|
|
16
16
|
readonly bps: number;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { MathLib, Time } from "@morpho-org/morpho-ts";
|
|
2
2
|
import { isHex, zeroAddress } from "viem";
|
|
3
|
+
import { MIDNIGHT_MAX_REFERRAL_FEE_PCT } from "../helpers/constant.js";
|
|
3
4
|
import { ExpiredDeadlineError, InputExceedsMaxError, NegativeInputError, NonPositiveInputError, } from "../types/index.js";
|
|
4
5
|
import { InvalidCalldataOriginError, NonIntegerInputError, ZeroAccountError, } from "./error.js";
|
|
5
6
|
import { validateCalldataOriginLength, validatePlanField, } from "./validation.js";
|
|
6
7
|
const BASIS_POINTS = 10000n;
|
|
7
8
|
const WAD_PER_BASIS_POINT = MathLib.WAD / BASIS_POINTS;
|
|
9
|
+
const MAX_REFERRAL_FEE_BPS = MIDNIGHT_MAX_REFERRAL_FEE_PCT / WAD_PER_BASIS_POINT;
|
|
8
10
|
function toSafeInteger(field, value) {
|
|
9
11
|
if (!Number.isSafeInteger(value)) {
|
|
10
12
|
throw new NonIntegerInputError(field, value);
|
|
@@ -34,11 +36,11 @@ export function resolveIntent(params, now) {
|
|
|
34
36
|
if (bps < 0n) {
|
|
35
37
|
throw new NegativeInputError("referralFee.bps", bps);
|
|
36
38
|
}
|
|
37
|
-
if (bps >
|
|
39
|
+
if (bps > MAX_REFERRAL_FEE_BPS) {
|
|
38
40
|
throw new InputExceedsMaxError({
|
|
39
41
|
field: "referralFee.bps",
|
|
40
42
|
value: bps,
|
|
41
|
-
max:
|
|
43
|
+
max: MAX_REFERRAL_FEE_BPS,
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
46
|
const { calldataOrigin } = params;
|
|
@@ -70,6 +70,7 @@ export declare function getPendingSignatureRequests(plan: TransactionPlan): read
|
|
|
70
70
|
* @param step - Recipe to encode; missing signatures on unrelated supported steps do not block it.
|
|
71
71
|
* @returns A frozen `{ to, data, value, action }`, ready to simulate or submit. `data` ends with the plan's `calldataOrigin` when one was set.
|
|
72
72
|
* @throws {InvalidTransactionPlanError} If the plan header, action context, IDs or deadlines are inconsistent.
|
|
73
|
+
* @throws {InvalidBigIntInputError} If a supplied Blue maxPenalty is not a bigint; uint256 schema validation is performed by parseTransactionPlan, not this builder.
|
|
73
74
|
* @throws {InvalidSignatureError} If a stored signature has high s, cannot recover a public key or does not match the request owner.
|
|
74
75
|
* @throws {UnsupportedTransactionPlanVersionError} If the plan version is unsupported.
|
|
75
76
|
* @throws {UnsupportedTransactionPlanActionError} If any plan step or the selected step names an unsupported action type.
|
|
@@ -83,13 +84,14 @@ export declare function getPendingSignatureRequests(plan: TransactionPlan): read
|
|
|
83
84
|
* @throws {EmptyDeallocationsError} If a force-redeem step has no deallocations.
|
|
84
85
|
* @throws {EmptyMarketParamsListError} If a Vault V1 in-kind redemption step has no markets.
|
|
85
86
|
* @throws {ReferralFeePctExceededError} If the action's referral fee is at least WAD.
|
|
87
|
+
* @throws {MidnightReferralFeePctExceededError} when the referral fee is above 10% but below WAD.
|
|
86
88
|
* @throws {ReferralFeeRecipientMissingError} If a positive referral fee has no nonzero recipient.
|
|
87
89
|
* @throws {IncompleteTransactionPlanError} If a referenced signature request or its signature is missing.
|
|
88
90
|
* @throws {TransactionPlanSignatureMismatchError} If a referenced request disagrees with the step's action or its encoding arguments.
|
|
89
91
|
* @throws {BundlesPermitMismatchError} If a stored signature cannot be parsed or a signed permit's encoding arguments do not match the step.
|
|
90
92
|
* @throws {MarketIdMismatchError} If a Blue market ID differs from its parameter tuple.
|
|
91
|
-
* @throws {NegativeInputError} If a Blue amount, native value, LTV bound or referral fee is negative.
|
|
92
|
-
* @throws {InputExceedsMaxError} If a Blue amount, bound or deadline exceeds uint256, or withdrawal-only funding is nonzero.
|
|
93
|
+
* @throws {NegativeInputError} If a Blue amount, native value, LTV bound, maxPenalty or referral fee is negative.
|
|
94
|
+
* @throws {InputExceedsMaxError} If a Blue amount, bound or deadline exceeds uint256, maxPenalty exceeds WAD, a reallocation penalty exceeds maxPenalty (default zero, rejecting any positive penalty), or withdrawal-only funding is nonzero.
|
|
93
95
|
* @throws {MutuallyExclusiveRepayAmountsError} If a Blue repayment specifies both nonzero assets and shares.
|
|
94
96
|
* @throws {MaxRepayAssetsBelowRepayAssetsError} If exact-asset funding cannot cover repayment plus referral fees.
|
|
95
97
|
* @throws {NativeFundingAmountMismatchError} If Blue native funding does not equal the full repayment cap.
|
|
@@ -120,6 +122,7 @@ export declare function buildTransaction(plan: TransactionPlan, step: Step): Rea
|
|
|
120
122
|
* @param plan - Plan whose referenced signature requests all carry a signature.
|
|
121
123
|
* @returns Frozen SDK transactions in step order; discriminate on `action.type` for per-step handling.
|
|
122
124
|
* @throws {InvalidTransactionPlanError} If the plan header, action context, IDs or deadlines are inconsistent.
|
|
125
|
+
* @throws {InvalidBigIntInputError} If a supplied Blue maxPenalty is not a bigint; uint256 schema validation is performed by parseTransactionPlan, not this builder.
|
|
123
126
|
* @throws {InvalidSignatureError} If a stored signature has high s, cannot recover a public key or does not match the request owner.
|
|
124
127
|
* @throws {UnsupportedTransactionPlanVersionError} If the plan version is unsupported, including empty plans.
|
|
125
128
|
* @throws {UnsupportedTransactionPlanActionError} If any plan step names an unsupported action type, before reading requests.
|
|
@@ -133,13 +136,14 @@ export declare function buildTransaction(plan: TransactionPlan, step: Step): Rea
|
|
|
133
136
|
* @throws {EmptyDeallocationsError} If a force-redeem step has no deallocations.
|
|
134
137
|
* @throws {EmptyMarketParamsListError} If a Vault V1 in-kind redemption step has no markets.
|
|
135
138
|
* @throws {ReferralFeePctExceededError} If an action's referral fee is at least WAD.
|
|
139
|
+
* @throws {MidnightReferralFeePctExceededError} when the referral fee is above 10% but below WAD.
|
|
136
140
|
* @throws {ReferralFeeRecipientMissingError} If a positive referral fee has no nonzero recipient.
|
|
137
141
|
* @throws {IncompleteTransactionPlanError} If any step references a signature request or signature that is missing.
|
|
138
142
|
* @throws {TransactionPlanSignatureMismatchError} If a referenced request disagrees with its action or encoding arguments.
|
|
139
143
|
* @throws {BundlesPermitMismatchError} If a stored signature cannot be parsed or a signed permit's encoding arguments do not match the step.
|
|
140
144
|
* @throws {MarketIdMismatchError} If a Blue market ID differs from its parameter tuple.
|
|
141
|
-
* @throws {NegativeInputError} If a Blue amount, native value, LTV bound or referral fee is negative.
|
|
142
|
-
* @throws {InputExceedsMaxError} If a Blue amount, bound or deadline exceeds uint256, or withdrawal-only funding is nonzero.
|
|
145
|
+
* @throws {NegativeInputError} If a Blue amount, native value, LTV bound, maxPenalty or referral fee is negative.
|
|
146
|
+
* @throws {InputExceedsMaxError} If a Blue amount, bound or deadline exceeds uint256, maxPenalty exceeds WAD, a reallocation penalty exceeds maxPenalty (default zero, rejecting any positive penalty), or withdrawal-only funding is nonzero.
|
|
143
147
|
* @throws {MutuallyExclusiveRepayAmountsError} If a Blue repayment specifies both nonzero assets and shares.
|
|
144
148
|
* @throws {MaxRepayAssetsBelowRepayAssetsError} If exact-asset funding cannot cover repayment plus referral fees.
|
|
145
149
|
* @throws {NativeFundingAmountMismatchError} If Blue native funding does not equal the full repayment cap.
|