@optimex-xyz/market-maker-sdk 0.9.0-dev-d2e92dd → 0.9.0-dev-d18dfd7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -30,10 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
- ContractRole: () => ContractRole,
33
+ AssetChainContractRole: () => AssetChainContractRole,
34
34
  ERC20__factory: () => ERC20__factory,
35
35
  L2ContractRole: () => L2ContractRole,
36
- MorphoLiquidator__factory: () => MorphoLiquidator__factory,
36
+ MorphoLiquidationGateway__factory: () => MorphoLiquidationGateway__factory,
37
37
  OptimexBtcNetwork: () => OptimexBtcNetwork,
38
38
  OptimexEvmNetwork: () => OptimexEvmNetwork,
39
39
  OptimexL2Network: () => OptimexL2Network,
@@ -192,7 +192,7 @@ var sdk = new SDK();
192
192
  var factories_exports = {};
193
193
  __export(factories_exports, {
194
194
  ERC20__factory: () => ERC20__factory,
195
- MorphoLiquidator__factory: () => MorphoLiquidator__factory,
195
+ MorphoLiquidationGateway__factory: () => MorphoLiquidationGateway__factory,
196
196
  Payment__factory: () => Payment__factory,
197
197
  ProtocolFetcherProxy__factory: () => ProtocolFetcherProxy__factory,
198
198
  Router__factory: () => Router__factory,
@@ -1599,14 +1599,14 @@ var ERC20__factory = class {
1599
1599
  };
1600
1600
  ERC20__factory.abi = _abi;
1601
1601
 
1602
- // src/contracts/contracts/factories/MorphoLiquidator__factory.ts
1602
+ // src/contracts/contracts/factories/MorphoLiquidationGateway__factory.ts
1603
1603
  var import_ethers2 = require("ethers");
1604
1604
  var _abi2 = [
1605
1605
  {
1606
1606
  inputs: [
1607
1607
  {
1608
1608
  internalType: "address",
1609
- name: "morphoManagement",
1609
+ name: "initProtocol",
1610
1610
  type: "address"
1611
1611
  },
1612
1612
  {
@@ -1616,82 +1616,18 @@ var _abi2 = [
1616
1616
  },
1617
1617
  {
1618
1618
  internalType: "string",
1619
- name: "version",
1619
+ name: "symbol",
1620
1620
  type: "string"
1621
1621
  }
1622
1622
  ],
1623
1623
  stateMutability: "nonpayable",
1624
1624
  type: "constructor"
1625
1625
  },
1626
- {
1627
- inputs: [],
1628
- name: "ECDSAInvalidSignature",
1629
- type: "error"
1630
- },
1631
- {
1632
- inputs: [
1633
- {
1634
- internalType: "uint256",
1635
- name: "length",
1636
- type: "uint256"
1637
- }
1638
- ],
1639
- name: "ECDSAInvalidSignatureLength",
1640
- type: "error"
1641
- },
1642
- {
1643
- inputs: [
1644
- {
1645
- internalType: "bytes32",
1646
- name: "s",
1647
- type: "bytes32"
1648
- }
1649
- ],
1650
- name: "ECDSAInvalidSignatureS",
1651
- type: "error"
1652
- },
1653
1626
  {
1654
1627
  inputs: [],
1655
1628
  name: "InvalidAmount",
1656
1629
  type: "error"
1657
1630
  },
1658
- {
1659
- inputs: [],
1660
- name: "InvalidBorrowShares",
1661
- type: "error"
1662
- },
1663
- {
1664
- inputs: [
1665
- {
1666
- internalType: "bytes32",
1667
- name: "positionId",
1668
- type: "bytes32"
1669
- }
1670
- ],
1671
- name: "InvalidPositionId",
1672
- type: "error"
1673
- },
1674
- {
1675
- inputs: [],
1676
- name: "InvalidShortString",
1677
- type: "error"
1678
- },
1679
- {
1680
- inputs: [
1681
- {
1682
- internalType: "address",
1683
- name: "validator",
1684
- type: "address"
1685
- }
1686
- ],
1687
- name: "InvalidValidator",
1688
- type: "error"
1689
- },
1690
- {
1691
- inputs: [],
1692
- name: "ReentrancyGuardReentrantCall",
1693
- type: "error"
1694
- },
1695
1631
  {
1696
1632
  inputs: [
1697
1633
  {
@@ -1724,33 +1660,6 @@ var _abi2 = [
1724
1660
  name: "SafeERC20FailedOperation",
1725
1661
  type: "error"
1726
1662
  },
1727
- {
1728
- inputs: [
1729
- {
1730
- internalType: "string",
1731
- name: "str",
1732
- type: "string"
1733
- }
1734
- ],
1735
- name: "StringTooLong",
1736
- type: "error"
1737
- },
1738
- {
1739
- inputs: [
1740
- {
1741
- internalType: "address",
1742
- name: "expected",
1743
- type: "address"
1744
- },
1745
- {
1746
- internalType: "address",
1747
- name: "actual",
1748
- type: "address"
1749
- }
1750
- ],
1751
- name: "TokenMismatch",
1752
- type: "error"
1753
- },
1754
1663
  {
1755
1664
  inputs: [
1756
1665
  {
@@ -1767,61 +1676,25 @@ var _abi2 = [
1767
1676
  name: "ZeroAddress",
1768
1677
  type: "error"
1769
1678
  },
1770
- {
1771
- inputs: [],
1772
- name: "ZeroAmount",
1773
- type: "error"
1774
- },
1775
1679
  {
1776
1680
  anonymous: false,
1777
1681
  inputs: [
1778
- {
1779
- indexed: true,
1780
- internalType: "bytes32",
1781
- name: "positionId",
1782
- type: "bytes32"
1783
- },
1784
1682
  {
1785
1683
  indexed: true,
1786
1684
  internalType: "address",
1787
- name: "token",
1685
+ name: "payer",
1788
1686
  type: "address"
1789
1687
  },
1790
1688
  {
1791
1689
  indexed: true,
1792
1690
  internalType: "address",
1793
- name: "recipient",
1691
+ name: "liquidator",
1794
1692
  type: "address"
1795
1693
  },
1796
1694
  {
1797
1695
  indexed: false,
1798
- internalType: "uint256",
1799
- name: "amount",
1800
- type: "uint256"
1801
- }
1802
- ],
1803
- name: "Credit",
1804
- type: "event"
1805
- },
1806
- {
1807
- anonymous: false,
1808
- inputs: [],
1809
- name: "EIP712DomainChanged",
1810
- type: "event"
1811
- },
1812
- {
1813
- anonymous: false,
1814
- inputs: [
1815
- {
1816
- indexed: true,
1817
- internalType: "bytes32",
1818
- name: "positionId",
1819
- type: "bytes32"
1820
- },
1821
- {
1822
- indexed: true,
1823
1696
  internalType: "address",
1824
- name: "apm",
1697
+ name: "token",
1825
1698
  type: "address"
1826
1699
  },
1827
1700
  {
@@ -1829,93 +1702,6 @@ var _abi2 = [
1829
1702
  internalType: "uint256",
1830
1703
  name: "amount",
1831
1704
  type: "uint256"
1832
- }
1833
- ],
1834
- name: "FinalizePosition",
1835
- type: "event"
1836
- },
1837
- {
1838
- anonymous: false,
1839
- inputs: [
1840
- {
1841
- indexed: true,
1842
- internalType: "bytes32",
1843
- name: "positionId",
1844
- type: "bytes32"
1845
- },
1846
- {
1847
- indexed: false,
1848
- internalType: "uint256",
1849
- name: "totalCollateral",
1850
- type: "uint256"
1851
- },
1852
- {
1853
- indexed: false,
1854
- internalType: "uint256",
1855
- name: "totalPayment",
1856
- type: "uint256"
1857
- },
1858
- {
1859
- indexed: false,
1860
- internalType: "uint256",
1861
- name: "repaidDebt",
1862
- type: "uint256"
1863
- }
1864
- ],
1865
- name: "ForceClose",
1866
- type: "event"
1867
- },
1868
- {
1869
- anonymous: false,
1870
- inputs: [
1871
- {
1872
- indexed: true,
1873
- internalType: "bytes32",
1874
- name: "positionId",
1875
- type: "bytes32"
1876
- },
1877
- {
1878
- indexed: false,
1879
- internalType: "uint256",
1880
- name: "totalCollateral",
1881
- type: "uint256"
1882
- },
1883
- {
1884
- indexed: false,
1885
- internalType: "uint256",
1886
- name: "seizedCollateral",
1887
- type: "uint256"
1888
- },
1889
- {
1890
- indexed: false,
1891
- internalType: "uint256",
1892
- name: "totalPayment",
1893
- type: "uint256"
1894
- },
1895
- {
1896
- indexed: false,
1897
- internalType: "uint256",
1898
- name: "repaidDebt",
1899
- type: "uint256"
1900
- }
1901
- ],
1902
- name: "Liquidate",
1903
- type: "event"
1904
- },
1905
- {
1906
- anonymous: false,
1907
- inputs: [
1908
- {
1909
- indexed: true,
1910
- internalType: "address",
1911
- name: "apm",
1912
- type: "address"
1913
- },
1914
- {
1915
- indexed: false,
1916
- internalType: "uint256",
1917
- name: "repaidAssets",
1918
- type: "uint256"
1919
1705
  },
1920
1706
  {
1921
1707
  indexed: false,
@@ -1924,115 +1710,35 @@ var _abi2 = [
1924
1710
  type: "bytes"
1925
1711
  }
1926
1712
  ],
1927
- name: "OnMorphoLiquidate",
1928
- type: "event"
1929
- },
1930
- {
1931
- anonymous: false,
1932
- inputs: [
1933
- {
1934
- indexed: true,
1935
- internalType: "address",
1936
- name: "apm",
1937
- type: "address"
1938
- },
1939
- {
1940
- indexed: false,
1941
- internalType: "uint256",
1942
- name: "repaidAssets",
1943
- type: "uint256"
1944
- },
1945
- {
1946
- indexed: false,
1947
- internalType: "bytes",
1948
- name: "data",
1949
- type: "bytes"
1950
- }
1951
- ],
1952
- name: "OnMorphoRepay",
1953
- type: "event"
1954
- },
1955
- {
1956
- anonymous: false,
1957
- inputs: [
1958
- {
1959
- indexed: true,
1960
- internalType: "bytes32",
1961
- name: "positionId",
1962
- type: "bytes32"
1963
- },
1964
- {
1965
- indexed: true,
1966
- internalType: "address",
1967
- name: "apm",
1968
- type: "address"
1969
- },
1970
- {
1971
- indexed: true,
1972
- internalType: "bytes32",
1973
- name: "tradeId",
1974
- type: "bytes32"
1975
- },
1976
- {
1977
- indexed: false,
1978
- internalType: "bytes32",
1979
- name: "marketId",
1980
- type: "bytes32"
1981
- },
1982
- {
1983
- indexed: false,
1984
- internalType: "address",
1985
- name: "payer",
1986
- type: "address"
1987
- },
1988
- {
1989
- indexed: false,
1990
- internalType: "bool",
1991
- name: "isLiquidated",
1992
- type: "bool"
1993
- }
1994
- ],
1995
- name: "Payment",
1713
+ name: "PaymentExecuted",
1996
1714
  type: "event"
1997
1715
  },
1998
1716
  {
1999
1717
  anonymous: false,
2000
1718
  inputs: [
2001
- {
2002
- indexed: true,
2003
- internalType: "bytes32",
2004
- name: "positionId",
2005
- type: "bytes32"
2006
- },
2007
1719
  {
2008
1720
  indexed: true,
2009
1721
  internalType: "address",
2010
- name: "token",
1722
+ name: "operator",
2011
1723
  type: "address"
2012
1724
  },
2013
1725
  {
2014
1726
  indexed: true,
2015
1727
  internalType: "address",
2016
- name: "recipient",
1728
+ name: "newProtocol",
2017
1729
  type: "address"
2018
- },
2019
- {
2020
- indexed: false,
2021
- internalType: "uint256",
2022
- name: "amount",
2023
- type: "uint256"
2024
1730
  }
2025
1731
  ],
2026
- name: "ProfitTaken",
1732
+ name: "ProtocolUpdated",
2027
1733
  type: "event"
2028
1734
  },
2029
1735
  {
2030
1736
  inputs: [],
2031
- name: "MORPHO_MANAGEMENT",
1737
+ name: "getProtocol",
2032
1738
  outputs: [
2033
1739
  {
2034
- internalType: "contract IMorphoManagement",
2035
- name: "",
1740
+ internalType: "address",
1741
+ name: "protocol",
2036
1742
  type: "address"
2037
1743
  }
2038
1744
  ],
@@ -2041,13 +1747,8 @@ var _abi2 = [
2041
1747
  },
2042
1748
  {
2043
1749
  inputs: [],
2044
- name: "eip712Domain",
1750
+ name: "optimexDomain",
2045
1751
  outputs: [
2046
- {
2047
- internalType: "bytes1",
2048
- name: "fields",
2049
- type: "bytes1"
2050
- },
2051
1752
  {
2052
1753
  internalType: "string",
2053
1754
  name: "name",
@@ -2057,26 +1758,6 @@ var _abi2 = [
2057
1758
  internalType: "string",
2058
1759
  name: "version",
2059
1760
  type: "string"
2060
- },
2061
- {
2062
- internalType: "uint256",
2063
- name: "chainId",
2064
- type: "uint256"
2065
- },
2066
- {
2067
- internalType: "address",
2068
- name: "verifyingContract",
2069
- type: "address"
2070
- },
2071
- {
2072
- internalType: "bytes32",
2073
- name: "salt",
2074
- type: "bytes32"
2075
- },
2076
- {
2077
- internalType: "uint256[]",
2078
- name: "extensions",
2079
- type: "uint256[]"
2080
1761
  }
2081
1762
  ],
2082
1763
  stateMutability: "view",
@@ -2086,74 +1767,43 @@ var _abi2 = [
2086
1767
  inputs: [
2087
1768
  {
2088
1769
  internalType: "address",
2089
- name: "apm",
1770
+ name: "token",
2090
1771
  type: "address"
2091
1772
  },
2092
- {
2093
- internalType: "bytes32",
2094
- name: "positionId",
2095
- type: "bytes32"
2096
- },
2097
- {
2098
- internalType: "bytes",
2099
- name: "signature",
2100
- type: "bytes"
2101
- }
2102
- ],
2103
- name: "finalizePosition",
2104
- outputs: [],
2105
- stateMutability: "nonpayable",
2106
- type: "function"
2107
- },
2108
- {
2109
- inputs: [
2110
1773
  {
2111
1774
  internalType: "uint256",
2112
- name: "repaidAssets",
2113
- type: "uint256"
2114
- },
2115
- {
2116
- internalType: "bytes",
2117
- name: "data",
2118
- type: "bytes"
2119
- }
2120
- ],
2121
- name: "onMorphoLiquidate",
2122
- outputs: [],
2123
- stateMutability: "nonpayable",
2124
- type: "function"
2125
- },
2126
- {
2127
- inputs: [
2128
- {
2129
- internalType: "uint256",
2130
- name: "repaidAssets",
1775
+ name: "amount",
2131
1776
  type: "uint256"
2132
1777
  },
2133
1778
  {
2134
1779
  internalType: "bytes",
2135
- name: "data",
1780
+ name: "externalCall",
2136
1781
  type: "bytes"
2137
1782
  }
2138
1783
  ],
2139
- name: "onMorphoRepay",
1784
+ name: "payment",
2140
1785
  outputs: [],
2141
1786
  stateMutability: "nonpayable",
2142
1787
  type: "function"
2143
1788
  },
2144
1789
  {
2145
1790
  inputs: [],
2146
- name: "optimexDomain",
1791
+ name: "paymentDetails",
2147
1792
  outputs: [
2148
1793
  {
2149
- internalType: "string",
2150
- name: "name",
2151
- type: "string"
1794
+ internalType: "address",
1795
+ name: "payer",
1796
+ type: "address"
2152
1797
  },
2153
1798
  {
2154
- internalType: "string",
2155
- name: "version",
2156
- type: "string"
1799
+ internalType: "address",
1800
+ name: "paymentToken",
1801
+ type: "address"
1802
+ },
1803
+ {
1804
+ internalType: "uint256",
1805
+ name: "paymentAmount",
1806
+ type: "uint256"
2157
1807
  }
2158
1808
  ],
2159
1809
  stateMutability: "view",
@@ -2163,50 +1813,29 @@ var _abi2 = [
2163
1813
  inputs: [
2164
1814
  {
2165
1815
  internalType: "address",
2166
- name: "apm",
1816
+ name: "newProtocol",
2167
1817
  type: "address"
2168
- },
2169
- {
2170
- internalType: "bytes32",
2171
- name: "positionId",
2172
- type: "bytes32"
2173
- },
2174
- {
2175
- internalType: "bytes32",
2176
- name: "tradeId",
2177
- type: "bytes32"
2178
- },
2179
- {
2180
- internalType: "uint256",
2181
- name: "amount",
2182
- type: "uint256"
2183
- },
2184
- {
2185
- internalType: "bool",
2186
- name: "isLiquidate",
2187
- type: "bool"
2188
- },
2189
- {
2190
- internalType: "bytes",
2191
- name: "signature",
2192
- type: "bytes"
2193
1818
  }
2194
1819
  ],
2195
- name: "payment",
1820
+ name: "setProtocol",
2196
1821
  outputs: [],
2197
1822
  stateMutability: "nonpayable",
2198
1823
  type: "function"
2199
1824
  }
2200
1825
  ];
2201
- var MorphoLiquidator__factory = class {
1826
+ var MorphoLiquidationGateway__factory = class {
2202
1827
  static createInterface() {
2203
1828
  return new import_ethers2.Interface(_abi2);
2204
1829
  }
2205
1830
  static connect(address, runner) {
2206
- return new import_ethers2.Contract(address, _abi2, runner);
1831
+ return new import_ethers2.Contract(
1832
+ address,
1833
+ _abi2,
1834
+ runner
1835
+ );
2207
1836
  }
2208
1837
  };
2209
- MorphoLiquidator__factory.abi = _abi2;
1838
+ MorphoLiquidationGateway__factory.abi = _abi2;
2210
1839
 
2211
1840
  // src/contracts/contracts/factories/Payment__factory.ts
2212
1841
  var import_ethers3 = require("ethers");
@@ -5169,11 +4798,15 @@ var isL2Network = (network) => {
5169
4798
  };
5170
4799
 
5171
4800
  // src/shared/role.ts
5172
- var ContractRole = /* @__PURE__ */ ((ContractRole3) => {
5173
- ContractRole3["AcrossTransitVault"] = "AcrossTransitVault";
5174
- ContractRole3["Payment"] = "OptimexSwapPayment";
5175
- return ContractRole3;
5176
- })(ContractRole || {});
4801
+ var AssetChainContractRole = /* @__PURE__ */ ((AssetChainContractRole3) => {
4802
+ AssetChainContractRole3["AcrossTransitVault"] = "AcrossTransitVault";
4803
+ AssetChainContractRole3["Payment"] = "OptimexSwapPayment";
4804
+ AssetChainContractRole3["OptimexManagement"] = "OptimexManagement";
4805
+ AssetChainContractRole3["MorphoSupplier"] = "MorphoSupplier";
4806
+ AssetChainContractRole3["MorphoLiquidationGateway"] = "MorphoLiquidationGateway";
4807
+ AssetChainContractRole3["MorphoManagement"] = "MorphoManagement";
4808
+ return AssetChainContractRole3;
4809
+ })(AssetChainContractRole || {});
5177
4810
  var L2ContractRole = /* @__PURE__ */ ((L2ContractRole3) => {
5178
4811
  L2ContractRole3["MorphoAdapter"] = "MorphoAdapter";
5179
4812
  L2ContractRole3["MorphoMarketRegistry"] = "MorphoMarketRegistry";
@@ -5748,10 +5381,10 @@ async function getSignature(Signer2, provider, signerHelper, tradeId, infoHash,
5748
5381
  }
5749
5382
  // Annotate the CommonJS export names for ESM import in node:
5750
5383
  0 && (module.exports = {
5751
- ContractRole,
5384
+ AssetChainContractRole,
5752
5385
  ERC20__factory,
5753
5386
  L2ContractRole,
5754
- MorphoLiquidator__factory,
5387
+ MorphoLiquidationGateway__factory,
5755
5388
  OptimexBtcNetwork,
5756
5389
  OptimexEvmNetwork,
5757
5390
  OptimexL2Network,