@morpho-org/morpho-sdk 10.1.0-next.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/README.md +6 -2
- package/lib/cjs/abis.d.ts +1 -1
- package/lib/cjs/abis.js +1 -5
- package/lib/cjs/actions/blue/borrow.d.ts +13 -4
- package/lib/cjs/actions/blue/borrow.internal.d.ts +13 -0
- package/lib/cjs/actions/blue/borrow.internal.js +36 -0
- package/lib/cjs/actions/blue/borrow.js +12 -18
- package/lib/cjs/actions/blue/common.d.ts +53 -28
- package/lib/cjs/actions/blue/common.js +36 -35
- package/lib/cjs/actions/blue/encode.d.ts +23 -0
- package/lib/cjs/actions/blue/encode.js +171 -0
- package/lib/cjs/actions/blue/refinance.d.ts +14 -5
- package/lib/cjs/actions/blue/refinance.internal.d.ts +42 -0
- package/lib/cjs/actions/blue/refinance.internal.js +65 -0
- package/lib/cjs/actions/blue/refinance.js +13 -65
- package/lib/cjs/actions/blue/refinanceValidation.d.ts +6 -6
- package/lib/cjs/actions/blue/refinanceValidation.js +10 -8
- package/lib/cjs/actions/blue/repay.d.ts +5 -4
- package/lib/cjs/actions/blue/repay.internal.d.ts +13 -0
- package/lib/cjs/actions/blue/repay.internal.js +38 -0
- package/lib/cjs/actions/blue/repay.js +5 -19
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +6 -5
- package/lib/cjs/actions/blue/repayWithdrawCollateral.internal.d.ts +61 -0
- package/lib/cjs/actions/blue/repayWithdrawCollateral.internal.js +112 -0
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +6 -118
- package/lib/cjs/actions/blue/signatures.d.ts +30 -0
- package/lib/cjs/actions/blue/signatures.js +90 -0
- package/lib/cjs/actions/blue/supply.d.ts +6 -4
- package/lib/cjs/actions/blue/supply.internal.d.ts +32 -0
- package/lib/cjs/actions/blue/supply.internal.js +101 -0
- package/lib/cjs/actions/blue/supply.js +6 -69
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +5 -4
- package/lib/cjs/actions/blue/supplyCollateral.internal.d.ts +13 -0
- package/lib/cjs/actions/blue/supplyCollateral.internal.js +37 -0
- package/lib/cjs/actions/blue/supplyCollateral.js +5 -19
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +15 -6
- package/lib/cjs/actions/blue/supplyCollateralBorrow.internal.d.ts +65 -0
- package/lib/cjs/actions/blue/supplyCollateralBorrow.internal.js +98 -0
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +13 -108
- package/lib/cjs/actions/blue/withdraw.d.ts +15 -6
- package/lib/cjs/actions/blue/withdraw.internal.d.ts +56 -0
- package/lib/cjs/actions/blue/withdraw.internal.js +87 -0
- package/lib/cjs/actions/blue/withdraw.js +13 -80
- package/lib/cjs/actions/blue/withdrawBuyCallback.d.ts +2 -2
- package/lib/cjs/actions/blue/withdrawBuyCallback.internal.d.ts +20 -0
- package/lib/cjs/actions/blue/withdrawBuyCallback.internal.js +58 -0
- package/lib/cjs/actions/blue/withdrawBuyCallback.js +2 -39
- package/lib/cjs/actions/blue/withdrawCollateral.d.ts +4 -3
- package/lib/cjs/actions/blue/withdrawCollateral.internal.d.ts +16 -0
- package/lib/cjs/actions/blue/withdrawCollateral.internal.js +39 -0
- package/lib/cjs/actions/blue/withdrawCollateral.js +5 -19
- package/lib/cjs/actions/bundles/common.d.ts +9 -0
- package/lib/cjs/actions/bundles/common.js +18 -6
- package/lib/cjs/actions/bundles/index.d.ts +1 -1
- package/lib/cjs/actions/bundles/index.js +3 -16
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +14 -0
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +59 -60
- package/lib/cjs/actions/midnight/cancelAndMake.d.ts +22 -1
- package/lib/cjs/actions/midnight/cancelAndMake.js +46 -87
- package/lib/cjs/actions/midnight/cancelOffers.d.ts +11 -0
- package/lib/cjs/actions/midnight/cancelOffers.js +22 -4
- package/lib/cjs/actions/midnight/encode.d.ts +36 -0
- package/lib/cjs/actions/midnight/encode.js +554 -0
- package/lib/cjs/actions/midnight/index.d.ts +14 -13
- package/lib/cjs/actions/midnight/index.js +29 -13
- package/lib/cjs/actions/midnight/parse.d.ts +35 -0
- package/lib/cjs/actions/midnight/parse.js +73 -0
- package/lib/cjs/actions/midnight/parseCollateralBatch.d.ts +58 -0
- package/lib/cjs/actions/midnight/parseCollateralBatch.js +216 -0
- package/lib/cjs/actions/midnight/redeem.d.ts +16 -3
- package/lib/cjs/actions/midnight/redeem.js +22 -51
- package/lib/cjs/actions/midnight/repayWithdrawCollateral.d.ts +13 -0
- package/lib/cjs/actions/midnight/repayWithdrawCollateral.js +42 -67
- package/lib/cjs/actions/midnight/supplyCollateral.d.ts +40 -5
- package/lib/cjs/actions/midnight/supplyCollateral.js +60 -54
- package/lib/cjs/actions/midnight/supplyCollateralBatch.d.ts +3 -3
- package/lib/cjs/actions/midnight/supplyCollateralBatch.js +3 -62
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +24 -0
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +39 -67
- package/lib/cjs/actions/midnight/supplyCollateralWithNative.d.ts +77 -0
- package/lib/cjs/actions/midnight/supplyCollateralWithNative.js +142 -0
- package/lib/cjs/actions/midnight/takeBorrow.d.ts +17 -2
- package/lib/cjs/actions/midnight/takeBorrow.js +25 -56
- package/lib/cjs/actions/midnight/takeLend.d.ts +21 -1
- package/lib/cjs/actions/midnight/takeLend.js +30 -58
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.d.ts +22 -2
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +34 -62
- package/lib/cjs/actions/midnight/takeWithdraw.d.ts +17 -2
- package/lib/cjs/actions/midnight/takeWithdraw.js +77 -115
- package/lib/cjs/actions/midnight/withdrawCollateral.d.ts +16 -3
- package/lib/cjs/actions/midnight/withdrawCollateral.js +25 -56
- package/lib/cjs/actions/midnight/withdrawCollateralBatch.d.ts +3 -3
- package/lib/cjs/actions/midnight/withdrawCollateralBatch.js +3 -71
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +13 -0
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +39 -19
- package/lib/cjs/actions/requirements/blue/index.d.ts +1 -1
- package/lib/cjs/actions/requirements/blue/index.js +3 -15
- package/lib/cjs/actions/requirements/chainCheck.d.ts +5 -0
- package/lib/cjs/actions/requirements/chainCheck.js +10 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +10 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +40 -27
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +11 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +36 -17
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +14 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +44 -9
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +10 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +61 -24
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +10 -0
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +25 -4
- package/lib/cjs/actions/requirements/encode/index.d.ts +5 -5
- package/lib/cjs/actions/requirements/encode/index.js +11 -19
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +26 -11
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +40 -12
- package/lib/cjs/actions/requirements/index.d.ts +1 -1
- package/lib/cjs/actions/requirements/index.js +3 -1
- package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +11 -0
- package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.js +34 -19
- package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +11 -0
- package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +26 -12
- package/lib/cjs/actions/requirements/midnight/index.d.ts +2 -2
- package/lib/cjs/actions/requirements/midnight/index.js +5 -16
- package/lib/cjs/actions/vaultV1/deposit.d.ts +23 -1
- package/lib/cjs/actions/vaultV1/deposit.js +48 -11
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +18 -1
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +36 -16
- package/lib/cjs/actions/vaultV1/index.d.ts +5 -5
- package/lib/cjs/actions/vaultV1/index.js +11 -19
- package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +24 -2
- package/lib/cjs/actions/vaultV1/migrateToV2.js +51 -12
- package/lib/cjs/actions/vaultV1/redeem.d.ts +22 -2
- package/lib/cjs/actions/vaultV1/redeem.js +30 -8
- package/lib/cjs/actions/vaultV1/withdraw.d.ts +21 -1
- package/lib/cjs/actions/vaultV1/withdraw.js +30 -8
- package/lib/cjs/actions/vaultV2/deposit.d.ts +23 -1
- package/lib/cjs/actions/vaultV2/deposit.js +48 -11
- package/lib/cjs/actions/vaultV2/forceRedeem.d.ts +20 -2
- package/lib/cjs/actions/vaultV2/forceRedeem.js +39 -8
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +25 -2
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +38 -15
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +18 -1
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +35 -15
- package/lib/cjs/actions/vaultV2/index.d.ts +6 -6
- package/lib/cjs/actions/vaultV2/index.js +13 -20
- package/lib/cjs/actions/vaultV2/redeem.d.ts +22 -2
- package/lib/cjs/actions/vaultV2/redeem.js +30 -8
- package/lib/cjs/actions/vaultV2/withdraw.d.ts +21 -1
- package/lib/cjs/actions/vaultV2/withdraw.js +30 -8
- package/lib/cjs/blue/abis.d.ts +1 -1
- package/lib/cjs/blue/abis.js +1 -5
- package/lib/cjs/blue/entities.d.ts +4 -4
- package/lib/cjs/blue/entities.js +1 -3
- package/lib/cjs/blue/errors.d.ts +2 -2
- package/lib/cjs/blue/errors.js +1 -5
- package/lib/cjs/blue/fetch.d.ts +2 -2
- package/lib/cjs/blue/fetch.js +1 -3
- package/lib/cjs/blue/utils.d.ts +1 -1
- package/lib/cjs/blue/utils.js +1 -2
- package/lib/cjs/constants.d.ts +1 -1
- package/lib/cjs/constants.js +2 -0
- package/lib/cjs/entities/blue/blue.d.ts +118 -28
- package/lib/cjs/entities/blue/blue.js +503 -416
- package/lib/cjs/entities/index.d.ts +4 -4
- package/lib/cjs/entities/index.js +1 -3
- package/lib/cjs/entities/midnight/midnight.d.ts +117 -41
- package/lib/cjs/entities/midnight/midnight.js +472 -843
- package/lib/cjs/entities/midnight/parse.d.ts +74 -0
- package/lib/cjs/entities/midnight/parse.js +336 -0
- package/lib/cjs/entities/midnight/prepare.d.ts +47 -0
- package/lib/cjs/entities/midnight/prepare.js +293 -0
- package/lib/cjs/entities/midnight/publication.d.ts +7 -3
- package/lib/cjs/entities/midnight/publication.js +10 -7
- package/lib/cjs/entities/midnight/types.d.ts +7 -0
- package/lib/cjs/entities/requirements/assertContractCode.d.ts +10 -5
- package/lib/cjs/entities/requirements/assertContractCode.js +24 -15
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +15 -0
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +59 -51
- package/lib/cjs/entities/requirements/getErc2612Permit.d.ts +7 -3
- package/lib/cjs/entities/requirements/getErc2612Permit.js +20 -4
- package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.d.ts +15 -0
- package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.js +24 -7
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +14 -0
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +27 -7
- package/lib/cjs/entities/requirements/getVaultV1InKindRedeemRequirements.js +4 -3
- package/lib/cjs/entities/requirements/getVaultV2ForceWithdrawRequirements.js +4 -3
- package/lib/cjs/entities/requirements/getVaultV2InKindRedeemRequirements.js +4 -3
- package/lib/cjs/entities/requirements/index.d.ts +2 -2
- package/lib/cjs/entities/requirements/index.js +5 -16
- package/lib/cjs/entities/requirements/validateNativeRequirements.d.ts +21 -0
- package/lib/cjs/entities/requirements/validateNativeRequirements.js +37 -0
- package/lib/cjs/entities/vaultV1/inKindRedeemQuote.d.ts +2 -2
- package/lib/cjs/entities/vaultV1/inKindRedeemQuote.js +1 -7
- 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 +29 -46
- package/lib/cjs/entities/vaultV1/vaultV1.js +234 -159
- package/lib/cjs/entities/vaultV2/forceWithdrawQuote.d.ts +4 -0
- package/lib/cjs/entities/vaultV2/forceWithdrawQuote.js +9 -4
- package/lib/cjs/entities/vaultV2/inKindRedeemQuote.d.ts +2 -2
- package/lib/cjs/entities/vaultV2/inKindRedeemQuote.js +1 -7
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +40 -92
- package/lib/cjs/entities/vaultV2/vaultV2.js +230 -188
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +13 -5
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +21 -27
- package/lib/cjs/errors.d.ts +4 -4
- package/lib/cjs/errors.js +5 -7
- package/lib/cjs/fetch.d.ts +2 -2
- package/lib/cjs/fetch.js +1 -3
- package/lib/cjs/helpers/constant.d.ts +2 -0
- package/lib/cjs/helpers/constant.js +3 -1
- package/lib/cjs/helpers/deadShares.js +0 -3
- 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/parse.d.ts +33 -0
- package/lib/cjs/helpers/parse.js +71 -0
- package/lib/cjs/helpers/parseMidnight.d.ts +48 -0
- package/lib/cjs/helpers/parseMidnight.js +95 -0
- package/lib/cjs/helpers/parseMidnightMaker.d.ts +44 -0
- package/lib/cjs/helpers/parseMidnightMaker.js +154 -0
- 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 +34 -6
- package/lib/cjs/helpers/validate.js +52 -9
- package/lib/cjs/helpers/validateMidnightBounds.d.ts +1 -2
- package/lib/cjs/helpers/validateMidnightBounds.js +1 -2
- package/lib/cjs/helpers/validateMidnightCancelAndMakePublication.d.ts +8 -0
- package/lib/cjs/helpers/validateMidnightCancelAndMakePublication.js +4 -4
- package/lib/cjs/helpers/validateMidnightPublication.d.ts +17 -1
- package/lib/cjs/helpers/validateMidnightTakeFeasibility.d.ts +2 -2
- package/lib/cjs/helpers/validateMidnightTakeFeasibility.js +1 -1
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/midnight/errors.d.ts +1 -2
- package/lib/cjs/midnight/errors.js +4 -5
- 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 +36 -11
- package/lib/cjs/transactionPlan/blue/repay.d.ts +1 -2
- package/lib/cjs/transactionPlan/blue/repay.js +3 -3
- package/lib/cjs/transactionPlan/blue/repayWithdrawCollateral.d.ts +4 -3
- package/lib/cjs/transactionPlan/blue/repayWithdrawCollateral.js +35 -7
- 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 +25 -8
- package/lib/cjs/transactionPlan/blue/withdraw.d.ts +17 -7
- package/lib/cjs/transactionPlan/blue/withdraw.js +28 -9
- package/lib/cjs/transactionPlan/blue/withdrawCollateral.d.ts +5 -5
- package/lib/cjs/transactionPlan/blue/withdrawCollateral.js +17 -9
- 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/validation.d.ts +1 -1
- package/lib/cjs/transactionPlan/validation.js +3 -0
- package/lib/cjs/transactionPlan/vaultv1/deposit.d.ts +5 -5
- package/lib/cjs/transactionPlan/vaultv1/deposit.js +5 -5
- 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/action.d.ts +13 -2
- package/lib/cjs/types/error.d.ts +27 -8
- package/lib/cjs/types/error.js +42 -12
- package/lib/cjs/types/sharedLiquidity.d.ts +7 -2
- package/lib/cjs/utils.d.ts +2 -2
- package/lib/cjs/utils.js +2 -4
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/abis.d.ts +1 -1
- package/lib/esm/abis.js +1 -1
- package/lib/esm/actions/blue/borrow.d.ts +13 -4
- package/lib/esm/actions/blue/borrow.internal.d.ts +13 -0
- package/lib/esm/actions/blue/borrow.internal.js +31 -0
- package/lib/esm/actions/blue/borrow.js +12 -18
- package/lib/esm/actions/blue/common.d.ts +53 -28
- package/lib/esm/actions/blue/common.js +36 -34
- package/lib/esm/actions/blue/encode.d.ts +23 -0
- package/lib/esm/actions/blue/encode.js +164 -0
- package/lib/esm/actions/blue/refinance.d.ts +14 -5
- package/lib/esm/actions/blue/refinance.internal.d.ts +42 -0
- package/lib/esm/actions/blue/refinance.internal.js +59 -0
- package/lib/esm/actions/blue/refinance.js +13 -65
- package/lib/esm/actions/blue/refinanceValidation.d.ts +6 -6
- package/lib/esm/actions/blue/refinanceValidation.js +11 -9
- package/lib/esm/actions/blue/repay.d.ts +5 -4
- package/lib/esm/actions/blue/repay.internal.d.ts +13 -0
- package/lib/esm/actions/blue/repay.internal.js +33 -0
- package/lib/esm/actions/blue/repay.js +5 -19
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +6 -5
- package/lib/esm/actions/blue/repayWithdrawCollateral.internal.d.ts +61 -0
- package/lib/esm/actions/blue/repayWithdrawCollateral.internal.js +104 -0
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +6 -118
- package/lib/esm/actions/blue/signatures.d.ts +30 -0
- package/lib/esm/actions/blue/signatures.js +82 -0
- package/lib/esm/actions/blue/supply.d.ts +6 -4
- package/lib/esm/actions/blue/supply.internal.d.ts +32 -0
- package/lib/esm/actions/blue/supply.internal.js +95 -0
- package/lib/esm/actions/blue/supply.js +6 -69
- package/lib/esm/actions/blue/supplyCollateral.d.ts +5 -4
- package/lib/esm/actions/blue/supplyCollateral.internal.d.ts +13 -0
- package/lib/esm/actions/blue/supplyCollateral.internal.js +32 -0
- package/lib/esm/actions/blue/supplyCollateral.js +5 -19
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +15 -6
- package/lib/esm/actions/blue/supplyCollateralBorrow.internal.d.ts +65 -0
- package/lib/esm/actions/blue/supplyCollateralBorrow.internal.js +91 -0
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +13 -108
- package/lib/esm/actions/blue/withdraw.d.ts +15 -6
- package/lib/esm/actions/blue/withdraw.internal.d.ts +56 -0
- package/lib/esm/actions/blue/withdraw.internal.js +80 -0
- package/lib/esm/actions/blue/withdraw.js +13 -80
- package/lib/esm/actions/blue/withdrawBuyCallback.d.ts +2 -2
- package/lib/esm/actions/blue/withdrawBuyCallback.internal.d.ts +20 -0
- package/lib/esm/actions/blue/withdrawBuyCallback.internal.js +53 -0
- package/lib/esm/actions/blue/withdrawBuyCallback.js +2 -39
- package/lib/esm/actions/blue/withdrawCollateral.d.ts +4 -3
- package/lib/esm/actions/blue/withdrawCollateral.internal.d.ts +16 -0
- package/lib/esm/actions/blue/withdrawCollateral.internal.js +34 -0
- package/lib/esm/actions/blue/withdrawCollateral.js +5 -19
- package/lib/esm/actions/bundles/common.d.ts +9 -0
- package/lib/esm/actions/bundles/common.js +15 -4
- package/lib/esm/actions/bundles/index.d.ts +1 -1
- package/lib/esm/actions/bundles/index.js +1 -1
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +14 -0
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +58 -61
- package/lib/esm/actions/midnight/cancelAndMake.d.ts +22 -1
- package/lib/esm/actions/midnight/cancelAndMake.js +43 -85
- package/lib/esm/actions/midnight/cancelOffers.d.ts +11 -0
- package/lib/esm/actions/midnight/cancelOffers.js +18 -2
- package/lib/esm/actions/midnight/encode.d.ts +36 -0
- package/lib/esm/actions/midnight/encode.js +539 -0
- package/lib/esm/actions/midnight/index.d.ts +14 -13
- package/lib/esm/actions/midnight/index.js +14 -13
- package/lib/esm/actions/midnight/parse.d.ts +35 -0
- package/lib/esm/actions/midnight/parse.js +68 -0
- package/lib/esm/actions/midnight/parseCollateralBatch.d.ts +58 -0
- package/lib/esm/actions/midnight/parseCollateralBatch.js +209 -0
- package/lib/esm/actions/midnight/redeem.d.ts +16 -3
- package/lib/esm/actions/midnight/redeem.js +20 -50
- package/lib/esm/actions/midnight/repayWithdrawCollateral.d.ts +13 -0
- package/lib/esm/actions/midnight/repayWithdrawCollateral.js +38 -64
- package/lib/esm/actions/midnight/supplyCollateral.d.ts +40 -5
- package/lib/esm/actions/midnight/supplyCollateral.js +57 -53
- package/lib/esm/actions/midnight/supplyCollateralBatch.d.ts +3 -3
- package/lib/esm/actions/midnight/supplyCollateralBatch.js +3 -62
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +24 -0
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +34 -63
- package/lib/esm/actions/midnight/supplyCollateralWithNative.d.ts +77 -0
- package/lib/esm/actions/midnight/supplyCollateralWithNative.js +137 -0
- package/lib/esm/actions/midnight/takeBorrow.d.ts +17 -2
- package/lib/esm/actions/midnight/takeBorrow.js +21 -53
- package/lib/esm/actions/midnight/takeLend.d.ts +21 -1
- package/lib/esm/actions/midnight/takeLend.js +27 -56
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +22 -2
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +31 -60
- package/lib/esm/actions/midnight/takeWithdraw.d.ts +17 -2
- package/lib/esm/actions/midnight/takeWithdraw.js +76 -115
- package/lib/esm/actions/midnight/withdrawCollateral.d.ts +16 -3
- package/lib/esm/actions/midnight/withdrawCollateral.js +23 -55
- package/lib/esm/actions/midnight/withdrawCollateralBatch.d.ts +3 -3
- package/lib/esm/actions/midnight/withdrawCollateralBatch.js +3 -71
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +13 -0
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +36 -18
- package/lib/esm/actions/requirements/blue/index.d.ts +1 -1
- package/lib/esm/actions/requirements/blue/index.js +1 -1
- package/lib/esm/actions/requirements/chainCheck.d.ts +5 -0
- package/lib/esm/actions/requirements/chainCheck.js +6 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +10 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +36 -25
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +11 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +33 -16
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +14 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +41 -8
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +10 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +59 -24
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +10 -0
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +21 -2
- package/lib/esm/actions/requirements/encode/index.d.ts +5 -5
- package/lib/esm/actions/requirements/encode/index.js +5 -5
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +26 -11
- package/lib/esm/actions/requirements/getRequirementsApproval.js +38 -12
- package/lib/esm/actions/requirements/index.d.ts +1 -1
- package/lib/esm/actions/requirements/index.js +1 -1
- package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +11 -0
- package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +31 -18
- package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +11 -0
- package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +22 -10
- package/lib/esm/actions/requirements/midnight/index.d.ts +2 -2
- package/lib/esm/actions/requirements/midnight/index.js +2 -2
- package/lib/esm/actions/vaultV1/deposit.d.ts +23 -1
- package/lib/esm/actions/vaultV1/deposit.js +45 -10
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +18 -1
- package/lib/esm/actions/vaultV1/inKindRedeem.js +33 -15
- package/lib/esm/actions/vaultV1/index.d.ts +5 -5
- package/lib/esm/actions/vaultV1/index.js +5 -5
- package/lib/esm/actions/vaultV1/migrateToV2.d.ts +24 -2
- package/lib/esm/actions/vaultV1/migrateToV2.js +49 -12
- package/lib/esm/actions/vaultV1/redeem.d.ts +22 -2
- package/lib/esm/actions/vaultV1/redeem.js +28 -8
- package/lib/esm/actions/vaultV1/withdraw.d.ts +21 -1
- package/lib/esm/actions/vaultV1/withdraw.js +28 -8
- package/lib/esm/actions/vaultV2/deposit.d.ts +23 -1
- package/lib/esm/actions/vaultV2/deposit.js +45 -10
- package/lib/esm/actions/vaultV2/forceRedeem.d.ts +20 -2
- package/lib/esm/actions/vaultV2/forceRedeem.js +35 -6
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +25 -2
- package/lib/esm/actions/vaultV2/forceWithdraw.js +35 -14
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +18 -1
- package/lib/esm/actions/vaultV2/inKindRedeem.js +32 -14
- package/lib/esm/actions/vaultV2/index.d.ts +6 -6
- package/lib/esm/actions/vaultV2/index.js +6 -6
- package/lib/esm/actions/vaultV2/redeem.d.ts +22 -2
- package/lib/esm/actions/vaultV2/redeem.js +28 -8
- package/lib/esm/actions/vaultV2/withdraw.d.ts +21 -1
- package/lib/esm/actions/vaultV2/withdraw.js +28 -8
- package/lib/esm/blue/abis.d.ts +1 -1
- package/lib/esm/blue/abis.js +1 -1
- package/lib/esm/blue/entities.d.ts +4 -4
- package/lib/esm/blue/entities.js +2 -2
- package/lib/esm/blue/errors.d.ts +2 -2
- package/lib/esm/blue/errors.js +2 -2
- package/lib/esm/blue/fetch.d.ts +2 -2
- package/lib/esm/blue/fetch.js +2 -2
- package/lib/esm/blue/utils.d.ts +1 -1
- package/lib/esm/blue/utils.js +1 -1
- package/lib/esm/constants.d.ts +1 -1
- package/lib/esm/constants.js +1 -1
- package/lib/esm/entities/blue/blue.d.ts +118 -28
- package/lib/esm/entities/blue/blue.js +485 -398
- package/lib/esm/entities/index.d.ts +4 -4
- package/lib/esm/entities/index.js +2 -2
- package/lib/esm/entities/midnight/midnight.d.ts +117 -41
- package/lib/esm/entities/midnight/midnight.js +455 -826
- package/lib/esm/entities/midnight/parse.d.ts +74 -0
- package/lib/esm/entities/midnight/parse.js +320 -0
- package/lib/esm/entities/midnight/prepare.d.ts +47 -0
- package/lib/esm/entities/midnight/prepare.js +282 -0
- package/lib/esm/entities/midnight/publication.d.ts +7 -3
- package/lib/esm/entities/midnight/publication.js +7 -3
- package/lib/esm/entities/midnight/types.d.ts +7 -0
- package/lib/esm/entities/requirements/assertContractCode.d.ts +10 -5
- package/lib/esm/entities/requirements/assertContractCode.js +24 -15
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +15 -0
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +53 -47
- package/lib/esm/entities/requirements/getErc2612Permit.d.ts +7 -3
- package/lib/esm/entities/requirements/getErc2612Permit.js +19 -4
- package/lib/esm/entities/requirements/getUnusedPermit2Nonce.d.ts +15 -0
- package/lib/esm/entities/requirements/getUnusedPermit2Nonce.js +20 -5
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +14 -0
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +23 -5
- package/lib/esm/entities/requirements/getVaultV1InKindRedeemRequirements.js +4 -3
- package/lib/esm/entities/requirements/getVaultV2ForceWithdrawRequirements.js +4 -3
- package/lib/esm/entities/requirements/getVaultV2InKindRedeemRequirements.js +4 -3
- package/lib/esm/entities/requirements/index.d.ts +2 -2
- package/lib/esm/entities/requirements/index.js +2 -2
- package/lib/esm/entities/requirements/validateNativeRequirements.d.ts +21 -0
- package/lib/esm/entities/requirements/validateNativeRequirements.js +33 -0
- package/lib/esm/entities/vaultV1/inKindRedeemQuote.d.ts +2 -2
- package/lib/esm/entities/vaultV1/inKindRedeemQuote.js +1 -7
- 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 +29 -46
- package/lib/esm/entities/vaultV1/vaultV1.js +214 -139
- package/lib/esm/entities/vaultV2/forceWithdrawQuote.d.ts +4 -0
- package/lib/esm/entities/vaultV2/forceWithdrawQuote.js +10 -5
- package/lib/esm/entities/vaultV2/inKindRedeemQuote.d.ts +2 -2
- package/lib/esm/entities/vaultV2/inKindRedeemQuote.js +1 -7
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +40 -92
- package/lib/esm/entities/vaultV2/vaultV2.js +214 -172
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +13 -5
- package/lib/esm/entities/vaultV2BlueReallocationData.js +19 -25
- package/lib/esm/errors.d.ts +4 -4
- package/lib/esm/errors.js +4 -4
- package/lib/esm/fetch.d.ts +2 -2
- package/lib/esm/fetch.js +2 -2
- package/lib/esm/helpers/constant.d.ts +2 -0
- package/lib/esm/helpers/constant.js +2 -0
- package/lib/esm/helpers/deadShares.js +1 -4
- 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/parse.d.ts +33 -0
- package/lib/esm/helpers/parse.js +61 -0
- package/lib/esm/helpers/parseMidnight.d.ts +48 -0
- package/lib/esm/helpers/parseMidnight.js +80 -0
- package/lib/esm/helpers/parseMidnightMaker.d.ts +44 -0
- package/lib/esm/helpers/parseMidnightMaker.js +147 -0
- 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 +34 -6
- package/lib/esm/helpers/validate.js +52 -11
- package/lib/esm/helpers/validateMidnightBounds.d.ts +1 -2
- package/lib/esm/helpers/validateMidnightBounds.js +1 -2
- package/lib/esm/helpers/validateMidnightCancelAndMakePublication.d.ts +8 -0
- package/lib/esm/helpers/validateMidnightCancelAndMakePublication.js +2 -2
- package/lib/esm/helpers/validateMidnightPublication.d.ts +17 -1
- package/lib/esm/helpers/validateMidnightTakeFeasibility.d.ts +2 -2
- package/lib/esm/helpers/validateMidnightTakeFeasibility.js +1 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/midnight/errors.d.ts +1 -2
- package/lib/esm/midnight/errors.js +1 -2
- 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 +37 -12
- package/lib/esm/transactionPlan/blue/repay.d.ts +1 -2
- package/lib/esm/transactionPlan/blue/repay.js +4 -4
- package/lib/esm/transactionPlan/blue/repayWithdrawCollateral.d.ts +4 -3
- package/lib/esm/transactionPlan/blue/repayWithdrawCollateral.js +36 -8
- 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 +25 -8
- package/lib/esm/transactionPlan/blue/withdraw.d.ts +17 -7
- package/lib/esm/transactionPlan/blue/withdraw.js +28 -9
- package/lib/esm/transactionPlan/blue/withdrawCollateral.d.ts +5 -5
- package/lib/esm/transactionPlan/blue/withdrawCollateral.js +17 -9
- 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/validation.d.ts +1 -1
- package/lib/esm/transactionPlan/validation.js +3 -0
- package/lib/esm/transactionPlan/vaultv1/deposit.d.ts +5 -5
- package/lib/esm/transactionPlan/vaultv1/deposit.js +5 -5
- 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/action.d.ts +13 -2
- package/lib/esm/types/error.d.ts +27 -8
- package/lib/esm/types/error.js +38 -10
- package/lib/esm/types/sharedLiquidity.d.ts +7 -2
- package/lib/esm/utils.d.ts +2 -2
- package/lib/esm/utils.js +2 -2
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +7 -7
|
@@ -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.
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { MathLib } from "@morpho-org/blue-sdk";
|
|
2
2
|
import { deepFreeze, Time } from "@morpho-org/morpho-ts";
|
|
3
3
|
import { maxUint256 } from "viem";
|
|
4
|
-
import { validateBlueBundlesV1NativeFunding } from "../../actions/blue/common.js";
|
|
5
4
|
import { blueSupplyCollateralBorrow } from "../../actions/blue/supplyCollateralBorrow.js";
|
|
6
5
|
import { validateClientChainId } from "../../actions/requirements/validateClientChainId.js";
|
|
6
|
+
import { getBlueBundlesV1QuoteTimestamp } from "../../helpers/getBlueBundlesV1QuoteTimestamp.js";
|
|
7
7
|
import { DEFAULT_LLTV_BUFFER, validatePositionHealth, } from "../../helpers/index.js";
|
|
8
|
+
import { parseNativeFunding } from "../../helpers/parse.js";
|
|
8
9
|
import { MissingAccrualPositionError, } from "../../types/index.js";
|
|
9
10
|
import { IncompleteTransactionPlanError, InvalidTransactionPlanError, TransactionPlanSignatureMismatchError, } from "../error.js";
|
|
10
11
|
import { getVaultPermit, validateTokenPermitRequest } from "../permit.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,14 +122,18 @@ 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,
|
|
122
133
|
lltv: marketParams.lltv,
|
|
123
134
|
});
|
|
124
135
|
}
|
|
125
|
-
const native =
|
|
136
|
+
const native = parseNativeFunding({
|
|
126
137
|
chainId,
|
|
127
138
|
token: marketParams.collateralToken,
|
|
128
139
|
fundedAmount: collateralAssets,
|
|
@@ -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
|
/**
|
|
@@ -44,12 +46,13 @@ export type BlueWithdrawPlanParams = IntentParams & AssetsOrSharesArgs & {
|
|
|
44
46
|
* @param params.account - Non-zero account whose supply position is withdrawn and which sends every plan transaction.
|
|
45
47
|
* @param params.marketId - Market ID matching the caller-fetched snapshot and its market tuple.
|
|
46
48
|
* @param params.marketData.chainId - Chain on which the market snapshot was fetched; must equal `chainId`.
|
|
47
|
-
* @param params.marketData.market - Caller-fetched `Market` snapshot
|
|
49
|
+
* @param params.marketData.market - Caller-fetched `Market` snapshot used to fix the market tuple; never stored in the plan.
|
|
48
50
|
* @param params.positionData.chainId - Position snapshot's chain; must match `chainId`.
|
|
49
|
-
* @param params.positionData.position - Caller-fetched `AccrualPosition` belonging to `account` and `marketId`; validates the withdrawal against supplied assets or shares.
|
|
51
|
+
* @param params.positionData.position - Caller-fetched `AccrualPosition` belonging to `account` and `marketId`; validates the withdrawal against supplied assets or shares and quotes share-mode penalty coverage.
|
|
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>>;
|
|
@@ -19,12 +19,13 @@ import { prepareBlue, } from "./prepare.js";
|
|
|
19
19
|
* @param params.account - Non-zero account whose supply position is withdrawn and which sends every plan transaction.
|
|
20
20
|
* @param params.marketId - Market ID matching the caller-fetched snapshot and its market tuple.
|
|
21
21
|
* @param params.marketData.chainId - Chain on which the market snapshot was fetched; must equal `chainId`.
|
|
22
|
-
* @param params.marketData.market - Caller-fetched `Market` snapshot
|
|
22
|
+
* @param params.marketData.market - Caller-fetched `Market` snapshot used to fix the market tuple; never stored in the plan.
|
|
23
23
|
* @param params.positionData.chainId - Position snapshot's chain; must match `chainId`.
|
|
24
|
-
* @param params.positionData.position - Caller-fetched `AccrualPosition` belonging to `account` and `marketId`; validates the withdrawal against supplied assets or shares.
|
|
24
|
+
* @param params.positionData.position - Caller-fetched `AccrualPosition` belonging to `account` and `marketId`; validates the withdrawal against supplied assets or shares and quotes share-mode penalty coverage.
|
|
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,
|
|
@@ -129,7 +133,7 @@ export async function prepareBlueWithdraw(client, params) {
|
|
|
129
133
|
});
|
|
130
134
|
const max = inputs.withdrawAssets > 0n
|
|
131
135
|
? inputs.withdrawAssets
|
|
132
|
-
:
|
|
136
|
+
: snapshot.position.market.toSupplyAssets(inputs.withdrawShares, "Down");
|
|
133
137
|
const penalty = getBlueBundlesV1PenaltyAssets(inputs.reallocations);
|
|
134
138
|
if (penalty > max) {
|
|
135
139
|
throw new InputExceedsMaxError({
|
|
@@ -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,
|
|
@@ -164,7 +168,7 @@ export function validateBlueWithdrawCollateralAuthorizationRequest(request, acti
|
|
|
164
168
|
}
|
|
165
169
|
/** @internal Encodes the self-contained collateral withdrawal recipe. */
|
|
166
170
|
export function buildBlueWithdrawCollateral(action, requests) {
|
|
167
|
-
const { chainId, account, marketParams,
|
|
171
|
+
const { chainId, account, marketParams, collateralAssets, maxLtv, deadline, referralFeePct, referralFeeRecipient, } = action.inputs;
|
|
168
172
|
const id = action.signatureRequestIds.morphoAuthorization;
|
|
169
173
|
const request = id === undefined
|
|
170
174
|
? undefined
|
|
@@ -179,7 +183,11 @@ export function buildBlueWithdrawCollateral(action, requests) {
|
|
|
179
183
|
return blueWithdrawCollateral({
|
|
180
184
|
market: { chainId, marketParams: new MarketParams(marketParams) },
|
|
181
185
|
args: {
|
|
182
|
-
|
|
186
|
+
collateralAssets,
|
|
187
|
+
maxLtv,
|
|
188
|
+
deadline,
|
|
189
|
+
referralFeePct,
|
|
190
|
+
referralFeeRecipient,
|
|
183
191
|
userAddress: account,
|
|
184
192
|
authorizationSignature: request?.kind === "morphoAuthorization" &&
|
|
185
193
|
request.signature !== undefined
|
|
@@ -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;
|