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