@morpho-org/midnight-sdk 1.7.0 → 2.0.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.
Files changed (103) hide show
  1. package/MIGRATION-v1-to-v2.md +6 -0
  2. package/README.md +63 -61
  3. package/lib/cjs/abis.d.ts +1962 -759
  4. package/lib/cjs/abis.js +2021 -995
  5. package/lib/cjs/api/helpers.d.ts +1 -17
  6. package/lib/cjs/api/helpers.js +0 -4
  7. package/lib/cjs/api/types.d.ts +5 -4
  8. package/lib/cjs/api/version.generated.d.ts +1 -1
  9. package/lib/cjs/api/version.generated.js +2 -2
  10. package/lib/cjs/bundlesV2.d.ts +15 -0
  11. package/lib/cjs/bundlesV2.js +2 -0
  12. package/lib/cjs/constants.d.ts +34 -0
  13. package/lib/cjs/constants.js +35 -1
  14. package/lib/cjs/errors.d.ts +107 -0
  15. package/lib/cjs/errors.js +139 -1
  16. package/lib/cjs/fetch/Ratifier.d.ts +4 -3
  17. package/lib/cjs/fetch/Ratifier.js +6 -4
  18. package/lib/cjs/index.d.ts +8 -0
  19. package/lib/cjs/index.js +16 -1
  20. package/lib/cjs/offers/Offer.d.ts +10 -0
  21. package/lib/cjs/offers/Offer.js +15 -1
  22. package/lib/cjs/offers/OfferUtils.d.ts +3 -0
  23. package/lib/cjs/offers/OfferUtils.js +3 -0
  24. package/lib/cjs/signatures/{EcrecoverRatifierUtils.d.ts → EcrecoverRatifier.d.ts} +118 -2
  25. package/lib/cjs/signatures/{EcrecoverRatifierUtils.js → EcrecoverRatifier.js} +146 -9
  26. package/lib/cjs/signatures/GroupUtils.d.ts +55 -2
  27. package/lib/cjs/signatures/GroupUtils.js +64 -5
  28. package/lib/cjs/signatures/Payload.d.ts +3 -3
  29. package/lib/cjs/signatures/PriceRatifierV1.d.ts +472 -0
  30. package/lib/cjs/signatures/PriceRatifierV1.js +521 -0
  31. package/lib/cjs/signatures/RateRatifierV1.d.ts +581 -0
  32. package/lib/cjs/signatures/RateRatifierV1.js +696 -0
  33. package/lib/{esm/signatures/RatifierUtils.d.ts → cjs/signatures/Ratifier.d.ts} +14 -12
  34. package/lib/cjs/signatures/{RatifierUtils.js → Ratifier.js} +29 -29
  35. package/lib/cjs/signatures/{SetterRatifierUtils.d.ts → SetterRatifier.d.ts} +50 -3
  36. package/lib/cjs/signatures/{SetterRatifierUtils.js → SetterRatifier.js} +65 -7
  37. package/lib/cjs/signatures/Tree.d.ts +94 -17
  38. package/lib/cjs/signatures/Tree.js +146 -111
  39. package/lib/cjs/signatures/TreeUtils.d.ts +191 -21
  40. package/lib/cjs/signatures/TreeUtils.js +320 -134
  41. package/lib/cjs/signatures/index.d.ts +7 -3
  42. package/lib/cjs/signatures/index.js +5 -3
  43. package/lib/cjs/signatures/ratifierRequests.d.ts +55 -0
  44. package/lib/cjs/signatures/ratifierRequests.js +2 -0
  45. package/lib/cjs/signatures/ratifierV1Internal.d.ts +57 -0
  46. package/lib/cjs/signatures/ratifierV1Internal.js +183 -0
  47. package/lib/cjs/signatures/standardRatifierInternal.d.ts +4 -0
  48. package/lib/cjs/signatures/standardRatifierInternal.js +12 -0
  49. package/lib/cjs/signatures/treeMathInternal.d.ts +4 -0
  50. package/lib/cjs/signatures/treeMathInternal.js +12 -0
  51. package/lib/cjs/signatures/treeTypes.d.ts +109 -0
  52. package/lib/cjs/signatures/treeTypes.js +2 -0
  53. package/lib/esm/abis.d.ts +1962 -759
  54. package/lib/esm/abis.js +2020 -994
  55. package/lib/esm/api/helpers.d.ts +1 -17
  56. package/lib/esm/api/helpers.js +4 -4
  57. package/lib/esm/api/types.d.ts +5 -4
  58. package/lib/esm/api/version.generated.d.ts +1 -1
  59. package/lib/esm/api/version.generated.js +2 -2
  60. package/lib/esm/bundlesV2.d.ts +15 -0
  61. package/lib/esm/bundlesV2.js +1 -0
  62. package/lib/esm/constants.d.ts +34 -0
  63. package/lib/esm/constants.js +34 -0
  64. package/lib/esm/errors.d.ts +107 -0
  65. package/lib/esm/errors.js +132 -0
  66. package/lib/esm/fetch/Ratifier.d.ts +4 -3
  67. package/lib/esm/fetch/Ratifier.js +6 -4
  68. package/lib/esm/index.d.ts +8 -0
  69. package/lib/esm/index.js +5 -0
  70. package/lib/esm/offers/Offer.d.ts +10 -0
  71. package/lib/esm/offers/Offer.js +15 -1
  72. package/lib/esm/offers/OfferUtils.d.ts +3 -0
  73. package/lib/esm/offers/OfferUtils.js +3 -0
  74. package/lib/esm/signatures/{EcrecoverRatifierUtils.d.ts → EcrecoverRatifier.d.ts} +118 -2
  75. package/lib/esm/signatures/{EcrecoverRatifierUtils.js → EcrecoverRatifier.js} +146 -9
  76. package/lib/esm/signatures/GroupUtils.d.ts +55 -2
  77. package/lib/esm/signatures/GroupUtils.js +64 -5
  78. package/lib/esm/signatures/Payload.d.ts +3 -3
  79. package/lib/esm/signatures/PriceRatifierV1.d.ts +472 -0
  80. package/lib/esm/signatures/PriceRatifierV1.js +520 -0
  81. package/lib/esm/signatures/RateRatifierV1.d.ts +581 -0
  82. package/lib/esm/signatures/RateRatifierV1.js +695 -0
  83. package/lib/{cjs/signatures/RatifierUtils.d.ts → esm/signatures/Ratifier.d.ts} +14 -12
  84. package/lib/esm/signatures/{RatifierUtils.js → Ratifier.js} +31 -29
  85. package/lib/esm/signatures/{SetterRatifierUtils.d.ts → SetterRatifier.d.ts} +50 -3
  86. package/lib/esm/signatures/{SetterRatifierUtils.js → SetterRatifier.js} +65 -7
  87. package/lib/esm/signatures/Tree.d.ts +94 -17
  88. package/lib/esm/signatures/Tree.js +147 -112
  89. package/lib/esm/signatures/TreeUtils.d.ts +191 -21
  90. package/lib/esm/signatures/TreeUtils.js +318 -132
  91. package/lib/esm/signatures/index.d.ts +7 -3
  92. package/lib/esm/signatures/index.js +5 -3
  93. package/lib/esm/signatures/ratifierRequests.d.ts +55 -0
  94. package/lib/esm/signatures/ratifierRequests.js +1 -0
  95. package/lib/esm/signatures/ratifierV1Internal.d.ts +57 -0
  96. package/lib/esm/signatures/ratifierV1Internal.js +176 -0
  97. package/lib/esm/signatures/standardRatifierInternal.d.ts +4 -0
  98. package/lib/esm/signatures/standardRatifierInternal.js +9 -0
  99. package/lib/esm/signatures/treeMathInternal.d.ts +4 -0
  100. package/lib/esm/signatures/treeMathInternal.js +8 -0
  101. package/lib/esm/signatures/treeTypes.d.ts +109 -0
  102. package/lib/esm/signatures/treeTypes.js +1 -0
  103. package/package.json +9 -8
package/lib/cjs/abis.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setterRatifierAbi = exports.ecrecoverRatifierAbi = exports.midnightBundlesAbi = exports.midnightAbi = void 0;
3
+ exports.blueBuyCallbackFactoryAbi = exports.midnightBundlesV2Abi = exports.rateRatifierV1Abi = exports.priceRatifierV1Abi = exports.setterRatifierAbi = exports.ecrecoverRatifierAbi = exports.midnightAbi = void 0;
4
4
  /**
5
5
  * Pinned ABI JSON for the core Midnight contract.
6
6
  *
@@ -2505,1803 +2505,2829 @@ exports.midnightAbi = [
2505
2505
  },
2506
2506
  ];
2507
2507
  /**
2508
- * ABI JSON for the Midnight Bundles periphery used by app-compatible taker and repay flows.
2508
+ * Pinned ABI JSON for the EcrecoverRatifier.
2509
2509
  *
2510
- * Source: `morpho-org/bundles` commit `34a12c68c2e638ae872f525a8226dbc92ccd1a30`,
2511
- * `src/midnight/interfaces/IMidnightBundlesV1.sol`, adapted to the current
2512
- * `morpho-org/midnight` `Market` and `Offer` struct fields exported by this package.
2510
+ * Source: `morpho-org/midnight` commit `336b924a2bb378d810ef6d35b6dd3486759af8bd`,
2511
+ * `src/ratifiers/interfaces/IEcrecoverRatifier.sol`, Forge artifact `out/IEcrecoverRatifier.sol/IEcrecoverRatifier.json`.
2513
2512
  *
2514
2513
  * @example
2515
2514
  * ```ts
2516
- * import { midnightBundlesAbi } from "@morpho-org/midnight-sdk";
2515
+ * import { ecrecoverRatifierAbi } from "@morpho-org/midnight-sdk";
2517
2516
  *
2518
- * console.log(midnightBundlesAbi.length);
2517
+ * console.log(ecrecoverRatifierAbi.length);
2519
2518
  * ```
2520
2519
  */
2521
- exports.midnightBundlesAbi = [
2522
- {
2523
- inputs: [],
2524
- name: "ContinuousFeeAboveMax",
2525
- type: "error",
2526
- },
2527
- {
2528
- inputs: [],
2529
- name: "DeadlinePassed",
2530
- type: "error",
2531
- },
2532
- {
2533
- inputs: [],
2534
- name: "InconsistentMarket",
2535
- type: "error",
2536
- },
2537
- {
2538
- inputs: [],
2539
- name: "InconsistentSide",
2540
- type: "error",
2541
- },
2542
- {
2543
- inputs: [],
2544
- name: "NotReduceOnly",
2545
- type: "error",
2546
- },
2547
- {
2548
- inputs: [],
2549
- name: "OutOfOffers",
2550
- type: "error",
2551
- },
2552
- {
2553
- inputs: [],
2554
- name: "PctExceeded",
2555
- type: "error",
2556
- },
2557
- {
2558
- inputs: [],
2559
- name: "SellerAssetsTooLow",
2560
- type: "error",
2561
- },
2562
- {
2563
- inputs: [],
2564
- name: "Unauthorized",
2565
- type: "error",
2566
- },
2567
- {
2568
- inputs: [],
2569
- name: "UnitsTooHigh",
2570
- type: "error",
2571
- },
2572
- {
2573
- inputs: [],
2574
- name: "UnitsTooLow",
2575
- type: "error",
2576
- },
2520
+ exports.ecrecoverRatifierAbi = [
2577
2521
  {
2578
- inputs: [],
2522
+ type: "function",
2579
2523
  name: "MIDNIGHT",
2524
+ inputs: [],
2580
2525
  outputs: [
2581
2526
  {
2582
- internalType: "address",
2583
2527
  name: "",
2584
2528
  type: "address",
2529
+ internalType: "address",
2585
2530
  },
2586
2531
  ],
2587
2532
  stateMutability: "view",
2588
- type: "function",
2589
2533
  },
2590
2534
  {
2535
+ type: "function",
2536
+ name: "cancelRoot",
2591
2537
  inputs: [
2592
2538
  {
2593
- internalType: "uint256",
2594
- name: "targetBuyerAssets",
2595
- type: "uint256",
2596
- },
2597
- {
2598
- internalType: "uint256",
2599
- name: "minUnits",
2600
- type: "uint256",
2601
- },
2602
- {
2603
- internalType: "address",
2604
- name: "taker",
2539
+ name: "maker",
2605
2540
  type: "address",
2541
+ internalType: "address",
2606
2542
  },
2607
2543
  {
2608
- internalType: "bool",
2609
- name: "reduceOnly",
2610
- type: "bool",
2544
+ name: "root",
2545
+ type: "bytes32",
2546
+ internalType: "bytes32",
2611
2547
  },
2548
+ ],
2549
+ outputs: [],
2550
+ stateMutability: "nonpayable",
2551
+ },
2552
+ {
2553
+ type: "function",
2554
+ name: "isRatified",
2555
+ inputs: [
2612
2556
  {
2613
- components: [
2614
- {
2615
- internalType: "enum PermitKind",
2616
- name: "kind",
2617
- type: "uint8",
2618
- },
2619
- {
2620
- internalType: "bytes",
2621
- name: "data",
2622
- type: "bytes",
2623
- },
2624
- ],
2625
- internalType: "struct TokenPermit",
2626
- name: "loanTokenPermit",
2557
+ name: "offer",
2627
2558
  type: "tuple",
2628
- },
2629
- {
2559
+ internalType: "struct Offer",
2630
2560
  components: [
2631
2561
  {
2562
+ name: "market",
2563
+ type: "tuple",
2564
+ internalType: "struct Market",
2632
2565
  components: [
2633
2566
  {
2567
+ name: "chainId",
2568
+ type: "uint256",
2569
+ internalType: "uint256",
2570
+ },
2571
+ {
2572
+ name: "midnight",
2573
+ type: "address",
2574
+ internalType: "address",
2575
+ },
2576
+ {
2577
+ name: "loanToken",
2578
+ type: "address",
2579
+ internalType: "address",
2580
+ },
2581
+ {
2582
+ name: "collateralParams",
2583
+ type: "tuple[]",
2584
+ internalType: "struct CollateralParams[]",
2634
2585
  components: [
2635
2586
  {
2636
- internalType: "uint256",
2637
- name: "chainId",
2638
- type: "uint256",
2639
- },
2640
- {
2641
- internalType: "address",
2642
- name: "midnight",
2587
+ name: "token",
2643
2588
  type: "address",
2644
- },
2645
- {
2646
2589
  internalType: "address",
2647
- name: "loanToken",
2648
- type: "address",
2649
- },
2650
- {
2651
- components: [
2652
- {
2653
- internalType: "address",
2654
- name: "token",
2655
- type: "address",
2656
- },
2657
- {
2658
- internalType: "uint256",
2659
- name: "lltv",
2660
- type: "uint256",
2661
- },
2662
- {
2663
- internalType: "uint256",
2664
- name: "liquidationCursor",
2665
- type: "uint256",
2666
- },
2667
- {
2668
- internalType: "address",
2669
- name: "oracle",
2670
- type: "address",
2671
- },
2672
- ],
2673
- internalType: "struct CollateralParams[]",
2674
- name: "collateralParams",
2675
- type: "tuple[]",
2676
2590
  },
2677
2591
  {
2678
- internalType: "uint256",
2679
- name: "maturity",
2592
+ name: "lltv",
2680
2593
  type: "uint256",
2594
+ internalType: "uint256",
2681
2595
  },
2682
2596
  {
2683
- internalType: "uint256",
2684
- name: "rcfThreshold",
2597
+ name: "liquidationCursor",
2685
2598
  type: "uint256",
2599
+ internalType: "uint256",
2686
2600
  },
2687
2601
  {
2688
- internalType: "address",
2689
- name: "enterGate",
2602
+ name: "oracle",
2690
2603
  type: "address",
2691
- },
2692
- {
2693
2604
  internalType: "address",
2694
- name: "liquidatorGate",
2695
- type: "address",
2696
2605
  },
2697
2606
  ],
2698
- internalType: "struct Market",
2699
- name: "market",
2700
- type: "tuple",
2701
- },
2702
- {
2703
- internalType: "bool",
2704
- name: "buy",
2705
- type: "bool",
2706
2607
  },
2707
2608
  {
2708
- internalType: "address",
2709
- name: "maker",
2710
- type: "address",
2711
- },
2712
- {
2713
- internalType: "uint256",
2714
- name: "start",
2609
+ name: "maturity",
2715
2610
  type: "uint256",
2716
- },
2717
- {
2718
2611
  internalType: "uint256",
2719
- name: "expiry",
2720
- type: "uint256",
2721
2612
  },
2722
2613
  {
2723
- internalType: "uint256",
2724
- name: "tick",
2614
+ name: "rcfThreshold",
2725
2615
  type: "uint256",
2616
+ internalType: "uint256",
2726
2617
  },
2727
2618
  {
2728
- internalType: "bytes32",
2729
- name: "group",
2730
- type: "bytes32",
2731
- },
2732
- {
2733
- internalType: "address",
2734
- name: "callback",
2619
+ name: "enterGate",
2735
2620
  type: "address",
2736
- },
2737
- {
2738
- internalType: "bytes",
2739
- name: "callbackData",
2740
- type: "bytes",
2741
- },
2742
- {
2743
2621
  internalType: "address",
2744
- name: "receiverIfMakerIsSeller",
2745
- type: "address",
2746
2622
  },
2747
2623
  {
2748
- internalType: "address",
2749
- name: "ratifier",
2624
+ name: "liquidatorGate",
2750
2625
  type: "address",
2751
- },
2752
- {
2753
- internalType: "bool",
2754
- name: "reduceOnly",
2755
- type: "bool",
2756
- },
2757
- {
2758
- internalType: "uint128",
2759
- name: "maxUnits",
2760
- type: "uint128",
2761
- },
2762
- {
2763
- internalType: "uint128",
2764
- name: "maxAssets",
2765
- type: "uint128",
2766
- },
2767
- {
2768
- internalType: "uint256",
2769
- name: "continuousFeeCap",
2770
- type: "uint256",
2626
+ internalType: "address",
2771
2627
  },
2772
2628
  ],
2773
- internalType: "struct Offer",
2774
- name: "offer",
2775
- type: "tuple",
2776
2629
  },
2777
2630
  {
2778
- internalType: "bytes",
2779
- name: "ratifierData",
2780
- type: "bytes",
2781
- },
2631
+ name: "buy",
2632
+ type: "bool",
2633
+ internalType: "bool",
2634
+ },
2635
+ {
2636
+ name: "maker",
2637
+ type: "address",
2638
+ internalType: "address",
2639
+ },
2640
+ {
2641
+ name: "start",
2642
+ type: "uint256",
2643
+ internalType: "uint256",
2644
+ },
2645
+ {
2646
+ name: "expiry",
2647
+ type: "uint256",
2648
+ internalType: "uint256",
2649
+ },
2650
+ {
2651
+ name: "tick",
2652
+ type: "uint256",
2653
+ internalType: "uint256",
2654
+ },
2655
+ {
2656
+ name: "group",
2657
+ type: "bytes32",
2658
+ internalType: "bytes32",
2659
+ },
2660
+ {
2661
+ name: "callback",
2662
+ type: "address",
2663
+ internalType: "address",
2664
+ },
2665
+ {
2666
+ name: "callbackData",
2667
+ type: "bytes",
2668
+ internalType: "bytes",
2669
+ },
2670
+ {
2671
+ name: "receiverIfMakerIsSeller",
2672
+ type: "address",
2673
+ internalType: "address",
2674
+ },
2675
+ {
2676
+ name: "ratifier",
2677
+ type: "address",
2678
+ internalType: "address",
2679
+ },
2680
+ {
2681
+ name: "reduceOnly",
2682
+ type: "bool",
2683
+ internalType: "bool",
2684
+ },
2685
+ {
2686
+ name: "maxUnits",
2687
+ type: "uint128",
2688
+ internalType: "uint128",
2689
+ },
2690
+ {
2691
+ name: "maxAssets",
2692
+ type: "uint128",
2693
+ internalType: "uint128",
2694
+ },
2695
+ {
2696
+ name: "continuousFeeCap",
2697
+ type: "uint256",
2698
+ internalType: "uint256",
2699
+ },
2700
+ ],
2701
+ },
2702
+ {
2703
+ name: "ratifierData",
2704
+ type: "bytes",
2705
+ internalType: "bytes",
2706
+ },
2707
+ {
2708
+ name: "taker",
2709
+ type: "address",
2710
+ internalType: "address",
2711
+ },
2712
+ ],
2713
+ outputs: [
2714
+ {
2715
+ name: "",
2716
+ type: "bytes32",
2717
+ internalType: "bytes32",
2718
+ },
2719
+ ],
2720
+ stateMutability: "view",
2721
+ },
2722
+ {
2723
+ type: "function",
2724
+ name: "isRootCanceled",
2725
+ inputs: [
2726
+ {
2727
+ name: "maker",
2728
+ type: "address",
2729
+ internalType: "address",
2730
+ },
2731
+ {
2732
+ name: "root",
2733
+ type: "bytes32",
2734
+ internalType: "bytes32",
2735
+ },
2736
+ ],
2737
+ outputs: [
2738
+ {
2739
+ name: "",
2740
+ type: "bool",
2741
+ internalType: "bool",
2742
+ },
2743
+ ],
2744
+ stateMutability: "view",
2745
+ },
2746
+ {
2747
+ type: "event",
2748
+ name: "CancelRoot",
2749
+ inputs: [
2750
+ {
2751
+ name: "caller",
2752
+ type: "address",
2753
+ indexed: true,
2754
+ internalType: "address",
2755
+ },
2756
+ {
2757
+ name: "maker",
2758
+ type: "address",
2759
+ indexed: true,
2760
+ internalType: "address",
2761
+ },
2762
+ {
2763
+ name: "root",
2764
+ type: "bytes32",
2765
+ indexed: true,
2766
+ internalType: "bytes32",
2767
+ },
2768
+ ],
2769
+ anonymous: false,
2770
+ },
2771
+ {
2772
+ type: "error",
2773
+ name: "InvalidProof",
2774
+ inputs: [],
2775
+ },
2776
+ {
2777
+ type: "error",
2778
+ name: "InvalidSignature",
2779
+ inputs: [],
2780
+ },
2781
+ {
2782
+ type: "error",
2783
+ name: "RootCanceled",
2784
+ inputs: [],
2785
+ },
2786
+ {
2787
+ type: "error",
2788
+ name: "Unauthorized",
2789
+ inputs: [],
2790
+ },
2791
+ ];
2792
+ /**
2793
+ * Pinned ABI JSON for the SetterRatifier.
2794
+ *
2795
+ * Source: `morpho-org/midnight` commit `336b924a2bb378d810ef6d35b6dd3486759af8bd`,
2796
+ * `src/ratifiers/interfaces/ISetterRatifier.sol`, Forge artifact `out/ISetterRatifier.sol/ISetterRatifier.json`.
2797
+ *
2798
+ * @example
2799
+ * ```ts
2800
+ * import { setterRatifierAbi } from "@morpho-org/midnight-sdk";
2801
+ *
2802
+ * console.log(setterRatifierAbi.length);
2803
+ * ```
2804
+ */
2805
+ exports.setterRatifierAbi = [
2806
+ {
2807
+ type: "function",
2808
+ name: "MIDNIGHT",
2809
+ inputs: [],
2810
+ outputs: [
2811
+ {
2812
+ name: "",
2813
+ type: "address",
2814
+ internalType: "address",
2815
+ },
2816
+ ],
2817
+ stateMutability: "view",
2818
+ },
2819
+ {
2820
+ type: "function",
2821
+ name: "isRatified",
2822
+ inputs: [
2823
+ {
2824
+ name: "offer",
2825
+ type: "tuple",
2826
+ internalType: "struct Offer",
2827
+ components: [
2828
+ {
2829
+ name: "market",
2830
+ type: "tuple",
2831
+ internalType: "struct Market",
2832
+ components: [
2833
+ {
2834
+ name: "chainId",
2835
+ type: "uint256",
2836
+ internalType: "uint256",
2837
+ },
2838
+ {
2839
+ name: "midnight",
2840
+ type: "address",
2841
+ internalType: "address",
2842
+ },
2843
+ {
2844
+ name: "loanToken",
2845
+ type: "address",
2846
+ internalType: "address",
2847
+ },
2848
+ {
2849
+ name: "collateralParams",
2850
+ type: "tuple[]",
2851
+ internalType: "struct CollateralParams[]",
2852
+ components: [
2853
+ {
2854
+ name: "token",
2855
+ type: "address",
2856
+ internalType: "address",
2857
+ },
2858
+ {
2859
+ name: "lltv",
2860
+ type: "uint256",
2861
+ internalType: "uint256",
2862
+ },
2863
+ {
2864
+ name: "liquidationCursor",
2865
+ type: "uint256",
2866
+ internalType: "uint256",
2867
+ },
2868
+ {
2869
+ name: "oracle",
2870
+ type: "address",
2871
+ internalType: "address",
2872
+ },
2873
+ ],
2874
+ },
2875
+ {
2876
+ name: "maturity",
2877
+ type: "uint256",
2878
+ internalType: "uint256",
2879
+ },
2880
+ {
2881
+ name: "rcfThreshold",
2882
+ type: "uint256",
2883
+ internalType: "uint256",
2884
+ },
2885
+ {
2886
+ name: "enterGate",
2887
+ type: "address",
2888
+ internalType: "address",
2889
+ },
2890
+ {
2891
+ name: "liquidatorGate",
2892
+ type: "address",
2893
+ internalType: "address",
2894
+ },
2895
+ ],
2896
+ },
2897
+ {
2898
+ name: "buy",
2899
+ type: "bool",
2900
+ internalType: "bool",
2901
+ },
2902
+ {
2903
+ name: "maker",
2904
+ type: "address",
2905
+ internalType: "address",
2906
+ },
2907
+ {
2908
+ name: "start",
2909
+ type: "uint256",
2910
+ internalType: "uint256",
2911
+ },
2912
+ {
2913
+ name: "expiry",
2914
+ type: "uint256",
2915
+ internalType: "uint256",
2916
+ },
2917
+ {
2918
+ name: "tick",
2919
+ type: "uint256",
2920
+ internalType: "uint256",
2921
+ },
2922
+ {
2923
+ name: "group",
2924
+ type: "bytes32",
2925
+ internalType: "bytes32",
2926
+ },
2927
+ {
2928
+ name: "callback",
2929
+ type: "address",
2930
+ internalType: "address",
2931
+ },
2932
+ {
2933
+ name: "callbackData",
2934
+ type: "bytes",
2935
+ internalType: "bytes",
2936
+ },
2937
+ {
2938
+ name: "receiverIfMakerIsSeller",
2939
+ type: "address",
2940
+ internalType: "address",
2941
+ },
2942
+ {
2943
+ name: "ratifier",
2944
+ type: "address",
2945
+ internalType: "address",
2946
+ },
2947
+ {
2948
+ name: "reduceOnly",
2949
+ type: "bool",
2950
+ internalType: "bool",
2951
+ },
2952
+ {
2953
+ name: "maxUnits",
2954
+ type: "uint128",
2955
+ internalType: "uint128",
2956
+ },
2957
+ {
2958
+ name: "maxAssets",
2959
+ type: "uint128",
2960
+ internalType: "uint128",
2961
+ },
2962
+ {
2963
+ name: "continuousFeeCap",
2964
+ type: "uint256",
2965
+ internalType: "uint256",
2966
+ },
2967
+ ],
2968
+ },
2969
+ {
2970
+ name: "ratifierData",
2971
+ type: "bytes",
2972
+ internalType: "bytes",
2973
+ },
2974
+ {
2975
+ name: "taker",
2976
+ type: "address",
2977
+ internalType: "address",
2978
+ },
2979
+ ],
2980
+ outputs: [
2981
+ {
2982
+ name: "",
2983
+ type: "bytes32",
2984
+ internalType: "bytes32",
2985
+ },
2986
+ ],
2987
+ stateMutability: "view",
2988
+ },
2989
+ {
2990
+ type: "function",
2991
+ name: "isRootRatified",
2992
+ inputs: [
2993
+ {
2994
+ name: "maker",
2995
+ type: "address",
2996
+ internalType: "address",
2997
+ },
2998
+ {
2999
+ name: "root",
3000
+ type: "bytes32",
3001
+ internalType: "bytes32",
3002
+ },
3003
+ ],
3004
+ outputs: [
3005
+ {
3006
+ name: "",
3007
+ type: "bool",
3008
+ internalType: "bool",
3009
+ },
3010
+ ],
3011
+ stateMutability: "view",
3012
+ },
3013
+ {
3014
+ type: "function",
3015
+ name: "setIsRootRatified",
3016
+ inputs: [
3017
+ {
3018
+ name: "maker",
3019
+ type: "address",
3020
+ internalType: "address",
3021
+ },
3022
+ {
3023
+ name: "root",
3024
+ type: "bytes32",
3025
+ internalType: "bytes32",
3026
+ },
3027
+ {
3028
+ name: "newIsRootRatified",
3029
+ type: "bool",
3030
+ internalType: "bool",
3031
+ },
3032
+ ],
3033
+ outputs: [],
3034
+ stateMutability: "nonpayable",
3035
+ },
3036
+ {
3037
+ type: "event",
3038
+ name: "SetIsRootRatified",
3039
+ inputs: [
3040
+ {
3041
+ name: "caller",
3042
+ type: "address",
3043
+ indexed: true,
3044
+ internalType: "address",
3045
+ },
3046
+ {
3047
+ name: "maker",
3048
+ type: "address",
3049
+ indexed: true,
3050
+ internalType: "address",
3051
+ },
3052
+ {
3053
+ name: "root",
3054
+ type: "bytes32",
3055
+ indexed: true,
3056
+ internalType: "bytes32",
3057
+ },
3058
+ {
3059
+ name: "newIsRootRatified",
3060
+ type: "bool",
3061
+ indexed: false,
3062
+ internalType: "bool",
3063
+ },
3064
+ ],
3065
+ anonymous: false,
3066
+ },
3067
+ {
3068
+ type: "error",
3069
+ name: "InvalidProof",
3070
+ inputs: [],
3071
+ },
3072
+ {
3073
+ type: "error",
3074
+ name: "NotRatified",
3075
+ inputs: [],
3076
+ },
3077
+ {
3078
+ type: "error",
3079
+ name: "Unauthorized",
3080
+ inputs: [],
3081
+ },
3082
+ ];
3083
+ /**
3084
+ * Pinned ABI JSON for the PriceRatifierV1.
3085
+ *
3086
+ * Source: `morpho-org/midnight` commit `11f3d984b53286fd9137eb89e5d1385e23fe1b30`,
3087
+ * `src/ratifiers/interfaces/IPriceRatifierV1.sol`, Forge artifact `out/IPriceRatifierV1.sol/IPriceRatifierV1.json`.
3088
+ *
3089
+ * @example
3090
+ * ```ts
3091
+ * import { priceRatifierV1Abi } from "@morpho-org/midnight-sdk";
3092
+ *
3093
+ * console.log(priceRatifierV1Abi.length);
3094
+ * ```
3095
+ */
3096
+ exports.priceRatifierV1Abi = [
3097
+ {
3098
+ type: "function",
3099
+ name: "DOMAIN_SEPARATOR",
3100
+ inputs: [],
3101
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
3102
+ stateMutability: "view",
3103
+ },
3104
+ {
3105
+ type: "function",
3106
+ name: "MIDNIGHT",
3107
+ inputs: [],
3108
+ outputs: [{ name: "", type: "address", internalType: "address" }],
3109
+ stateMutability: "view",
3110
+ },
3111
+ {
3112
+ type: "function",
3113
+ name: "isRatified",
3114
+ inputs: [
3115
+ {
3116
+ name: "offer",
3117
+ type: "tuple",
3118
+ internalType: "struct Offer",
3119
+ components: [
3120
+ {
3121
+ name: "market",
3122
+ type: "tuple",
3123
+ internalType: "struct Market",
3124
+ components: [
3125
+ { name: "chainId", type: "uint256", internalType: "uint256" },
3126
+ { name: "midnight", type: "address", internalType: "address" },
3127
+ { name: "loanToken", type: "address", internalType: "address" },
3128
+ {
3129
+ name: "collateralParams",
3130
+ type: "tuple[]",
3131
+ internalType: "struct CollateralParams[]",
3132
+ components: [
3133
+ { name: "token", type: "address", internalType: "address" },
3134
+ { name: "lltv", type: "uint256", internalType: "uint256" },
3135
+ {
3136
+ name: "liquidationCursor",
3137
+ type: "uint256",
3138
+ internalType: "uint256",
3139
+ },
3140
+ { name: "oracle", type: "address", internalType: "address" },
3141
+ ],
3142
+ },
3143
+ { name: "maturity", type: "uint256", internalType: "uint256" },
3144
+ {
3145
+ name: "rcfThreshold",
3146
+ type: "uint256",
3147
+ internalType: "uint256",
3148
+ },
3149
+ { name: "enterGate", type: "address", internalType: "address" },
3150
+ {
3151
+ name: "liquidatorGate",
3152
+ type: "address",
3153
+ internalType: "address",
3154
+ },
3155
+ ],
3156
+ },
3157
+ { name: "buy", type: "bool", internalType: "bool" },
3158
+ { name: "maker", type: "address", internalType: "address" },
3159
+ { name: "start", type: "uint256", internalType: "uint256" },
3160
+ { name: "expiry", type: "uint256", internalType: "uint256" },
3161
+ { name: "tick", type: "uint256", internalType: "uint256" },
3162
+ { name: "group", type: "bytes32", internalType: "bytes32" },
3163
+ { name: "callback", type: "address", internalType: "address" },
3164
+ { name: "callbackData", type: "bytes", internalType: "bytes" },
3165
+ {
3166
+ name: "receiverIfMakerIsSeller",
3167
+ type: "address",
3168
+ internalType: "address",
3169
+ },
3170
+ { name: "ratifier", type: "address", internalType: "address" },
3171
+ { name: "reduceOnly", type: "bool", internalType: "bool" },
3172
+ { name: "maxUnits", type: "uint128", internalType: "uint128" },
3173
+ { name: "maxAssets", type: "uint128", internalType: "uint128" },
3174
+ {
3175
+ name: "continuousFeeCap",
3176
+ type: "uint256",
3177
+ internalType: "uint256",
3178
+ },
3179
+ ],
3180
+ },
3181
+ { name: "ratifierData", type: "bytes", internalType: "bytes" },
3182
+ { name: "taker", type: "address", internalType: "address" },
3183
+ ],
3184
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
3185
+ stateMutability: "view",
3186
+ },
3187
+ {
3188
+ type: "function",
3189
+ name: "isRootRatified",
3190
+ inputs: [
3191
+ { name: "maker", type: "address", internalType: "address" },
3192
+ { name: "root", type: "bytes32", internalType: "bytes32" },
3193
+ ],
3194
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
3195
+ stateMutability: "view",
3196
+ },
3197
+ {
3198
+ type: "function",
3199
+ name: "ratification",
3200
+ inputs: [
3201
+ { name: "maker", type: "address", internalType: "address" },
3202
+ { name: "root", type: "bytes32", internalType: "bytes32" },
3203
+ ],
3204
+ outputs: [
3205
+ { name: "isRootRatified", type: "bool", internalType: "bool" },
3206
+ { name: "rootNonce", type: "uint128", internalType: "uint128" },
3207
+ ],
3208
+ stateMutability: "view",
3209
+ },
3210
+ {
3211
+ type: "function",
3212
+ name: "rootNonce",
3213
+ inputs: [
3214
+ { name: "maker", type: "address", internalType: "address" },
3215
+ { name: "root", type: "bytes32", internalType: "bytes32" },
3216
+ ],
3217
+ outputs: [{ name: "", type: "uint128", internalType: "uint128" }],
3218
+ stateMutability: "view",
3219
+ },
3220
+ {
3221
+ type: "function",
3222
+ name: "setIsRootRatified",
3223
+ inputs: [
3224
+ { name: "maker", type: "address", internalType: "address" },
3225
+ { name: "root", type: "bytes32", internalType: "bytes32" },
3226
+ { name: "newIsRootRatified", type: "bool", internalType: "bool" },
3227
+ ],
3228
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
3229
+ stateMutability: "nonpayable",
3230
+ },
3231
+ {
3232
+ type: "function",
3233
+ name: "setIsRootRatifiedWithSig",
3234
+ inputs: [
3235
+ { name: "maker", type: "address", internalType: "address" },
3236
+ { name: "root", type: "bytes32", internalType: "bytes32" },
3237
+ { name: "height", type: "uint256", internalType: "uint256" },
3238
+ { name: "newIsRootRatified", type: "bool", internalType: "bool" },
3239
+ { name: "nonce", type: "uint128", internalType: "uint128" },
3240
+ { name: "deadline", type: "uint256", internalType: "uint256" },
3241
+ { name: "v", type: "uint8", internalType: "uint8" },
3242
+ { name: "r", type: "bytes32", internalType: "bytes32" },
3243
+ { name: "s", type: "bytes32", internalType: "bytes32" },
3244
+ ],
3245
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
3246
+ stateMutability: "nonpayable",
3247
+ },
3248
+ {
3249
+ type: "event",
3250
+ name: "SetIsRootRatified",
3251
+ inputs: [
3252
+ {
3253
+ name: "caller",
3254
+ type: "address",
3255
+ indexed: true,
3256
+ internalType: "address",
3257
+ },
3258
+ {
3259
+ name: "maker",
3260
+ type: "address",
3261
+ indexed: true,
3262
+ internalType: "address",
3263
+ },
3264
+ { name: "root", type: "bytes32", indexed: true, internalType: "bytes32" },
3265
+ {
3266
+ name: "newIsRootRatified",
3267
+ type: "bool",
3268
+ indexed: false,
3269
+ internalType: "bool",
3270
+ },
3271
+ ],
3272
+ anonymous: false,
3273
+ },
3274
+ {
3275
+ type: "event",
3276
+ name: "SetIsRootRatifiedWithSig",
3277
+ inputs: [
3278
+ {
3279
+ name: "caller",
3280
+ type: "address",
3281
+ indexed: false,
3282
+ internalType: "address",
3283
+ },
3284
+ {
3285
+ name: "signer",
3286
+ type: "address",
3287
+ indexed: true,
3288
+ internalType: "address",
3289
+ },
3290
+ {
3291
+ name: "maker",
3292
+ type: "address",
3293
+ indexed: true,
3294
+ internalType: "address",
3295
+ },
3296
+ { name: "root", type: "bytes32", indexed: true, internalType: "bytes32" },
3297
+ {
3298
+ name: "height",
3299
+ type: "uint256",
3300
+ indexed: false,
3301
+ internalType: "uint256",
3302
+ },
3303
+ {
3304
+ name: "newIsRootRatified",
3305
+ type: "bool",
3306
+ indexed: false,
3307
+ internalType: "bool",
3308
+ },
3309
+ {
3310
+ name: "signatureNonce",
3311
+ type: "uint128",
3312
+ indexed: false,
3313
+ internalType: "uint128",
3314
+ },
3315
+ {
3316
+ name: "previousNonce",
3317
+ type: "uint128",
3318
+ indexed: false,
3319
+ internalType: "uint128",
3320
+ },
3321
+ ],
3322
+ anonymous: false,
3323
+ },
3324
+ { type: "error", name: "DeadlineExpired", inputs: [] },
3325
+ { type: "error", name: "InvalidNonce", inputs: [] },
3326
+ { type: "error", name: "InvalidProof", inputs: [] },
3327
+ { type: "error", name: "InvalidSignature", inputs: [] },
3328
+ { type: "error", name: "NotRatified", inputs: [] },
3329
+ { type: "error", name: "RatifiedStatusChanged", inputs: [] },
3330
+ { type: "error", name: "Unauthorized", inputs: [] },
3331
+ { type: "error", name: "UnauthorizedTaker", inputs: [] },
3332
+ ];
3333
+ /**
3334
+ * Pinned ABI JSON for the RateRatifierV1.
3335
+ *
3336
+ * Source: `morpho-org/midnight` commit `11f3d984b53286fd9137eb89e5d1385e23fe1b30`,
3337
+ * `src/ratifiers/interfaces/IRateRatifierV1.sol`, Forge artifact `out/IRateRatifierV1.sol/IRateRatifierV1.json`.
3338
+ *
3339
+ * @example
3340
+ * ```ts
3341
+ * import { rateRatifierV1Abi } from "@morpho-org/midnight-sdk";
3342
+ *
3343
+ * console.log(rateRatifierV1Abi.length);
3344
+ * ```
3345
+ */
3346
+ exports.rateRatifierV1Abi = [
3347
+ {
3348
+ type: "function",
3349
+ name: "DOMAIN_SEPARATOR",
3350
+ inputs: [],
3351
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
3352
+ stateMutability: "view",
3353
+ },
3354
+ {
3355
+ type: "function",
3356
+ name: "MIDNIGHT",
3357
+ inputs: [],
3358
+ outputs: [{ name: "", type: "address", internalType: "address" }],
3359
+ stateMutability: "view",
3360
+ },
3361
+ {
3362
+ type: "function",
3363
+ name: "isRatified",
3364
+ inputs: [
3365
+ {
3366
+ name: "offer",
3367
+ type: "tuple",
3368
+ internalType: "struct Offer",
3369
+ components: [
3370
+ {
3371
+ name: "market",
3372
+ type: "tuple",
3373
+ internalType: "struct Market",
3374
+ components: [
3375
+ { name: "chainId", type: "uint256", internalType: "uint256" },
3376
+ { name: "midnight", type: "address", internalType: "address" },
3377
+ { name: "loanToken", type: "address", internalType: "address" },
3378
+ {
3379
+ name: "collateralParams",
3380
+ type: "tuple[]",
3381
+ internalType: "struct CollateralParams[]",
3382
+ components: [
3383
+ { name: "token", type: "address", internalType: "address" },
3384
+ { name: "lltv", type: "uint256", internalType: "uint256" },
3385
+ {
3386
+ name: "liquidationCursor",
3387
+ type: "uint256",
3388
+ internalType: "uint256",
3389
+ },
3390
+ { name: "oracle", type: "address", internalType: "address" },
3391
+ ],
3392
+ },
3393
+ { name: "maturity", type: "uint256", internalType: "uint256" },
3394
+ {
3395
+ name: "rcfThreshold",
3396
+ type: "uint256",
3397
+ internalType: "uint256",
3398
+ },
3399
+ { name: "enterGate", type: "address", internalType: "address" },
3400
+ {
3401
+ name: "liquidatorGate",
3402
+ type: "address",
3403
+ internalType: "address",
3404
+ },
3405
+ ],
3406
+ },
3407
+ { name: "buy", type: "bool", internalType: "bool" },
3408
+ { name: "maker", type: "address", internalType: "address" },
3409
+ { name: "start", type: "uint256", internalType: "uint256" },
3410
+ { name: "expiry", type: "uint256", internalType: "uint256" },
3411
+ { name: "tick", type: "uint256", internalType: "uint256" },
3412
+ { name: "group", type: "bytes32", internalType: "bytes32" },
3413
+ { name: "callback", type: "address", internalType: "address" },
3414
+ { name: "callbackData", type: "bytes", internalType: "bytes" },
2782
3415
  {
2783
- internalType: "uint256",
2784
- name: "units",
3416
+ name: "receiverIfMakerIsSeller",
3417
+ type: "address",
3418
+ internalType: "address",
3419
+ },
3420
+ { name: "ratifier", type: "address", internalType: "address" },
3421
+ { name: "reduceOnly", type: "bool", internalType: "bool" },
3422
+ { name: "maxUnits", type: "uint128", internalType: "uint128" },
3423
+ { name: "maxAssets", type: "uint128", internalType: "uint128" },
3424
+ {
3425
+ name: "continuousFeeCap",
2785
3426
  type: "uint256",
3427
+ internalType: "uint256",
2786
3428
  },
2787
3429
  ],
2788
- internalType: "struct OfferFill[]",
2789
- name: "offerFills",
2790
- type: "tuple[]",
2791
3430
  },
3431
+ { name: "ratifierData", type: "bytes", internalType: "bytes" },
3432
+ { name: "taker", type: "address", internalType: "address" },
3433
+ ],
3434
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
3435
+ stateMutability: "view",
3436
+ },
3437
+ {
3438
+ type: "function",
3439
+ name: "isRootRatified",
3440
+ inputs: [
3441
+ { name: "maker", type: "address", internalType: "address" },
3442
+ { name: "root", type: "bytes32", internalType: "bytes32" },
3443
+ ],
3444
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
3445
+ stateMutability: "view",
3446
+ },
3447
+ {
3448
+ type: "function",
3449
+ name: "ratification",
3450
+ inputs: [
3451
+ { name: "maker", type: "address", internalType: "address" },
3452
+ { name: "root", type: "bytes32", internalType: "bytes32" },
3453
+ ],
3454
+ outputs: [
3455
+ { name: "isRootRatified", type: "bool", internalType: "bool" },
3456
+ { name: "rootNonce", type: "uint128", internalType: "uint128" },
3457
+ ],
3458
+ stateMutability: "view",
3459
+ },
3460
+ {
3461
+ type: "function",
3462
+ name: "rootNonce",
3463
+ inputs: [
3464
+ { name: "maker", type: "address", internalType: "address" },
3465
+ { name: "root", type: "bytes32", internalType: "bytes32" },
3466
+ ],
3467
+ outputs: [{ name: "", type: "uint128", internalType: "uint128" }],
3468
+ stateMutability: "view",
3469
+ },
3470
+ {
3471
+ type: "function",
3472
+ name: "setIsRootRatified",
3473
+ inputs: [
3474
+ { name: "maker", type: "address", internalType: "address" },
3475
+ { name: "root", type: "bytes32", internalType: "bytes32" },
3476
+ { name: "newIsRootRatified", type: "bool", internalType: "bool" },
3477
+ ],
3478
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
3479
+ stateMutability: "nonpayable",
3480
+ },
3481
+ {
3482
+ type: "function",
3483
+ name: "setIsRootRatifiedWithSig",
3484
+ inputs: [
3485
+ { name: "maker", type: "address", internalType: "address" },
3486
+ { name: "root", type: "bytes32", internalType: "bytes32" },
3487
+ { name: "height", type: "uint256", internalType: "uint256" },
3488
+ { name: "newIsRootRatified", type: "bool", internalType: "bool" },
3489
+ { name: "nonce", type: "uint128", internalType: "uint128" },
3490
+ { name: "deadline", type: "uint256", internalType: "uint256" },
3491
+ { name: "v", type: "uint8", internalType: "uint8" },
3492
+ { name: "r", type: "bytes32", internalType: "bytes32" },
3493
+ { name: "s", type: "bytes32", internalType: "bytes32" },
3494
+ ],
3495
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
3496
+ stateMutability: "nonpayable",
3497
+ },
3498
+ {
3499
+ type: "event",
3500
+ name: "SetIsRootRatified",
3501
+ inputs: [
3502
+ {
3503
+ name: "caller",
3504
+ type: "address",
3505
+ indexed: true,
3506
+ internalType: "address",
3507
+ },
3508
+ {
3509
+ name: "maker",
3510
+ type: "address",
3511
+ indexed: true,
3512
+ internalType: "address",
3513
+ },
3514
+ { name: "root", type: "bytes32", indexed: true, internalType: "bytes32" },
3515
+ {
3516
+ name: "newIsRootRatified",
3517
+ type: "bool",
3518
+ indexed: false,
3519
+ internalType: "bool",
3520
+ },
3521
+ ],
3522
+ anonymous: false,
3523
+ },
3524
+ {
3525
+ type: "event",
3526
+ name: "SetIsRootRatifiedWithSig",
3527
+ inputs: [
3528
+ {
3529
+ name: "caller",
3530
+ type: "address",
3531
+ indexed: false,
3532
+ internalType: "address",
3533
+ },
3534
+ {
3535
+ name: "signer",
3536
+ type: "address",
3537
+ indexed: true,
3538
+ internalType: "address",
3539
+ },
3540
+ {
3541
+ name: "maker",
3542
+ type: "address",
3543
+ indexed: true,
3544
+ internalType: "address",
3545
+ },
3546
+ { name: "root", type: "bytes32", indexed: true, internalType: "bytes32" },
3547
+ {
3548
+ name: "height",
3549
+ type: "uint256",
3550
+ indexed: false,
3551
+ internalType: "uint256",
3552
+ },
3553
+ {
3554
+ name: "newIsRootRatified",
3555
+ type: "bool",
3556
+ indexed: false,
3557
+ internalType: "bool",
3558
+ },
3559
+ {
3560
+ name: "signatureNonce",
3561
+ type: "uint128",
3562
+ indexed: false,
3563
+ internalType: "uint128",
3564
+ },
3565
+ {
3566
+ name: "previousNonce",
3567
+ type: "uint128",
3568
+ indexed: false,
3569
+ internalType: "uint128",
3570
+ },
3571
+ ],
3572
+ anonymous: false,
3573
+ },
3574
+ { type: "error", name: "DeadlineExpired", inputs: [] },
3575
+ { type: "error", name: "InvalidNonce", inputs: [] },
3576
+ { type: "error", name: "InvalidProof", inputs: [] },
3577
+ { type: "error", name: "InvalidSignature", inputs: [] },
3578
+ { type: "error", name: "NotRatified", inputs: [] },
3579
+ { type: "error", name: "RatifiedStatusChanged", inputs: [] },
3580
+ { type: "error", name: "Unauthorized", inputs: [] },
3581
+ { type: "error", name: "UnauthorizedTaker", inputs: [] },
3582
+ { type: "error", name: "WorsePrice", inputs: [] },
3583
+ ];
3584
+ /**
3585
+ * ABI JSON for the Midnight Bundles V2 periphery used by maker cancel-and-make and taker flows.
3586
+ *
3587
+ * Source: `morpho-org/bundles` commit `07f293b383824b35adc745454ac2622a27eb0502`,
3588
+ * `src/midnight/MidnightBundlesV2.sol` (compiled with `forge inspect ... abi`).
3589
+ * V2 acts on `msg.sender` only and does not accept inline token permits.
3590
+ *
3591
+ * @example
3592
+ * ```ts
3593
+ * import { midnightBundlesV2Abi } from "@morpho-org/midnight-sdk";
3594
+ *
3595
+ * console.log(midnightBundlesV2Abi.length);
3596
+ * ```
3597
+ */
3598
+ exports.midnightBundlesV2Abi = [
3599
+ {
3600
+ type: "constructor",
3601
+ inputs: [
3602
+ {
3603
+ name: "_midnight",
3604
+ type: "address",
3605
+ internalType: "address",
3606
+ },
3607
+ {
3608
+ name: "_blue",
3609
+ type: "address",
3610
+ internalType: "address",
3611
+ },
3612
+ {
3613
+ name: "_blueBuyCallbackFactory",
3614
+ type: "address",
3615
+ internalType: "address",
3616
+ },
3617
+ {
3618
+ name: "_log",
3619
+ type: "address",
3620
+ internalType: "address",
3621
+ },
3622
+ ],
3623
+ stateMutability: "nonpayable",
3624
+ },
3625
+ {
3626
+ type: "function",
3627
+ name: "BLUE",
3628
+ inputs: [],
3629
+ outputs: [
3630
+ {
3631
+ name: "",
3632
+ type: "address",
3633
+ internalType: "address",
3634
+ },
3635
+ ],
3636
+ stateMutability: "view",
3637
+ },
3638
+ {
3639
+ type: "function",
3640
+ name: "BLUE_BUY_CALLBACK_FACTORY",
3641
+ inputs: [],
3642
+ outputs: [
3643
+ {
3644
+ name: "",
3645
+ type: "address",
3646
+ internalType: "address",
3647
+ },
3648
+ ],
3649
+ stateMutability: "view",
3650
+ },
3651
+ {
3652
+ type: "function",
3653
+ name: "LOG",
3654
+ inputs: [],
3655
+ outputs: [
3656
+ {
3657
+ name: "",
3658
+ type: "address",
3659
+ internalType: "address",
3660
+ },
3661
+ ],
3662
+ stateMutability: "view",
3663
+ },
3664
+ {
3665
+ type: "function",
3666
+ name: "MIDNIGHT",
3667
+ inputs: [],
3668
+ outputs: [
3669
+ {
3670
+ name: "",
3671
+ type: "address",
3672
+ internalType: "address",
3673
+ },
3674
+ ],
3675
+ stateMutability: "view",
3676
+ },
3677
+ {
3678
+ type: "function",
3679
+ name: "midnightBundlesV2BuyWithAssetsTargetAndWithdrawCollateral",
3680
+ inputs: [
2792
3681
  {
3682
+ name: "market",
3683
+ type: "tuple",
3684
+ internalType: "struct Market",
2793
3685
  components: [
2794
3686
  {
3687
+ name: "chainId",
3688
+ type: "uint256",
2795
3689
  internalType: "uint256",
2796
- name: "collateralIndex",
3690
+ },
3691
+ {
3692
+ name: "midnight",
3693
+ type: "address",
3694
+ internalType: "address",
3695
+ },
3696
+ {
3697
+ name: "loanToken",
3698
+ type: "address",
3699
+ internalType: "address",
3700
+ },
3701
+ {
3702
+ name: "collateralParams",
3703
+ type: "tuple[]",
3704
+ internalType: "struct CollateralParams[]",
3705
+ components: [
3706
+ {
3707
+ name: "token",
3708
+ type: "address",
3709
+ internalType: "address",
3710
+ },
3711
+ {
3712
+ name: "lltv",
3713
+ type: "uint256",
3714
+ internalType: "uint256",
3715
+ },
3716
+ {
3717
+ name: "liquidationCursor",
3718
+ type: "uint256",
3719
+ internalType: "uint256",
3720
+ },
3721
+ {
3722
+ name: "oracle",
3723
+ type: "address",
3724
+ internalType: "address",
3725
+ },
3726
+ ],
3727
+ },
3728
+ {
3729
+ name: "maturity",
3730
+ type: "uint256",
3731
+ internalType: "uint256",
3732
+ },
3733
+ {
3734
+ name: "rcfThreshold",
2797
3735
  type: "uint256",
3736
+ internalType: "uint256",
3737
+ },
3738
+ {
3739
+ name: "enterGate",
3740
+ type: "address",
3741
+ internalType: "address",
2798
3742
  },
2799
3743
  {
2800
- internalType: "uint256",
2801
- name: "assets",
2802
- type: "uint256",
3744
+ name: "liquidatorGate",
3745
+ type: "address",
3746
+ internalType: "address",
2803
3747
  },
2804
3748
  ],
2805
- internalType: "struct CollateralWithdrawal[]",
2806
- name: "collateralWithdrawals",
2807
- type: "tuple[]",
2808
- },
2809
- {
2810
- internalType: "address",
2811
- name: "collateralReceiver",
2812
- type: "address",
2813
- },
2814
- {
2815
- internalType: "uint256",
2816
- name: "referralFeePct",
2817
- type: "uint256",
2818
- },
2819
- {
2820
- internalType: "address",
2821
- name: "referralFeeRecipient",
2822
- type: "address",
2823
3749
  },
2824
3750
  {
2825
- internalType: "uint256",
2826
- name: "maxContinuousFee",
3751
+ name: "targetBuyerAssets",
2827
3752
  type: "uint256",
2828
- },
2829
- {
2830
3753
  internalType: "uint256",
2831
- name: "deadline",
2832
- type: "uint256",
2833
3754
  },
2834
- ],
2835
- name: "midnightBundlesV1BuyWithAssetsTargetAndWithdrawCollateral",
2836
- outputs: [],
2837
- stateMutability: "nonpayable",
2838
- type: "function",
2839
- },
2840
- {
2841
- inputs: [
2842
3755
  {
2843
- internalType: "uint256",
2844
- name: "targetUnits",
3756
+ name: "minUnits",
2845
3757
  type: "uint256",
2846
- },
2847
- {
2848
3758
  internalType: "uint256",
2849
- name: "maxBuyerAssets",
2850
- type: "uint256",
2851
3759
  },
2852
3760
  {
2853
- internalType: "address",
2854
- name: "taker",
2855
- type: "address",
2856
- },
2857
- {
2858
- internalType: "bool",
2859
3761
  name: "reduceOnly",
2860
3762
  type: "bool",
3763
+ internalType: "bool",
2861
3764
  },
2862
3765
  {
2863
- components: [
2864
- {
2865
- internalType: "enum PermitKind",
2866
- name: "kind",
2867
- type: "uint8",
2868
- },
2869
- {
2870
- internalType: "bytes",
2871
- name: "data",
2872
- type: "bytes",
2873
- },
2874
- ],
2875
- internalType: "struct TokenPermit",
2876
- name: "loanTokenPermit",
2877
- type: "tuple",
3766
+ name: "repayEnabled",
3767
+ type: "bool",
3768
+ internalType: "bool",
2878
3769
  },
2879
3770
  {
3771
+ name: "offerFills",
3772
+ type: "tuple[]",
3773
+ internalType: "struct OfferFill[]",
2880
3774
  components: [
2881
3775
  {
3776
+ name: "offer",
3777
+ type: "tuple",
3778
+ internalType: "struct Offer",
2882
3779
  components: [
2883
3780
  {
3781
+ name: "market",
3782
+ type: "tuple",
3783
+ internalType: "struct Market",
2884
3784
  components: [
2885
3785
  {
2886
- internalType: "uint256",
2887
3786
  name: "chainId",
2888
3787
  type: "uint256",
3788
+ internalType: "uint256",
2889
3789
  },
2890
3790
  {
2891
- internalType: "address",
2892
3791
  name: "midnight",
2893
3792
  type: "address",
3793
+ internalType: "address",
2894
3794
  },
2895
3795
  {
2896
- internalType: "address",
2897
3796
  name: "loanToken",
2898
3797
  type: "address",
3798
+ internalType: "address",
2899
3799
  },
2900
3800
  {
3801
+ name: "collateralParams",
3802
+ type: "tuple[]",
3803
+ internalType: "struct CollateralParams[]",
2901
3804
  components: [
2902
3805
  {
2903
- internalType: "address",
2904
3806
  name: "token",
2905
3807
  type: "address",
3808
+ internalType: "address",
2906
3809
  },
2907
3810
  {
2908
- internalType: "uint256",
2909
3811
  name: "lltv",
2910
3812
  type: "uint256",
3813
+ internalType: "uint256",
2911
3814
  },
2912
3815
  {
2913
- internalType: "uint256",
2914
3816
  name: "liquidationCursor",
2915
3817
  type: "uint256",
3818
+ internalType: "uint256",
2916
3819
  },
2917
3820
  {
2918
- internalType: "address",
2919
3821
  name: "oracle",
2920
3822
  type: "address",
3823
+ internalType: "address",
2921
3824
  },
2922
3825
  ],
2923
- internalType: "struct CollateralParams[]",
2924
- name: "collateralParams",
2925
- type: "tuple[]",
2926
3826
  },
2927
3827
  {
2928
- internalType: "uint256",
2929
3828
  name: "maturity",
2930
3829
  type: "uint256",
3830
+ internalType: "uint256",
2931
3831
  },
2932
3832
  {
2933
- internalType: "uint256",
2934
3833
  name: "rcfThreshold",
2935
3834
  type: "uint256",
3835
+ internalType: "uint256",
2936
3836
  },
2937
3837
  {
2938
- internalType: "address",
2939
3838
  name: "enterGate",
2940
3839
  type: "address",
3840
+ internalType: "address",
2941
3841
  },
2942
3842
  {
2943
- internalType: "address",
2944
3843
  name: "liquidatorGate",
2945
3844
  type: "address",
3845
+ internalType: "address",
2946
3846
  },
2947
3847
  ],
2948
- internalType: "struct Market",
2949
- name: "market",
2950
- type: "tuple",
2951
3848
  },
2952
3849
  {
2953
- internalType: "bool",
2954
3850
  name: "buy",
2955
3851
  type: "bool",
3852
+ internalType: "bool",
2956
3853
  },
2957
3854
  {
2958
- internalType: "address",
2959
3855
  name: "maker",
2960
3856
  type: "address",
3857
+ internalType: "address",
2961
3858
  },
2962
3859
  {
2963
- internalType: "uint256",
2964
3860
  name: "start",
2965
3861
  type: "uint256",
3862
+ internalType: "uint256",
2966
3863
  },
2967
3864
  {
2968
- internalType: "uint256",
2969
3865
  name: "expiry",
2970
3866
  type: "uint256",
3867
+ internalType: "uint256",
2971
3868
  },
2972
3869
  {
2973
- internalType: "uint256",
2974
3870
  name: "tick",
2975
3871
  type: "uint256",
3872
+ internalType: "uint256",
2976
3873
  },
2977
3874
  {
2978
- internalType: "bytes32",
2979
3875
  name: "group",
2980
3876
  type: "bytes32",
3877
+ internalType: "bytes32",
2981
3878
  },
2982
3879
  {
2983
- internalType: "address",
2984
3880
  name: "callback",
2985
3881
  type: "address",
3882
+ internalType: "address",
2986
3883
  },
2987
3884
  {
2988
- internalType: "bytes",
2989
3885
  name: "callbackData",
2990
3886
  type: "bytes",
3887
+ internalType: "bytes",
2991
3888
  },
2992
3889
  {
2993
- internalType: "address",
2994
3890
  name: "receiverIfMakerIsSeller",
2995
3891
  type: "address",
3892
+ internalType: "address",
2996
3893
  },
2997
3894
  {
2998
- internalType: "address",
2999
3895
  name: "ratifier",
3000
3896
  type: "address",
3897
+ internalType: "address",
3001
3898
  },
3002
3899
  {
3003
- internalType: "bool",
3004
3900
  name: "reduceOnly",
3005
3901
  type: "bool",
3902
+ internalType: "bool",
3006
3903
  },
3007
3904
  {
3008
- internalType: "uint128",
3009
3905
  name: "maxUnits",
3010
3906
  type: "uint128",
3907
+ internalType: "uint128",
3011
3908
  },
3012
3909
  {
3013
- internalType: "uint128",
3014
3910
  name: "maxAssets",
3015
3911
  type: "uint128",
3912
+ internalType: "uint128",
3016
3913
  },
3017
3914
  {
3018
- internalType: "uint256",
3019
3915
  name: "continuousFeeCap",
3020
3916
  type: "uint256",
3917
+ internalType: "uint256",
3021
3918
  },
3022
3919
  ],
3023
- internalType: "struct Offer",
3024
- name: "offer",
3025
- type: "tuple",
3026
3920
  },
3027
3921
  {
3028
- internalType: "bytes",
3029
3922
  name: "ratifierData",
3030
3923
  type: "bytes",
3924
+ internalType: "bytes",
3031
3925
  },
3032
3926
  {
3033
- internalType: "uint256",
3034
3927
  name: "units",
3035
3928
  type: "uint256",
3929
+ internalType: "uint256",
3036
3930
  },
3037
3931
  ],
3038
- internalType: "struct OfferFill[]",
3039
- name: "offerFills",
3040
- type: "tuple[]",
3041
3932
  },
3042
3933
  {
3934
+ name: "collateralWithdrawals",
3935
+ type: "tuple[]",
3936
+ internalType: "struct CollateralTransfer[]",
3043
3937
  components: [
3044
3938
  {
3045
- internalType: "uint256",
3046
3939
  name: "collateralIndex",
3047
3940
  type: "uint256",
3941
+ internalType: "uint256",
3048
3942
  },
3049
3943
  {
3050
- internalType: "uint256",
3051
3944
  name: "assets",
3052
3945
  type: "uint256",
3946
+ internalType: "uint256",
3053
3947
  },
3054
3948
  ],
3055
- internalType: "struct CollateralWithdrawal[]",
3056
- name: "collateralWithdrawals",
3057
- type: "tuple[]",
3058
3949
  },
3059
3950
  {
3060
- internalType: "address",
3061
3951
  name: "collateralReceiver",
3062
3952
  type: "address",
3953
+ internalType: "address",
3063
3954
  },
3064
3955
  {
3065
- internalType: "uint256",
3066
3956
  name: "referralFeePct",
3067
3957
  type: "uint256",
3958
+ internalType: "uint256",
3068
3959
  },
3069
3960
  {
3070
- internalType: "address",
3071
3961
  name: "referralFeeRecipient",
3072
3962
  type: "address",
3963
+ internalType: "address",
3073
3964
  },
3074
3965
  {
3075
- internalType: "uint256",
3076
3966
  name: "maxContinuousFee",
3077
3967
  type: "uint256",
3968
+ internalType: "uint256",
3078
3969
  },
3079
3970
  {
3080
- internalType: "uint256",
3081
3971
  name: "deadline",
3082
3972
  type: "uint256",
3973
+ internalType: "uint256",
3974
+ },
3975
+ {
3976
+ name: "wrappedNative",
3977
+ type: "address",
3978
+ internalType: "address",
3083
3979
  },
3084
3980
  ],
3085
- name: "midnightBundlesV1BuyWithUnitsTargetAndWithdrawCollateral",
3086
3981
  outputs: [],
3087
- stateMutability: "nonpayable",
3088
- type: "function",
3982
+ stateMutability: "payable",
3089
3983
  },
3090
3984
  {
3985
+ type: "function",
3986
+ name: "midnightBundlesV2BuyWithUnitsTargetAndWithdrawCollateral",
3091
3987
  inputs: [
3092
3988
  {
3989
+ name: "market",
3990
+ type: "tuple",
3991
+ internalType: "struct Market",
3093
3992
  components: [
3094
3993
  {
3095
- internalType: "uint256",
3096
3994
  name: "chainId",
3097
3995
  type: "uint256",
3996
+ internalType: "uint256",
3098
3997
  },
3099
3998
  {
3100
- internalType: "address",
3101
3999
  name: "midnight",
3102
4000
  type: "address",
4001
+ internalType: "address",
3103
4002
  },
3104
4003
  {
3105
- internalType: "address",
3106
4004
  name: "loanToken",
3107
4005
  type: "address",
4006
+ internalType: "address",
3108
4007
  },
3109
4008
  {
4009
+ name: "collateralParams",
4010
+ type: "tuple[]",
4011
+ internalType: "struct CollateralParams[]",
3110
4012
  components: [
3111
4013
  {
3112
- internalType: "address",
3113
4014
  name: "token",
3114
4015
  type: "address",
4016
+ internalType: "address",
3115
4017
  },
3116
4018
  {
3117
- internalType: "uint256",
3118
4019
  name: "lltv",
3119
4020
  type: "uint256",
4021
+ internalType: "uint256",
3120
4022
  },
3121
4023
  {
3122
- internalType: "uint256",
3123
4024
  name: "liquidationCursor",
3124
4025
  type: "uint256",
4026
+ internalType: "uint256",
3125
4027
  },
3126
4028
  {
3127
- internalType: "address",
3128
4029
  name: "oracle",
3129
4030
  type: "address",
4031
+ internalType: "address",
3130
4032
  },
3131
4033
  ],
3132
- internalType: "struct CollateralParams[]",
3133
- name: "collateralParams",
3134
- type: "tuple[]",
3135
4034
  },
3136
4035
  {
3137
- internalType: "uint256",
3138
4036
  name: "maturity",
3139
4037
  type: "uint256",
4038
+ internalType: "uint256",
3140
4039
  },
3141
4040
  {
3142
- internalType: "uint256",
3143
4041
  name: "rcfThreshold",
3144
4042
  type: "uint256",
4043
+ internalType: "uint256",
3145
4044
  },
3146
4045
  {
3147
- internalType: "address",
3148
4046
  name: "enterGate",
3149
4047
  type: "address",
4048
+ internalType: "address",
3150
4049
  },
3151
4050
  {
3152
- internalType: "address",
3153
4051
  name: "liquidatorGate",
3154
4052
  type: "address",
4053
+ internalType: "address",
3155
4054
  },
3156
- ],
3157
- internalType: "struct Market",
3158
- name: "market",
3159
- type: "tuple",
3160
- },
3161
- {
3162
- internalType: "uint256",
3163
- name: "assets",
3164
- type: "uint256",
3165
- },
3166
- {
3167
- internalType: "address",
3168
- name: "onBehalf",
3169
- type: "address",
3170
- },
3171
- {
3172
- components: [
3173
- {
3174
- internalType: "enum PermitKind",
3175
- name: "kind",
3176
- type: "uint8",
3177
- },
3178
- {
3179
- internalType: "bytes",
3180
- name: "data",
3181
- type: "bytes",
3182
- },
3183
- ],
3184
- internalType: "struct TokenPermit",
3185
- name: "loanTokenPermit",
3186
- type: "tuple",
3187
- },
3188
- {
3189
- components: [
3190
- {
3191
- internalType: "uint256",
3192
- name: "collateralIndex",
3193
- type: "uint256",
3194
- },
3195
- {
3196
- internalType: "uint256",
3197
- name: "assets",
3198
- type: "uint256",
3199
- },
3200
- ],
3201
- internalType: "struct CollateralWithdrawal[]",
3202
- name: "collateralWithdrawals",
3203
- type: "tuple[]",
3204
- },
3205
- {
3206
- internalType: "address",
3207
- name: "collateralReceiver",
3208
- type: "address",
3209
- },
3210
- {
3211
- internalType: "uint256",
3212
- name: "referralFeePct",
3213
- type: "uint256",
3214
- },
3215
- {
3216
- internalType: "address",
3217
- name: "referralFeeRecipient",
3218
- type: "address",
4055
+ ],
3219
4056
  },
3220
4057
  {
3221
- internalType: "uint256",
3222
- name: "deadline",
4058
+ name: "targetUnits",
3223
4059
  type: "uint256",
3224
- },
3225
- ],
3226
- name: "midnightBundlesV1RepayAndWithdrawCollateral",
3227
- outputs: [],
3228
- stateMutability: "nonpayable",
3229
- type: "function",
3230
- },
3231
- {
3232
- inputs: [
3233
- {
3234
4060
  internalType: "uint256",
3235
- name: "targetSellerAssets",
3236
- type: "uint256",
3237
4061
  },
3238
4062
  {
3239
- internalType: "uint256",
3240
- name: "maxUnits",
4063
+ name: "maxBuyerAssets",
3241
4064
  type: "uint256",
4065
+ internalType: "uint256",
3242
4066
  },
3243
4067
  {
3244
- internalType: "address",
3245
- name: "taker",
3246
- type: "address",
3247
- },
3248
- {
3249
- internalType: "bool",
3250
4068
  name: "reduceOnly",
3251
4069
  type: "bool",
4070
+ internalType: "bool",
3252
4071
  },
3253
4072
  {
3254
- internalType: "address",
3255
- name: "receiver",
3256
- type: "address",
4073
+ name: "repayEnabled",
4074
+ type: "bool",
4075
+ internalType: "bool",
3257
4076
  },
3258
4077
  {
3259
- components: [
3260
- {
3261
- internalType: "uint256",
3262
- name: "collateralIndex",
3263
- type: "uint256",
3264
- },
3265
- {
3266
- internalType: "uint256",
3267
- name: "assets",
3268
- type: "uint256",
3269
- },
3270
- {
3271
- components: [
3272
- {
3273
- internalType: "enum PermitKind",
3274
- name: "kind",
3275
- type: "uint8",
3276
- },
3277
- {
3278
- internalType: "bytes",
3279
- name: "data",
3280
- type: "bytes",
3281
- },
3282
- ],
3283
- internalType: "struct TokenPermit",
3284
- name: "permit",
3285
- type: "tuple",
3286
- },
3287
- ],
3288
- internalType: "struct CollateralSupply[]",
3289
- name: "collateralSupplies",
4078
+ name: "offerFills",
3290
4079
  type: "tuple[]",
3291
- },
3292
- {
4080
+ internalType: "struct OfferFill[]",
3293
4081
  components: [
3294
4082
  {
4083
+ name: "offer",
4084
+ type: "tuple",
4085
+ internalType: "struct Offer",
3295
4086
  components: [
3296
4087
  {
4088
+ name: "market",
4089
+ type: "tuple",
4090
+ internalType: "struct Market",
3297
4091
  components: [
3298
4092
  {
3299
- internalType: "uint256",
3300
4093
  name: "chainId",
3301
4094
  type: "uint256",
4095
+ internalType: "uint256",
3302
4096
  },
3303
4097
  {
3304
- internalType: "address",
3305
4098
  name: "midnight",
3306
4099
  type: "address",
4100
+ internalType: "address",
3307
4101
  },
3308
4102
  {
3309
- internalType: "address",
3310
4103
  name: "loanToken",
3311
4104
  type: "address",
4105
+ internalType: "address",
3312
4106
  },
3313
4107
  {
4108
+ name: "collateralParams",
4109
+ type: "tuple[]",
4110
+ internalType: "struct CollateralParams[]",
3314
4111
  components: [
3315
4112
  {
3316
- internalType: "address",
3317
4113
  name: "token",
3318
4114
  type: "address",
4115
+ internalType: "address",
3319
4116
  },
3320
4117
  {
3321
- internalType: "uint256",
3322
4118
  name: "lltv",
3323
4119
  type: "uint256",
4120
+ internalType: "uint256",
3324
4121
  },
3325
4122
  {
3326
- internalType: "uint256",
3327
4123
  name: "liquidationCursor",
3328
4124
  type: "uint256",
4125
+ internalType: "uint256",
3329
4126
  },
3330
4127
  {
3331
- internalType: "address",
3332
4128
  name: "oracle",
3333
4129
  type: "address",
4130
+ internalType: "address",
3334
4131
  },
3335
4132
  ],
3336
- internalType: "struct CollateralParams[]",
3337
- name: "collateralParams",
3338
- type: "tuple[]",
3339
4133
  },
3340
4134
  {
3341
- internalType: "uint256",
3342
4135
  name: "maturity",
3343
4136
  type: "uint256",
4137
+ internalType: "uint256",
3344
4138
  },
3345
4139
  {
3346
- internalType: "uint256",
3347
4140
  name: "rcfThreshold",
3348
4141
  type: "uint256",
4142
+ internalType: "uint256",
3349
4143
  },
3350
4144
  {
3351
- internalType: "address",
3352
4145
  name: "enterGate",
3353
4146
  type: "address",
4147
+ internalType: "address",
3354
4148
  },
3355
4149
  {
3356
- internalType: "address",
3357
4150
  name: "liquidatorGate",
3358
4151
  type: "address",
4152
+ internalType: "address",
3359
4153
  },
3360
4154
  ],
3361
- internalType: "struct Market",
3362
- name: "market",
3363
- type: "tuple",
3364
4155
  },
3365
4156
  {
3366
- internalType: "bool",
3367
4157
  name: "buy",
3368
4158
  type: "bool",
4159
+ internalType: "bool",
3369
4160
  },
3370
4161
  {
3371
- internalType: "address",
3372
4162
  name: "maker",
3373
4163
  type: "address",
4164
+ internalType: "address",
3374
4165
  },
3375
4166
  {
3376
- internalType: "uint256",
3377
4167
  name: "start",
3378
4168
  type: "uint256",
4169
+ internalType: "uint256",
3379
4170
  },
3380
4171
  {
3381
- internalType: "uint256",
3382
4172
  name: "expiry",
3383
4173
  type: "uint256",
4174
+ internalType: "uint256",
3384
4175
  },
3385
4176
  {
3386
- internalType: "uint256",
3387
4177
  name: "tick",
3388
4178
  type: "uint256",
4179
+ internalType: "uint256",
3389
4180
  },
3390
4181
  {
3391
- internalType: "bytes32",
3392
4182
  name: "group",
3393
4183
  type: "bytes32",
4184
+ internalType: "bytes32",
3394
4185
  },
3395
4186
  {
3396
- internalType: "address",
3397
4187
  name: "callback",
3398
4188
  type: "address",
4189
+ internalType: "address",
3399
4190
  },
3400
4191
  {
3401
- internalType: "bytes",
3402
4192
  name: "callbackData",
3403
4193
  type: "bytes",
4194
+ internalType: "bytes",
3404
4195
  },
3405
4196
  {
3406
- internalType: "address",
3407
4197
  name: "receiverIfMakerIsSeller",
3408
4198
  type: "address",
4199
+ internalType: "address",
3409
4200
  },
3410
4201
  {
3411
- internalType: "address",
3412
4202
  name: "ratifier",
3413
4203
  type: "address",
4204
+ internalType: "address",
3414
4205
  },
3415
4206
  {
3416
- internalType: "bool",
3417
4207
  name: "reduceOnly",
3418
4208
  type: "bool",
4209
+ internalType: "bool",
4210
+ },
4211
+ {
4212
+ name: "maxUnits",
4213
+ type: "uint128",
4214
+ internalType: "uint128",
4215
+ },
4216
+ {
4217
+ name: "maxAssets",
4218
+ type: "uint128",
4219
+ internalType: "uint128",
3419
4220
  },
3420
4221
  {
3421
- internalType: "uint128",
3422
- name: "maxUnits",
3423
- type: "uint128",
4222
+ name: "continuousFeeCap",
4223
+ type: "uint256",
4224
+ internalType: "uint256",
4225
+ },
4226
+ ],
4227
+ },
4228
+ {
4229
+ name: "ratifierData",
4230
+ type: "bytes",
4231
+ internalType: "bytes",
4232
+ },
4233
+ {
4234
+ name: "units",
4235
+ type: "uint256",
4236
+ internalType: "uint256",
4237
+ },
4238
+ ],
4239
+ },
4240
+ {
4241
+ name: "collateralWithdrawals",
4242
+ type: "tuple[]",
4243
+ internalType: "struct CollateralTransfer[]",
4244
+ components: [
4245
+ {
4246
+ name: "collateralIndex",
4247
+ type: "uint256",
4248
+ internalType: "uint256",
4249
+ },
4250
+ {
4251
+ name: "assets",
4252
+ type: "uint256",
4253
+ internalType: "uint256",
4254
+ },
4255
+ ],
4256
+ },
4257
+ {
4258
+ name: "collateralReceiver",
4259
+ type: "address",
4260
+ internalType: "address",
4261
+ },
4262
+ {
4263
+ name: "referralFeePct",
4264
+ type: "uint256",
4265
+ internalType: "uint256",
4266
+ },
4267
+ {
4268
+ name: "referralFeeRecipient",
4269
+ type: "address",
4270
+ internalType: "address",
4271
+ },
4272
+ {
4273
+ name: "maxContinuousFee",
4274
+ type: "uint256",
4275
+ internalType: "uint256",
4276
+ },
4277
+ {
4278
+ name: "deadline",
4279
+ type: "uint256",
4280
+ internalType: "uint256",
4281
+ },
4282
+ {
4283
+ name: "wrappedNative",
4284
+ type: "address",
4285
+ internalType: "address",
4286
+ },
4287
+ ],
4288
+ outputs: [],
4289
+ stateMutability: "payable",
4290
+ },
4291
+ {
4292
+ type: "function",
4293
+ name: "midnightBundlesV2CancelAndMake",
4294
+ inputs: [
4295
+ {
4296
+ name: "blueMarket",
4297
+ type: "tuple",
4298
+ internalType: "struct MarketParams",
4299
+ components: [
4300
+ {
4301
+ name: "loanToken",
4302
+ type: "address",
4303
+ internalType: "address",
4304
+ },
4305
+ {
4306
+ name: "collateralToken",
4307
+ type: "address",
4308
+ internalType: "address",
4309
+ },
4310
+ {
4311
+ name: "oracle",
4312
+ type: "address",
4313
+ internalType: "address",
4314
+ },
4315
+ {
4316
+ name: "irm",
4317
+ type: "address",
4318
+ internalType: "address",
4319
+ },
4320
+ {
4321
+ name: "lltv",
4322
+ type: "uint256",
4323
+ internalType: "uint256",
4324
+ },
4325
+ ],
4326
+ },
4327
+ {
4328
+ name: "assetsToPark",
4329
+ type: "uint256",
4330
+ internalType: "uint256",
4331
+ },
4332
+ {
4333
+ name: "callbackSalt",
4334
+ type: "bytes32",
4335
+ internalType: "bytes32",
4336
+ },
4337
+ {
4338
+ name: "market",
4339
+ type: "tuple",
4340
+ internalType: "struct Market",
4341
+ components: [
4342
+ {
4343
+ name: "chainId",
4344
+ type: "uint256",
4345
+ internalType: "uint256",
4346
+ },
4347
+ {
4348
+ name: "midnight",
4349
+ type: "address",
4350
+ internalType: "address",
4351
+ },
4352
+ {
4353
+ name: "loanToken",
4354
+ type: "address",
4355
+ internalType: "address",
4356
+ },
4357
+ {
4358
+ name: "collateralParams",
4359
+ type: "tuple[]",
4360
+ internalType: "struct CollateralParams[]",
4361
+ components: [
4362
+ {
4363
+ name: "token",
4364
+ type: "address",
4365
+ internalType: "address",
3424
4366
  },
3425
4367
  {
3426
- internalType: "uint128",
3427
- name: "maxAssets",
3428
- type: "uint128",
4368
+ name: "lltv",
4369
+ type: "uint256",
4370
+ internalType: "uint256",
3429
4371
  },
3430
4372
  {
3431
- internalType: "uint256",
3432
- name: "continuousFeeCap",
4373
+ name: "liquidationCursor",
3433
4374
  type: "uint256",
4375
+ internalType: "uint256",
4376
+ },
4377
+ {
4378
+ name: "oracle",
4379
+ type: "address",
4380
+ internalType: "address",
3434
4381
  },
3435
4382
  ],
3436
- internalType: "struct Offer",
3437
- name: "offer",
3438
- type: "tuple",
3439
4383
  },
3440
4384
  {
3441
- internalType: "bytes",
3442
- name: "ratifierData",
3443
- type: "bytes",
4385
+ name: "maturity",
4386
+ type: "uint256",
4387
+ internalType: "uint256",
3444
4388
  },
3445
4389
  {
3446
- internalType: "uint256",
3447
- name: "units",
4390
+ name: "rcfThreshold",
3448
4391
  type: "uint256",
4392
+ internalType: "uint256",
4393
+ },
4394
+ {
4395
+ name: "enterGate",
4396
+ type: "address",
4397
+ internalType: "address",
4398
+ },
4399
+ {
4400
+ name: "liquidatorGate",
4401
+ type: "address",
4402
+ internalType: "address",
3449
4403
  },
3450
4404
  ],
3451
- internalType: "struct OfferFill[]",
3452
- name: "offerFills",
3453
- type: "tuple[]",
3454
4405
  },
3455
4406
  {
3456
- internalType: "uint256",
3457
- name: "referralFeePct",
3458
- type: "uint256",
4407
+ name: "collateralSupplies",
4408
+ type: "tuple[]",
4409
+ internalType: "struct CollateralTransfer[]",
4410
+ components: [
4411
+ {
4412
+ name: "collateralIndex",
4413
+ type: "uint256",
4414
+ internalType: "uint256",
4415
+ },
4416
+ {
4417
+ name: "assets",
4418
+ type: "uint256",
4419
+ internalType: "uint256",
4420
+ },
4421
+ ],
3459
4422
  },
3460
4423
  {
3461
- internalType: "address",
3462
- name: "referralFeeRecipient",
4424
+ name: "ratifier",
3463
4425
  type: "address",
4426
+ internalType: "address",
3464
4427
  },
3465
4428
  {
3466
- internalType: "uint256",
3467
- name: "maxContinuousFee",
4429
+ name: "newRoot",
4430
+ type: "bytes32",
4431
+ internalType: "bytes32",
4432
+ },
4433
+ {
4434
+ name: "signatureHeight",
3468
4435
  type: "uint256",
4436
+ internalType: "uint256",
4437
+ },
4438
+ {
4439
+ name: "signatureNonce",
4440
+ type: "uint128",
4441
+ internalType: "uint128",
3469
4442
  },
3470
4443
  {
4444
+ name: "signatureDeadline",
4445
+ type: "uint256",
3471
4446
  internalType: "uint256",
4447
+ },
4448
+ {
4449
+ name: "v",
4450
+ type: "uint8",
4451
+ internalType: "uint8",
4452
+ },
4453
+ {
4454
+ name: "r",
4455
+ type: "bytes32",
4456
+ internalType: "bytes32",
4457
+ },
4458
+ {
4459
+ name: "s",
4460
+ type: "bytes32",
4461
+ internalType: "bytes32",
4462
+ },
4463
+ {
4464
+ name: "groupsToCancel",
4465
+ type: "tuple[]",
4466
+ internalType: "struct GroupCancellation[]",
4467
+ components: [
4468
+ {
4469
+ name: "group",
4470
+ type: "bytes32",
4471
+ internalType: "bytes32",
4472
+ },
4473
+ {
4474
+ name: "maxConsumed",
4475
+ type: "uint128",
4476
+ internalType: "uint128",
4477
+ },
4478
+ ],
4479
+ },
4480
+ {
4481
+ name: "payload",
4482
+ type: "bytes",
4483
+ internalType: "bytes",
4484
+ },
4485
+ {
3472
4486
  name: "deadline",
3473
4487
  type: "uint256",
4488
+ internalType: "uint256",
4489
+ },
4490
+ {
4491
+ name: "wrappedNative",
4492
+ type: "address",
4493
+ internalType: "address",
3474
4494
  },
3475
4495
  ],
3476
- name: "midnightBundlesV1SupplyCollateralAndSellWithAssetsTarget",
3477
4496
  outputs: [],
3478
- stateMutability: "nonpayable",
3479
- type: "function",
4497
+ stateMutability: "payable",
3480
4498
  },
3481
4499
  {
4500
+ type: "function",
4501
+ name: "midnightBundlesV2SupplyCollateralAndSellWithAssetsTarget",
3482
4502
  inputs: [
3483
4503
  {
3484
- internalType: "uint256",
3485
- name: "targetUnits",
3486
- type: "uint256",
4504
+ name: "market",
4505
+ type: "tuple",
4506
+ internalType: "struct Market",
4507
+ components: [
4508
+ {
4509
+ name: "chainId",
4510
+ type: "uint256",
4511
+ internalType: "uint256",
4512
+ },
4513
+ {
4514
+ name: "midnight",
4515
+ type: "address",
4516
+ internalType: "address",
4517
+ },
4518
+ {
4519
+ name: "loanToken",
4520
+ type: "address",
4521
+ internalType: "address",
4522
+ },
4523
+ {
4524
+ name: "collateralParams",
4525
+ type: "tuple[]",
4526
+ internalType: "struct CollateralParams[]",
4527
+ components: [
4528
+ {
4529
+ name: "token",
4530
+ type: "address",
4531
+ internalType: "address",
4532
+ },
4533
+ {
4534
+ name: "lltv",
4535
+ type: "uint256",
4536
+ internalType: "uint256",
4537
+ },
4538
+ {
4539
+ name: "liquidationCursor",
4540
+ type: "uint256",
4541
+ internalType: "uint256",
4542
+ },
4543
+ {
4544
+ name: "oracle",
4545
+ type: "address",
4546
+ internalType: "address",
4547
+ },
4548
+ ],
4549
+ },
4550
+ {
4551
+ name: "maturity",
4552
+ type: "uint256",
4553
+ internalType: "uint256",
4554
+ },
4555
+ {
4556
+ name: "rcfThreshold",
4557
+ type: "uint256",
4558
+ internalType: "uint256",
4559
+ },
4560
+ {
4561
+ name: "enterGate",
4562
+ type: "address",
4563
+ internalType: "address",
4564
+ },
4565
+ {
4566
+ name: "liquidatorGate",
4567
+ type: "address",
4568
+ internalType: "address",
4569
+ },
4570
+ ],
3487
4571
  },
3488
4572
  {
3489
- internalType: "uint256",
3490
- name: "minSellerAssets",
4573
+ name: "targetSellerAssets",
3491
4574
  type: "uint256",
4575
+ internalType: "uint256",
3492
4576
  },
3493
4577
  {
3494
- internalType: "address",
3495
- name: "taker",
3496
- type: "address",
4578
+ name: "maxUnits",
4579
+ type: "uint256",
4580
+ internalType: "uint256",
3497
4581
  },
3498
4582
  {
3499
- internalType: "bool",
3500
4583
  name: "reduceOnly",
3501
4584
  type: "bool",
4585
+ internalType: "bool",
3502
4586
  },
3503
4587
  {
3504
- internalType: "address",
3505
4588
  name: "receiver",
3506
4589
  type: "address",
4590
+ internalType: "address",
3507
4591
  },
3508
4592
  {
4593
+ name: "collateralSupplies",
4594
+ type: "tuple[]",
4595
+ internalType: "struct CollateralTransfer[]",
3509
4596
  components: [
3510
4597
  {
3511
- internalType: "uint256",
3512
4598
  name: "collateralIndex",
3513
4599
  type: "uint256",
4600
+ internalType: "uint256",
3514
4601
  },
3515
4602
  {
3516
- internalType: "uint256",
3517
4603
  name: "assets",
3518
4604
  type: "uint256",
3519
- },
3520
- {
3521
- components: [
3522
- {
3523
- internalType: "enum PermitKind",
3524
- name: "kind",
3525
- type: "uint8",
3526
- },
3527
- {
3528
- internalType: "bytes",
3529
- name: "data",
3530
- type: "bytes",
3531
- },
3532
- ],
3533
- internalType: "struct TokenPermit",
3534
- name: "permit",
3535
- type: "tuple",
4605
+ internalType: "uint256",
3536
4606
  },
3537
4607
  ],
3538
- internalType: "struct CollateralSupply[]",
3539
- name: "collateralSupplies",
3540
- type: "tuple[]",
3541
4608
  },
3542
4609
  {
4610
+ name: "offerFills",
4611
+ type: "tuple[]",
4612
+ internalType: "struct OfferFill[]",
3543
4613
  components: [
3544
4614
  {
4615
+ name: "offer",
4616
+ type: "tuple",
4617
+ internalType: "struct Offer",
3545
4618
  components: [
3546
4619
  {
4620
+ name: "market",
4621
+ type: "tuple",
4622
+ internalType: "struct Market",
3547
4623
  components: [
3548
4624
  {
3549
- internalType: "uint256",
3550
4625
  name: "chainId",
3551
4626
  type: "uint256",
4627
+ internalType: "uint256",
3552
4628
  },
3553
4629
  {
3554
- internalType: "address",
3555
4630
  name: "midnight",
3556
4631
  type: "address",
4632
+ internalType: "address",
3557
4633
  },
3558
4634
  {
3559
- internalType: "address",
3560
4635
  name: "loanToken",
3561
4636
  type: "address",
4637
+ internalType: "address",
3562
4638
  },
3563
4639
  {
4640
+ name: "collateralParams",
4641
+ type: "tuple[]",
4642
+ internalType: "struct CollateralParams[]",
3564
4643
  components: [
3565
4644
  {
3566
- internalType: "address",
3567
4645
  name: "token",
3568
4646
  type: "address",
4647
+ internalType: "address",
3569
4648
  },
3570
4649
  {
3571
- internalType: "uint256",
3572
4650
  name: "lltv",
3573
4651
  type: "uint256",
4652
+ internalType: "uint256",
3574
4653
  },
3575
4654
  {
3576
- internalType: "uint256",
3577
4655
  name: "liquidationCursor",
3578
4656
  type: "uint256",
4657
+ internalType: "uint256",
3579
4658
  },
3580
4659
  {
3581
- internalType: "address",
3582
4660
  name: "oracle",
3583
4661
  type: "address",
4662
+ internalType: "address",
3584
4663
  },
3585
4664
  ],
3586
- internalType: "struct CollateralParams[]",
3587
- name: "collateralParams",
3588
- type: "tuple[]",
3589
4665
  },
3590
4666
  {
3591
- internalType: "uint256",
3592
4667
  name: "maturity",
3593
4668
  type: "uint256",
4669
+ internalType: "uint256",
3594
4670
  },
3595
4671
  {
3596
- internalType: "uint256",
3597
4672
  name: "rcfThreshold",
3598
4673
  type: "uint256",
4674
+ internalType: "uint256",
3599
4675
  },
3600
4676
  {
3601
- internalType: "address",
3602
4677
  name: "enterGate",
3603
4678
  type: "address",
4679
+ internalType: "address",
3604
4680
  },
3605
4681
  {
3606
- internalType: "address",
3607
4682
  name: "liquidatorGate",
3608
4683
  type: "address",
4684
+ internalType: "address",
3609
4685
  },
3610
4686
  ],
3611
- internalType: "struct Market",
3612
- name: "market",
3613
- type: "tuple",
3614
4687
  },
3615
4688
  {
3616
- internalType: "bool",
3617
4689
  name: "buy",
3618
4690
  type: "bool",
4691
+ internalType: "bool",
3619
4692
  },
3620
4693
  {
3621
- internalType: "address",
3622
4694
  name: "maker",
3623
4695
  type: "address",
4696
+ internalType: "address",
3624
4697
  },
3625
4698
  {
3626
- internalType: "uint256",
3627
4699
  name: "start",
3628
4700
  type: "uint256",
4701
+ internalType: "uint256",
3629
4702
  },
3630
4703
  {
3631
- internalType: "uint256",
3632
4704
  name: "expiry",
3633
4705
  type: "uint256",
4706
+ internalType: "uint256",
3634
4707
  },
3635
4708
  {
3636
- internalType: "uint256",
3637
4709
  name: "tick",
3638
4710
  type: "uint256",
4711
+ internalType: "uint256",
3639
4712
  },
3640
4713
  {
3641
- internalType: "bytes32",
3642
4714
  name: "group",
3643
4715
  type: "bytes32",
4716
+ internalType: "bytes32",
3644
4717
  },
3645
4718
  {
3646
- internalType: "address",
3647
4719
  name: "callback",
3648
4720
  type: "address",
4721
+ internalType: "address",
3649
4722
  },
3650
4723
  {
3651
- internalType: "bytes",
3652
4724
  name: "callbackData",
3653
4725
  type: "bytes",
4726
+ internalType: "bytes",
3654
4727
  },
3655
4728
  {
3656
- internalType: "address",
3657
4729
  name: "receiverIfMakerIsSeller",
3658
4730
  type: "address",
4731
+ internalType: "address",
3659
4732
  },
3660
4733
  {
3661
- internalType: "address",
3662
4734
  name: "ratifier",
3663
4735
  type: "address",
4736
+ internalType: "address",
3664
4737
  },
3665
4738
  {
3666
- internalType: "bool",
3667
4739
  name: "reduceOnly",
3668
4740
  type: "bool",
4741
+ internalType: "bool",
3669
4742
  },
3670
4743
  {
3671
- internalType: "uint128",
3672
4744
  name: "maxUnits",
3673
4745
  type: "uint128",
4746
+ internalType: "uint128",
3674
4747
  },
3675
4748
  {
3676
- internalType: "uint128",
3677
4749
  name: "maxAssets",
3678
4750
  type: "uint128",
4751
+ internalType: "uint128",
3679
4752
  },
3680
4753
  {
3681
- internalType: "uint256",
3682
4754
  name: "continuousFeeCap",
3683
4755
  type: "uint256",
4756
+ internalType: "uint256",
3684
4757
  },
3685
4758
  ],
3686
- internalType: "struct Offer",
3687
- name: "offer",
3688
- type: "tuple",
3689
4759
  },
3690
4760
  {
3691
- internalType: "bytes",
3692
4761
  name: "ratifierData",
3693
4762
  type: "bytes",
4763
+ internalType: "bytes",
3694
4764
  },
3695
4765
  {
3696
- internalType: "uint256",
3697
4766
  name: "units",
3698
4767
  type: "uint256",
4768
+ internalType: "uint256",
3699
4769
  },
3700
4770
  ],
3701
- internalType: "struct OfferFill[]",
3702
- name: "offerFills",
3703
- type: "tuple[]",
3704
4771
  },
3705
4772
  {
3706
- internalType: "uint256",
3707
4773
  name: "referralFeePct",
3708
4774
  type: "uint256",
4775
+ internalType: "uint256",
3709
4776
  },
3710
4777
  {
3711
- internalType: "address",
3712
4778
  name: "referralFeeRecipient",
3713
4779
  type: "address",
4780
+ internalType: "address",
3714
4781
  },
3715
4782
  {
3716
- internalType: "uint256",
3717
- name: "maxContinuousFee",
3718
- type: "uint256",
3719
- },
3720
- {
3721
- internalType: "uint256",
3722
4783
  name: "deadline",
3723
4784
  type: "uint256",
4785
+ internalType: "uint256",
3724
4786
  },
3725
- ],
3726
- name: "midnightBundlesV1SupplyCollateralAndSellWithUnitsTarget",
3727
- outputs: [],
3728
- stateMutability: "nonpayable",
3729
- type: "function",
3730
- },
3731
- ];
3732
- /**
3733
- * Pinned ABI JSON for the EcrecoverRatifier.
3734
- *
3735
- * Source: `morpho-org/midnight` commit `336b924a2bb378d810ef6d35b6dd3486759af8bd`,
3736
- * `src/ratifiers/interfaces/IEcrecoverRatifier.sol`, Forge artifact `out/IEcrecoverRatifier.sol/IEcrecoverRatifier.json`.
3737
- *
3738
- * @example
3739
- * ```ts
3740
- * import { ecrecoverRatifierAbi } from "@morpho-org/midnight-sdk";
3741
- *
3742
- * console.log(ecrecoverRatifierAbi.length);
3743
- * ```
3744
- */
3745
- exports.ecrecoverRatifierAbi = [
3746
- {
3747
- type: "function",
3748
- name: "MIDNIGHT",
3749
- inputs: [],
3750
- outputs: [
3751
- {
3752
- name: "",
3753
- type: "address",
3754
- internalType: "address",
3755
- },
3756
- ],
3757
- stateMutability: "view",
3758
- },
3759
- {
3760
- type: "function",
3761
- name: "cancelRoot",
3762
- inputs: [
3763
4787
  {
3764
- name: "maker",
4788
+ name: "wrappedNative",
3765
4789
  type: "address",
3766
4790
  internalType: "address",
3767
4791
  },
3768
- {
3769
- name: "root",
3770
- type: "bytes32",
3771
- internalType: "bytes32",
3772
- },
3773
4792
  ],
3774
4793
  outputs: [],
3775
- stateMutability: "nonpayable",
4794
+ stateMutability: "payable",
3776
4795
  },
3777
4796
  {
3778
4797
  type: "function",
3779
- name: "isRatified",
4798
+ name: "midnightBundlesV2SupplyCollateralAndSellWithUnitsTarget",
3780
4799
  inputs: [
3781
4800
  {
3782
- name: "offer",
4801
+ name: "market",
3783
4802
  type: "tuple",
3784
- internalType: "struct Offer",
4803
+ internalType: "struct Market",
3785
4804
  components: [
3786
4805
  {
3787
- name: "market",
3788
- type: "tuple",
3789
- internalType: "struct Market",
4806
+ name: "chainId",
4807
+ type: "uint256",
4808
+ internalType: "uint256",
4809
+ },
4810
+ {
4811
+ name: "midnight",
4812
+ type: "address",
4813
+ internalType: "address",
4814
+ },
4815
+ {
4816
+ name: "loanToken",
4817
+ type: "address",
4818
+ internalType: "address",
4819
+ },
4820
+ {
4821
+ name: "collateralParams",
4822
+ type: "tuple[]",
4823
+ internalType: "struct CollateralParams[]",
3790
4824
  components: [
3791
4825
  {
3792
- name: "chainId",
4826
+ name: "token",
4827
+ type: "address",
4828
+ internalType: "address",
4829
+ },
4830
+ {
4831
+ name: "lltv",
3793
4832
  type: "uint256",
3794
4833
  internalType: "uint256",
3795
4834
  },
3796
4835
  {
3797
- name: "midnight",
3798
- type: "address",
3799
- internalType: "address",
4836
+ name: "liquidationCursor",
4837
+ type: "uint256",
4838
+ internalType: "uint256",
3800
4839
  },
3801
4840
  {
3802
- name: "loanToken",
4841
+ name: "oracle",
3803
4842
  type: "address",
3804
4843
  internalType: "address",
3805
4844
  },
4845
+ ],
4846
+ },
4847
+ {
4848
+ name: "maturity",
4849
+ type: "uint256",
4850
+ internalType: "uint256",
4851
+ },
4852
+ {
4853
+ name: "rcfThreshold",
4854
+ type: "uint256",
4855
+ internalType: "uint256",
4856
+ },
4857
+ {
4858
+ name: "enterGate",
4859
+ type: "address",
4860
+ internalType: "address",
4861
+ },
4862
+ {
4863
+ name: "liquidatorGate",
4864
+ type: "address",
4865
+ internalType: "address",
4866
+ },
4867
+ ],
4868
+ },
4869
+ {
4870
+ name: "targetUnits",
4871
+ type: "uint256",
4872
+ internalType: "uint256",
4873
+ },
4874
+ {
4875
+ name: "minSellerAssets",
4876
+ type: "uint256",
4877
+ internalType: "uint256",
4878
+ },
4879
+ {
4880
+ name: "reduceOnly",
4881
+ type: "bool",
4882
+ internalType: "bool",
4883
+ },
4884
+ {
4885
+ name: "receiver",
4886
+ type: "address",
4887
+ internalType: "address",
4888
+ },
4889
+ {
4890
+ name: "collateralSupplies",
4891
+ type: "tuple[]",
4892
+ internalType: "struct CollateralTransfer[]",
4893
+ components: [
4894
+ {
4895
+ name: "collateralIndex",
4896
+ type: "uint256",
4897
+ internalType: "uint256",
4898
+ },
4899
+ {
4900
+ name: "assets",
4901
+ type: "uint256",
4902
+ internalType: "uint256",
4903
+ },
4904
+ ],
4905
+ },
4906
+ {
4907
+ name: "offerFills",
4908
+ type: "tuple[]",
4909
+ internalType: "struct OfferFill[]",
4910
+ components: [
4911
+ {
4912
+ name: "offer",
4913
+ type: "tuple",
4914
+ internalType: "struct Offer",
4915
+ components: [
3806
4916
  {
3807
- name: "collateralParams",
3808
- type: "tuple[]",
3809
- internalType: "struct CollateralParams[]",
4917
+ name: "market",
4918
+ type: "tuple",
4919
+ internalType: "struct Market",
3810
4920
  components: [
3811
4921
  {
3812
- name: "token",
4922
+ name: "chainId",
4923
+ type: "uint256",
4924
+ internalType: "uint256",
4925
+ },
4926
+ {
4927
+ name: "midnight",
3813
4928
  type: "address",
3814
4929
  internalType: "address",
3815
4930
  },
3816
4931
  {
3817
- name: "lltv",
4932
+ name: "loanToken",
4933
+ type: "address",
4934
+ internalType: "address",
4935
+ },
4936
+ {
4937
+ name: "collateralParams",
4938
+ type: "tuple[]",
4939
+ internalType: "struct CollateralParams[]",
4940
+ components: [
4941
+ {
4942
+ name: "token",
4943
+ type: "address",
4944
+ internalType: "address",
4945
+ },
4946
+ {
4947
+ name: "lltv",
4948
+ type: "uint256",
4949
+ internalType: "uint256",
4950
+ },
4951
+ {
4952
+ name: "liquidationCursor",
4953
+ type: "uint256",
4954
+ internalType: "uint256",
4955
+ },
4956
+ {
4957
+ name: "oracle",
4958
+ type: "address",
4959
+ internalType: "address",
4960
+ },
4961
+ ],
4962
+ },
4963
+ {
4964
+ name: "maturity",
3818
4965
  type: "uint256",
3819
4966
  internalType: "uint256",
3820
4967
  },
3821
4968
  {
3822
- name: "liquidationCursor",
4969
+ name: "rcfThreshold",
3823
4970
  type: "uint256",
3824
4971
  internalType: "uint256",
3825
4972
  },
3826
4973
  {
3827
- name: "oracle",
4974
+ name: "enterGate",
4975
+ type: "address",
4976
+ internalType: "address",
4977
+ },
4978
+ {
4979
+ name: "liquidatorGate",
3828
4980
  type: "address",
3829
4981
  internalType: "address",
3830
4982
  },
3831
4983
  ],
3832
4984
  },
3833
4985
  {
3834
- name: "maturity",
4986
+ name: "buy",
4987
+ type: "bool",
4988
+ internalType: "bool",
4989
+ },
4990
+ {
4991
+ name: "maker",
4992
+ type: "address",
4993
+ internalType: "address",
4994
+ },
4995
+ {
4996
+ name: "start",
3835
4997
  type: "uint256",
3836
4998
  internalType: "uint256",
3837
4999
  },
3838
5000
  {
3839
- name: "rcfThreshold",
5001
+ name: "expiry",
3840
5002
  type: "uint256",
3841
5003
  internalType: "uint256",
3842
5004
  },
3843
5005
  {
3844
- name: "enterGate",
5006
+ name: "tick",
5007
+ type: "uint256",
5008
+ internalType: "uint256",
5009
+ },
5010
+ {
5011
+ name: "group",
5012
+ type: "bytes32",
5013
+ internalType: "bytes32",
5014
+ },
5015
+ {
5016
+ name: "callback",
3845
5017
  type: "address",
3846
5018
  internalType: "address",
3847
5019
  },
3848
5020
  {
3849
- name: "liquidatorGate",
5021
+ name: "callbackData",
5022
+ type: "bytes",
5023
+ internalType: "bytes",
5024
+ },
5025
+ {
5026
+ name: "receiverIfMakerIsSeller",
5027
+ type: "address",
5028
+ internalType: "address",
5029
+ },
5030
+ {
5031
+ name: "ratifier",
3850
5032
  type: "address",
3851
5033
  internalType: "address",
3852
5034
  },
5035
+ {
5036
+ name: "reduceOnly",
5037
+ type: "bool",
5038
+ internalType: "bool",
5039
+ },
5040
+ {
5041
+ name: "maxUnits",
5042
+ type: "uint128",
5043
+ internalType: "uint128",
5044
+ },
5045
+ {
5046
+ name: "maxAssets",
5047
+ type: "uint128",
5048
+ internalType: "uint128",
5049
+ },
5050
+ {
5051
+ name: "continuousFeeCap",
5052
+ type: "uint256",
5053
+ internalType: "uint256",
5054
+ },
3853
5055
  ],
3854
5056
  },
3855
5057
  {
3856
- name: "buy",
3857
- type: "bool",
3858
- internalType: "bool",
3859
- },
3860
- {
3861
- name: "maker",
3862
- type: "address",
3863
- internalType: "address",
3864
- },
3865
- {
3866
- name: "start",
3867
- type: "uint256",
3868
- internalType: "uint256",
3869
- },
3870
- {
3871
- name: "expiry",
3872
- type: "uint256",
3873
- internalType: "uint256",
3874
- },
3875
- {
3876
- name: "tick",
3877
- type: "uint256",
3878
- internalType: "uint256",
3879
- },
3880
- {
3881
- name: "group",
3882
- type: "bytes32",
3883
- internalType: "bytes32",
3884
- },
3885
- {
3886
- name: "callback",
3887
- type: "address",
3888
- internalType: "address",
3889
- },
3890
- {
3891
- name: "callbackData",
5058
+ name: "ratifierData",
3892
5059
  type: "bytes",
3893
5060
  internalType: "bytes",
3894
5061
  },
3895
5062
  {
3896
- name: "receiverIfMakerIsSeller",
3897
- type: "address",
3898
- internalType: "address",
3899
- },
3900
- {
3901
- name: "ratifier",
3902
- type: "address",
3903
- internalType: "address",
3904
- },
3905
- {
3906
- name: "reduceOnly",
3907
- type: "bool",
3908
- internalType: "bool",
3909
- },
3910
- {
3911
- name: "maxUnits",
3912
- type: "uint128",
3913
- internalType: "uint128",
3914
- },
3915
- {
3916
- name: "maxAssets",
3917
- type: "uint128",
3918
- internalType: "uint128",
3919
- },
3920
- {
3921
- name: "continuousFeeCap",
5063
+ name: "units",
3922
5064
  type: "uint256",
3923
5065
  internalType: "uint256",
3924
5066
  },
3925
5067
  ],
3926
5068
  },
3927
5069
  {
3928
- name: "ratifierData",
3929
- type: "bytes",
3930
- internalType: "bytes",
5070
+ name: "referralFeePct",
5071
+ type: "uint256",
5072
+ internalType: "uint256",
3931
5073
  },
3932
5074
  {
3933
- name: "taker",
5075
+ name: "referralFeeRecipient",
3934
5076
  type: "address",
3935
5077
  internalType: "address",
3936
5078
  },
3937
- ],
3938
- outputs: [
3939
5079
  {
3940
- name: "",
3941
- type: "bytes32",
3942
- internalType: "bytes32",
5080
+ name: "deadline",
5081
+ type: "uint256",
5082
+ internalType: "uint256",
3943
5083
  },
3944
- ],
3945
- stateMutability: "view",
3946
- },
3947
- {
3948
- type: "function",
3949
- name: "isRootCanceled",
3950
- inputs: [
3951
5084
  {
3952
- name: "maker",
5085
+ name: "wrappedNative",
3953
5086
  type: "address",
3954
5087
  internalType: "address",
3955
5088
  },
3956
- {
3957
- name: "root",
3958
- type: "bytes32",
3959
- internalType: "bytes32",
3960
- },
3961
- ],
3962
- outputs: [
3963
- {
3964
- name: "",
3965
- type: "bool",
3966
- internalType: "bool",
3967
- },
3968
5089
  ],
3969
- stateMutability: "view",
5090
+ outputs: [],
5091
+ stateMutability: "payable",
3970
5092
  },
3971
5093
  {
3972
- type: "event",
3973
- name: "CancelRoot",
3974
- inputs: [
3975
- {
3976
- name: "caller",
3977
- type: "address",
3978
- indexed: true,
3979
- internalType: "address",
3980
- },
3981
- {
3982
- name: "maker",
3983
- type: "address",
3984
- indexed: true,
3985
- internalType: "address",
3986
- },
3987
- {
3988
- name: "root",
3989
- type: "bytes32",
3990
- indexed: true,
3991
- internalType: "bytes32",
3992
- },
3993
- ],
3994
- anonymous: false,
5094
+ type: "error",
5095
+ name: "ApproveReturnedFalse",
5096
+ inputs: [],
5097
+ },
5098
+ {
5099
+ type: "error",
5100
+ name: "ConsumedAboveMax",
5101
+ inputs: [],
5102
+ },
5103
+ {
5104
+ type: "error",
5105
+ name: "ContinuousFeeAboveMax",
5106
+ inputs: [],
5107
+ },
5108
+ {
5109
+ type: "error",
5110
+ name: "DeadlinePassed",
5111
+ inputs: [],
5112
+ },
5113
+ {
5114
+ type: "error",
5115
+ name: "InconsistentBlue",
5116
+ inputs: [],
5117
+ },
5118
+ {
5119
+ type: "error",
5120
+ name: "InconsistentMarket",
5121
+ inputs: [],
5122
+ },
5123
+ {
5124
+ type: "error",
5125
+ name: "InconsistentMidnight",
5126
+ inputs: [],
5127
+ },
5128
+ {
5129
+ type: "error",
5130
+ name: "InconsistentSide",
5131
+ inputs: [],
5132
+ },
5133
+ {
5134
+ type: "error",
5135
+ name: "InvalidRatifierResponse",
5136
+ inputs: [],
5137
+ },
5138
+ {
5139
+ type: "error",
5140
+ name: "NoCode",
5141
+ inputs: [],
5142
+ },
5143
+ {
5144
+ type: "error",
5145
+ name: "NotReduceOnly",
5146
+ inputs: [],
5147
+ },
5148
+ {
5149
+ type: "error",
5150
+ name: "OutOfOffers",
5151
+ inputs: [],
5152
+ },
5153
+ {
5154
+ type: "error",
5155
+ name: "PctExceeded",
5156
+ inputs: [],
5157
+ },
5158
+ {
5159
+ type: "error",
5160
+ name: "PriceGreaterThanOne",
5161
+ inputs: [],
5162
+ },
5163
+ {
5164
+ type: "error",
5165
+ name: "SellerAssetsTooLow",
5166
+ inputs: [],
3995
5167
  },
3996
5168
  {
3997
5169
  type: "error",
3998
- name: "InvalidProof",
5170
+ name: "TickOutOfRange",
3999
5171
  inputs: [],
4000
5172
  },
4001
5173
  {
4002
5174
  type: "error",
4003
- name: "InvalidSignature",
5175
+ name: "TransferFromReturnedFalse",
4004
5176
  inputs: [],
4005
5177
  },
4006
5178
  {
4007
5179
  type: "error",
4008
- name: "RootCanceled",
5180
+ name: "TransferReturnedFalse",
4009
5181
  inputs: [],
4010
5182
  },
4011
5183
  {
4012
5184
  type: "error",
4013
- name: "Unauthorized",
5185
+ name: "UnitsTooHigh",
5186
+ inputs: [],
5187
+ },
5188
+ {
5189
+ type: "error",
5190
+ name: "UnitsTooLow",
4014
5191
  inputs: [],
4015
5192
  },
4016
5193
  ];
4017
5194
  /**
4018
- * Pinned ABI JSON for the SetterRatifier.
5195
+ * ABI JSON for the BlueBuyCallback factory that deploys per-owner callbacks funding Midnight buy
5196
+ * offers from Morpho Blue supply.
4019
5197
  *
4020
- * Source: `morpho-org/midnight` commit `336b924a2bb378d810ef6d35b6dd3486759af8bd`,
4021
- * `src/ratifiers/interfaces/ISetterRatifier.sol`, Forge artifact `out/ISetterRatifier.sol/ISetterRatifier.json`.
5198
+ * Source: `morpho-org/midnight` commit `4603969e80d6f911c33586c6b971e8edd7821bbc`,
5199
+ * `src/periphery/blue-buy-callback/BlueBuyCallbackFactory.sol` (compiled with `forge inspect ... abi`).
4022
5200
  *
4023
5201
  * @example
4024
5202
  * ```ts
4025
- * import { setterRatifierAbi } from "@morpho-org/midnight-sdk";
5203
+ * import { blueBuyCallbackFactoryAbi } from "@morpho-org/midnight-sdk";
4026
5204
  *
4027
- * console.log(setterRatifierAbi.length);
5205
+ * console.log(blueBuyCallbackFactoryAbi.length);
4028
5206
  * ```
4029
5207
  */
4030
- exports.setterRatifierAbi = [
5208
+ exports.blueBuyCallbackFactoryAbi = [
5209
+ {
5210
+ type: "constructor",
5211
+ inputs: [
5212
+ {
5213
+ name: "_midnight",
5214
+ type: "address",
5215
+ },
5216
+ {
5217
+ name: "_blue",
5218
+ type: "address",
5219
+ },
5220
+ ],
5221
+ stateMutability: "nonpayable",
5222
+ },
4031
5223
  {
4032
5224
  type: "function",
4033
- name: "MIDNIGHT",
5225
+ name: "BLUE",
4034
5226
  inputs: [],
4035
5227
  outputs: [
4036
5228
  {
4037
5229
  name: "",
4038
5230
  type: "address",
4039
- internalType: "address",
4040
5231
  },
4041
5232
  ],
4042
5233
  stateMutability: "view",
4043
5234
  },
4044
5235
  {
4045
5236
  type: "function",
4046
- name: "isRatified",
4047
- inputs: [
5237
+ name: "MIDNIGHT",
5238
+ inputs: [],
5239
+ outputs: [
4048
5240
  {
4049
- name: "offer",
4050
- type: "tuple",
4051
- internalType: "struct Offer",
4052
- components: [
4053
- {
4054
- name: "market",
4055
- type: "tuple",
4056
- internalType: "struct Market",
4057
- components: [
4058
- {
4059
- name: "chainId",
4060
- type: "uint256",
4061
- internalType: "uint256",
4062
- },
4063
- {
4064
- name: "midnight",
4065
- type: "address",
4066
- internalType: "address",
4067
- },
4068
- {
4069
- name: "loanToken",
4070
- type: "address",
4071
- internalType: "address",
4072
- },
4073
- {
4074
- name: "collateralParams",
4075
- type: "tuple[]",
4076
- internalType: "struct CollateralParams[]",
4077
- components: [
4078
- {
4079
- name: "token",
4080
- type: "address",
4081
- internalType: "address",
4082
- },
4083
- {
4084
- name: "lltv",
4085
- type: "uint256",
4086
- internalType: "uint256",
4087
- },
4088
- {
4089
- name: "liquidationCursor",
4090
- type: "uint256",
4091
- internalType: "uint256",
4092
- },
4093
- {
4094
- name: "oracle",
4095
- type: "address",
4096
- internalType: "address",
4097
- },
4098
- ],
4099
- },
4100
- {
4101
- name: "maturity",
4102
- type: "uint256",
4103
- internalType: "uint256",
4104
- },
4105
- {
4106
- name: "rcfThreshold",
4107
- type: "uint256",
4108
- internalType: "uint256",
4109
- },
4110
- {
4111
- name: "enterGate",
4112
- type: "address",
4113
- internalType: "address",
4114
- },
4115
- {
4116
- name: "liquidatorGate",
4117
- type: "address",
4118
- internalType: "address",
4119
- },
4120
- ],
4121
- },
4122
- {
4123
- name: "buy",
4124
- type: "bool",
4125
- internalType: "bool",
4126
- },
4127
- {
4128
- name: "maker",
4129
- type: "address",
4130
- internalType: "address",
4131
- },
4132
- {
4133
- name: "start",
4134
- type: "uint256",
4135
- internalType: "uint256",
4136
- },
4137
- {
4138
- name: "expiry",
4139
- type: "uint256",
4140
- internalType: "uint256",
4141
- },
4142
- {
4143
- name: "tick",
4144
- type: "uint256",
4145
- internalType: "uint256",
4146
- },
4147
- {
4148
- name: "group",
4149
- type: "bytes32",
4150
- internalType: "bytes32",
4151
- },
4152
- {
4153
- name: "callback",
4154
- type: "address",
4155
- internalType: "address",
4156
- },
4157
- {
4158
- name: "callbackData",
4159
- type: "bytes",
4160
- internalType: "bytes",
4161
- },
4162
- {
4163
- name: "receiverIfMakerIsSeller",
4164
- type: "address",
4165
- internalType: "address",
4166
- },
4167
- {
4168
- name: "ratifier",
4169
- type: "address",
4170
- internalType: "address",
4171
- },
4172
- {
4173
- name: "reduceOnly",
4174
- type: "bool",
4175
- internalType: "bool",
4176
- },
4177
- {
4178
- name: "maxUnits",
4179
- type: "uint128",
4180
- internalType: "uint128",
4181
- },
4182
- {
4183
- name: "maxAssets",
4184
- type: "uint128",
4185
- internalType: "uint128",
4186
- },
4187
- {
4188
- name: "continuousFeeCap",
4189
- type: "uint256",
4190
- internalType: "uint256",
4191
- },
4192
- ],
5241
+ name: "",
5242
+ type: "address",
4193
5243
  },
5244
+ ],
5245
+ stateMutability: "view",
5246
+ },
5247
+ {
5248
+ type: "function",
5249
+ name: "callbackOf",
5250
+ inputs: [
4194
5251
  {
4195
- name: "ratifierData",
4196
- type: "bytes",
4197
- internalType: "bytes",
5252
+ name: "owner",
5253
+ type: "address",
4198
5254
  },
4199
5255
  {
4200
- name: "taker",
4201
- type: "address",
4202
- internalType: "address",
5256
+ name: "salt",
5257
+ type: "bytes32",
4203
5258
  },
4204
5259
  ],
4205
5260
  outputs: [
4206
5261
  {
4207
5262
  name: "",
4208
- type: "bytes32",
4209
- internalType: "bytes32",
5263
+ type: "address",
4210
5264
  },
4211
5265
  ],
4212
5266
  stateMutability: "view",
4213
5267
  },
4214
5268
  {
4215
5269
  type: "function",
4216
- name: "isRootRatified",
5270
+ name: "createBlueBuyCallback",
4217
5271
  inputs: [
4218
5272
  {
4219
- name: "maker",
5273
+ name: "owner",
4220
5274
  type: "address",
4221
- internalType: "address",
4222
5275
  },
4223
5276
  {
4224
- name: "root",
5277
+ name: "salt",
4225
5278
  type: "bytes32",
4226
- internalType: "bytes32",
4227
5279
  },
4228
5280
  ],
4229
5281
  outputs: [
4230
5282
  {
4231
5283
  name: "",
4232
- type: "bool",
4233
- internalType: "bool",
5284
+ type: "address",
4234
5285
  },
4235
5286
  ],
4236
- stateMutability: "view",
5287
+ stateMutability: "nonpayable",
4237
5288
  },
4238
5289
  {
4239
5290
  type: "function",
4240
- name: "setIsRootRatified",
5291
+ name: "isBlueBuyCallback",
4241
5292
  inputs: [
4242
5293
  {
4243
- name: "maker",
5294
+ name: "callback",
4244
5295
  type: "address",
4245
- internalType: "address",
4246
- },
4247
- {
4248
- name: "root",
4249
- type: "bytes32",
4250
- internalType: "bytes32",
4251
5296
  },
5297
+ ],
5298
+ outputs: [
4252
5299
  {
4253
- name: "newIsRootRatified",
5300
+ name: "",
4254
5301
  type: "bool",
4255
- internalType: "bool",
4256
5302
  },
4257
5303
  ],
4258
- outputs: [],
4259
- stateMutability: "nonpayable",
5304
+ stateMutability: "view",
4260
5305
  },
4261
5306
  {
4262
5307
  type: "event",
4263
- name: "SetIsRootRatified",
5308
+ name: "CreateBlueBuyCallback",
4264
5309
  inputs: [
4265
5310
  {
4266
5311
  name: "caller",
4267
5312
  type: "address",
4268
5313
  indexed: true,
4269
- internalType: "address",
4270
5314
  },
4271
5315
  {
4272
- name: "maker",
5316
+ name: "owner",
4273
5317
  type: "address",
4274
5318
  indexed: true,
4275
- internalType: "address",
4276
5319
  },
4277
5320
  {
4278
- name: "root",
5321
+ name: "salt",
4279
5322
  type: "bytes32",
4280
- indexed: true,
4281
- internalType: "bytes32",
5323
+ indexed: false,
4282
5324
  },
4283
5325
  {
4284
- name: "newIsRootRatified",
4285
- type: "bool",
5326
+ name: "callback",
5327
+ type: "address",
4286
5328
  indexed: false,
4287
- internalType: "bool",
4288
5329
  },
4289
5330
  ],
4290
5331
  anonymous: false,
4291
5332
  },
4292
- {
4293
- type: "error",
4294
- name: "InvalidProof",
4295
- inputs: [],
4296
- },
4297
- {
4298
- type: "error",
4299
- name: "NotRatified",
4300
- inputs: [],
4301
- },
4302
- {
4303
- type: "error",
4304
- name: "Unauthorized",
4305
- inputs: [],
4306
- },
4307
5333
  ];