@morpho-org/morpho-sdk 10.3.1 → 10.4.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 +169 -5
- package/lib/cjs/actions/midnight/redeem.d.ts +20 -3
- package/lib/cjs/actions/midnight/redeem.js +58 -1
- package/lib/cjs/actions/midnight/supplyCollateralWithNative.d.ts +24 -1
- package/lib/cjs/actions/midnight/supplyCollateralWithNative.js +41 -0
- package/lib/cjs/actions/midnight/withdrawCollateral.d.ts +16 -2
- package/lib/cjs/actions/midnight/withdrawCollateral.js +26 -1
- package/lib/cjs/helpers/callback.d.ts +3 -2
- package/lib/cjs/helpers/callback.js +4 -20
- package/lib/cjs/helpers/computeMidnightPostWithdrawalCollateral.d.ts +17 -0
- package/lib/cjs/helpers/computeMidnightPostWithdrawalCollateral.js +30 -0
- package/lib/cjs/helpers/parseMidnightMaker.d.ts +21 -0
- package/lib/cjs/helpers/parseMidnightMaker.js +41 -1
- package/lib/cjs/helpers/validate.d.ts +49 -1
- package/lib/cjs/helpers/validate.js +87 -1
- package/lib/cjs/helpers/validateMidnightPublication.d.ts +10 -0
- package/lib/cjs/helpers/validateMidnightPublication.js +18 -1
- package/lib/cjs/helpers/validateMidnightTakeableOfferFields.d.ts +28 -0
- package/lib/cjs/helpers/validateMidnightTakeableOfferFields.js +85 -0
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/index.js +23 -1
- package/lib/cjs/midnight/utils.d.ts +1 -1
- package/lib/cjs/midnight/utils.js +2 -1
- package/lib/cjs/transactionPlan/blue/withdrawBuyCallback.d.ts +101 -0
- package/lib/cjs/transactionPlan/blue/withdrawBuyCallback.js +264 -0
- package/lib/cjs/transactionPlan/error.d.ts +27 -0
- package/lib/cjs/transactionPlan/error.js +30 -1
- package/lib/cjs/transactionPlan/index.d.ts +40 -1
- package/lib/cjs/transactionPlan/index.js +46 -5
- package/lib/cjs/transactionPlan/midnight/authorization.d.ts +15 -0
- package/lib/cjs/transactionPlan/midnight/authorization.js +45 -0
- package/lib/cjs/transactionPlan/midnight/cancelOffers.d.ts +80 -0
- package/lib/cjs/transactionPlan/midnight/cancelOffers.js +125 -0
- package/lib/cjs/transactionPlan/midnight/makeBorrow.d.ts +104 -0
- package/lib/cjs/transactionPlan/midnight/makeBorrow.js +126 -0
- package/lib/cjs/transactionPlan/midnight/makeLend.d.ts +140 -0
- package/lib/cjs/transactionPlan/midnight/makeLend.js +176 -0
- package/lib/cjs/transactionPlan/midnight/makeRepay.d.ts +118 -0
- package/lib/cjs/transactionPlan/midnight/makeRepay.js +118 -0
- package/lib/cjs/transactionPlan/midnight/makeWithdraw.d.ts +104 -0
- package/lib/cjs/transactionPlan/midnight/makeWithdraw.js +126 -0
- package/lib/cjs/transactionPlan/midnight/makerPublication.d.ts +55 -0
- package/lib/cjs/transactionPlan/midnight/makerPublication.js +315 -0
- package/lib/cjs/transactionPlan/midnight/market.d.ts +49 -0
- package/lib/cjs/transactionPlan/midnight/market.js +120 -0
- package/lib/cjs/transactionPlan/midnight/prepare.d.ts +244 -0
- package/lib/cjs/transactionPlan/midnight/prepare.js +547 -0
- package/lib/cjs/transactionPlan/midnight/publicationState.d.ts +24 -0
- package/lib/cjs/transactionPlan/midnight/publicationState.js +50 -0
- package/lib/cjs/transactionPlan/midnight/redeem.d.ts +102 -0
- package/lib/cjs/transactionPlan/midnight/redeem.js +170 -0
- package/lib/cjs/transactionPlan/midnight/reduceOnlySellFeasibility.d.ts +25 -0
- package/lib/cjs/transactionPlan/midnight/reduceOnlySellFeasibility.js +51 -0
- package/lib/cjs/transactionPlan/midnight/repayWithdrawCollateral.d.ts +162 -0
- package/lib/cjs/transactionPlan/midnight/repayWithdrawCollateral.js +328 -0
- package/lib/cjs/transactionPlan/midnight/supplyBlueMakeLend.d.ts +155 -0
- package/lib/cjs/transactionPlan/midnight/supplyBlueMakeLend.js +199 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateral.d.ts +96 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateral.js +190 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateralBatch.d.ts +112 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateralBatch.js +221 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateralMakeBorrow.d.ts +129 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateralMakeBorrow.js +179 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateralWithNative.d.ts +115 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateralWithNative.js +259 -0
- package/lib/cjs/transactionPlan/midnight/takeBorrow.d.ts +304 -0
- package/lib/cjs/transactionPlan/midnight/takeBorrow.js +545 -0
- package/lib/cjs/transactionPlan/midnight/takeLend.d.ts +99 -0
- package/lib/cjs/transactionPlan/midnight/takeLend.js +263 -0
- package/lib/cjs/transactionPlan/midnight/takeRepayWithdrawCollateral.d.ts +175 -0
- package/lib/cjs/transactionPlan/midnight/takeRepayWithdrawCollateral.js +440 -0
- package/lib/cjs/transactionPlan/midnight/takeWithdraw.d.ts +139 -0
- package/lib/cjs/transactionPlan/midnight/takeWithdraw.js +240 -0
- package/lib/cjs/transactionPlan/midnight/validation.d.ts +22 -0
- package/lib/cjs/transactionPlan/midnight/validation.js +158 -0
- package/lib/cjs/transactionPlan/midnight/withdrawCollateral.d.ts +130 -0
- package/lib/cjs/transactionPlan/midnight/withdrawCollateral.js +228 -0
- package/lib/cjs/transactionPlan/midnight/withdrawCollateralBatch.d.ts +142 -0
- package/lib/cjs/transactionPlan/midnight/withdrawCollateralBatch.js +232 -0
- package/lib/cjs/transactionPlan/plan.d.ts +48 -14
- package/lib/cjs/transactionPlan/plan.js +103 -18
- package/lib/cjs/transactionPlan/requirements.d.ts +7 -4
- package/lib/cjs/transactionPlan/requirements.js +2 -2
- package/lib/cjs/transactionPlan/serde.d.ts +13 -2
- package/lib/cjs/transactionPlan/serde.js +68 -21
- package/lib/cjs/transactionPlan/types.d.ts +147 -0
- package/lib/cjs/transactionPlan/validateActions.d.ts +3 -1
- package/lib/cjs/transactionPlan/validateActions.js +31 -3
- package/lib/cjs/transactionPlan/validation.d.ts +1 -1
- package/lib/cjs/transactionPlan/validation.js +37 -1
- package/lib/cjs/types/error.d.ts +2 -0
- package/lib/cjs/types/error.js +2 -0
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/actions/midnight/redeem.d.ts +20 -3
- package/lib/esm/actions/midnight/redeem.js +56 -0
- package/lib/esm/actions/midnight/supplyCollateralWithNative.d.ts +24 -1
- package/lib/esm/actions/midnight/supplyCollateralWithNative.js +40 -0
- package/lib/esm/actions/midnight/withdrawCollateral.d.ts +16 -2
- package/lib/esm/actions/midnight/withdrawCollateral.js +25 -1
- package/lib/esm/helpers/callback.d.ts +3 -2
- package/lib/esm/helpers/callback.js +5 -21
- package/lib/esm/helpers/computeMidnightPostWithdrawalCollateral.d.ts +17 -0
- package/lib/esm/helpers/computeMidnightPostWithdrawalCollateral.js +27 -0
- package/lib/esm/helpers/parseMidnightMaker.d.ts +21 -0
- package/lib/esm/helpers/parseMidnightMaker.js +40 -1
- package/lib/esm/helpers/validate.d.ts +49 -1
- package/lib/esm/helpers/validate.js +84 -1
- package/lib/esm/helpers/validateMidnightPublication.d.ts +10 -0
- package/lib/esm/helpers/validateMidnightPublication.js +16 -0
- package/lib/esm/helpers/validateMidnightTakeableOfferFields.d.ts +28 -0
- package/lib/esm/helpers/validateMidnightTakeableOfferFields.js +81 -0
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js +1 -1
- package/lib/esm/midnight/utils.d.ts +1 -1
- package/lib/esm/midnight/utils.js +1 -1
- package/lib/esm/transactionPlan/blue/withdrawBuyCallback.d.ts +101 -0
- package/lib/esm/transactionPlan/blue/withdrawBuyCallback.js +259 -0
- package/lib/esm/transactionPlan/error.d.ts +27 -0
- package/lib/esm/transactionPlan/error.js +28 -0
- package/lib/esm/transactionPlan/index.d.ts +40 -1
- package/lib/esm/transactionPlan/index.js +20 -1
- package/lib/esm/transactionPlan/midnight/authorization.d.ts +15 -0
- package/lib/esm/transactionPlan/midnight/authorization.js +40 -0
- package/lib/esm/transactionPlan/midnight/cancelOffers.d.ts +80 -0
- package/lib/esm/transactionPlan/midnight/cancelOffers.js +120 -0
- package/lib/esm/transactionPlan/midnight/makeBorrow.d.ts +104 -0
- package/lib/esm/transactionPlan/midnight/makeBorrow.js +123 -0
- package/lib/esm/transactionPlan/midnight/makeLend.d.ts +140 -0
- package/lib/esm/transactionPlan/midnight/makeLend.js +172 -0
- package/lib/esm/transactionPlan/midnight/makeRepay.d.ts +118 -0
- package/lib/esm/transactionPlan/midnight/makeRepay.js +115 -0
- package/lib/esm/transactionPlan/midnight/makeWithdraw.d.ts +104 -0
- package/lib/esm/transactionPlan/midnight/makeWithdraw.js +123 -0
- package/lib/esm/transactionPlan/midnight/makerPublication.d.ts +55 -0
- package/lib/esm/transactionPlan/midnight/makerPublication.js +310 -0
- package/lib/esm/transactionPlan/midnight/market.d.ts +49 -0
- package/lib/esm/transactionPlan/midnight/market.js +112 -0
- package/lib/esm/transactionPlan/midnight/prepare.d.ts +244 -0
- package/lib/esm/transactionPlan/midnight/prepare.js +536 -0
- package/lib/esm/transactionPlan/midnight/publicationState.d.ts +24 -0
- package/lib/esm/transactionPlan/midnight/publicationState.js +47 -0
- package/lib/esm/transactionPlan/midnight/redeem.d.ts +102 -0
- package/lib/esm/transactionPlan/midnight/redeem.js +165 -0
- package/lib/esm/transactionPlan/midnight/reduceOnlySellFeasibility.d.ts +25 -0
- package/lib/esm/transactionPlan/midnight/reduceOnlySellFeasibility.js +47 -0
- package/lib/esm/transactionPlan/midnight/repayWithdrawCollateral.d.ts +162 -0
- package/lib/esm/transactionPlan/midnight/repayWithdrawCollateral.js +323 -0
- package/lib/esm/transactionPlan/midnight/supplyBlueMakeLend.d.ts +155 -0
- package/lib/esm/transactionPlan/midnight/supplyBlueMakeLend.js +196 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateral.d.ts +96 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateral.js +185 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateralBatch.d.ts +112 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateralBatch.js +216 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateralMakeBorrow.d.ts +129 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateralMakeBorrow.js +176 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateralWithNative.d.ts +115 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateralWithNative.js +254 -0
- package/lib/esm/transactionPlan/midnight/takeBorrow.d.ts +304 -0
- package/lib/esm/transactionPlan/midnight/takeBorrow.js +539 -0
- package/lib/esm/transactionPlan/midnight/takeLend.d.ts +99 -0
- package/lib/esm/transactionPlan/midnight/takeLend.js +258 -0
- package/lib/esm/transactionPlan/midnight/takeRepayWithdrawCollateral.d.ts +175 -0
- package/lib/esm/transactionPlan/midnight/takeRepayWithdrawCollateral.js +435 -0
- package/lib/esm/transactionPlan/midnight/takeWithdraw.d.ts +139 -0
- package/lib/esm/transactionPlan/midnight/takeWithdraw.js +236 -0
- package/lib/esm/transactionPlan/midnight/validation.d.ts +22 -0
- package/lib/esm/transactionPlan/midnight/validation.js +151 -0
- package/lib/esm/transactionPlan/midnight/withdrawCollateral.d.ts +130 -0
- package/lib/esm/transactionPlan/midnight/withdrawCollateral.js +223 -0
- package/lib/esm/transactionPlan/midnight/withdrawCollateralBatch.d.ts +142 -0
- package/lib/esm/transactionPlan/midnight/withdrawCollateralBatch.js +227 -0
- package/lib/esm/transactionPlan/plan.d.ts +48 -14
- package/lib/esm/transactionPlan/plan.js +99 -14
- package/lib/esm/transactionPlan/requirements.d.ts +7 -4
- package/lib/esm/transactionPlan/requirements.js +2 -2
- package/lib/esm/transactionPlan/serde.d.ts +13 -2
- package/lib/esm/transactionPlan/serde.js +49 -2
- package/lib/esm/transactionPlan/types.d.ts +147 -0
- package/lib/esm/transactionPlan/validateActions.d.ts +3 -1
- package/lib/esm/transactionPlan/validateActions.js +31 -3
- package/lib/esm/transactionPlan/validation.d.ts +1 -1
- package/lib/esm/transactionPlan/validation.js +38 -2
- package/lib/esm/types/error.d.ts +2 -0
- package/lib/esm/types/error.js +2 -0
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +2 -2
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { marketParamsAbi } from "@morpho-org/blue-sdk";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
/**
|
|
5
|
-
* `BlueBuyCallback` creation bytecode from `morpho-org/midnight` commit
|
|
6
|
-
* `4603969e`, embedded in every `midnightBlueBuyCallbackFactory` of the address registry.
|
|
7
|
-
*/
|
|
8
|
-
const blueBuyCallbackBytecode = "0x60e0806040523461012657606081611611803803809161001f828561012a565b8339810103126101265761003281610161565b9061004b604061004460208401610161565b9201610161565b908260805260a0528060c05260018060a01b031690813b15610126576040516207767560ed1b81526001600160a01b03909116600482015260016024820152905f908290604490829084905af1801561011b5761010b575b60405161149b9081610176823960805181818160b4015281816102fc0152818161078201528181610dfd0152611004015260a0518181816102210152610dc3015260c051818181610103015281816102650152818161067c015281816108660152610f5e0152f35b5f6101159161012a565b5f6100a3565b6040513d5f823e3d90fd5b5f80fd5b601f909101601f19168101906001600160401b0382119082101761014d57604052565b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036101265756fe6080806040526004361015610012575f80fd5b5f905f3560e01c908163117803e314610fe7575080631c0bb54d14610d585780631e686318146107ef5780638069218f1461043d578063affed0e014610420578063bc25cf7714610289578063c011ff6414610245578063dc400c12146102015763eecea00014610081575f80fd5b346101a15760403660031901126101a15761009a61107c565b9060243591821515908184036101fd576001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633036101ee576040516332f256cf60e11b81523060048201526001600160a01b038281166024830152939485947f000000000000000000000000000000000000000000000000000000000000000016939091602081604481885afa9081156101e35786916101b4575b5015150361014a57505050f35b823b156101af576040516207767560ed1b81526001600160a01b03929092166004830152151560248201529082908290604490829084905af180156101a4576101905750f35b8161019a91611044565b6101a15780f35b80fd5b6040513d84823e3d90fd5b505050fd5b6101d6915060203d6020116101dc575b6101ce8183611044565b810190611358565b5f61013d565b503d6101c4565b6040513d88823e3d90fd5b6330cd747160e01b8352600483fd5b8280fd5b50346101a157806003193601126101a15760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346101a157806003193601126101a15760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346101a15760203660031901126101a1576102a361107c565b6040516370a0823160e01b81523060048201526001600160a01b03821691602082602481865afa9182156104155784926103dd575b50803b156103ce5760405163a9059cbb60e01b602082019081526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660248301526044820184905285928392909190839061034881606481015b03601f198101835282611044565b51925af1610354611370565b90156103c65780519081159182156103ac575b50501561039d576040519081527f2ae72b44f59d038340fca5739135a1d51fc5ab720bb02d983e4c5ff4119ca7b860203392a380f35b630bc11c3f60e21b8352600483fd5b6103bf9250602080918301019101611358565b5f80610367565b602081519101fd5b633c11a9c560e21b8452600484fd5b9091506020813d60201161040d575b816103f960209383611044565b810103126104095751905f6102d8565b5f80fd5b3d91506103ec565b6040513d86823e3d90fd5b50346101a157806003193601126101a15760209054604051908152f35b503461040957366003190161010081126104095760a0136104095760405161046481611028565b61046c61107c565b8152602435906001600160a01b038216820361040957602081019182526044359182151583036104095760408201928352606082019160643583526084356080820190808252606060a3193601126104095742116107e05783515f54905f1982146107cc57600182015f55036107bd5760405160208101917f81d0284fb0e2cde18d0553b06189d6f7613c96a01bb5b5e7828eade6a0dcac9183526001600160a01b0384511660408301526001600160a01b038551166060830152865115156080830152855160a08301525160c082015260c0815261054c60e082611044565b51902060405160208101907f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218825246604082015230606082015260608152610595608082611044565b5190209060405190602082019261190160f01b845260228301526042820152604281526105c3606282611044565b51902060a4359060ff82168092036104095760805f916020936040519182528482015260c435604082015260e435606082015282805260015afa1561073b576001600160a01b035f511680151591826107a9575b5081610776575b5015610767576106af91516040519081527fbae999fc435f6200224444d8535f1936f9abd69060fcaec680f690f1810ae36a60203392a280516040516332f256cf60e11b81523060048201526001600160a01b0391821660248201527f0000000000000000000000000000000000000000000000000000000000000000909116939092602090849081906044820190565b0381875afa92831561073b575f93610746575b5051151580921515036106d3578380f35b516001600160a01b031690823b15610409576040516207767560ed1b81526001600160a01b0392909216600483015215156024820152905f908290604490829084905af1801561073b57610728575b80808380f35b61073491505f90611044565b5f5f610722565b6040513d5f823e3d90fd5b61076091935060203d6020116101dc576101ce8183611044565b915f6106c2565b638baa579f60e01b5f5260045ffd5b90506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145f61061e565b516001600160a01b0316811491505f610617565b633ab3447f60e11b5f5260045ffd5b634e487b7160e01b5f52601160045260245ffd5b630f05f5bf60e01b5f5260045ffd5b346104095760803660031901126104095760243567ffffffffffffffff8111610409576108209036906004016110a6565b50610829611066565b5060643567ffffffffffffffff81116104095761084d61085c91369060040161122a565b60208082518301019101611284565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169060a0812060405190632e3071cd60e11b8252600482015260c081602481865afa90811561073b575f91610ca8575b50608081016108ce6001600160801b038251164261134b565b9081151580610c92575b80610c7c575b610a82575b50506001600160801b03815116906001600160801b03604081602084015116920151169060a08420604051906349e2903160e11b82526004820152306024820152606081604481895afa90811561073b575f916109f9575b505160018401928385116107cc57620f424083018093116107cc576109766001600160a01b039361097160209661097c956113cc565b611470565b9461134b565b935116936024604051809681936370a0823160e01b835260048301525afa91821561073b575f926109c4575b6020935081811090821802186040519181811090821802188152f35b91506020833d6020116109f1575b816109df60209383611044565b810103126104095760209251916109a8565b3d91506109d2565b90506060813d606011610a7a575b81610a1460609383611044565b8101031261040957604051906060820182811067ffffffffffffffff821117610a6657610a5b91604091825280518452610a5060208201611337565b602085015201611337565b60408201528661093b565b634e487b7160e01b5f52604160045260245ffd5b3d9150610a07565b6060840151604051638c00bf6b60e01b8152906001600160a01b0316610aab60048301876112e6565b6001600160801b0385511660a483015260208501936001600160801b0385511660c48401526001600160801b0360408701948186511660e48601528160608901511661010486015251166101248401526020836101648160a08a01956001600160801b038751166101448301525afa92831561073b575f93610c46575b50610b8b6001600160801b0393610b85610b4f670de0b6b3a76400009487895116936113cc565b610b80671bc16d674ec80000610b6583806113cc565b046729a2241af62c0000610b7984836113cc565b04926113bf565b6113bf565b906113cc565b049282610ba3610b9a866113df565b8284511661139f565b16905281610bbc610bb3856113df565b8288511661139f565b16855251169081610bce575b506108e3565b670de0b6b3a764000091610be1916113cc565b04610bf6816001600160801b0385511661134b565b6001600160801b0383511691620f424083018093116107cc57600182018092116107cc57610c36610c3b926109716001600160801b0395610b9a946113cc565b6113df565b169052838080610bc8565b92506020833d602011610c74575b81610c6160209383611044565b8101031261040957915191610b8b610b28565b3d9150610c54565b506001600160a01b0360608501511615156108de565b506001600160801b0360408401511615156108d8565b905060c0813d60c011610d50575b81610cc360c09383611044565b81010312610409576040519060c0820182811067ffffffffffffffff821117610a6657610d459160a091604052610cf981611337565b8452610d0760208201611337565b6020850152610d1860408201611337565b6040850152610d2960608201611337565b6060850152610d3a60808201611337565b608085015201611337565b60a0820152836108b5565b3d9150610cb6565b346104095760e03660031901126104095760243567ffffffffffffffff811161040957610d899036906004016110a6565b60443560a435916001600160a01b0383168093036104095760c43567ffffffffffffffff811161040957610dc190369060040161122a565b7f0000000000000000000000000000000000000000000000000000000000000000936001600160a01b0385163303610fd8576001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001603610fc95780602080610e3593518301019101611284565b60406001600160a01b038251169201916001600160a01b0383511603610fba5782610f17575b505160405163095ea7b360e01b602082019081526001600160a01b03948516602483015260448201939093525f938493921691908390610e9e816064810161033a565b51925af1610eaa611370565b90156103c6578051908115918215610efd575b505015610eee5760206040517f7f87788ea698181ea4d28d1576d0ba4fc92c0dbe5bf75b43692af2ce91dbaea28152f35b631f55ddd960e21b5f5260045ffd5b610f109250602080918301019101611358565b8180610ebd565b604051635c2bea4960e01b815290610f339060048301906112e6565b8260a48201525f60c48201523060e482015230610104820152604081610124815f6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165af1801561073b5715610e5b57604090819392933d8311610fb3575b610fa48183611044565b81010312610409579083610e5b565b503d610f9a565b63effb039160e01b5f5260045ffd5b631ec6e83760e21b5f5260045ffd5b631e6a35c760e01b5f5260045ffd5b34610409575f366003190112610409576020906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b60a0810190811067ffffffffffffffff821117610a6657604052565b90601f8019910116810190811067ffffffffffffffff821117610a6657604052565b604435906001600160a01b038216820361040957565b600435906001600160a01b038216820361040957565b35906001600160a01b038216820361040957565b919091610100818403126104095760405190610100820182811067ffffffffffffffff821117610a66576040528193813583526110e560208301611092565b60208401526110f660408301611092565b6040840152606082013567ffffffffffffffff811161040957820181601f820112156104095780359067ffffffffffffffff8211610a66576040519261114260208460051b0185611044565b82845260208085019360071b8301019181831161040957602001925b8284106111a6575050505060e080926111a19260608601526080810135608086015260a081013560a086015261119660c08201611092565b60c086015201611092565b910152565b6080848303126104095760405190608082019082821067ffffffffffffffff831117610a66576080926020926040526111de87611092565b81528287013583820152604087013560408201526111fe60608801611092565b606082015281520193019261115e565b67ffffffffffffffff8111610a6657601f01601f191660200190565b81601f82011215610409578035906112418261120e565b9261124f6040519485611044565b8284526020838301011161040957815f926020809301838601378301015290565b51906001600160a01b038216820361040957565b908160a09103126104095760806040519161129e83611028565b6112a781611270565b83526112b560208201611270565b60208401526112c660408201611270565b60408401526112d760608201611270565b60608401520151608082015290565b608080916001600160a01b0381511684526001600160a01b0360208201511660208501526001600160a01b0360408201511660408501526001600160a01b0360608201511660608501520151910152565b51906001600160801b038216820361040957565b919082039182116107cc57565b90816020910312610409575180151581036104095790565b3d1561139a573d906113818261120e565b9161138f6040519384611044565b82523d5f602084013e565b606090565b906001600160801b03809116911601906001600160801b0382116107cc57565b919082018092116107cc57565b818102929181159184041417156107cc57565b6040516113ed604082611044565b6014815260208101907f6d61782075696e7431323820657863656564656400000000000000000000000082526001600160801b0383116114355750506001600160801b031690565b60449060405192839162461bcd60e51b8352602060048401525180918160248501528484015e5f828201840152601f01601f19168101030190fd5b811561147a570490565b634e487b7160e01b5f52601260045260245ffdfea164736f6c6343000822000a";
|
|
2
|
+
import { getBlueBuyCallbackAddress } from "@morpho-org/midnight-sdk";
|
|
3
|
+
import { encodeAbiParameters } from "viem";
|
|
9
4
|
/**
|
|
10
5
|
* Computes the CREATE2 address of `owner`'s `BlueBuyCallback` for `salt`, as deployed or
|
|
11
6
|
* returned by the chain's `midnightBlueBuyCallbackFactory.createBlueBuyCallback(owner, salt)`.
|
|
12
7
|
*
|
|
13
|
-
* Use it to fill each offer's `callback` before calling `supplyBlueMakeLend`.
|
|
8
|
+
* Use it to fill each offer's `callback` before calling `supplyBlueMakeLend`. It is the
|
|
9
|
+
* Midnight-qualified name of midnight-sdk's `getBlueBuyCallbackAddress`.
|
|
14
10
|
*
|
|
15
11
|
* @param params.chainId - Chain whose `midnightBlueBuyCallbackFactory`, `midnight` and `blue` are used.
|
|
16
12
|
* @param params.owner - Callback owner, the maker.
|
|
@@ -34,19 +30,7 @@ const blueBuyCallbackBytecode = "0x60e080604052346101265760608161161180380380916
|
|
|
34
30
|
* // `callbackFor(maker)` returns the maker's BlueBuyCallback address, deployed or not.
|
|
35
31
|
* ```
|
|
36
32
|
*/
|
|
37
|
-
export const getMidnightBlueBuyCallbackAddress = (
|
|
38
|
-
opcode: "CREATE2",
|
|
39
|
-
from: getChainAddress(chainId, "midnightBlueBuyCallbackFactory"),
|
|
40
|
-
salt,
|
|
41
|
-
bytecode: concatHex([
|
|
42
|
-
blueBuyCallbackBytecode,
|
|
43
|
-
encodeAbiParameters([{ type: "address" }, { type: "address" }, { type: "address" }], [
|
|
44
|
-
owner,
|
|
45
|
-
getChainAddress(chainId, "midnight"),
|
|
46
|
-
getChainAddress(chainId, "blue"),
|
|
47
|
-
]),
|
|
48
|
-
]),
|
|
49
|
-
});
|
|
33
|
+
export const getMidnightBlueBuyCallbackAddress = (params) => getBlueBuyCallbackAddress(params);
|
|
50
34
|
/**
|
|
51
35
|
* Returns the `callbackData` every `supplyBlueMakeLend` offer must carry: `abi.encode(blueMarket)`.
|
|
52
36
|
*
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IMarketParams, Market } from "@morpho-org/midnight-sdk";
|
|
2
|
+
import type { MidnightCollateralTransfer } from "../types/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* @internal Applies Midnight bundle withdrawals to a collateral snapshot in order. Callers parse the
|
|
5
|
+
* withdrawals first, so every `collateralIndex` is configured on `market`.
|
|
6
|
+
* A maxUint256 withdrawal uses the balance left at its index by earlier withdrawals.
|
|
7
|
+
* @throws {WithdrawExceedsCollateralError} If a withdrawal exceeds the remaining balance.
|
|
8
|
+
*/
|
|
9
|
+
export declare function computeMidnightPostWithdrawalCollateral({ market, marketId, collateral, withdrawals, }: {
|
|
10
|
+
readonly market: IMarketParams;
|
|
11
|
+
readonly marketId: Market["id"];
|
|
12
|
+
readonly collateral: readonly bigint[];
|
|
13
|
+
readonly withdrawals: readonly MidnightCollateralTransfer[];
|
|
14
|
+
}): {
|
|
15
|
+
postCollateral: bigint[];
|
|
16
|
+
withdrawAmount: bigint;
|
|
17
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { maxUint256 } from "viem";
|
|
2
|
+
import { WithdrawExceedsCollateralError } from "../types/error.js";
|
|
3
|
+
/**
|
|
4
|
+
* @internal Applies Midnight bundle withdrawals to a collateral snapshot in order. Callers parse the
|
|
5
|
+
* withdrawals first, so every `collateralIndex` is configured on `market`.
|
|
6
|
+
* A maxUint256 withdrawal uses the balance left at its index by earlier withdrawals.
|
|
7
|
+
* @throws {WithdrawExceedsCollateralError} If a withdrawal exceeds the remaining balance.
|
|
8
|
+
*/
|
|
9
|
+
export function computeMidnightPostWithdrawalCollateral({ market, marketId, collateral, withdrawals, }) {
|
|
10
|
+
const postCollateral = Array.from({ length: market.collateralParams.length }, (_, index) => collateral[index] ?? 0n);
|
|
11
|
+
let withdrawAmount = 0n;
|
|
12
|
+
for (const { collateralIndex, assets } of withdrawals) {
|
|
13
|
+
const index = Number(collateralIndex);
|
|
14
|
+
const available = postCollateral[index] ?? 0n;
|
|
15
|
+
const amount = assets === maxUint256 ? available : assets;
|
|
16
|
+
if (amount > available) {
|
|
17
|
+
throw new WithdrawExceedsCollateralError({
|
|
18
|
+
withdrawAmount: amount,
|
|
19
|
+
available,
|
|
20
|
+
market: marketId,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
postCollateral[index] = available - amount;
|
|
24
|
+
withdrawAmount += amount;
|
|
25
|
+
}
|
|
26
|
+
return { postCollateral, withdrawAmount };
|
|
27
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Tree, type TreeCreateRequest } from "@morpho-org/midnight-sdk";
|
|
2
2
|
import { type Address, type Hex } from "viem";
|
|
3
|
+
import type { MidnightCancelAndMakeParams } from "../types/midnightCancelAndMake.js";
|
|
3
4
|
/** Preserves maker and sell-receiver errors before the upstream tree constructor. @internal */
|
|
4
5
|
export declare const parseMidnightMakerTree: (params: {
|
|
5
6
|
readonly offers: Extract<TreeCreateRequest, {
|
|
@@ -42,3 +43,23 @@ export declare const parseMidnightMakerFundingBinding: (params: {
|
|
|
42
43
|
}) => {
|
|
43
44
|
loanToken: `0x${string}`;
|
|
44
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Rejects malformed cancellations before any maker-state read, with the bundle parser's checks
|
|
48
|
+
* and order: group hex, then each ceiling's type, bounds and duplicate, then overlap with the new
|
|
49
|
+
* tree. Used by TransactionPlan maker constructors; entity flows run these checks in the bundle
|
|
50
|
+
* parser.
|
|
51
|
+
*
|
|
52
|
+
* @param params.cancellations - Groups to cancel with their consumption ceilings.
|
|
53
|
+
* @param params.tree - Parsed offer tree whose groups the bundle publishes.
|
|
54
|
+
* @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
|
|
55
|
+
* @throws {InvalidBigIntInputError} when a `maxConsumed` ceiling is not a bigint.
|
|
56
|
+
* @throws {NegativeInputError} when a `maxConsumed` ceiling is negative.
|
|
57
|
+
* @throws {InputExceedsMaxError} when a `maxConsumed` ceiling exceeds uint128.
|
|
58
|
+
* @throws {DuplicateMidnightGroupCancellationError} when a group is cancelled more than once.
|
|
59
|
+
* @throws {MidnightReplacementGroupCancelledError} when a cancelled group is in the new tree.
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
export declare const validateMidnightMakerCancellations: (params: {
|
|
63
|
+
readonly cancellations: MidnightCancelAndMakeParams["cancellations"];
|
|
64
|
+
readonly tree: ReturnType<typeof parseMidnightMakerTree>;
|
|
65
|
+
}) => void;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Tree } from "@morpho-org/midnight-sdk";
|
|
2
2
|
import { getChainAddress } from "@morpho-org/morpho-ts";
|
|
3
3
|
import { isAddressEqual, zeroAddress } from "viem";
|
|
4
|
-
import { MidnightOfferCallbackDataMismatchError, MidnightOfferCallbackMismatchError, MidnightOfferContinuousFeeCapError, MidnightOfferMakerMismatchError, MidnightOfferMarketAddressMismatchError, MidnightOfferMarketChainMismatchError, MidnightOfferMarketLoanTokenMismatchError, MidnightOfferNotReduceOnlyError, MidnightOfferRatifierMismatchError, MidnightOfferReduceOnlyError, MidnightOfferSellerReceiverMismatchError, } from "../types/index.js";
|
|
4
|
+
import { DuplicateMidnightGroupCancellationError, InvalidBigIntInputError, MidnightOfferCallbackDataMismatchError, MidnightOfferCallbackMismatchError, MidnightOfferContinuousFeeCapError, MidnightOfferMakerMismatchError, MidnightOfferMarketAddressMismatchError, MidnightOfferMarketChainMismatchError, MidnightOfferMarketLoanTokenMismatchError, MidnightOfferNotReduceOnlyError, MidnightOfferRatifierMismatchError, MidnightOfferReduceOnlyError, MidnightOfferSellerReceiverMismatchError, MidnightReplacementGroupCancelledError, } from "../types/index.js";
|
|
5
5
|
import { wrapMidnightEncoding } from "./encodeMidnightCalldata.js";
|
|
6
|
+
import { validateMidnightUint128Field } from "./validateMidnightBounds.js";
|
|
7
|
+
import { validateMidnightCancellationGroups } from "./validateMidnightPublication.js";
|
|
6
8
|
import { validateOfferSides } from "./validateOfferSides.js";
|
|
7
9
|
/** Preserves maker and sell-receiver errors before the upstream tree constructor. @internal */
|
|
8
10
|
export const parseMidnightMakerTree = (params) => {
|
|
@@ -145,3 +147,40 @@ export const parseMidnightMakerFundingBinding = (params) => {
|
|
|
145
147
|
});
|
|
146
148
|
return { loanToken: params.loanToken };
|
|
147
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* Rejects malformed cancellations before any maker-state read, with the bundle parser's checks
|
|
152
|
+
* and order: group hex, then each ceiling's type, bounds and duplicate, then overlap with the new
|
|
153
|
+
* tree. Used by TransactionPlan maker constructors; entity flows run these checks in the bundle
|
|
154
|
+
* parser.
|
|
155
|
+
*
|
|
156
|
+
* @param params.cancellations - Groups to cancel with their consumption ceilings.
|
|
157
|
+
* @param params.tree - Parsed offer tree whose groups the bundle publishes.
|
|
158
|
+
* @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
|
|
159
|
+
* @throws {InvalidBigIntInputError} when a `maxConsumed` ceiling is not a bigint.
|
|
160
|
+
* @throws {NegativeInputError} when a `maxConsumed` ceiling is negative.
|
|
161
|
+
* @throws {InputExceedsMaxError} when a `maxConsumed` ceiling exceeds uint128.
|
|
162
|
+
* @throws {DuplicateMidnightGroupCancellationError} when a group is cancelled more than once.
|
|
163
|
+
* @throws {MidnightReplacementGroupCancelledError} when a cancelled group is in the new tree.
|
|
164
|
+
* @internal
|
|
165
|
+
*/
|
|
166
|
+
export const validateMidnightMakerCancellations = (params) => {
|
|
167
|
+
const { cancellations, tree } = params;
|
|
168
|
+
validateMidnightCancellationGroups(cancellations);
|
|
169
|
+
const cancelledGroups = new Set();
|
|
170
|
+
for (const [index, { group, maxConsumed }] of cancellations.entries()) {
|
|
171
|
+
if (typeof maxConsumed !== "bigint") {
|
|
172
|
+
throw new InvalidBigIntInputError(`cancellations[${index}].maxConsumed`, maxConsumed);
|
|
173
|
+
}
|
|
174
|
+
validateMidnightUint128Field(`cancellations[${index}].maxConsumed`, maxConsumed);
|
|
175
|
+
const key = group.toLowerCase();
|
|
176
|
+
if (cancelledGroups.has(key)) {
|
|
177
|
+
throw new DuplicateMidnightGroupCancellationError({ index, group });
|
|
178
|
+
}
|
|
179
|
+
cancelledGroups.add(key);
|
|
180
|
+
}
|
|
181
|
+
for (const { group } of tree.offers) {
|
|
182
|
+
if (cancelledGroups.has(group.toLowerCase())) {
|
|
183
|
+
throw new MidnightReplacementGroupCancelledError({ group });
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AccrualPosition, type InputMarketParams, type MarketId, type MarketParams } from "@morpho-org/blue-sdk";
|
|
2
2
|
import { type Market as MidnightMarket, type MarketInput as MidnightMarketInput } from "@morpho-org/midnight-sdk";
|
|
3
3
|
import { type Address } from "viem";
|
|
4
|
-
import { type VaultV2BlueReallocation } from "../types/index.js";
|
|
4
|
+
import { type MidnightCollateralTransfer, type MidnightRepay, type VaultV2BlueReallocation } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Rejects a reference time that is not a bigint, so a serialized timestamp fails with a typed
|
|
7
7
|
* error before any deadline arithmetic.
|
|
@@ -223,6 +223,54 @@ export declare const getMidnightMaxSafeDebt: (params: {
|
|
|
223
223
|
readonly collateral: readonly bigint[];
|
|
224
224
|
readonly collateralPrices: readonly bigint[];
|
|
225
225
|
}) => bigint;
|
|
226
|
+
/**
|
|
227
|
+
* @internal Rejects a Midnight borrow whose post-borrow debt exceeds the collateral's capacity at
|
|
228
|
+
* LLTV minus `DEFAULT_LLTV_BUFFER`, with the same check and error as the entity borrow flows.
|
|
229
|
+
* Used by TransactionPlan preparers; the entity keeps its inline check.
|
|
230
|
+
*/
|
|
231
|
+
export declare const validateMidnightBorrowHealth: (params: {
|
|
232
|
+
readonly market: MidnightMarket;
|
|
233
|
+
readonly collateral: readonly bigint[];
|
|
234
|
+
readonly collateralPrices: readonly bigint[];
|
|
235
|
+
readonly debt: bigint;
|
|
236
|
+
readonly borrowUnits: bigint;
|
|
237
|
+
}) => void;
|
|
238
|
+
/**
|
|
239
|
+
* @internal Rejects a Midnight collateral withdrawal whose post-operation debt exceeds the remaining
|
|
240
|
+
* collateral's capacity at LLTV minus `DEFAULT_LLTV_BUFFER`, with the same check and error as the
|
|
241
|
+
* entity withdraw and repay-withdraw flows. Used by TransactionPlan preparers; the entity keeps its
|
|
242
|
+
* inline checks.
|
|
243
|
+
*/
|
|
244
|
+
export declare const validateMidnightWithdrawHealth: (params: {
|
|
245
|
+
readonly market: MidnightMarket;
|
|
246
|
+
readonly collateral: readonly bigint[];
|
|
247
|
+
readonly collateralPrices: readonly bigint[];
|
|
248
|
+
readonly debt: bigint;
|
|
249
|
+
readonly withdrawAmount: bigint;
|
|
250
|
+
}) => void;
|
|
251
|
+
/**
|
|
252
|
+
* @internal Checks a direct Midnight repayment and collateral withdrawal against the position
|
|
253
|
+
* snapshot, in order: each withdrawal against the remaining collateral, an exact repayment against
|
|
254
|
+
* the debt, a full repayment cap against the debt, then the remaining debt against the remaining
|
|
255
|
+
* collateral's buffered capacity when collateral is withdrawn. Matches the entity
|
|
256
|
+
* `repayWithdrawCollateral` checks; used by TransactionPlan preparers, while the entity keeps its
|
|
257
|
+
* inline checks. Callers parse the withdrawals first.
|
|
258
|
+
* @throws {WithdrawExceedsCollateralError} If a withdrawal exceeds the remaining collateral.
|
|
259
|
+
* @throws {MidnightRepayExceedsDebtError} If an exact repayment exceeds the debt.
|
|
260
|
+
* @throws {MidnightTakeTargetUnreachableError} If a full repayment cap is below the debt.
|
|
261
|
+
* @throws {MissingMarketPriceError} If remaining collateral has no price for the health check.
|
|
262
|
+
* @throws {WithdrawMakesPositionUnhealthyError} If the remaining debt exceeds buffered capacity.
|
|
263
|
+
*/
|
|
264
|
+
export declare const validateMidnightRepayWithdrawCollateralPosition: (params: {
|
|
265
|
+
readonly marketData: MidnightMarket;
|
|
266
|
+
readonly positionData: {
|
|
267
|
+
readonly collateral: readonly bigint[];
|
|
268
|
+
readonly debt: bigint;
|
|
269
|
+
};
|
|
270
|
+
readonly collateralPrices: readonly bigint[];
|
|
271
|
+
readonly repay: MidnightRepay;
|
|
272
|
+
readonly collateralWithdrawals: readonly MidnightCollateralTransfer[];
|
|
273
|
+
}) => void;
|
|
226
274
|
/**
|
|
227
275
|
* Validates that the resulting position stays within the safe LTV threshold
|
|
228
276
|
* (LLTV minus buffer) after supplying additional collateral and borrowing.
|
|
@@ -2,7 +2,8 @@ import { getChainAddresses, MarketUtils, MathLib, ORACLE_PRICE_SCALE, } from "@m
|
|
|
2
2
|
import { MarketUtils as MidnightMarketUtils, } from "@morpho-org/midnight-sdk";
|
|
3
3
|
import { isDefined, isHexEqual } from "@morpho-org/morpho-ts";
|
|
4
4
|
import { isAddress, isAddressEqual, maxUint128, maxUint256, zeroAddress, } from "viem";
|
|
5
|
-
import { AccrualPositionUserMismatchError, AddressMismatchError, BorrowExceedsSafeLtvError, ChainIdMismatchError, ChainWNativeMissingError, ExcessiveSlippageToleranceError, InconsistentReallocationPenaltyError, InputExceedsMaxError, InvalidBigIntInputError, InvalidMidnightNativeAmountTypeError, InvalidReallocationAddressError, InvalidReallocationSourceTypeError, InvalidVaultV2BlueReallocationShapeError, MarketIdMismatchError, MissingClientPropertyError, MissingMarketPriceError, NativeAmountOnNonWNativeAssetError, NativeAmountOnNonWNativeVaultError, NegativeInputError, NonPositiveInputError, ReallocationWithdrawalOnTargetMarketError, ReferralFeePctExceededError, ReferralFeeRecipientMissingError, RepayExceedsDebtError, RepaySharesExceedDebtError, WithdrawExceedsCollateralError, WithdrawExceedsSupplyError, WithdrawMakesPositionUnhealthyError, WithdrawSharesExceedSupplyError, } from "../types/index.js";
|
|
5
|
+
import { AccrualPositionUserMismatchError, AddressMismatchError, BorrowExceedsSafeLtvError, ChainIdMismatchError, ChainWNativeMissingError, ExcessiveSlippageToleranceError, InconsistentReallocationPenaltyError, InputExceedsMaxError, InvalidBigIntInputError, InvalidMidnightNativeAmountTypeError, InvalidReallocationAddressError, InvalidReallocationSourceTypeError, InvalidVaultV2BlueReallocationShapeError, MarketIdMismatchError, MidnightRepayExceedsDebtError, MidnightTakeTargetUnreachableError, MissingClientPropertyError, MissingMarketPriceError, NativeAmountOnNonWNativeAssetError, NativeAmountOnNonWNativeVaultError, NegativeInputError, NonPositiveInputError, ReallocationWithdrawalOnTargetMarketError, ReferralFeePctExceededError, ReferralFeeRecipientMissingError, RepayExceedsDebtError, RepaySharesExceedDebtError, WithdrawExceedsCollateralError, WithdrawExceedsSupplyError, WithdrawMakesPositionUnhealthyError, WithdrawSharesExceedSupplyError, } from "../types/index.js";
|
|
6
|
+
import { computeMidnightPostWithdrawalCollateral } from "./computeMidnightPostWithdrawalCollateral.js";
|
|
6
7
|
import { DEFAULT_LLTV_BUFFER, MAX_SLIPPAGE_TOLERANCE, VAULT_DEPOSIT_MAX_DEADLINE_SECONDS, } from "./constant.js";
|
|
7
8
|
import { resolveMaxPenalty } from "./reallocationPenalty.js";
|
|
8
9
|
import { validateMidnightAddress } from "./validateMidnightAccount.js";
|
|
@@ -307,6 +308,88 @@ export const getMidnightMaxSafeDebt = (params) => {
|
|
|
307
308
|
}
|
|
308
309
|
return maxSafeDebt;
|
|
309
310
|
};
|
|
311
|
+
/**
|
|
312
|
+
* @internal Rejects a Midnight borrow whose post-borrow debt exceeds the collateral's capacity at
|
|
313
|
+
* LLTV minus `DEFAULT_LLTV_BUFFER`, with the same check and error as the entity borrow flows.
|
|
314
|
+
* Used by TransactionPlan preparers; the entity keeps its inline check.
|
|
315
|
+
*/
|
|
316
|
+
export const validateMidnightBorrowHealth = (params) => {
|
|
317
|
+
const postDebt = params.debt + params.borrowUnits;
|
|
318
|
+
if (postDebt <= 0n) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const maxSafeDebt = getMidnightMaxSafeDebt(params);
|
|
322
|
+
if (postDebt > maxSafeDebt) {
|
|
323
|
+
throw new BorrowExceedsSafeLtvError(params.borrowUnits, MathLib.zeroFloorSub(maxSafeDebt, params.debt));
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
* @internal Rejects a Midnight collateral withdrawal whose post-operation debt exceeds the remaining
|
|
328
|
+
* collateral's capacity at LLTV minus `DEFAULT_LLTV_BUFFER`, with the same check and error as the
|
|
329
|
+
* entity withdraw and repay-withdraw flows. Used by TransactionPlan preparers; the entity keeps its
|
|
330
|
+
* inline checks.
|
|
331
|
+
*/
|
|
332
|
+
export const validateMidnightWithdrawHealth = (params) => {
|
|
333
|
+
if (params.debt <= 0n) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const maxSafeDebt = getMidnightMaxSafeDebt(params);
|
|
337
|
+
if (params.debt > maxSafeDebt) {
|
|
338
|
+
throw new WithdrawMakesPositionUnhealthyError({
|
|
339
|
+
withdrawAmount: params.withdrawAmount,
|
|
340
|
+
borrowAssets: params.debt,
|
|
341
|
+
maxSafeBorrow: maxSafeDebt,
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
/**
|
|
346
|
+
* @internal Checks a direct Midnight repayment and collateral withdrawal against the position
|
|
347
|
+
* snapshot, in order: each withdrawal against the remaining collateral, an exact repayment against
|
|
348
|
+
* the debt, a full repayment cap against the debt, then the remaining debt against the remaining
|
|
349
|
+
* collateral's buffered capacity when collateral is withdrawn. Matches the entity
|
|
350
|
+
* `repayWithdrawCollateral` checks; used by TransactionPlan preparers, while the entity keeps its
|
|
351
|
+
* inline checks. Callers parse the withdrawals first.
|
|
352
|
+
* @throws {WithdrawExceedsCollateralError} If a withdrawal exceeds the remaining collateral.
|
|
353
|
+
* @throws {MidnightRepayExceedsDebtError} If an exact repayment exceeds the debt.
|
|
354
|
+
* @throws {MidnightTakeTargetUnreachableError} If a full repayment cap is below the debt.
|
|
355
|
+
* @throws {MissingMarketPriceError} If remaining collateral has no price for the health check.
|
|
356
|
+
* @throws {WithdrawMakesPositionUnhealthyError} If the remaining debt exceeds buffered capacity.
|
|
357
|
+
*/
|
|
358
|
+
export const validateMidnightRepayWithdrawCollateralPosition = (params) => {
|
|
359
|
+
const { marketData, positionData, repay, collateralWithdrawals } = params;
|
|
360
|
+
const { debt } = positionData;
|
|
361
|
+
const { postCollateral, withdrawAmount } = computeMidnightPostWithdrawalCollateral({
|
|
362
|
+
market: marketData.params,
|
|
363
|
+
marketId: marketData.id,
|
|
364
|
+
collateral: positionData.collateral,
|
|
365
|
+
withdrawals: collateralWithdrawals,
|
|
366
|
+
});
|
|
367
|
+
// The bundle must fill the whole assets target and the direct repay is capped at the debt, so a repay above it reverts `OutOfOffers()`.
|
|
368
|
+
if (repay.type === "assets" && repay.assets > debt) {
|
|
369
|
+
throw new MidnightRepayExceedsDebtError({
|
|
370
|
+
field: "repay.assets",
|
|
371
|
+
value: repay.assets,
|
|
372
|
+
debt,
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
if (repay.type === "full" && repay.maxBuyerAssets < debt) {
|
|
376
|
+
throw new MidnightTakeTargetUnreachableError({
|
|
377
|
+
field: "repay.maxBuyerAssets",
|
|
378
|
+
value: repay.maxBuyerAssets,
|
|
379
|
+
limit: debt,
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
if (collateralWithdrawals.length === 0) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
validateMidnightWithdrawHealth({
|
|
386
|
+
market: marketData,
|
|
387
|
+
collateral: postCollateral,
|
|
388
|
+
collateralPrices: params.collateralPrices,
|
|
389
|
+
debt: repay.type === "assets" && debt > repay.assets ? debt - repay.assets : 0n,
|
|
390
|
+
withdrawAmount,
|
|
391
|
+
});
|
|
392
|
+
};
|
|
310
393
|
/**
|
|
311
394
|
* Validates that the resulting position stays within the safe LTV threshold
|
|
312
395
|
* (LLTV minus buffer) after supplying additional collateral and borrowing.
|
|
@@ -37,3 +37,13 @@ export declare const validateMidnightPublication: (params: MidnightCancelAndMake
|
|
|
37
37
|
* @throws {InvalidMidnightHexInputError} when `value` is not exactly 32 bytes of hex.
|
|
38
38
|
*/
|
|
39
39
|
export declare const validateMidnightBytes32: (field: string, value: Hex) => void;
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
* Validates every cancelled group as 32-byte hex, in input order, with the same checks and error
|
|
43
|
+
* labels as {@link validateMidnightPublication}. Used by TransactionPlan maker constructors before
|
|
44
|
+
* any state read; entity flows keep the check inside the bundle parser.
|
|
45
|
+
*
|
|
46
|
+
* @param cancellations - Groups to cancel with their consumption ceilings.
|
|
47
|
+
* @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
|
|
48
|
+
*/
|
|
49
|
+
export declare const validateMidnightCancellationGroups: (cancellations: MidnightCancelAndMakeParams["cancellations"]) => void;
|
|
@@ -149,3 +149,19 @@ const validateHexInput = (value, field, size) => {
|
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
|
+
/**
|
|
153
|
+
* @internal
|
|
154
|
+
* Validates every cancelled group as 32-byte hex, in input order, with the same checks and error
|
|
155
|
+
* labels as {@link validateMidnightPublication}. Used by TransactionPlan maker constructors before
|
|
156
|
+
* any state read; entity flows keep the check inside the bundle parser.
|
|
157
|
+
*
|
|
158
|
+
* @param cancellations - Groups to cancel with their consumption ceilings.
|
|
159
|
+
* @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
|
|
160
|
+
*/
|
|
161
|
+
export const validateMidnightCancellationGroups = (cancellations) => {
|
|
162
|
+
for (const [index, { group }] of cancellations.entries()) {
|
|
163
|
+
validateHexInput(group, `cancellations[${index}].group`, {
|
|
164
|
+
exactBytes: 32,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { OfferStruct } from "@morpho-org/midnight-sdk";
|
|
2
|
+
import { type Hex } from "viem";
|
|
3
|
+
declare const OFFER_ADDRESS_FIELDS: readonly ["maker", "callback", "receiverIfMakerIsSeller", "ratifier"];
|
|
4
|
+
declare const OFFER_UINT256_FIELDS: readonly ["start", "expiry", "tick", "continuousFeeCap"];
|
|
5
|
+
declare const OFFER_CAP_FIELDS: readonly ["maxUnits", "maxAssets"];
|
|
6
|
+
/**
|
|
7
|
+
* Parses the fields of each taken offer fill that `MidnightBundlesV2` ABI-encodes and that the
|
|
8
|
+
* side, market and cap guards do not already check, so a malformed offer is rejected before any
|
|
9
|
+
* read or encoding.
|
|
10
|
+
*
|
|
11
|
+
* Integer and address bounds are the ABI's: `start`, `expiry`, `tick`, `continuousFeeCap` and
|
|
12
|
+
* the fill's `units` are `uint256` bigints; the `maxUnits` and `maxAssets` caps are bigints whose
|
|
13
|
+
* `uint128` bounds the action parser checks; `maker`, `callback`, `receiverIfMakerIsSeller` and
|
|
14
|
+
* `ratifier` are addresses (checksummed when mixed-case); `group` is exactly 32 bytes of `0x` hex;
|
|
15
|
+
* `reduceOnly` is a boolean. `callbackData` and `ratifierData` must be even-length `0x` hex.
|
|
16
|
+
*
|
|
17
|
+
* @param takeableOffers - Offers selected for a Midnight take.
|
|
18
|
+
* @returns Nothing when every offer field can be encoded.
|
|
19
|
+
* @throws {MidnightCalldataEncodingError} when a field is malformed; `input` is its path, such as
|
|
20
|
+
* `"takeableOffers[0].offer.maker"`.
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare const validateMidnightTakeableOfferFields: (takeableOffers: readonly {
|
|
24
|
+
readonly units: bigint;
|
|
25
|
+
readonly offer: Pick<OfferStruct, (typeof OFFER_ADDRESS_FIELDS)[number] | (typeof OFFER_UINT256_FIELDS)[number] | (typeof OFFER_CAP_FIELDS)[number] | "group" | "callbackData" | "reduceOnly">;
|
|
26
|
+
readonly ratifierData: Hex;
|
|
27
|
+
}[]) => void;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { AbiEncodingBytesSizeMismatchError, BaseError, IntegerOutOfRangeError, InvalidHexValueError, isHex, maxUint256, } from "viem";
|
|
2
|
+
import { MidnightCalldataEncodingError } from "../types/index.js";
|
|
3
|
+
import { validateMidnightAddress } from "./validateMidnightAccount.js";
|
|
4
|
+
const OFFER_ADDRESS_FIELDS = [
|
|
5
|
+
"maker",
|
|
6
|
+
"callback",
|
|
7
|
+
"receiverIfMakerIsSeller",
|
|
8
|
+
"ratifier",
|
|
9
|
+
];
|
|
10
|
+
const OFFER_UINT256_FIELDS = [
|
|
11
|
+
"start",
|
|
12
|
+
"expiry",
|
|
13
|
+
"tick",
|
|
14
|
+
"continuousFeeCap",
|
|
15
|
+
];
|
|
16
|
+
const OFFER_CAP_FIELDS = ["maxUnits", "maxAssets"];
|
|
17
|
+
const BYTES32_PATTERN = /^0x[0-9a-fA-F]{64}$/;
|
|
18
|
+
const validateUint256 = (field, value) => {
|
|
19
|
+
if (typeof value !== "bigint") {
|
|
20
|
+
throw new MidnightCalldataEncodingError(field, new BaseError(`Invalid bigint value: "${String(value)}".`));
|
|
21
|
+
}
|
|
22
|
+
if (value < 0n || value > maxUint256) {
|
|
23
|
+
throw new MidnightCalldataEncodingError(field, new IntegerOutOfRangeError({
|
|
24
|
+
max: `${maxUint256}n`,
|
|
25
|
+
min: "0n",
|
|
26
|
+
signed: false,
|
|
27
|
+
size: 32,
|
|
28
|
+
value: `${value}n`,
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const validateBytes = (field, value) => {
|
|
33
|
+
if (!isHex(value) || value.length % 2 !== 0) {
|
|
34
|
+
throw new MidnightCalldataEncodingError(field, new InvalidHexValueError(value));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Parses the fields of each taken offer fill that `MidnightBundlesV2` ABI-encodes and that the
|
|
39
|
+
* side, market and cap guards do not already check, so a malformed offer is rejected before any
|
|
40
|
+
* read or encoding.
|
|
41
|
+
*
|
|
42
|
+
* Integer and address bounds are the ABI's: `start`, `expiry`, `tick`, `continuousFeeCap` and
|
|
43
|
+
* the fill's `units` are `uint256` bigints; the `maxUnits` and `maxAssets` caps are bigints whose
|
|
44
|
+
* `uint128` bounds the action parser checks; `maker`, `callback`, `receiverIfMakerIsSeller` and
|
|
45
|
+
* `ratifier` are addresses (checksummed when mixed-case); `group` is exactly 32 bytes of `0x` hex;
|
|
46
|
+
* `reduceOnly` is a boolean. `callbackData` and `ratifierData` must be even-length `0x` hex.
|
|
47
|
+
*
|
|
48
|
+
* @param takeableOffers - Offers selected for a Midnight take.
|
|
49
|
+
* @returns Nothing when every offer field can be encoded.
|
|
50
|
+
* @throws {MidnightCalldataEncodingError} when a field is malformed; `input` is its path, such as
|
|
51
|
+
* `"takeableOffers[0].offer.maker"`.
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
export const validateMidnightTakeableOfferFields = (takeableOffers) => {
|
|
55
|
+
for (const [index, { units, offer, ratifierData },] of takeableOffers.entries()) {
|
|
56
|
+
const path = `takeableOffers[${index}]`;
|
|
57
|
+
for (const field of OFFER_ADDRESS_FIELDS) {
|
|
58
|
+
validateMidnightAddress(`${path}.offer.${field}`, offer[field]);
|
|
59
|
+
}
|
|
60
|
+
for (const field of OFFER_UINT256_FIELDS) {
|
|
61
|
+
validateUint256(`${path}.offer.${field}`, offer[field]);
|
|
62
|
+
}
|
|
63
|
+
for (const field of OFFER_CAP_FIELDS) {
|
|
64
|
+
validateUint256(`${path}.offer.${field}`, offer[field]);
|
|
65
|
+
}
|
|
66
|
+
if (typeof offer.group !== "string" || !BYTES32_PATTERN.test(offer.group)) {
|
|
67
|
+
throw new MidnightCalldataEncodingError(`${path}.offer.group`, isHex(offer.group, { strict: true })
|
|
68
|
+
? new AbiEncodingBytesSizeMismatchError({
|
|
69
|
+
expectedSize: 32,
|
|
70
|
+
value: offer.group,
|
|
71
|
+
})
|
|
72
|
+
: new InvalidHexValueError(offer.group));
|
|
73
|
+
}
|
|
74
|
+
validateBytes(`${path}.offer.callbackData`, offer.callbackData);
|
|
75
|
+
if (typeof offer.reduceOnly !== "boolean") {
|
|
76
|
+
throw new MidnightCalldataEncodingError(`${path}.offer.reduceOnly`, new BaseError(`Invalid boolean value: "${offer.reduceOnly}".`));
|
|
77
|
+
}
|
|
78
|
+
validateBytes(`${path}.ratifierData`, ratifierData);
|
|
79
|
+
validateUint256(`${path}.units`, units);
|
|
80
|
+
}
|
|
81
|
+
};
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export * from "./client/index.js";
|
|
|
4
4
|
export type { SupplyCollateralWithNativeParams } from "./entities/midnight/types.js";
|
|
5
5
|
export * from "./entities/requirements/index.js";
|
|
6
6
|
export * from "./helpers/index.js";
|
|
7
|
-
export type { Action, BlueBorrowPlanParams, BlueMarketSnapshot, BluePositionSnapshot, BlueRefinancePlanParams, BlueRepayPlanParams, BlueRepayWithdrawCollateralPlanParams, BlueSupplyCollateralBorrowPlanParams, BlueSupplyCollateralPlanParams, BlueSupplyPlanParams, BlueWithdrawCollateralPlanParams, BlueWithdrawPlanParams, Funding, IntentParams, ReferralFee, SignatureRequest, Step, TransactionPlan, VaultV1DepositPlanParams, VaultV1InKindRedeemPlanParams, VaultV1MigrateToV2PlanParams, VaultV1RedeemPlanParams, VaultV1WithdrawPlanParams, VaultV2DepositPlanParams, VaultV2ForceRedeemPlanParams, VaultV2ForceWithdrawPlanParams, VaultV2InKindRedeemPlanParams, VaultV2RedeemPlanParams, VaultV2WithdrawPlanParams, } from "./transactionPlan/index.js";
|
|
8
|
-
export { applySignatures, BlueSnapshotChainMismatchError, BlueSnapshotStateMismatchError, buildTransaction, buildTransactions, getPendingSignatureRequests, IncompleteTransactionPlanError, InvalidCalldataOriginError, InvalidTransactionPlanError, NonIntegerInputError, parseTransactionPlan, prepareBlueBorrow, prepareBlueRefinance, prepareBlueRepay, prepareBlueRepayWithdrawCollateral, prepareBlueSupply, prepareBlueSupplyCollateral, prepareBlueSupplyCollateralBorrow, prepareBlueWithdraw, prepareBlueWithdrawCollateral, prepareVaultV1Deposit, prepareVaultV1InKindRedeem, prepareVaultV1MigrateToV2, prepareVaultV1Redeem, prepareVaultV1Withdraw, prepareVaultV2Deposit, prepareVaultV2ForceRedeem, prepareVaultV2ForceWithdraw, prepareVaultV2InKindRedeem, prepareVaultV2Redeem, prepareVaultV2Withdraw, serializeTransactionPlan, TransactionPlanSignatureMismatchError, UnsupportedTransactionPlanActionError, UnsupportedTransactionPlanVersionError, validateBlueMarketSnapshot, ZeroAccountError, } from "./transactionPlan/index.js";
|
|
7
|
+
export type { Action, BlueBorrowPlanParams, BlueMarketSnapshot, BluePositionSnapshot, BlueRefinancePlanParams, BlueRepayPlanParams, BlueRepayWithdrawCollateralPlanParams, BlueSupplyCollateralBorrowPlanParams, BlueSupplyCollateralPlanParams, BlueSupplyPlanParams, BlueWithdrawBuyCallbackPlanParams, BlueWithdrawCollateralPlanParams, BlueWithdrawPlanParams, Funding, IntentParams, MidnightCancelOffersPlanParams, MidnightMakeBorrowPlanParams, MidnightMakeLendPlanParams, MidnightMakeRepayPlanParams, MidnightMakerPublicationPlanParams, MidnightMakeWithdrawPlanParams, MidnightRedeemPlanParams, MidnightRepayWithdrawCollateralPlanParams, MidnightSupplyBlueMakeLendPlanParams, MidnightSupplyCollateralBatchPlanParams, MidnightSupplyCollateralMakeBorrowPlanParams, MidnightSupplyCollateralPlanParams, MidnightSupplyCollateralTakeBorrowPlanParams, MidnightSupplyCollateralWithNativePlanParams, MidnightTakeBorrowPlanParams, MidnightTakeLendPlanParams, MidnightTakeRepayWithdrawCollateralPlanParams, MidnightTakeWithdrawPlanParams, MidnightWithdrawCollateralBatchPlanParams, MidnightWithdrawCollateralPlanParams, ReferralFee, SignatureRequest, Step, TransactionPlan, VaultV1DepositPlanParams, VaultV1InKindRedeemPlanParams, VaultV1MigrateToV2PlanParams, VaultV1RedeemPlanParams, VaultV1WithdrawPlanParams, VaultV2DepositPlanParams, VaultV2ForceRedeemPlanParams, VaultV2ForceWithdrawPlanParams, VaultV2InKindRedeemPlanParams, VaultV2RedeemPlanParams, VaultV2WithdrawPlanParams, } from "./transactionPlan/index.js";
|
|
8
|
+
export { applySignatures, BlueSnapshotChainMismatchError, BlueSnapshotStateMismatchError, buildTransaction, buildTransactions, getPendingSignatureRequests, IncompleteTransactionPlanError, InvalidCalldataOriginError, InvalidTransactionPlanError, MidnightTakeCreditInsufficientError, NonIntegerInputError, parseTransactionPlan, prepareBlueBorrow, prepareBlueRefinance, prepareBlueRepay, prepareBlueRepayWithdrawCollateral, prepareBlueSupply, prepareBlueSupplyCollateral, prepareBlueSupplyCollateralBorrow, prepareBlueWithdraw, prepareBlueWithdrawBuyCallback, prepareBlueWithdrawCollateral, prepareMidnightCancelOffers, prepareMidnightMakeBorrow, prepareMidnightMakeLend, prepareMidnightMakeRepay, prepareMidnightMakeWithdraw, prepareMidnightRedeem, prepareMidnightRepayWithdrawCollateral, prepareMidnightSupplyBlueMakeLend, prepareMidnightSupplyCollateral, prepareMidnightSupplyCollateralBatch, prepareMidnightSupplyCollateralMakeBorrow, prepareMidnightSupplyCollateralTakeBorrow, prepareMidnightSupplyCollateralWithNative, prepareMidnightTakeBorrow, prepareMidnightTakeLend, prepareMidnightTakeRepayWithdrawCollateral, prepareMidnightTakeWithdraw, prepareMidnightWithdrawCollateral, prepareMidnightWithdrawCollateralBatch, prepareVaultV1Deposit, prepareVaultV1InKindRedeem, prepareVaultV1MigrateToV2, prepareVaultV1Redeem, prepareVaultV1Withdraw, prepareVaultV2Deposit, prepareVaultV2ForceRedeem, prepareVaultV2ForceWithdraw, prepareVaultV2InKindRedeem, prepareVaultV2Redeem, prepareVaultV2Withdraw, serializeTransactionPlan, TransactionPlanSignatureMismatchError, UnsupportedTransactionPlanActionError, UnsupportedTransactionPlanVersionError, validateBlueMarketSnapshot, ZeroAccountError, } from "./transactionPlan/index.js";
|
|
9
9
|
export * from "./types/index.js";
|
|
10
10
|
export { version } from "./version.js";
|
package/lib/esm/index.js
CHANGED
|
@@ -3,6 +3,6 @@ export { validateClientChainId } from "./actions/requirements/validateClientChai
|
|
|
3
3
|
export * from "./client/index.js";
|
|
4
4
|
export * from "./entities/requirements/index.js";
|
|
5
5
|
export * from "./helpers/index.js";
|
|
6
|
-
export { applySignatures, BlueSnapshotChainMismatchError, BlueSnapshotStateMismatchError, buildTransaction, buildTransactions, getPendingSignatureRequests, IncompleteTransactionPlanError, InvalidCalldataOriginError, InvalidTransactionPlanError, NonIntegerInputError, parseTransactionPlan, prepareBlueBorrow, prepareBlueRefinance, prepareBlueRepay, prepareBlueRepayWithdrawCollateral, prepareBlueSupply, prepareBlueSupplyCollateral, prepareBlueSupplyCollateralBorrow, prepareBlueWithdraw, prepareBlueWithdrawCollateral, prepareVaultV1Deposit, prepareVaultV1InKindRedeem, prepareVaultV1MigrateToV2, prepareVaultV1Redeem, prepareVaultV1Withdraw, prepareVaultV2Deposit, prepareVaultV2ForceRedeem, prepareVaultV2ForceWithdraw, prepareVaultV2InKindRedeem, prepareVaultV2Redeem, prepareVaultV2Withdraw, serializeTransactionPlan, TransactionPlanSignatureMismatchError, UnsupportedTransactionPlanActionError, UnsupportedTransactionPlanVersionError, validateBlueMarketSnapshot, ZeroAccountError, } from "./transactionPlan/index.js";
|
|
6
|
+
export { applySignatures, BlueSnapshotChainMismatchError, BlueSnapshotStateMismatchError, buildTransaction, buildTransactions, getPendingSignatureRequests, IncompleteTransactionPlanError, InvalidCalldataOriginError, InvalidTransactionPlanError, MidnightTakeCreditInsufficientError, NonIntegerInputError, parseTransactionPlan, prepareBlueBorrow, prepareBlueRefinance, prepareBlueRepay, prepareBlueRepayWithdrawCollateral, prepareBlueSupply, prepareBlueSupplyCollateral, prepareBlueSupplyCollateralBorrow, prepareBlueWithdraw, prepareBlueWithdrawBuyCallback, prepareBlueWithdrawCollateral, prepareMidnightCancelOffers, prepareMidnightMakeBorrow, prepareMidnightMakeLend, prepareMidnightMakeRepay, prepareMidnightMakeWithdraw, prepareMidnightRedeem, prepareMidnightRepayWithdrawCollateral, prepareMidnightSupplyBlueMakeLend, prepareMidnightSupplyCollateral, prepareMidnightSupplyCollateralBatch, prepareMidnightSupplyCollateralMakeBorrow, prepareMidnightSupplyCollateralTakeBorrow, prepareMidnightSupplyCollateralWithNative, prepareMidnightTakeBorrow, prepareMidnightTakeLend, prepareMidnightTakeRepayWithdrawCollateral, prepareMidnightTakeWithdraw, prepareMidnightWithdrawCollateral, prepareMidnightWithdrawCollateralBatch, prepareVaultV1Deposit, prepareVaultV1InKindRedeem, prepareVaultV1MigrateToV2, prepareVaultV1Redeem, prepareVaultV1Withdraw, prepareVaultV2Deposit, prepareVaultV2ForceRedeem, prepareVaultV2ForceWithdraw, prepareVaultV2InKindRedeem, prepareVaultV2Redeem, prepareVaultV2Withdraw, serializeTransactionPlan, TransactionPlanSignatureMismatchError, UnsupportedTransactionPlanActionError, UnsupportedTransactionPlanVersionError, validateBlueMarketSnapshot, ZeroAccountError, } from "./transactionPlan/index.js";
|
|
7
7
|
export * from "./types/index.js";
|
|
8
8
|
export { version } from "./version.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { EcrecoverRatifier,
|
|
2
2
|
/** @deprecated Use EcrecoverRatifier with a tagged tree. */
|
|
3
|
-
EcrecoverRatifierUtils, eip712Digest, GroupUtils, MarketUtils, OfferChainUtils, OfferUtils, Payload, PositionUtils, PriceRatifierV1,
|
|
3
|
+
EcrecoverRatifierUtils, eip712Digest, GroupUtils, getBlueBuyCallbackAddress, MarketUtils, OfferChainUtils, OfferUtils, Payload, PositionUtils, PriceRatifierV1,
|
|
4
4
|
/** @deprecated Use PriceRatifierV1. */
|
|
5
5
|
PriceRatifierV1Utils, RateRatifierV1,
|
|
6
6
|
/** @deprecated Use RateRatifierV1. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { EcrecoverRatifier,
|
|
2
2
|
/** @deprecated Use EcrecoverRatifier with a tagged tree. */
|
|
3
|
-
EcrecoverRatifierUtils, eip712Digest, GroupUtils, MarketUtils, OfferChainUtils, OfferUtils, Payload, PositionUtils, PriceRatifierV1,
|
|
3
|
+
EcrecoverRatifierUtils, eip712Digest, GroupUtils, getBlueBuyCallbackAddress, MarketUtils, OfferChainUtils, OfferUtils, Payload, PositionUtils, PriceRatifierV1,
|
|
4
4
|
/** @deprecated Use PriceRatifierV1. */
|
|
5
5
|
PriceRatifierV1Utils, RateRatifierV1,
|
|
6
6
|
/** @deprecated Use RateRatifierV1. */
|