@morpho-org/calldata-verifier 0.1.0 → 0.3.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 +8 -3
- package/lib/cjs/midnight.d.ts +47 -0
- package/lib/cjs/midnight.js +57 -4
- package/lib/cjs/midnightMakers.d.ts +17 -0
- package/lib/cjs/midnightMakers.js +383 -0
- package/lib/cjs/midnightOffers.d.ts +0 -5
- package/lib/cjs/midnightOffers.js +0 -7
- package/lib/cjs/types.d.ts +1 -0
- package/lib/cjs/verifyCalldata.js +2 -0
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/midnight.d.ts +47 -0
- package/lib/esm/midnight.js +58 -7
- package/lib/esm/midnightMakers.d.ts +17 -0
- package/lib/esm/midnightMakers.js +380 -0
- package/lib/esm/midnightOffers.d.ts +0 -5
- package/lib/esm/midnightOffers.js +1 -8
- package/lib/esm/types.d.ts +1 -0
- package/lib/esm/verifyCalldata.js +2 -0
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -25,7 +25,8 @@ Use [`@morpho-org/evm-simulation`](../evm-simulation) for execution-dependent ch
|
|
|
25
25
|
- Midnight buy bundles for lend, market repay, and `midnight.take_lend`: the verifier does not bound the encoded `maxContinuousFee`. Compare it with an independently chosen ceiling. To check the market's actual fee against that ceiling, read Midnight's `continuousFee(marketId)` at the simulation block or use a simulation `assertBefore` view call.
|
|
26
26
|
- Midnight fill prices under a `slippage` guard: the secondary bound and offer ticks depend on the onchain price. Check the resulting fill price in simulation.
|
|
27
27
|
- Midnight borrow takes withdraw available existing credit first and may succeed without filling the requested offer. If a fill is required, verify it in simulation.
|
|
28
|
-
- Midnight
|
|
28
|
+
- Midnight take ratification: for takes, the verifier does not check roots, proofs, or ratifier data. Midnight checks ratification at execution.
|
|
29
|
+
- Midnight maker state: whether offer markets exist, their tick spacing, whether the published group is already consumed or cancelled, and existing allowances. Midnight checks these at execution or when offers are taken.
|
|
29
30
|
|
|
30
31
|
## Usage
|
|
31
32
|
|
|
@@ -53,11 +54,12 @@ For Blue and Midnight, pass the market ID as `market` and the chain separately a
|
|
|
53
54
|
|
|
54
55
|
- Submit only the verified calls, in order, from `account` on `chain_id`. Calldata does not identify the signer or the network; some Vault calls pay the caller directly.
|
|
55
56
|
- For `amount.unit: "all"`, the owner and every recipient (including any referral recipient) must be `account`. The verifier does not compare a concrete share or asset amount, so a withdrawal may return less than the full balance.
|
|
56
|
-
- An approval's spender must match the main call's target. A positive approval included in the response must cover the encoded pull where the amount is available: at least the encoded assets on Vault deposits, or at least the encoded shares on share-unit and `"all"` Vault withdrawals. An unlimited approval is accepted. A zero reset must immediately precede a positive approval for the same token and spender.
|
|
57
|
+
- An approval's spender must match the main call's target, except where an action's section names another spender (Midnight maker lend and repay approve Midnight core). A positive approval included in the response must cover the encoded pull where the amount is available: at least the encoded assets on Vault deposits, or at least the encoded shares on share-unit and `"all"` Vault withdrawals. An unlimited approval is accepted. A zero reset must immediately precede a positive approval for the same token and spender.
|
|
57
58
|
- Nonzero native value must be authorized by the request's `funding.max_native_assets`. The verifier does not require a native-capable request to use native funds.
|
|
58
59
|
- Blue reallocations with a nonzero penalty are rejected.
|
|
59
60
|
- Midnight accepts `slippage` or no guard, and checks explicit `min_units`/`max_assets` on buys and `max_units`/`min_assets` on sells and direct withdrawals. Unknown and wrong-side guards throw `CalldataUnsupportedError`.
|
|
60
61
|
- For Midnight, an approval, if included, must cover the encoded loan-token or collateral pull.
|
|
62
|
+
- Standalone `midnight.supply_collateral` accepts direct Midnight `supplyCollateral` (zero native value, no authorization prerequisite) or native-funded `MidnightBundlesV2.midnightBundlesV2CancelAndMake` (positive native value on the chain's wrapped-native collateral up to `funding.max_native_assets` and the collateral amount, with all Blue-parking, offer-publication, and cancellation fields zero or empty, plus optional wrapped-native approval and `MidnightBundlesV2` authorization prerequisites).
|
|
61
63
|
- Midnight `min_rate` and `max_rate` guards throw `CalldataUnsupportedError`: the rate is not encoded directly in the bundle, and its conversion depends on the quote and execution context.
|
|
62
64
|
- Midnight core withdrawals transfer one loan asset per unit withdrawn after the contract updates the account's credit for losses. The verifier accepts exact asset and exact unit requests for this route.
|
|
63
65
|
- The verifier does not check slippage, expiry or attribution tags, or verify typed-data signing requests.
|
|
@@ -95,4 +97,7 @@ Verification stays synchronous and throws `CalldataProofError` if the signature,
|
|
|
95
97
|
|
|
96
98
|
- For takes, pass `group` from the original path and `market_id` from the request. Group IDs are scoped to a maker: without `maker`, the group alone does not identify the offer, and the verifier only checks that all fills use one maker. Takes without a caller-known market ID or with a reduce-only maker fill throw `CalldataUnsupportedError`. Use an explicit amount guard to enforce a minimum or maximum on the other side of the trade.
|
|
97
99
|
- Funding withdrawals must pay `account` from the original `funding_address` and `funding_market`. The request has no amount: the verifier checks for a positive share withdrawal, not that it empties the position.
|
|
98
|
-
-
|
|
100
|
+
- `midnight.make_lend`, `make_borrow`, `make_repay` and `make_withdraw` must call `MidnightBundlesV2.midnightBundlesV2CancelAndMake` with the chain's `priceRatifierV1` or `rateRatifierV1` for `offers.type`, no delegated root signature, no cancellations, a nonzero deadline, and no Blue parking unless `make_lend` is funded from a variable-rate market. The verifier decompresses the published payload, rebuilds the offer tree from it, and requires its root to equal the activated root, so the payload is exactly the set of offers the call activates. A payload with an attribution suffix is rejected. Decoding stops at the number of request entries, so a payload with extra offers is rejected before its items are ABI-decoded.
|
|
101
|
+
- Each published offer must match the request entry at the same index: `account` as maker, the entry's `market_id` on the intended chain and Midnight deployment, `starts_at` and `expires_at`, the entry's `tick` when given, and for rate offers a ratified rate equal to `rate_wad`. On rate offers only `rate_wad` is binding: the root commits to the rate, not the tick, so a request `tick` is only compared with the published payload. Use price offers when the exact tick matters. Lend and repay offers buy; borrow and withdraw offers sell and pay `account`. Lend and borrow cap `maxAssets` at `amount`, except variable-rate funded lend, whose offers carry an unbounded `maxAssets` (`2^128 - 1`) because the parked Blue position bounds what the callback can fund; repay and withdraw are reduce-only and cap `maxUnits` at `amount`. Offers carry no taker restriction or continuous-fee cap and, except on variable-rate funded lend, no callback, and share the group derived from their leaves.
|
|
102
|
+
- Lend and repay may include an approval of the offers' loan token to Midnight, at least `amount` for lend. `make_borrow` with `collateral_supplies` must supply exactly that collateral on the offers' market, with native value up to the wrapped-native collateral amount and `funding.max_native_assets`; without it, the call must encode no collateral and no value.
|
|
103
|
+
- `make_lend` with `funding_source.type: "variable_rate_market"` must park exactly `amount` on the Blue market whose id is `funding_source.market_id` and whose loan token is the offers' loan token. The callback salt must be the group id of the callback-free offers the backend builds first: the published offers with their callback cleared and `maxAssets` set back to `amount`. Every offer must name the maker's `BlueBuyCallback` (the CREATE2 address the chain's `midnightBlueBuyCallbackFactory` derives for `account` and that salt) with `abi.encode(blueMarket)` as callback data. The loan-token approval names `MidnightBundlesV2`, not Midnight, and covers at least `amount`: the bundle wraps the native value for the maker and still pulls the full parked amount. Native value is accepted only on a wrapped-native loan token, up to `amount` and `funding.max_native_assets`. Whether the Blue market exists is left to EVM simulation. Any other `funding_source.type` throws `CalldataUnsupportedError`.
|
package/lib/cjs/midnight.d.ts
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
|
+
import { midnightBundlesV2Abi } from "@morpho-org/midnight-sdk";
|
|
1
2
|
import type { ChainAddresses } from "@morpho-org/morpho-ts";
|
|
3
|
+
import { type Address } from "viem";
|
|
4
|
+
import { decode } from "./checks.js";
|
|
2
5
|
import type { CalldataCall, DecodedCalldataCall, MidnightMarketIntent, MidnightTakeIntent } from "./types.js";
|
|
3
6
|
type Intent = MidnightMarketIntent | MidnightTakeIntent;
|
|
7
|
+
type BundleCall = ReturnType<typeof decode<typeof midnightBundlesV2Abi>>;
|
|
8
|
+
type Transfer = {
|
|
9
|
+
readonly collateralIndex: bigint;
|
|
10
|
+
readonly assets: bigint;
|
|
11
|
+
};
|
|
12
|
+
type TokenPull = {
|
|
13
|
+
readonly token: Address;
|
|
14
|
+
readonly assets: bigint;
|
|
15
|
+
readonly spender?: Address;
|
|
16
|
+
};
|
|
17
|
+
type RequestedTransfer = {
|
|
18
|
+
readonly collateral: {
|
|
19
|
+
readonly address: Address;
|
|
20
|
+
};
|
|
21
|
+
readonly amount: {
|
|
22
|
+
readonly unit: "all";
|
|
23
|
+
} | {
|
|
24
|
+
readonly unit: "assets";
|
|
25
|
+
readonly value: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
type Market = Extract<BundleCall, {
|
|
29
|
+
functionName: "midnightBundlesV2BuyWithAssetsTargetAndWithdrawCollateral";
|
|
30
|
+
}>["args"][0];
|
|
31
|
+
/** @internal */
|
|
32
|
+
export declare function checkCollateral(transfers: readonly Transfer[], { requested, market, call, withdrawal, }: {
|
|
33
|
+
requested: readonly RequestedTransfer[];
|
|
34
|
+
market: Market;
|
|
35
|
+
call: CalldataCall;
|
|
36
|
+
withdrawal?: "core" | "bundle";
|
|
37
|
+
}): {
|
|
38
|
+
token: `0x${string}`;
|
|
39
|
+
assets: bigint;
|
|
40
|
+
}[];
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare function checkPrerequisites(calls: readonly CalldataCall[], { intent, chain, call: main, pulls, allowAuthorization, }: {
|
|
43
|
+
readonly intent: {
|
|
44
|
+
readonly account: Address;
|
|
45
|
+
};
|
|
46
|
+
readonly chain: ChainAddresses;
|
|
47
|
+
readonly call: CalldataCall;
|
|
48
|
+
readonly pulls: readonly TokenPull[];
|
|
49
|
+
readonly allowAuthorization: boolean;
|
|
50
|
+
}): DecodedCalldataCall[];
|
|
4
51
|
declare function verifyMidnight(intent: Intent, { calls, chain, }: {
|
|
5
52
|
readonly calls: readonly CalldataCall[];
|
|
6
53
|
readonly chain: ChainAddresses;
|
package/lib/cjs/midnight.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.midnightRules = void 0;
|
|
4
|
+
exports.checkCollateral = checkCollateral;
|
|
5
|
+
exports.checkPrerequisites = checkPrerequisites;
|
|
4
6
|
const midnight_sdk_1 = require("@morpho-org/midnight-sdk");
|
|
5
7
|
const viem_1 = require("viem");
|
|
6
8
|
const checks_js_1 = require("./checks.js");
|
|
@@ -46,6 +48,7 @@ function assetsMatch(assets, { requested, withdrawal, call, }) {
|
|
|
46
48
|
field: "collateral.amount",
|
|
47
49
|
});
|
|
48
50
|
}
|
|
51
|
+
/** @internal */
|
|
49
52
|
function checkCollateral(transfers, { requested, market, call, withdrawal, }) {
|
|
50
53
|
if (!Array.isArray(requested) || transfers.length !== requested.length) {
|
|
51
54
|
throw new errors_js_1.CalldataCallError("collateral", call.id);
|
|
@@ -69,6 +72,7 @@ function noValue(call) {
|
|
|
69
72
|
field: "value",
|
|
70
73
|
});
|
|
71
74
|
}
|
|
75
|
+
/** @internal */
|
|
72
76
|
function checkPrerequisites(calls, { intent, chain, call: main, pulls, allowAuthorization, }) {
|
|
73
77
|
let authorized = false;
|
|
74
78
|
const approved = new Map();
|
|
@@ -98,9 +102,9 @@ function checkPrerequisites(calls, { intent, chain, call: main, pulls, allowAuth
|
|
|
98
102
|
if (pull == null) {
|
|
99
103
|
throw new errors_js_1.CalldataTargetError("approval.token", call.id);
|
|
100
104
|
}
|
|
101
|
-
const { token, assets } = pull;
|
|
105
|
+
const { token, assets, spender = main.to } = pull;
|
|
102
106
|
const verified = (0, checks_js_1.approval)(call, {
|
|
103
|
-
spender
|
|
107
|
+
spender,
|
|
104
108
|
token,
|
|
105
109
|
minAmount: assets,
|
|
106
110
|
allowReset: (0, checks_js_1.sameAddress)(calls[index + 1]?.to, token),
|
|
@@ -235,9 +239,11 @@ function checkCoreWithdrawals(decoded, context) {
|
|
|
235
239
|
})
|
|
236
240
|
: first.result;
|
|
237
241
|
}
|
|
238
|
-
function checkNative(wrappedNative, { intent, chain, call, cap }) {
|
|
242
|
+
function checkNative(wrappedNative, { intent, chain, call, cap, requireValue = false, }) {
|
|
239
243
|
const value = (0, checks_js_1.uint)(call.value, { field: "value", call });
|
|
240
|
-
if (
|
|
244
|
+
if (!requireValue &&
|
|
245
|
+
value === 0n &&
|
|
246
|
+
(0, checks_js_1.sameAddress)(wrappedNative, viem_1.zeroAddress)) {
|
|
241
247
|
return;
|
|
242
248
|
}
|
|
243
249
|
if (value === 0n ||
|
|
@@ -437,6 +443,50 @@ function checkSell(decoded, context) {
|
|
|
437
443
|
});
|
|
438
444
|
return collateral;
|
|
439
445
|
}
|
|
446
|
+
function checkSupplyCollateralWithNative(decoded, context) {
|
|
447
|
+
const { intent, call } = context;
|
|
448
|
+
if (intent.action !== "midnight.supply_collateral") {
|
|
449
|
+
throw new errors_js_1.CalldataCallError("function", call.id);
|
|
450
|
+
}
|
|
451
|
+
const [blueMarket, assetsToPark, callbackSalt, market, supplies, ratifier, newRoot, signatureHeight, signatureNonce, signatureDeadline, v, r, s, groupsToCancel, payload, deadline, wrappedNative,] = decoded.args;
|
|
452
|
+
const emptyBlueMarket = (0, checks_js_1.sameAddress)(blueMarket.loanToken, viem_1.zeroAddress) &&
|
|
453
|
+
(0, checks_js_1.sameAddress)(blueMarket.collateralToken, viem_1.zeroAddress) &&
|
|
454
|
+
(0, checks_js_1.sameAddress)(blueMarket.oracle, viem_1.zeroAddress) &&
|
|
455
|
+
(0, checks_js_1.sameAddress)(blueMarket.irm, viem_1.zeroAddress) &&
|
|
456
|
+
blueMarket.lltv === 0n;
|
|
457
|
+
const emptyPublication = (0, checks_js_1.sameAddress)(ratifier, viem_1.zeroAddress) &&
|
|
458
|
+
(0, checks_js_1.sameHex)(newRoot, viem_1.zeroHash) &&
|
|
459
|
+
signatureHeight === 0n &&
|
|
460
|
+
signatureNonce === 0n &&
|
|
461
|
+
signatureDeadline === 0n &&
|
|
462
|
+
v === 0 &&
|
|
463
|
+
(0, checks_js_1.sameHex)(r, viem_1.zeroHash) &&
|
|
464
|
+
(0, checks_js_1.sameHex)(s, viem_1.zeroHash) &&
|
|
465
|
+
groupsToCancel.length === 0 &&
|
|
466
|
+
(0, checks_js_1.sameHex)(payload, "0x");
|
|
467
|
+
if (!emptyBlueMarket ||
|
|
468
|
+
assetsToPark !== 0n ||
|
|
469
|
+
!(0, checks_js_1.sameHex)(callbackSalt, viem_1.zeroHash) ||
|
|
470
|
+
!emptyPublication) {
|
|
471
|
+
throw new errors_js_1.CalldataCallError("cancel_and_make", call.id);
|
|
472
|
+
}
|
|
473
|
+
if (deadline === 0n) {
|
|
474
|
+
throw new errors_js_1.CalldataAmountError("deadline", call.id);
|
|
475
|
+
}
|
|
476
|
+
requireMarket(market, context);
|
|
477
|
+
const collateral = checkCollateral(supplies, {
|
|
478
|
+
requested: [intent],
|
|
479
|
+
market,
|
|
480
|
+
call,
|
|
481
|
+
});
|
|
482
|
+
const nativeCollateral = collateral.find(({ token }) => (0, checks_js_1.sameAddress)(token, wrappedNative));
|
|
483
|
+
checkNative(wrappedNative, {
|
|
484
|
+
...context,
|
|
485
|
+
cap: nativeCollateral?.assets ?? 0n,
|
|
486
|
+
requireValue: true,
|
|
487
|
+
});
|
|
488
|
+
return collateral;
|
|
489
|
+
}
|
|
440
490
|
function checkFills(fills, context) {
|
|
441
491
|
for (const { offer, units } of fills) {
|
|
442
492
|
requireMarket(offer.market, context);
|
|
@@ -504,6 +554,9 @@ function verifyMidnight(intent, { calls, chain, }) {
|
|
|
504
554
|
case "midnightBundlesV2SupplyCollateralAndSellWithUnitsTarget":
|
|
505
555
|
pulls = checkSell(decoded, context);
|
|
506
556
|
break;
|
|
557
|
+
case "midnightBundlesV2CancelAndMake":
|
|
558
|
+
pulls = checkSupplyCollateralWithNative(decoded, context);
|
|
559
|
+
break;
|
|
507
560
|
default:
|
|
508
561
|
throw new errors_js_1.CalldataCallError("function", call.id);
|
|
509
562
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ChainAddresses } from "@morpho-org/morpho-ts";
|
|
2
|
+
import type { CalldataCall, DecodedCalldataCall, MidnightOfferManagementIntent } from "./types.js";
|
|
3
|
+
type MakeIntent = Extract<MidnightOfferManagementIntent, {
|
|
4
|
+
readonly offers: unknown;
|
|
5
|
+
}>;
|
|
6
|
+
declare function verifyMake(intent: MakeIntent, { calls, chain, }: {
|
|
7
|
+
readonly calls: readonly CalldataCall[];
|
|
8
|
+
readonly chain: ChainAddresses;
|
|
9
|
+
}): readonly DecodedCalldataCall[];
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare const midnightMakerRules: {
|
|
12
|
+
"midnight.make_borrow": typeof verifyMake;
|
|
13
|
+
"midnight.make_lend": typeof verifyMake;
|
|
14
|
+
"midnight.make_repay": typeof verifyMake;
|
|
15
|
+
"midnight.make_withdraw": typeof verifyMake;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.midnightMakerRules = void 0;
|
|
4
|
+
const midnight_sdk_1 = require("@morpho-org/midnight-sdk");
|
|
5
|
+
const abis_1 = require("@morpho-org/morpho-ts/abis");
|
|
6
|
+
const fflate_1 = require("fflate");
|
|
7
|
+
const viem_1 = require("viem");
|
|
8
|
+
const checks_js_1 = require("./checks.js");
|
|
9
|
+
const errors_js_1 = require("./errors.js");
|
|
10
|
+
const midnight_js_1 = require("./midnight.js");
|
|
11
|
+
const sides = {
|
|
12
|
+
"midnight.make_lend": { buy: true, reduceOnly: false, unit: "assets" },
|
|
13
|
+
"midnight.make_borrow": { buy: false, reduceOnly: false, unit: "assets" },
|
|
14
|
+
"midnight.make_repay": { buy: true, reduceOnly: true, unit: "units" },
|
|
15
|
+
"midnight.make_withdraw": { buy: false, reduceOnly: true, unit: "units" },
|
|
16
|
+
};
|
|
17
|
+
const GUNZIP_SLICE_BYTES = 1_024;
|
|
18
|
+
function gunzip(compressed, maxBytes) {
|
|
19
|
+
const chunks = [];
|
|
20
|
+
let length = 0;
|
|
21
|
+
const stream = new fflate_1.Gunzip((chunk) => {
|
|
22
|
+
length += chunk.length;
|
|
23
|
+
if (length > maxBytes) {
|
|
24
|
+
throw new RangeError(`gzip output exceeds ${maxBytes} bytes`);
|
|
25
|
+
}
|
|
26
|
+
chunks.push(chunk);
|
|
27
|
+
});
|
|
28
|
+
// fflate inflates a whole push before reporting output, so small slices bound the work done past the cap.
|
|
29
|
+
for (let offset = 0; offset < compressed.length; offset += GUNZIP_SLICE_BYTES) {
|
|
30
|
+
const end = offset + GUNZIP_SLICE_BYTES;
|
|
31
|
+
stream.push(compressed.subarray(offset, end), end >= compressed.length);
|
|
32
|
+
}
|
|
33
|
+
const output = new Uint8Array(length);
|
|
34
|
+
let offset = 0;
|
|
35
|
+
for (const chunk of chunks) {
|
|
36
|
+
output.set(chunk, offset);
|
|
37
|
+
offset += chunk.length;
|
|
38
|
+
}
|
|
39
|
+
return output;
|
|
40
|
+
}
|
|
41
|
+
function decodePayload(payload, { call, maxItems }) {
|
|
42
|
+
try {
|
|
43
|
+
const bytes = (0, viem_1.hexToBytes)(payload);
|
|
44
|
+
// The API never appends an attribution suffix after the gzip stream.
|
|
45
|
+
if (bytes.length !== 5 + new DataView(bytes.buffer).getUint32(1)) {
|
|
46
|
+
throw new errors_js_1.CalldataDecodeError("payload", call.id);
|
|
47
|
+
}
|
|
48
|
+
return midnight_sdk_1.Payload.decodeSync(payload, { gunzip, maxItems });
|
|
49
|
+
}
|
|
50
|
+
catch (cause) {
|
|
51
|
+
if (cause instanceof errors_js_1.CalldataDecodeError) {
|
|
52
|
+
throw cause;
|
|
53
|
+
}
|
|
54
|
+
throw new errors_js_1.CalldataDecodeError("payload", { callId: call.id, cause });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function rebuildTree(items, { intent, call }) {
|
|
58
|
+
try {
|
|
59
|
+
if (intent.offers.type === "rate") {
|
|
60
|
+
const entries = items.map(({ offer, ratifierData }) => ({
|
|
61
|
+
offer,
|
|
62
|
+
...midnight_sdk_1.RateRatifierV1.decodeRatifierData(ratifierData),
|
|
63
|
+
}));
|
|
64
|
+
const tree = midnight_sdk_1.Tree.create({ type: "rateV1", entries });
|
|
65
|
+
return {
|
|
66
|
+
leaves: entries.map(({ offer, rate, allowedTaker }) => ({
|
|
67
|
+
offer: midnight_sdk_1.OfferUtils.toStruct({ offer }),
|
|
68
|
+
rate,
|
|
69
|
+
allowedTaker,
|
|
70
|
+
})),
|
|
71
|
+
root: tree.root,
|
|
72
|
+
group: midnight_sdk_1.RateRatifierV1.groupId(entries),
|
|
73
|
+
items: midnight_sdk_1.RateRatifierV1.ratify({ tree }),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
const entries = items.map(({ offer, ratifierData }) => ({
|
|
77
|
+
offer,
|
|
78
|
+
...midnight_sdk_1.PriceRatifierV1.decodeRatifierData(ratifierData),
|
|
79
|
+
}));
|
|
80
|
+
const tree = midnight_sdk_1.Tree.create({ type: "priceV1", entries });
|
|
81
|
+
return {
|
|
82
|
+
leaves: entries.map(({ offer, allowedTaker }) => ({
|
|
83
|
+
offer: midnight_sdk_1.OfferUtils.toStruct({ offer }),
|
|
84
|
+
allowedTaker,
|
|
85
|
+
})),
|
|
86
|
+
root: tree.root,
|
|
87
|
+
group: midnight_sdk_1.PriceRatifierV1.groupId(entries),
|
|
88
|
+
items: midnight_sdk_1.PriceRatifierV1.ratify({ tree }),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
catch (cause) {
|
|
92
|
+
throw new errors_js_1.CalldataCallError("payload", { callId: call.id, cause });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function marketId(market, call) {
|
|
96
|
+
try {
|
|
97
|
+
const sorted = market.collateralParams.every((collateral, index) => index === 0 ||
|
|
98
|
+
midnight_sdk_1.MarketUtils.compareCollateralTokens(market.collateralParams[index - 1], collateral) < 0);
|
|
99
|
+
if (sorted) {
|
|
100
|
+
return midnight_sdk_1.MarketUtils.toId(market);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (cause) {
|
|
104
|
+
throw new errors_js_1.CalldataTargetError("market", { callId: call.id, cause });
|
|
105
|
+
}
|
|
106
|
+
throw new errors_js_1.CalldataTargetError("market", call.id);
|
|
107
|
+
}
|
|
108
|
+
function checkOffer({ offer, rate }, { entry, ratifier, cap, context: { intent, chain, call, blue }, }) {
|
|
109
|
+
const { buy, reduceOnly, unit } = sides[intent.action];
|
|
110
|
+
if (offer.market.chainId !== BigInt(intent.chain_id) ||
|
|
111
|
+
!(0, checks_js_1.sameAddress)(offer.market.midnight, chain.midnight) ||
|
|
112
|
+
!(0, checks_js_1.sameHex)(marketId(offer.market, call), entry.market_id)) {
|
|
113
|
+
throw new errors_js_1.CalldataTargetError("offers.market_id", call.id);
|
|
114
|
+
}
|
|
115
|
+
(0, checks_js_1.requireAccount)(offer.maker, {
|
|
116
|
+
expected: intent.account,
|
|
117
|
+
field: "offers.maker",
|
|
118
|
+
call,
|
|
119
|
+
});
|
|
120
|
+
(0, checks_js_1.requireAccount)(offer.receiverIfMakerIsSeller, {
|
|
121
|
+
expected: buy ? viem_1.zeroAddress : intent.account,
|
|
122
|
+
field: "offers.receiver",
|
|
123
|
+
call,
|
|
124
|
+
});
|
|
125
|
+
if (offer.buy !== buy ||
|
|
126
|
+
offer.reduceOnly !== reduceOnly ||
|
|
127
|
+
!(0, checks_js_1.sameAddress)(offer.ratifier, ratifier) ||
|
|
128
|
+
!(0, checks_js_1.sameAddress)(offer.callback, blue?.callback ?? viem_1.zeroAddress) ||
|
|
129
|
+
!(0, checks_js_1.sameHex)(offer.callbackData, blue?.callbackData ?? "0x") ||
|
|
130
|
+
offer.continuousFeeCap !== 0n) {
|
|
131
|
+
throw new errors_js_1.CalldataCallError("offers", call.id);
|
|
132
|
+
}
|
|
133
|
+
if (offer.start !==
|
|
134
|
+
(0, checks_js_1.uint)(String(entry.starts_at), { field: "offers.starts_at", call }) ||
|
|
135
|
+
offer.expiry !==
|
|
136
|
+
(0, checks_js_1.uint)(String(entry.expires_at), { field: "offers.expires_at", call })) {
|
|
137
|
+
throw new errors_js_1.CalldataAmountError("offers.expires_at", call.id);
|
|
138
|
+
}
|
|
139
|
+
if ((intent.offers.type === "price" || entry.tick != null) &&
|
|
140
|
+
offer.tick !== (0, checks_js_1.uint)(entry.tick ?? "", { field: "offers.tick", call })) {
|
|
141
|
+
throw new errors_js_1.CalldataAmountError("offers.tick", call.id);
|
|
142
|
+
}
|
|
143
|
+
if (intent.offers.type === "rate" &&
|
|
144
|
+
rate !==
|
|
145
|
+
(0, checks_js_1.uint)(("rate_wad" in entry ? entry.rate_wad : undefined) ?? "", {
|
|
146
|
+
field: "offers.rate_wad",
|
|
147
|
+
call,
|
|
148
|
+
})) {
|
|
149
|
+
throw new errors_js_1.CalldataAmountError("offers.rate_wad", call.id);
|
|
150
|
+
}
|
|
151
|
+
(0, checks_js_1.requireAmount)(unit === "assets" ? offer.maxAssets : offer.maxUnits, {
|
|
152
|
+
expected: blue == null ? cap : viem_1.maxUint128,
|
|
153
|
+
field: "amount",
|
|
154
|
+
call,
|
|
155
|
+
});
|
|
156
|
+
(0, checks_js_1.requireAmount)(unit === "assets" ? offer.maxUnits : offer.maxAssets, {
|
|
157
|
+
expected: 0n,
|
|
158
|
+
field: "amount",
|
|
159
|
+
call,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function checkOffers(args, context) {
|
|
163
|
+
const { intent, chain, call, cap } = context;
|
|
164
|
+
const [, , , , , ratifier, root, , , , , , , , payload] = args;
|
|
165
|
+
const { offers } = intent;
|
|
166
|
+
const expectedRatifier = offers?.type === "rate" || offers?.type === "price"
|
|
167
|
+
? { rate: chain.rateRatifierV1, price: chain.priceRatifierV1 }[offers.type]
|
|
168
|
+
: undefined;
|
|
169
|
+
if (expectedRatifier == null || !(0, checks_js_1.sameAddress)(ratifier, expectedRatifier)) {
|
|
170
|
+
throw new errors_js_1.CalldataTargetError("ratifier", call.id);
|
|
171
|
+
}
|
|
172
|
+
if (!Array.isArray(offers.entries) ||
|
|
173
|
+
offers.entries.length === 0 ||
|
|
174
|
+
Array.from(offers.entries).some((entry) => typeof entry !== "object" || entry == null)) {
|
|
175
|
+
throw new errors_js_1.CalldataCallError("offers.entries", call.id);
|
|
176
|
+
}
|
|
177
|
+
const items = decodePayload(payload, {
|
|
178
|
+
call,
|
|
179
|
+
maxItems: offers.entries.length,
|
|
180
|
+
});
|
|
181
|
+
if (items.length !== offers.entries.length) {
|
|
182
|
+
throw new errors_js_1.CalldataCallError("offers.entries", call.id);
|
|
183
|
+
}
|
|
184
|
+
const { blue } = context;
|
|
185
|
+
if (blue != null &&
|
|
186
|
+
!(0, checks_js_1.sameHex)(blue.salt, midnight_sdk_1.GroupUtils.hash(items.map(({ offer }) => ({
|
|
187
|
+
...offer,
|
|
188
|
+
maxAssets: cap,
|
|
189
|
+
callback: viem_1.zeroAddress,
|
|
190
|
+
callbackData: "0x",
|
|
191
|
+
}))))) {
|
|
192
|
+
throw new errors_js_1.CalldataCallError("callback_salt", call.id);
|
|
193
|
+
}
|
|
194
|
+
const tree = rebuildTree(items, context);
|
|
195
|
+
if (!(0, checks_js_1.sameHex)(tree.root, root) ||
|
|
196
|
+
tree.items.some(({ ratifierData }, index) => !(0, checks_js_1.sameHex)(ratifierData, items[index]?.ratifierData))) {
|
|
197
|
+
throw new errors_js_1.CalldataCallError("root", call.id);
|
|
198
|
+
}
|
|
199
|
+
const entries = offers.entries;
|
|
200
|
+
tree.leaves.forEach((leaf, index) => {
|
|
201
|
+
if (!(0, checks_js_1.sameAddress)(leaf.allowedTaker, viem_1.zeroAddress)) {
|
|
202
|
+
throw new errors_js_1.CalldataCallError("offers.allowed_taker", call.id);
|
|
203
|
+
}
|
|
204
|
+
checkOffer(leaf, {
|
|
205
|
+
entry: entries[index],
|
|
206
|
+
ratifier: expectedRatifier,
|
|
207
|
+
cap,
|
|
208
|
+
context,
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
if (tree.leaves.some(({ offer }) => !(0, checks_js_1.sameHex)(offer.group, tree.group))) {
|
|
212
|
+
throw new errors_js_1.CalldataCallError("offers.group", call.id);
|
|
213
|
+
}
|
|
214
|
+
return tree.leaves.map(({ offer }) => offer);
|
|
215
|
+
}
|
|
216
|
+
function checkEnvelope(args, { call }) {
|
|
217
|
+
const [, , , , , , , height, nonce, signatureDeadline, v, r, s, groupsToCancel, , deadline,] = args;
|
|
218
|
+
if (height !== 0n ||
|
|
219
|
+
nonce !== 0n ||
|
|
220
|
+
signatureDeadline !== 0n ||
|
|
221
|
+
v !== 0 ||
|
|
222
|
+
!(0, checks_js_1.sameHex)(r, viem_1.zeroHash) ||
|
|
223
|
+
!(0, checks_js_1.sameHex)(s, viem_1.zeroHash)) {
|
|
224
|
+
throw new errors_js_1.CalldataCallError("root_signature", call.id);
|
|
225
|
+
}
|
|
226
|
+
if (groupsToCancel.length !== 0) {
|
|
227
|
+
throw new errors_js_1.CalldataCallError("cancellations", call.id);
|
|
228
|
+
}
|
|
229
|
+
if (deadline === 0n) {
|
|
230
|
+
throw new errors_js_1.CalldataAmountError("deadline", call.id);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function checkBlueFunding(args, { intent, call, cap }) {
|
|
234
|
+
const [market, assets, salt] = args;
|
|
235
|
+
const source = intent.action === "midnight.make_lend" ? intent.funding_source : undefined;
|
|
236
|
+
if (source != null &&
|
|
237
|
+
!["wallet", "variable_rate_market"].includes(source.type)) {
|
|
238
|
+
throw new errors_js_1.CalldataUnsupportedError("funding_source", call.id);
|
|
239
|
+
}
|
|
240
|
+
if (intent.action !== "midnight.make_lend" ||
|
|
241
|
+
intent.funding_source?.type !== "variable_rate_market") {
|
|
242
|
+
if (!(0, checks_js_1.sameAddress)(market.loanToken, viem_1.zeroAddress) ||
|
|
243
|
+
!(0, checks_js_1.sameAddress)(market.collateralToken, viem_1.zeroAddress) ||
|
|
244
|
+
!(0, checks_js_1.sameAddress)(market.oracle, viem_1.zeroAddress) ||
|
|
245
|
+
!(0, checks_js_1.sameAddress)(market.irm, viem_1.zeroAddress) ||
|
|
246
|
+
market.lltv !== 0n ||
|
|
247
|
+
assets !== 0n ||
|
|
248
|
+
!(0, checks_js_1.sameHex)(salt, viem_1.zeroHash)) {
|
|
249
|
+
throw new errors_js_1.CalldataCallError("funding_source", call.id);
|
|
250
|
+
}
|
|
251
|
+
return undefined;
|
|
252
|
+
}
|
|
253
|
+
const callbackData = (0, viem_1.encodeAbiParameters)([abis_1.marketParamsAbi], [market]);
|
|
254
|
+
if (!(0, checks_js_1.sameHex)((0, viem_1.keccak256)(callbackData), intent.funding_source.market_id)) {
|
|
255
|
+
throw new errors_js_1.CalldataTargetError("funding_source.market_id", call.id);
|
|
256
|
+
}
|
|
257
|
+
if (cap === 0n || cap > viem_1.maxUint128) {
|
|
258
|
+
throw new errors_js_1.CalldataAmountError("amount", call.id);
|
|
259
|
+
}
|
|
260
|
+
(0, checks_js_1.requireAmount)(assets, {
|
|
261
|
+
expected: cap,
|
|
262
|
+
field: "amount",
|
|
263
|
+
call,
|
|
264
|
+
});
|
|
265
|
+
return {
|
|
266
|
+
funding: intent.funding,
|
|
267
|
+
loanToken: market.loanToken,
|
|
268
|
+
assets,
|
|
269
|
+
salt,
|
|
270
|
+
callback: (0, midnight_sdk_1.getBlueBuyCallbackAddress)({
|
|
271
|
+
chainId: intent.chain_id,
|
|
272
|
+
owner: intent.account,
|
|
273
|
+
salt,
|
|
274
|
+
}),
|
|
275
|
+
callbackData,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function checkCollateralSupplies(args, { offers, context }) {
|
|
279
|
+
const { intent, chain, call, blue } = context;
|
|
280
|
+
const [, , , market, supplies, , , , , , , , , , , , wrappedNative] = args;
|
|
281
|
+
const value = (0, checks_js_1.uint)(call.value, { field: "value", call });
|
|
282
|
+
const { requested, funding } = intent.action === "midnight.make_borrow"
|
|
283
|
+
? { requested: intent.collateral_supplies, funding: intent.funding }
|
|
284
|
+
: { requested: undefined, funding: undefined };
|
|
285
|
+
if (requested == null) {
|
|
286
|
+
if (market.chainId !== 0n ||
|
|
287
|
+
!(0, checks_js_1.sameAddress)(market.midnight, viem_1.zeroAddress) ||
|
|
288
|
+
!(0, checks_js_1.sameAddress)(market.loanToken, viem_1.zeroAddress) ||
|
|
289
|
+
market.collateralParams.length !== 0 ||
|
|
290
|
+
market.maturity !== 0n ||
|
|
291
|
+
market.rcfThreshold !== 0n ||
|
|
292
|
+
!(0, checks_js_1.sameAddress)(market.enterGate, viem_1.zeroAddress) ||
|
|
293
|
+
!(0, checks_js_1.sameAddress)(market.liquidatorGate, viem_1.zeroAddress) ||
|
|
294
|
+
supplies.length !== 0 ||
|
|
295
|
+
(blue == null &&
|
|
296
|
+
(value !== 0n || !(0, checks_js_1.sameAddress)(wrappedNative, viem_1.zeroAddress)))) {
|
|
297
|
+
throw new errors_js_1.CalldataCallError("collateral_supplies", call.id);
|
|
298
|
+
}
|
|
299
|
+
if (blue == null ||
|
|
300
|
+
(value === 0n && (0, checks_js_1.sameAddress)(wrappedNative, viem_1.zeroAddress))) {
|
|
301
|
+
return [];
|
|
302
|
+
}
|
|
303
|
+
if (value === 0n ||
|
|
304
|
+
!(0, checks_js_1.sameAddress)(blue.loanToken, chain.wNative) ||
|
|
305
|
+
!(0, checks_js_1.sameAddress)(wrappedNative, chain.wNative) ||
|
|
306
|
+
value > blue.assets) {
|
|
307
|
+
throw new errors_js_1.CalldataAmountError("value", call.id);
|
|
308
|
+
}
|
|
309
|
+
(0, checks_js_1.requireNativeBudget)(value, { funding: blue.funding, call });
|
|
310
|
+
return [];
|
|
311
|
+
}
|
|
312
|
+
const collateralMarketId = marketId(market, call);
|
|
313
|
+
if (market.chainId !== BigInt(intent.chain_id) ||
|
|
314
|
+
!(0, checks_js_1.sameAddress)(market.midnight, chain.midnight) ||
|
|
315
|
+
offers.some((offer) => !(0, checks_js_1.sameHex)(marketId(offer.market, call), collateralMarketId))) {
|
|
316
|
+
throw new errors_js_1.CalldataTargetError("market", call.id);
|
|
317
|
+
}
|
|
318
|
+
const collateral = (0, midnight_js_1.checkCollateral)(supplies, { requested, market, call });
|
|
319
|
+
if (value === 0n && (0, checks_js_1.sameAddress)(wrappedNative, viem_1.zeroAddress)) {
|
|
320
|
+
return collateral;
|
|
321
|
+
}
|
|
322
|
+
const nativeCap = collateral.find(({ token }) => (0, checks_js_1.sameAddress)(token, chain.wNative))?.assets ??
|
|
323
|
+
0n;
|
|
324
|
+
if (value === 0n ||
|
|
325
|
+
!(0, checks_js_1.sameAddress)(wrappedNative, chain.wNative) ||
|
|
326
|
+
value > nativeCap) {
|
|
327
|
+
throw new errors_js_1.CalldataAmountError("value", call.id);
|
|
328
|
+
}
|
|
329
|
+
(0, checks_js_1.requireNativeBudget)(value, { funding, call });
|
|
330
|
+
return collateral;
|
|
331
|
+
}
|
|
332
|
+
function loanTokenPulls(offers, { intent, chain, call, cap, blue }) {
|
|
333
|
+
if (!sides[intent.action].buy) {
|
|
334
|
+
return [];
|
|
335
|
+
}
|
|
336
|
+
const token = offers[0].market.loanToken;
|
|
337
|
+
if (blue != null && !(0, checks_js_1.sameAddress)(blue.loanToken, token)) {
|
|
338
|
+
throw new errors_js_1.CalldataTargetError("funding_source.market_id", call.id);
|
|
339
|
+
}
|
|
340
|
+
return [
|
|
341
|
+
{
|
|
342
|
+
token,
|
|
343
|
+
spender: blue == null ? chain.midnight : chain.midnightBundlesV2,
|
|
344
|
+
assets: intent.action === "midnight.make_lend" ? cap : 0n,
|
|
345
|
+
},
|
|
346
|
+
];
|
|
347
|
+
}
|
|
348
|
+
function verifyMake(intent, { calls, chain, }) {
|
|
349
|
+
const call = (0, checks_js_1.mainCall)(calls, Number.MAX_SAFE_INTEGER);
|
|
350
|
+
(0, checks_js_1.requireTarget)(call, chain.midnightBundlesV2);
|
|
351
|
+
const decoded = (0, checks_js_1.decode)(call, { abi: midnight_sdk_1.midnightBundlesV2Abi });
|
|
352
|
+
if (decoded.functionName !== "midnightBundlesV2CancelAndMake") {
|
|
353
|
+
throw new errors_js_1.CalldataCallError("function", call.id);
|
|
354
|
+
}
|
|
355
|
+
if (intent.amount?.unit !== sides[intent.action].unit) {
|
|
356
|
+
throw new errors_js_1.CalldataAmountError("amount.unit", call.id);
|
|
357
|
+
}
|
|
358
|
+
const base = {
|
|
359
|
+
intent,
|
|
360
|
+
chain,
|
|
361
|
+
call,
|
|
362
|
+
cap: (0, checks_js_1.uint)(intent.amount.value, { field: "amount", call }),
|
|
363
|
+
};
|
|
364
|
+
const context = { ...base, blue: checkBlueFunding(decoded.args, base) };
|
|
365
|
+
checkEnvelope(decoded.args, context);
|
|
366
|
+
const offers = checkOffers(decoded.args, context);
|
|
367
|
+
const collateral = checkCollateralSupplies(decoded.args, { offers, context });
|
|
368
|
+
return [
|
|
369
|
+
...(0, midnight_js_1.checkPrerequisites)(calls.slice(0, -1), {
|
|
370
|
+
...context,
|
|
371
|
+
pulls: [...collateral, ...loanTokenPulls(offers, context)],
|
|
372
|
+
allowAuthorization: true,
|
|
373
|
+
}),
|
|
374
|
+
(0, checks_js_1.checked)(call, decoded),
|
|
375
|
+
];
|
|
376
|
+
}
|
|
377
|
+
/** @internal */
|
|
378
|
+
exports.midnightMakerRules = {
|
|
379
|
+
"midnight.make_borrow": verifyMake,
|
|
380
|
+
"midnight.make_lend": verifyMake,
|
|
381
|
+
"midnight.make_repay": verifyMake,
|
|
382
|
+
"midnight.make_withdraw": verifyMake,
|
|
383
|
+
};
|
|
@@ -10,14 +10,9 @@ declare function cancel(intent: Extract<MidnightOfferManagementIntent, {
|
|
|
10
10
|
declare function withdrawFunding(intent: Extract<MidnightOfferManagementIntent, {
|
|
11
11
|
action: "midnight.withdraw_funding";
|
|
12
12
|
}>, context: Context): import("./types.js").DecodedCalldataCall[];
|
|
13
|
-
declare function unsupported(intent: MidnightOfferManagementIntent, { calls }: Context): never;
|
|
14
13
|
/** @internal */
|
|
15
14
|
export declare const midnightOfferRules: {
|
|
16
15
|
"midnight.cancel_offers": typeof cancel;
|
|
17
16
|
"midnight.withdraw_funding": typeof withdrawFunding;
|
|
18
|
-
"midnight.make_borrow": typeof unsupported;
|
|
19
|
-
"midnight.make_lend": typeof unsupported;
|
|
20
|
-
"midnight.make_repay": typeof unsupported;
|
|
21
|
-
"midnight.make_withdraw": typeof unsupported;
|
|
22
17
|
};
|
|
23
18
|
export {};
|
|
@@ -94,15 +94,8 @@ function withdrawFunding(intent, context) {
|
|
|
94
94
|
}
|
|
95
95
|
return [(0, checks_js_1.checked)(call, decoded)];
|
|
96
96
|
}
|
|
97
|
-
function unsupported(intent, { calls }) {
|
|
98
|
-
throw new errors_js_1.CalldataUnsupportedError(intent.action, calls[0]?.id);
|
|
99
|
-
}
|
|
100
97
|
/** @internal */
|
|
101
98
|
exports.midnightOfferRules = {
|
|
102
99
|
"midnight.cancel_offers": cancel,
|
|
103
100
|
"midnight.withdraw_funding": withdrawFunding,
|
|
104
|
-
"midnight.make_borrow": unsupported,
|
|
105
|
-
"midnight.make_lend": unsupported,
|
|
106
|
-
"midnight.make_repay": unsupported,
|
|
107
|
-
"midnight.make_withdraw": unsupported,
|
|
108
101
|
};
|
package/lib/cjs/types.d.ts
CHANGED
|
@@ -232,6 +232,7 @@ export type MidnightMarketIntent = MidnightMarket & (({
|
|
|
232
232
|
readonly referral_fee?: never;
|
|
233
233
|
})) | ({
|
|
234
234
|
readonly action: "midnight.supply_collateral";
|
|
235
|
+
readonly funding?: Funding;
|
|
235
236
|
} & MidnightCollateral<Amount<"assets">>) | ({
|
|
236
237
|
readonly action: "midnight.withdraw_collateral";
|
|
237
238
|
} & MidnightWithdrawals));
|
|
@@ -8,6 +8,7 @@ const blue_js_1 = require("./blue.js");
|
|
|
8
8
|
const checks_js_1 = require("./checks.js");
|
|
9
9
|
const errors_js_1 = require("./errors.js");
|
|
10
10
|
const midnight_js_1 = require("./midnight.js");
|
|
11
|
+
const midnightMakers_js_1 = require("./midnightMakers.js");
|
|
11
12
|
const midnightOffers_js_1 = require("./midnightOffers.js");
|
|
12
13
|
const vault_js_1 = require("./vault.js");
|
|
13
14
|
const rules = {
|
|
@@ -15,6 +16,7 @@ const rules = {
|
|
|
15
16
|
...blue_js_1.blueRules,
|
|
16
17
|
...midnight_js_1.midnightRules,
|
|
17
18
|
...midnightOffers_js_1.midnightOfferRules,
|
|
19
|
+
...midnightMakers_js_1.midnightMakerRules,
|
|
18
20
|
};
|
|
19
21
|
/**
|
|
20
22
|
* Statically checks Actions API calldata against the original request before signing; does not simulate execution.
|
package/lib/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Installed @morpho-org/calldata-verifier package version. */
|
|
2
|
-
export declare const version = "0.
|
|
2
|
+
export declare const version = "0.3.0";
|