@baseline-markets/sdk 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1572,1825 +1572,10 @@ var bCredit = [
1572
1572
  ];
1573
1573
 
1574
1574
  // ../contracts/abis/mercury/bFactory.ts
1575
- var bFactory = [
1576
- {
1577
- type: "function",
1578
- name: "LABEL",
1579
- inputs: [],
1580
- outputs: [
1581
- {
1582
- name: "",
1583
- type: "bytes32",
1584
- internalType: "bytes32"
1585
- }
1586
- ],
1587
- stateMutability: "pure"
1588
- },
1589
- {
1590
- type: "function",
1591
- name: "ROUTES",
1592
- inputs: [],
1593
- outputs: [
1594
- {
1595
- name: "routes_",
1596
- type: "bytes4[]",
1597
- internalType: "bytes4[]"
1598
- }
1599
- ],
1600
- stateMutability: "pure"
1601
- },
1602
- {
1603
- type: "function",
1604
- name: "VERSION",
1605
- inputs: [],
1606
- outputs: [
1607
- {
1608
- name: "",
1609
- type: "uint256",
1610
- internalType: "uint256"
1611
- }
1612
- ],
1613
- stateMutability: "pure"
1614
- },
1615
- {
1616
- type: "function",
1617
- name: "createBToken",
1618
- inputs: [
1619
- {
1620
- name: "_name",
1621
- type: "string",
1622
- internalType: "string"
1623
- },
1624
- {
1625
- name: "_symbol",
1626
- type: "string",
1627
- internalType: "string"
1628
- },
1629
- {
1630
- name: "_totalSupply",
1631
- type: "uint256",
1632
- internalType: "uint256"
1633
- },
1634
- {
1635
- name: "_salt",
1636
- type: "bytes32",
1637
- internalType: "bytes32"
1638
- }
1639
- ],
1640
- outputs: [
1641
- {
1642
- name: "bToken_",
1643
- type: "address",
1644
- internalType: "contract BToken"
1645
- }
1646
- ],
1647
- stateMutability: "nonpayable"
1648
- },
1649
- {
1650
- type: "function",
1651
- name: "createPool",
1652
- inputs: [
1653
- {
1654
- name: "params",
1655
- type: "tuple",
1656
- internalType: "struct BFactory.CreateParams",
1657
- components: [
1658
- {
1659
- name: "bToken",
1660
- type: "address",
1661
- internalType: "contract BToken"
1662
- },
1663
- {
1664
- name: "initialPoolBTokens",
1665
- type: "uint256",
1666
- internalType: "uint256"
1667
- },
1668
- {
1669
- name: "reserve",
1670
- type: "address",
1671
- internalType: "address"
1672
- },
1673
- {
1674
- name: "initialPoolReserves",
1675
- type: "uint256",
1676
- internalType: "uint256"
1677
- },
1678
- {
1679
- name: "initialActivePrice",
1680
- type: "uint256",
1681
- internalType: "uint256"
1682
- },
1683
- {
1684
- name: "initialBLV",
1685
- type: "uint256",
1686
- internalType: "uint256"
1687
- },
1688
- {
1689
- name: "creator",
1690
- type: "address",
1691
- internalType: "address"
1692
- },
1693
- {
1694
- name: "feeRecipient",
1695
- type: "address",
1696
- internalType: "address"
1697
- },
1698
- {
1699
- name: "creatorFeePct",
1700
- type: "uint256",
1701
- internalType: "uint256"
1702
- },
1703
- {
1704
- name: "swapFeePct",
1705
- type: "uint256",
1706
- internalType: "uint256"
1707
- },
1708
- {
1709
- name: "createHook",
1710
- type: "bool",
1711
- internalType: "bool"
1712
- },
1713
- {
1714
- name: "claimMerkleRoot",
1715
- type: "bytes32",
1716
- internalType: "bytes32"
1717
- },
1718
- {
1719
- name: "initialCollateral",
1720
- type: "uint256",
1721
- internalType: "uint256"
1722
- },
1723
- {
1724
- name: "initialDebt",
1725
- type: "uint256",
1726
- internalType: "uint256"
1727
- }
1728
- ]
1729
- }
1730
- ],
1731
- outputs: [],
1732
- stateMutability: "payable"
1733
- },
1734
- {
1735
- type: "function",
1736
- name: "precomputeBTokenAddress",
1737
- inputs: [
1738
- {
1739
- name: "_name",
1740
- type: "string",
1741
- internalType: "string"
1742
- },
1743
- {
1744
- name: "_symbol",
1745
- type: "string",
1746
- internalType: "string"
1747
- },
1748
- {
1749
- name: "_totalSupply",
1750
- type: "uint256",
1751
- internalType: "uint256"
1752
- },
1753
- {
1754
- name: "_salt",
1755
- type: "bytes32",
1756
- internalType: "bytes32"
1757
- },
1758
- {
1759
- name: "_deployer",
1760
- type: "address",
1761
- internalType: "address"
1762
- }
1763
- ],
1764
- outputs: [
1765
- {
1766
- name: "computedAddress_",
1767
- type: "address",
1768
- internalType: "address"
1769
- }
1770
- ],
1771
- stateMutability: "view"
1772
- },
1773
- {
1774
- type: "function",
1775
- name: "supportsInterface",
1776
- inputs: [
1777
- {
1778
- name: "_interfaceId",
1779
- type: "bytes4",
1780
- internalType: "bytes4"
1781
- }
1782
- ],
1783
- outputs: [
1784
- {
1785
- name: "",
1786
- type: "bool",
1787
- internalType: "bool"
1788
- }
1789
- ],
1790
- stateMutability: "pure"
1791
- },
1792
- {
1793
- type: "event",
1794
- name: "BTokenCreated",
1795
- inputs: [
1796
- {
1797
- name: "bTokenAddress",
1798
- type: "address",
1799
- indexed: false,
1800
- internalType: "contract BToken"
1801
- },
1802
- {
1803
- name: "name",
1804
- type: "string",
1805
- indexed: false,
1806
- internalType: "string"
1807
- },
1808
- {
1809
- name: "symbol",
1810
- type: "string",
1811
- indexed: false,
1812
- internalType: "string"
1813
- },
1814
- {
1815
- name: "decimals",
1816
- type: "uint8",
1817
- indexed: false,
1818
- internalType: "uint8"
1819
- },
1820
- {
1821
- name: "totalSupply",
1822
- type: "uint256",
1823
- indexed: false,
1824
- internalType: "uint256"
1825
- },
1826
- {
1827
- name: "creator",
1828
- type: "address",
1829
- indexed: false,
1830
- internalType: "address"
1831
- }
1832
- ],
1833
- anonymous: false
1834
- },
1835
- {
1836
- type: "event",
1837
- name: "Initialized",
1838
- inputs: [
1839
- {
1840
- name: "bToken",
1841
- type: "address",
1842
- indexed: false,
1843
- internalType: "contract BToken"
1844
- },
1845
- {
1846
- name: "activePrice",
1847
- type: "uint256",
1848
- indexed: false,
1849
- internalType: "uint256"
1850
- },
1851
- {
1852
- name: "blvPrice",
1853
- type: "uint256",
1854
- indexed: false,
1855
- internalType: "uint256"
1856
- },
1857
- {
1858
- name: "swapFeePct",
1859
- type: "uint256",
1860
- indexed: false,
1861
- internalType: "uint256"
1862
- }
1863
- ],
1864
- anonymous: false
1865
- },
1866
- {
1867
- type: "event",
1868
- name: "PoolCreated",
1869
- inputs: [
1870
- {
1871
- name: "bTokenAddress",
1872
- type: "address",
1873
- indexed: false,
1874
- internalType: "contract BToken"
1875
- },
1876
- {
1877
- name: "reserveAddress",
1878
- type: "address",
1879
- indexed: false,
1880
- internalType: "address"
1881
- },
1882
- {
1883
- name: "creator",
1884
- type: "address",
1885
- indexed: false,
1886
- internalType: "address"
1887
- },
1888
- {
1889
- name: "feeRecipient",
1890
- type: "address",
1891
- indexed: false,
1892
- internalType: "address"
1893
- },
1894
- {
1895
- name: "creatorFeePct",
1896
- type: "uint256",
1897
- indexed: false,
1898
- internalType: "uint256"
1899
- },
1900
- {
1901
- name: "initialActivePrice",
1902
- type: "uint256",
1903
- indexed: false,
1904
- internalType: "uint256"
1905
- },
1906
- {
1907
- name: "initialBlvPrice",
1908
- type: "uint256",
1909
- indexed: false,
1910
- internalType: "uint256"
1911
- },
1912
- {
1913
- name: "totalReserves",
1914
- type: "uint256",
1915
- indexed: false,
1916
- internalType: "uint256"
1917
- },
1918
- {
1919
- name: "totalBTokens",
1920
- type: "uint256",
1921
- indexed: false,
1922
- internalType: "uint256"
1923
- },
1924
- {
1925
- name: "totalCollateral",
1926
- type: "uint256",
1927
- indexed: false,
1928
- internalType: "uint256"
1929
- },
1930
- {
1931
- name: "totalDebt",
1932
- type: "uint256",
1933
- indexed: false,
1934
- internalType: "uint256"
1935
- },
1936
- {
1937
- name: "poolId",
1938
- type: "bytes32",
1939
- indexed: false,
1940
- internalType: "bytes32"
1941
- }
1942
- ],
1943
- anonymous: false
1944
- },
1945
- {
1946
- type: "error",
1947
- name: "AlreadyInitialized",
1948
- inputs: []
1949
- },
1950
- {
1951
- type: "error",
1952
- name: "Component_NotPermitted",
1953
- inputs: []
1954
- },
1955
- {
1956
- type: "error",
1957
- name: "GuardLib_Paused",
1958
- inputs: []
1959
- },
1960
- {
1961
- type: "error",
1962
- name: "GuardLib_Reentrant",
1963
- inputs: []
1964
- },
1965
- {
1966
- type: "error",
1967
- name: "GuardLib_ReserveAccountingMismatch",
1968
- inputs: []
1969
- },
1970
- {
1971
- type: "error",
1972
- name: "InsolventInitialCreditPosition",
1973
- inputs: []
1974
- },
1975
- {
1976
- type: "error",
1977
- name: "InvalidActivePrice",
1978
- inputs: []
1979
- },
1980
- {
1981
- type: "error",
1982
- name: "InvalidBLVPrice",
1983
- inputs: []
1984
- },
1985
- {
1986
- type: "error",
1987
- name: "InvalidConvexityExp",
1988
- inputs: []
1989
- },
1990
- {
1991
- type: "error",
1992
- name: "InvalidConvexityExp",
1993
- inputs: []
1994
- },
1995
- {
1996
- type: "error",
1997
- name: "InvalidCreator",
1998
- inputs: []
1999
- },
2000
- {
2001
- type: "error",
2002
- name: "InvalidCreatorFee",
2003
- inputs: []
2004
- },
2005
- {
2006
- type: "error",
2007
- name: "InvalidFeeRecipient",
2008
- inputs: []
2009
- },
2010
- {
2011
- type: "error",
2012
- name: "InvalidInitialCollateralOrDebt",
2013
- inputs: []
2014
- },
2015
- {
2016
- type: "error",
2017
- name: "InvalidName",
2018
- inputs: []
2019
- },
2020
- {
2021
- type: "error",
2022
- name: "InvalidPoolSupply",
2023
- inputs: []
2024
- },
2025
- {
2026
- type: "error",
2027
- name: "InvalidSalt",
2028
- inputs: []
2029
- },
2030
- {
2031
- type: "error",
2032
- name: "InvalidSwapFeePct",
2033
- inputs: []
2034
- },
2035
- {
2036
- type: "error",
2037
- name: "InvalidSymbol",
2038
- inputs: []
2039
- },
2040
- {
2041
- type: "error",
2042
- name: "InvariantDecreased",
2043
- inputs: [
2044
- {
2045
- name: "prevInvariant",
2046
- type: "uint256",
2047
- internalType: "uint256"
2048
- },
2049
- {
2050
- name: "newInvariant",
2051
- type: "uint256",
2052
- internalType: "uint256"
2053
- }
2054
- ]
2055
- },
2056
- {
2057
- type: "error",
2058
- name: "NativeLib_AmountMismatch",
2059
- inputs: []
2060
- },
2061
- {
2062
- type: "error",
2063
- name: "NativeLib_NotWrapped",
2064
- inputs: []
2065
- },
2066
- {
2067
- type: "error",
2068
- name: "NotApprovedReserve",
2069
- inputs: []
2070
- },
2071
- {
2072
- type: "error",
2073
- name: "NotDeployer",
2074
- inputs: []
2075
- },
2076
- {
2077
- type: "error",
2078
- name: "PoolAlreadyInitialized",
2079
- inputs: []
2080
- },
2081
- {
2082
- type: "error",
2083
- name: "TotalSupplyTooHigh",
2084
- inputs: []
2085
- },
2086
- {
2087
- type: "error",
2088
- name: "TotalSupplyTooLow",
2089
- inputs: []
2090
- },
2091
- {
2092
- type: "error",
2093
- name: "UnauthorizedCreditPositionCreation",
2094
- inputs: []
2095
- }
2096
- ];
2097
-
2098
- // ../contracts/abis/mercury/bLens.ts
2099
- var bLens = [
2100
- {
2101
- type: "function",
2102
- name: "LABEL",
2103
- inputs: [],
2104
- outputs: [
2105
- {
2106
- name: "",
2107
- type: "bytes32",
2108
- internalType: "bytes32"
2109
- }
2110
- ],
2111
- stateMutability: "view"
2112
- },
2113
- {
2114
- type: "function",
2115
- name: "ROUTES",
2116
- inputs: [],
2117
- outputs: [
2118
- {
2119
- name: "routes_",
2120
- type: "bytes4[]",
2121
- internalType: "bytes4[]"
2122
- }
2123
- ],
2124
- stateMutability: "pure"
2125
- },
2126
- {
2127
- type: "function",
2128
- name: "VERSION",
2129
- inputs: [],
2130
- outputs: [
2131
- {
2132
- name: "",
2133
- type: "uint256",
2134
- internalType: "uint256"
2135
- }
2136
- ],
2137
- stateMutability: "view"
2138
- },
2139
- {
2140
- type: "function",
2141
- name: "accumulator",
2142
- inputs: [
2143
- {
2144
- name: "_bToken",
2145
- type: "address",
2146
- internalType: "contract BToken"
2147
- }
2148
- ],
2149
- outputs: [
2150
- {
2151
- name: "",
2152
- type: "uint256",
2153
- internalType: "uint256"
2154
- }
2155
- ],
2156
- stateMutability: "view"
2157
- },
2158
- {
2159
- type: "function",
2160
- name: "activePrice",
2161
- inputs: [
2162
- {
2163
- name: "_bToken",
2164
- type: "address",
2165
- internalType: "contract BToken"
2166
- }
2167
- ],
2168
- outputs: [
2169
- {
2170
- name: "",
2171
- type: "uint256",
2172
- internalType: "uint256"
2173
- }
2174
- ],
2175
- stateMutability: "view"
2176
- },
2177
- {
2178
- type: "function",
2179
- name: "blvPrice",
2180
- inputs: [
2181
- {
2182
- name: "_bToken",
2183
- type: "address",
2184
- internalType: "contract BToken"
2185
- }
2186
- ],
2187
- outputs: [
2188
- {
2189
- name: "",
2190
- type: "uint256",
2191
- internalType: "uint256"
2192
- }
2193
- ],
2194
- stateMutability: "view"
2195
- },
2196
- {
2197
- type: "function",
2198
- name: "claimableYield",
2199
- inputs: [
2200
- {
2201
- name: "_bToken",
2202
- type: "address",
2203
- internalType: "contract BToken"
2204
- }
2205
- ],
2206
- outputs: [
2207
- {
2208
- name: "",
2209
- type: "uint256",
2210
- internalType: "uint256"
2211
- }
2212
- ],
2213
- stateMutability: "view"
2214
- },
2215
- {
2216
- type: "function",
2217
- name: "convexityExp",
2218
- inputs: [
2219
- {
2220
- name: "_bToken",
2221
- type: "address",
2222
- internalType: "contract BToken"
2223
- }
2224
- ],
2225
- outputs: [
2226
- {
2227
- name: "",
2228
- type: "uint256",
2229
- internalType: "uint256"
2230
- }
2231
- ],
2232
- stateMutability: "view"
2233
- },
2234
- {
2235
- type: "function",
2236
- name: "creator",
2237
- inputs: [
2238
- {
2239
- name: "_bToken",
2240
- type: "address",
2241
- internalType: "contract BToken"
2242
- }
2243
- ],
2244
- outputs: [
2245
- {
2246
- name: "",
2247
- type: "address",
2248
- internalType: "address"
2249
- }
2250
- ],
2251
- stateMutability: "view"
2252
- },
2253
- {
2254
- type: "function",
2255
- name: "creatorClaimable",
2256
- inputs: [
2257
- {
2258
- name: "_bToken",
2259
- type: "address",
2260
- internalType: "contract BToken"
2261
- }
2262
- ],
2263
- outputs: [
2264
- {
2265
- name: "",
2266
- type: "uint256",
2267
- internalType: "uint256"
2268
- }
2269
- ],
2270
- stateMutability: "view"
2271
- },
2272
- {
2273
- type: "function",
2274
- name: "creatorFeePct",
2275
- inputs: [
2276
- {
2277
- name: "_bToken",
2278
- type: "address",
2279
- internalType: "contract BToken"
2280
- }
2281
- ],
2282
- outputs: [
2283
- {
2284
- name: "",
2285
- type: "uint256",
2286
- internalType: "uint256"
2287
- }
2288
- ],
2289
- stateMutability: "view"
2290
- },
2291
- {
2292
- type: "function",
2293
- name: "creditAccount",
2294
- inputs: [
2295
- {
2296
- name: "_bToken",
2297
- type: "address",
2298
- internalType: "contract BToken"
2299
- },
2300
- {
2301
- name: "_user",
2302
- type: "address",
2303
- internalType: "address"
2304
- }
2305
- ],
2306
- outputs: [
2307
- {
2308
- name: "",
2309
- type: "uint256",
2310
- internalType: "uint256"
2311
- },
2312
- {
2313
- name: "",
2314
- type: "uint256",
2315
- internalType: "uint256"
2316
- }
2317
- ],
2318
- stateMutability: "view"
2319
- },
2320
- {
2321
- type: "function",
2322
- name: "defaultLiquidityFeePct",
2323
- inputs: [],
2324
- outputs: [
2325
- {
2326
- name: "",
2327
- type: "uint256",
2328
- internalType: "uint256"
2329
- }
2330
- ],
2331
- stateMutability: "view"
2332
- },
2333
- {
2334
- type: "function",
2335
- name: "defaultProtocolFeePct",
2336
- inputs: [],
2337
- outputs: [
2338
- {
2339
- name: "",
2340
- type: "uint256",
2341
- internalType: "uint256"
2342
- }
2343
- ],
2344
- stateMutability: "view"
2345
- },
2346
- {
2347
- type: "function",
2348
- name: "deployerProfile",
2349
- inputs: [
2350
- {
2351
- name: "_user",
2352
- type: "address",
2353
- internalType: "address"
2354
- }
2355
- ],
2356
- outputs: [
2357
- {
2358
- name: "",
2359
- type: "tuple",
2360
- internalType: "struct State.DeployerProfile",
2361
- components: [
2362
- {
2363
- name: "active",
2364
- type: "bool",
2365
- internalType: "bool"
2366
- },
2367
- {
2368
- name: "approvedCreditDeployer",
2369
- type: "bool",
2370
- internalType: "bool"
2371
- },
2372
- {
2373
- name: "pauser",
2374
- type: "bool",
2375
- internalType: "bool"
2376
- },
2377
- {
2378
- name: "protocolFeePct",
2379
- type: "uint64",
2380
- internalType: "uint64"
2381
- },
2382
- {
2383
- name: "liquidityFeePct",
2384
- type: "uint64",
2385
- internalType: "uint64"
2386
- }
2387
- ]
2388
- }
2389
- ],
2390
- stateMutability: "view"
2391
- },
2392
- {
2393
- type: "function",
2394
- name: "getBookPrice",
2395
- inputs: [
2396
- {
2397
- name: "_bToken",
2398
- type: "address",
2399
- internalType: "contract BToken"
2400
- }
2401
- ],
2402
- outputs: [
2403
- {
2404
- name: "",
2405
- type: "uint256",
2406
- internalType: "uint256"
2407
- }
2408
- ],
2409
- stateMutability: "view"
2410
- },
2411
- {
2412
- type: "function",
2413
- name: "getCirculatingSupply",
2414
- inputs: [
2415
- {
2416
- name: "_bToken",
2417
- type: "address",
2418
- internalType: "contract BToken"
2419
- }
2420
- ],
2421
- outputs: [
2422
- {
2423
- name: "",
2424
- type: "uint256",
2425
- internalType: "uint256"
2426
- }
2427
- ],
2428
- stateMutability: "view"
2429
- },
2430
- {
2431
- type: "function",
2432
- name: "getComponents",
2433
- inputs: [],
2434
- outputs: [
2435
- {
2436
- name: "components_",
2437
- type: "address[]",
2438
- internalType: "contract Component[]"
2439
- }
2440
- ],
2441
- stateMutability: "view"
2442
- },
2443
- {
2444
- type: "function",
2445
- name: "getMaker",
2446
- inputs: [
2447
- {
2448
- name: "_bToken",
2449
- type: "address",
2450
- internalType: "contract BToken"
2451
- }
2452
- ],
2453
- outputs: [
2454
- {
2455
- name: "",
2456
- type: "tuple",
2457
- internalType: "struct State.Maker",
2458
- components: [
2459
- {
2460
- name: "initialized",
2461
- type: "bool",
2462
- internalType: "bool"
2463
- },
2464
- {
2465
- name: "blvPrice",
2466
- type: "uint128",
2467
- internalType: "uint128"
2468
- },
2469
- {
2470
- name: "swapFee",
2471
- type: "uint128",
2472
- internalType: "uint128"
2473
- },
2474
- {
2475
- name: "maxCirc",
2476
- type: "uint128",
2477
- internalType: "uint128"
2478
- },
2479
- {
2480
- name: "maxReserves",
2481
- type: "uint128",
2482
- internalType: "uint128"
2483
- },
2484
- {
2485
- name: "convexityExp",
2486
- type: "uint128",
2487
- internalType: "uint128"
2488
- },
2489
- {
2490
- name: "lastInvariant",
2491
- type: "uint256",
2492
- internalType: "uint256"
2493
- }
2494
- ]
2495
- }
2496
- ],
2497
- stateMutability: "view"
2498
- },
2499
- {
2500
- type: "function",
2501
- name: "getQuoteState",
2502
- inputs: [
2503
- {
2504
- name: "_bToken",
2505
- type: "address",
2506
- internalType: "contract BToken"
2507
- }
2508
- ],
2509
- outputs: [
2510
- {
2511
- name: "state_",
2512
- type: "tuple",
2513
- internalType: "struct BLens.QuoteState",
2514
- components: [
2515
- {
2516
- name: "snapshotCurveParams",
2517
- type: "tuple",
2518
- internalType: "struct CurveParams",
2519
- components: [
2520
- {
2521
- name: "BLV",
2522
- type: "uint256",
2523
- internalType: "uint256"
2524
- },
2525
- {
2526
- name: "circ",
2527
- type: "uint256",
2528
- internalType: "uint256"
2529
- },
2530
- {
2531
- name: "supply",
2532
- type: "uint256",
2533
- internalType: "uint256"
2534
- },
2535
- {
2536
- name: "swapFee",
2537
- type: "uint256",
2538
- internalType: "uint256"
2539
- },
2540
- {
2541
- name: "reserves",
2542
- type: "uint256",
2543
- internalType: "uint256"
2544
- },
2545
- {
2546
- name: "totalSupply",
2547
- type: "uint256",
2548
- internalType: "uint256"
2549
- },
2550
- {
2551
- name: "convexityExp",
2552
- type: "uint256",
2553
- internalType: "uint256"
2554
- },
2555
- {
2556
- name: "lastInvariant",
2557
- type: "uint256",
2558
- internalType: "uint256"
2559
- }
2560
- ]
2561
- },
2562
- {
2563
- name: "quoteBlockBuyDeltaCirc",
2564
- type: "uint256",
2565
- internalType: "uint256"
2566
- },
2567
- {
2568
- name: "quoteBlockSellDeltaCirc",
2569
- type: "uint256",
2570
- internalType: "uint256"
2571
- },
2572
- {
2573
- name: "totalSupply",
2574
- type: "uint256",
2575
- internalType: "uint256"
2576
- },
2577
- {
2578
- name: "totalBTokens",
2579
- type: "uint256",
2580
- internalType: "uint256"
2581
- },
2582
- {
2583
- name: "totalReserves",
2584
- type: "uint256",
2585
- internalType: "uint256"
2586
- },
2587
- {
2588
- name: "reserveDecimals",
2589
- type: "uint8",
2590
- internalType: "uint8"
2591
- },
2592
- {
2593
- name: "liquidityFeePct",
2594
- type: "uint256",
2595
- internalType: "uint256"
2596
- },
2597
- {
2598
- name: "pendingSurplus",
2599
- type: "uint256",
2600
- internalType: "uint256"
2601
- },
2602
- {
2603
- name: "shouldSettlePendingSurplus",
2604
- type: "bool",
2605
- internalType: "bool"
2606
- },
2607
- {
2608
- name: "maxSellDelta",
2609
- type: "uint256",
2610
- internalType: "uint256"
2611
- },
2612
- {
2613
- name: "snapshotActivePrice",
2614
- type: "uint256",
2615
- internalType: "uint256"
2616
- }
2617
- ]
2618
- }
2619
- ],
2620
- stateMutability: "view"
2621
- },
2622
- {
2623
- type: "function",
2624
- name: "hasHook",
2625
- inputs: [
2626
- {
2627
- name: "_bToken",
2628
- type: "address",
2629
- internalType: "contract BToken"
2630
- }
2631
- ],
2632
- outputs: [
2633
- {
2634
- name: "",
2635
- type: "bool",
2636
- internalType: "bool"
2637
- }
2638
- ],
2639
- stateMutability: "view"
2640
- },
2641
- {
2642
- type: "function",
2643
- name: "isApprovedCreditDeployer",
2644
- inputs: [
2645
- {
2646
- name: "_user",
2647
- type: "address",
2648
- internalType: "address"
2649
- }
2650
- ],
2651
- outputs: [
2652
- {
2653
- name: "",
2654
- type: "bool",
2655
- internalType: "bool"
2656
- }
2657
- ],
2658
- stateMutability: "view"
2659
- },
2660
- {
2661
- type: "function",
2662
- name: "isLocked",
2663
- inputs: [],
2664
- outputs: [
2665
- {
2666
- name: "",
2667
- type: "bool",
2668
- internalType: "bool"
2669
- }
2670
- ],
2671
- stateMutability: "view"
2672
- },
2673
- {
2674
- type: "function",
2675
- name: "isPoolPaused",
2676
- inputs: [
2677
- {
2678
- name: "_bToken",
2679
- type: "address",
2680
- internalType: "contract BToken"
2681
- }
2682
- ],
2683
- outputs: [
2684
- {
2685
- name: "",
2686
- type: "bool",
2687
- internalType: "bool"
2688
- }
2689
- ],
2690
- stateMutability: "view"
2691
- },
2692
- {
2693
- type: "function",
2694
- name: "isProtocolPaused",
2695
- inputs: [],
2696
- outputs: [
2697
- {
2698
- name: "",
2699
- type: "bool",
2700
- internalType: "bool"
2701
- }
2702
- ],
2703
- stateMutability: "view"
2704
- },
2705
- {
2706
- type: "function",
2707
- name: "lastInvariant",
2708
- inputs: [
2709
- {
2710
- name: "_bToken",
2711
- type: "address",
2712
- internalType: "contract BToken"
2713
- }
2714
- ],
2715
- outputs: [
2716
- {
2717
- name: "",
2718
- type: "uint256",
2719
- internalType: "uint256"
2720
- }
2721
- ],
2722
- stateMutability: "view"
2723
- },
2724
- {
2725
- type: "function",
2726
- name: "lastUpdatedTimestamp",
2727
- inputs: [
2728
- {
2729
- name: "_bToken",
2730
- type: "address",
2731
- internalType: "contract BToken"
2732
- }
2733
- ],
2734
- outputs: [
2735
- {
2736
- name: "",
2737
- type: "uint256",
2738
- internalType: "uint256"
2739
- }
2740
- ],
2741
- stateMutability: "view"
2742
- },
2743
- {
2744
- type: "function",
2745
- name: "liquidityFeePct",
2746
- inputs: [
2747
- {
2748
- name: "_bToken",
2749
- type: "address",
2750
- internalType: "contract BToken"
2751
- }
2752
- ],
2753
- outputs: [
2754
- {
2755
- name: "",
2756
- type: "uint256",
2757
- internalType: "uint256"
2758
- }
2759
- ],
2760
- stateMutability: "view"
2761
- },
2762
- {
2763
- type: "function",
2764
- name: "originationFee",
2765
- inputs: [],
2766
- outputs: [
2767
- {
2768
- name: "",
2769
- type: "uint256",
2770
- internalType: "uint256"
2771
- }
2772
- ],
2773
- stateMutability: "view"
2774
- },
2775
- {
2776
- type: "function",
2777
- name: "pendingSurplus",
2778
- inputs: [
2779
- {
2780
- name: "_bToken",
2781
- type: "address",
2782
- internalType: "contract BToken"
2783
- }
2784
- ],
2785
- outputs: [
2786
- {
2787
- name: "",
2788
- type: "uint256",
2789
- internalType: "uint256"
2790
- }
2791
- ],
2792
- stateMutability: "view"
2793
- },
2794
- {
2795
- type: "function",
2796
- name: "pendingYield",
2797
- inputs: [
2798
- {
2799
- name: "_bToken",
2800
- type: "address",
2801
- internalType: "contract BToken"
2802
- }
2803
- ],
2804
- outputs: [
2805
- {
2806
- name: "",
2807
- type: "uint256",
2808
- internalType: "uint256"
2809
- }
2810
- ],
2811
- stateMutability: "view"
2812
- },
2813
- {
2814
- type: "function",
2815
- name: "poolFeeRecipient",
2816
- inputs: [
2817
- {
2818
- name: "_bToken",
2819
- type: "address",
2820
- internalType: "contract BToken"
2821
- }
2822
- ],
2823
- outputs: [
2824
- {
2825
- name: "",
2826
- type: "address",
2827
- internalType: "address"
2828
- }
2829
- ],
2830
- stateMutability: "view"
2831
- },
2832
- {
2833
- type: "function",
2834
- name: "poolFeeShare",
2835
- inputs: [
2836
- {
2837
- name: "_bToken",
2838
- type: "address",
2839
- internalType: "contract BToken"
2840
- }
2841
- ],
2842
- outputs: [
2843
- {
2844
- name: "creator_",
2845
- type: "uint256",
2846
- internalType: "uint256"
2847
- },
2848
- {
2849
- name: "staking_",
2850
- type: "uint256",
2851
- internalType: "uint256"
2852
- }
2853
- ],
2854
- stateMutability: "view"
2855
- },
2856
- {
2857
- type: "function",
2858
- name: "poolIdToBToken",
2859
- inputs: [
2860
- {
2861
- name: "_poolId",
2862
- type: "bytes32",
2863
- internalType: "PoolId"
2864
- }
2865
- ],
2866
- outputs: [
2867
- {
2868
- name: "",
2869
- type: "address",
2870
- internalType: "contract BToken"
2871
- }
2872
- ],
2873
- stateMutability: "view"
2874
- },
2875
- {
2876
- type: "function",
2877
- name: "poolKey",
2878
- inputs: [
2879
- {
2880
- name: "_bToken",
2881
- type: "address",
2882
- internalType: "contract BToken"
2883
- }
2884
- ],
2885
- outputs: [
2886
- {
2887
- name: "",
2888
- type: "tuple",
2889
- internalType: "struct PoolKey",
2890
- components: [
2891
- {
2892
- name: "currency0",
2893
- type: "address",
2894
- internalType: "Currency"
2895
- },
2896
- {
2897
- name: "currency1",
2898
- type: "address",
2899
- internalType: "Currency"
2900
- },
2901
- {
2902
- name: "fee",
2903
- type: "uint24",
2904
- internalType: "uint24"
2905
- },
2906
- {
2907
- name: "tickSpacing",
2908
- type: "int24",
2909
- internalType: "int24"
2910
- },
2911
- {
2912
- name: "hooks",
2913
- type: "address",
2914
- internalType: "contract IHooks"
2915
- }
2916
- ]
2917
- }
2918
- ],
2919
- stateMutability: "view"
2920
- },
2921
- {
2922
- type: "function",
2923
- name: "protocolClaimable",
2924
- inputs: [
2925
- {
2926
- name: "_bToken",
2927
- type: "address",
2928
- internalType: "contract BToken"
2929
- }
2930
- ],
2931
- outputs: [
2932
- {
2933
- name: "",
2934
- type: "uint256",
2935
- internalType: "uint256"
2936
- }
2937
- ],
2938
- stateMutability: "view"
2939
- },
2940
- {
2941
- type: "function",
2942
- name: "protocolFeePct",
2943
- inputs: [
2944
- {
2945
- name: "_bToken",
2946
- type: "address",
2947
- internalType: "contract BToken"
2948
- }
2949
- ],
2950
- outputs: [
2951
- {
2952
- name: "",
2953
- type: "uint256",
2954
- internalType: "uint256"
2955
- }
2956
- ],
2957
- stateMutability: "view"
2958
- },
2959
- {
2960
- type: "function",
2961
- name: "protocolFeeRecipient",
2962
- inputs: [],
2963
- outputs: [
2964
- {
2965
- name: "",
2966
- type: "address",
2967
- internalType: "address"
2968
- }
2969
- ],
2970
- stateMutability: "view"
2971
- },
2972
- {
2973
- type: "function",
2974
- name: "quoteLeverage",
2975
- inputs: [
2976
- {
2977
- name: "_bToken",
2978
- type: "address",
2979
- internalType: "contract BToken"
2980
- },
2981
- {
2982
- name: "_collateralIn",
2983
- type: "uint256",
2984
- internalType: "uint256"
2985
- },
2986
- {
2987
- name: "_leverageFactor",
2988
- type: "uint256",
2989
- internalType: "uint256"
2990
- }
2991
- ],
2992
- outputs: [
2993
- {
2994
- name: "targetCollateral_",
2995
- type: "uint256",
2996
- internalType: "uint256"
2997
- },
2998
- {
2999
- name: "maxSwapReservesIn_",
3000
- type: "uint256",
3001
- internalType: "uint256"
3002
- },
3003
- {
3004
- name: "expectedDebt_",
3005
- type: "uint256",
3006
- internalType: "uint256"
3007
- },
3008
- {
3009
- name: "slippage_",
3010
- type: "uint256",
3011
- internalType: "uint256"
3012
- }
3013
- ],
3014
- stateMutability: "view"
3015
- },
3016
- {
3017
- type: "function",
3018
- name: "reserve",
3019
- inputs: [
3020
- {
3021
- name: "_bToken",
3022
- type: "address",
3023
- internalType: "contract BToken"
3024
- }
3025
- ],
3026
- outputs: [
3027
- {
3028
- name: "",
3029
- type: "address",
3030
- internalType: "contract ERC20"
3031
- }
3032
- ],
3033
- stateMutability: "view"
3034
- },
3035
- {
3036
- type: "function",
3037
- name: "reserveHoldings",
3038
- inputs: [
3039
- {
3040
- name: "_reserve",
3041
- type: "address",
3042
- internalType: "contract ERC20"
3043
- }
3044
- ],
3045
- outputs: [
3046
- {
3047
- name: "",
3048
- type: "uint256",
3049
- internalType: "uint256"
3050
- }
3051
- ],
3052
- stateMutability: "view"
3053
- },
3054
- {
3055
- type: "function",
3056
- name: "settledReserves",
3057
- inputs: [
3058
- {
3059
- name: "_bToken",
3060
- type: "address",
3061
- internalType: "contract BToken"
3062
- }
3063
- ],
3064
- outputs: [
3065
- {
3066
- name: "",
3067
- type: "uint256",
3068
- internalType: "uint256"
3069
- }
3070
- ],
3071
- stateMutability: "view"
3072
- },
3073
- {
3074
- type: "function",
3075
- name: "stakedPosition",
3076
- inputs: [
3077
- {
3078
- name: "_bToken",
3079
- type: "address",
3080
- internalType: "contract BToken"
3081
- },
3082
- {
3083
- name: "_user",
3084
- type: "address",
3085
- internalType: "address"
3086
- }
3087
- ],
3088
- outputs: [
3089
- {
3090
- name: "",
3091
- type: "uint256",
3092
- internalType: "uint256"
3093
- },
3094
- {
3095
- name: "",
3096
- type: "uint256",
3097
- internalType: "uint256"
3098
- },
3099
- {
3100
- name: "",
3101
- type: "uint256",
3102
- internalType: "uint256"
3103
- },
3104
- {
3105
- name: "",
3106
- type: "uint256",
3107
- internalType: "uint256"
3108
- }
3109
- ],
3110
- stateMutability: "view"
3111
- },
3112
- {
3113
- type: "function",
3114
- name: "supportsInterface",
3115
- inputs: [
3116
- {
3117
- name: "_interfaceId",
3118
- type: "bytes4",
3119
- internalType: "bytes4"
3120
- }
3121
- ],
3122
- outputs: [
3123
- {
3124
- name: "",
3125
- type: "bool",
3126
- internalType: "bool"
3127
- }
3128
- ],
3129
- stateMutability: "pure"
3130
- },
3131
- {
3132
- type: "function",
3133
- name: "swapFee",
3134
- inputs: [
3135
- {
3136
- name: "_bToken",
3137
- type: "address",
3138
- internalType: "contract BToken"
3139
- }
3140
- ],
3141
- outputs: [
3142
- {
3143
- name: "",
3144
- type: "uint256",
3145
- internalType: "uint256"
3146
- }
3147
- ],
3148
- stateMutability: "view"
3149
- },
3150
- {
3151
- type: "function",
3152
- name: "timeToAdapt",
3153
- inputs: [],
3154
- outputs: [
3155
- {
3156
- name: "",
3157
- type: "uint256",
3158
- internalType: "uint256"
3159
- }
3160
- ],
3161
- stateMutability: "view"
3162
- },
3163
- {
3164
- type: "function",
3165
- name: "timeToDistribute",
3166
- inputs: [],
3167
- outputs: [
3168
- {
3169
- name: "",
3170
- type: "uint256",
3171
- internalType: "uint256"
3172
- }
3173
- ],
3174
- stateMutability: "view"
3175
- },
3176
- {
3177
- type: "function",
3178
- name: "tokensPerSecond",
3179
- inputs: [
3180
- {
3181
- name: "_bToken",
3182
- type: "address",
3183
- internalType: "contract BToken"
3184
- }
3185
- ],
3186
- outputs: [
3187
- {
3188
- name: "",
3189
- type: "uint256",
3190
- internalType: "uint256"
3191
- }
3192
- ],
3193
- stateMutability: "view"
3194
- },
3195
- {
3196
- type: "function",
3197
- name: "totalBTokens",
3198
- inputs: [
3199
- {
3200
- name: "_bToken",
3201
- type: "address",
3202
- internalType: "contract BToken"
3203
- }
3204
- ],
3205
- outputs: [
3206
- {
3207
- name: "",
3208
- type: "uint256",
3209
- internalType: "uint256"
3210
- }
3211
- ],
3212
- stateMutability: "view"
3213
- },
3214
- {
3215
- type: "function",
3216
- name: "totalCollateral",
3217
- inputs: [
3218
- {
3219
- name: "_bToken",
3220
- type: "address",
3221
- internalType: "contract BToken"
3222
- }
3223
- ],
3224
- outputs: [
3225
- {
3226
- name: "",
3227
- type: "uint256",
3228
- internalType: "uint256"
3229
- }
3230
- ],
3231
- stateMutability: "view"
3232
- },
3233
- {
3234
- type: "function",
3235
- name: "totalDebt",
3236
- inputs: [
3237
- {
3238
- name: "_bToken",
3239
- type: "address",
3240
- internalType: "contract BToken"
3241
- }
3242
- ],
3243
- outputs: [
3244
- {
3245
- name: "",
3246
- type: "uint256",
3247
- internalType: "uint256"
3248
- }
3249
- ],
3250
- stateMutability: "view"
3251
- },
3252
- {
3253
- type: "function",
3254
- name: "totalFeeShare",
3255
- inputs: [
3256
- {
3257
- name: "_bToken",
3258
- type: "address",
3259
- internalType: "contract BToken"
3260
- }
3261
- ],
3262
- outputs: [
3263
- {
3264
- name: "creator_",
3265
- type: "uint256",
3266
- internalType: "uint256"
3267
- },
3268
- {
3269
- name: "staking_",
3270
- type: "uint256",
3271
- internalType: "uint256"
3272
- },
3273
- {
3274
- name: "protocol_",
3275
- type: "uint256",
3276
- internalType: "uint256"
3277
- }
3278
- ],
3279
- stateMutability: "view"
3280
- },
3281
- {
3282
- type: "function",
3283
- name: "totalReserves",
3284
- inputs: [
3285
- {
3286
- name: "_bToken",
3287
- type: "address",
3288
- internalType: "contract BToken"
3289
- }
3290
- ],
3291
- outputs: [
3292
- {
3293
- name: "",
3294
- type: "uint256",
3295
- internalType: "uint256"
3296
- }
3297
- ],
3298
- stateMutability: "view"
3299
- },
3300
- {
3301
- type: "function",
3302
- name: "totalStaked",
3303
- inputs: [
3304
- {
3305
- name: "_bToken",
3306
- type: "address",
3307
- internalType: "contract BToken"
3308
- }
3309
- ],
3310
- outputs: [
3311
- {
3312
- name: "",
3313
- type: "uint256",
3314
- internalType: "uint256"
3315
- }
3316
- ],
3317
- stateMutability: "view"
3318
- },
3319
- {
3320
- type: "function",
3321
- name: "totalSupply",
3322
- inputs: [
3323
- {
3324
- name: "_bToken",
3325
- type: "address",
3326
- internalType: "contract BToken"
3327
- }
3328
- ],
3329
- outputs: [
3330
- {
3331
- name: "",
3332
- type: "uint256",
3333
- internalType: "uint256"
3334
- }
3335
- ],
3336
- stateMutability: "view"
3337
- },
3338
- {
3339
- type: "function",
3340
- name: "withdrawable",
3341
- inputs: [
3342
- {
3343
- name: "_bToken",
3344
- type: "address",
3345
- internalType: "contract BToken"
3346
- },
3347
- {
3348
- name: "_user",
3349
- type: "address",
3350
- internalType: "address"
3351
- }
3352
- ],
3353
- outputs: [
3354
- {
3355
- name: "",
3356
- type: "uint256",
3357
- internalType: "uint256"
3358
- }
3359
- ],
3360
- stateMutability: "view"
3361
- },
3362
- {
3363
- type: "error",
3364
- name: "BLens_InvalidLeverageFactor",
3365
- inputs: []
3366
- },
3367
- {
3368
- type: "error",
3369
- name: "Component_NotPermitted",
3370
- inputs: []
3371
- },
3372
- {
3373
- type: "error",
3374
- name: "InvalidConvexityExp",
3375
- inputs: []
3376
- },
3377
- {
3378
- type: "error",
3379
- name: "InvariantDecreased",
3380
- inputs: [
3381
- {
3382
- name: "prevInvariant",
3383
- type: "uint256",
3384
- internalType: "uint256"
3385
- },
3386
- {
3387
- name: "newInvariant",
3388
- type: "uint256",
3389
- internalType: "uint256"
3390
- }
3391
- ]
3392
- }
3393
- ];
1575
+ var bFactory = [{ "type": "function", "name": "LABEL", "inputs": [], "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], "stateMutability": "pure" }, { "type": "function", "name": "ROUTES", "inputs": [], "outputs": [{ "name": "routes_", "type": "bytes4[]", "internalType": "bytes4[]" }], "stateMutability": "pure" }, { "type": "function", "name": "VERSION", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "pure" }, { "type": "function", "name": "createBToken", "inputs": [{ "name": "_name", "type": "string", "internalType": "string" }, { "name": "_symbol", "type": "string", "internalType": "string" }, { "name": "_totalSupply", "type": "uint256", "internalType": "uint256" }, { "name": "_salt", "type": "bytes32", "internalType": "bytes32" }], "outputs": [{ "name": "bToken_", "type": "address", "internalType": "contract BToken" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "createPool", "inputs": [{ "name": "params", "type": "tuple", "internalType": "struct BFactory.CreateParams", "components": [{ "name": "bToken", "type": "address", "internalType": "contract BToken" }, { "name": "initialPoolBTokens", "type": "uint256", "internalType": "uint256" }, { "name": "reserve", "type": "address", "internalType": "address" }, { "name": "initialPoolReserves", "type": "uint256", "internalType": "uint256" }, { "name": "initialActivePrice", "type": "uint256", "internalType": "uint256" }, { "name": "initialBLV", "type": "uint256", "internalType": "uint256" }, { "name": "creator", "type": "address", "internalType": "address" }, { "name": "feeRecipient", "type": "address", "internalType": "address" }, { "name": "creatorFeePct", "type": "uint256", "internalType": "uint256" }, { "name": "swapFeePct", "type": "uint256", "internalType": "uint256" }, { "name": "createHook", "type": "bool", "internalType": "bool" }, { "name": "claimMerkleRoot", "type": "bytes32", "internalType": "bytes32" }, { "name": "initialCollateral", "type": "uint256", "internalType": "uint256" }, { "name": "initialDebt", "type": "uint256", "internalType": "uint256" }] }], "outputs": [], "stateMutability": "payable" }, { "type": "function", "name": "createPoolFromInvariant", "inputs": [{ "name": "params", "type": "tuple", "internalType": "struct BFactory.CreateFromInvariantParams", "components": [{ "name": "bToken", "type": "address", "internalType": "contract BToken" }, { "name": "initialPoolBTokens", "type": "uint256", "internalType": "uint256" }, { "name": "reserve", "type": "address", "internalType": "address" }, { "name": "initialInvariant", "type": "uint256", "internalType": "uint256" }, { "name": "creator", "type": "address", "internalType": "address" }, { "name": "feeRecipient", "type": "address", "internalType": "address" }, { "name": "creatorFeePct", "type": "uint256", "internalType": "uint256" }, { "name": "swapFeePct", "type": "uint256", "internalType": "uint256" }, { "name": "createHook", "type": "bool", "internalType": "bool" }] }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "precomputeBTokenAddress", "inputs": [{ "name": "_name", "type": "string", "internalType": "string" }, { "name": "_symbol", "type": "string", "internalType": "string" }, { "name": "_totalSupply", "type": "uint256", "internalType": "uint256" }, { "name": "_salt", "type": "bytes32", "internalType": "bytes32" }, { "name": "_deployer", "type": "address", "internalType": "address" }], "outputs": [{ "name": "computedAddress_", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "supportsInterface", "inputs": [{ "name": "_interfaceId", "type": "bytes4", "internalType": "bytes4" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "pure" }, { "type": "event", "name": "BTokenCreated", "inputs": [{ "name": "bTokenAddress", "type": "address", "indexed": false, "internalType": "contract BToken" }, { "name": "name", "type": "string", "indexed": false, "internalType": "string" }, { "name": "symbol", "type": "string", "indexed": false, "internalType": "string" }, { "name": "decimals", "type": "uint8", "indexed": false, "internalType": "uint8" }, { "name": "totalSupply", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "creator", "type": "address", "indexed": false, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "Initialized", "inputs": [{ "name": "bToken", "type": "address", "indexed": false, "internalType": "contract BToken" }, { "name": "activePrice", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "blvPrice", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "swapFeePct", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "PoolCreated", "inputs": [{ "name": "bTokenAddress", "type": "address", "indexed": false, "internalType": "contract BToken" }, { "name": "reserveAddress", "type": "address", "indexed": false, "internalType": "address" }, { "name": "creator", "type": "address", "indexed": false, "internalType": "address" }, { "name": "feeRecipient", "type": "address", "indexed": false, "internalType": "address" }, { "name": "creatorFeePct", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "initialActivePrice", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "initialBlvPrice", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "totalReserves", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "totalBTokens", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "totalCollateral", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "totalDebt", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "poolId", "type": "bytes32", "indexed": false, "internalType": "bytes32" }], "anonymous": false }, { "type": "error", "name": "AlreadyInitialized", "inputs": [] }, { "type": "error", "name": "Component_NotPermitted", "inputs": [] }, { "type": "error", "name": "GuardLib_Paused", "inputs": [] }, { "type": "error", "name": "GuardLib_Reentrant", "inputs": [] }, { "type": "error", "name": "GuardLib_ReserveAccountingMismatch", "inputs": [] }, { "type": "error", "name": "InsolventInitialCreditPosition", "inputs": [] }, { "type": "error", "name": "InvalidActivePrice", "inputs": [] }, { "type": "error", "name": "InvalidBLVPrice", "inputs": [] }, { "type": "error", "name": "InvalidConvexityExp", "inputs": [] }, { "type": "error", "name": "InvalidConvexityExp", "inputs": [] }, { "type": "error", "name": "InvalidCreator", "inputs": [] }, { "type": "error", "name": "InvalidCreatorFee", "inputs": [] }, { "type": "error", "name": "InvalidDecimals", "inputs": [] }, { "type": "error", "name": "InvalidFeeRecipient", "inputs": [] }, { "type": "error", "name": "InvalidInitialCollateralOrDebt", "inputs": [] }, { "type": "error", "name": "InvalidName", "inputs": [] }, { "type": "error", "name": "InvalidParameters", "inputs": [] }, { "type": "error", "name": "InvalidPoolSupply", "inputs": [] }, { "type": "error", "name": "InvalidSalt", "inputs": [] }, { "type": "error", "name": "InvalidSwapFeePct", "inputs": [] }, { "type": "error", "name": "InvalidSymbol", "inputs": [] }, { "type": "error", "name": "InvariantDecreased", "inputs": [{ "name": "prevInvariant", "type": "uint256", "internalType": "uint256" }, { "name": "newInvariant", "type": "uint256", "internalType": "uint256" }] }, { "type": "error", "name": "InvariantTooLarge", "inputs": [] }, { "type": "error", "name": "InvariantTooSmall", "inputs": [] }, { "type": "error", "name": "NativeLib_AmountMismatch", "inputs": [] }, { "type": "error", "name": "NativeLib_NotWrapped", "inputs": [] }, { "type": "error", "name": "NotApprovedReserve", "inputs": [] }, { "type": "error", "name": "NotDeployer", "inputs": [] }, { "type": "error", "name": "PoolAlreadyInitialized", "inputs": [] }, { "type": "error", "name": "TotalSupplyTooHigh", "inputs": [] }, { "type": "error", "name": "TotalSupplyTooLow", "inputs": [] }, { "type": "error", "name": "UnauthorizedCreditPositionCreation", "inputs": [] }];
1576
+
1577
+ // ../contracts/abis/mercury/bLens.ts
1578
+ var bLens = [{ "type": "function", "name": "LABEL", "inputs": [], "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], "stateMutability": "view" }, { "type": "function", "name": "ROUTES", "inputs": [], "outputs": [{ "name": "routes_", "type": "bytes4[]", "internalType": "bytes4[]" }], "stateMutability": "pure" }, { "type": "function", "name": "VERSION", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "accumulator", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "activePrice", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "blvPrice", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "claimableYield", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "convexityExp", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "creator", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "creatorClaimable", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "creatorFeePct", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "creditAccount", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }, { "name": "_user", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }, { "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "defaultLiquidityFeePct", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "defaultProtocolFeePct", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "deployerProfile", "inputs": [{ "name": "_user", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "tuple", "internalType": "struct State.DeployerProfile", "components": [{ "name": "active", "type": "bool", "internalType": "bool" }, { "name": "approvedCreditDeployer", "type": "bool", "internalType": "bool" }, { "name": "pauser", "type": "bool", "internalType": "bool" }, { "name": "protocolFeePct", "type": "uint64", "internalType": "uint64" }, { "name": "liquidityFeePct", "type": "uint64", "internalType": "uint64" }, { "name": "approvedTokenRegistrar", "type": "bool", "internalType": "bool" }] }], "stateMutability": "view" }, { "type": "function", "name": "getBookPrice", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "getCirculatingSupply", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "getComponents", "inputs": [], "outputs": [{ "name": "components_", "type": "address[]", "internalType": "contract Component[]" }], "stateMutability": "view" }, { "type": "function", "name": "getMaker", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "tuple", "internalType": "struct State.Maker", "components": [{ "name": "initialized", "type": "bool", "internalType": "bool" }, { "name": "blvPrice", "type": "uint128", "internalType": "uint128" }, { "name": "swapFee", "type": "uint128", "internalType": "uint128" }, { "name": "maxCirc", "type": "uint128", "internalType": "uint128" }, { "name": "maxReserves", "type": "uint128", "internalType": "uint128" }, { "name": "convexityExp", "type": "uint128", "internalType": "uint128" }, { "name": "lastInvariant", "type": "uint256", "internalType": "uint256" }] }], "stateMutability": "view" }, { "type": "function", "name": "getQuoteState", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "state_", "type": "tuple", "internalType": "struct BLens.QuoteState", "components": [{ "name": "snapshotCurveParams", "type": "tuple", "internalType": "struct CurveParams", "components": [{ "name": "BLV", "type": "uint256", "internalType": "uint256" }, { "name": "circ", "type": "uint256", "internalType": "uint256" }, { "name": "supply", "type": "uint256", "internalType": "uint256" }, { "name": "swapFee", "type": "uint256", "internalType": "uint256" }, { "name": "reserves", "type": "uint256", "internalType": "uint256" }, { "name": "totalSupply", "type": "uint256", "internalType": "uint256" }, { "name": "convexityExp", "type": "uint256", "internalType": "uint256" }, { "name": "lastInvariant", "type": "uint256", "internalType": "uint256" }] }, { "name": "quoteBlockBuyDeltaCirc", "type": "uint256", "internalType": "uint256" }, { "name": "quoteBlockSellDeltaCirc", "type": "uint256", "internalType": "uint256" }, { "name": "totalSupply", "type": "uint256", "internalType": "uint256" }, { "name": "totalBTokens", "type": "uint256", "internalType": "uint256" }, { "name": "totalReserves", "type": "uint256", "internalType": "uint256" }, { "name": "reserveDecimals", "type": "uint8", "internalType": "uint8" }, { "name": "liquidityFeePct", "type": "uint256", "internalType": "uint256" }, { "name": "pendingSurplus", "type": "uint256", "internalType": "uint256" }, { "name": "shouldSettlePendingSurplus", "type": "bool", "internalType": "bool" }, { "name": "maxSellDelta", "type": "uint256", "internalType": "uint256" }, { "name": "snapshotActivePrice", "type": "uint256", "internalType": "uint256" }] }], "stateMutability": "view" }, { "type": "function", "name": "hasHook", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isApprovedCreditDeployer", "inputs": [{ "name": "_user", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isLocked", "inputs": [], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isPoolPaused", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isProtocolPaused", "inputs": [], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "lastInvariant", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "lastUpdatedTimestamp", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "liquidityFeePct", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "originationFee", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "pendingSurplus", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "pendingYield", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "poolFeeRecipient", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "poolFeeShare", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "creator_", "type": "uint256", "internalType": "uint256" }, { "name": "staking_", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "poolIdToBToken", "inputs": [{ "name": "_poolId", "type": "bytes32", "internalType": "PoolId" }], "outputs": [{ "name": "", "type": "address", "internalType": "contract BToken" }], "stateMutability": "view" }, { "type": "function", "name": "poolKey", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "tuple", "internalType": "struct PoolKey", "components": [{ "name": "currency0", "type": "address", "internalType": "Currency" }, { "name": "currency1", "type": "address", "internalType": "Currency" }, { "name": "fee", "type": "uint24", "internalType": "uint24" }, { "name": "tickSpacing", "type": "int24", "internalType": "int24" }, { "name": "hooks", "type": "address", "internalType": "contract IHooks" }] }], "stateMutability": "view" }, { "type": "function", "name": "previewInvariantForPrice", "inputs": [{ "name": "_launchPrice", "type": "uint256", "internalType": "uint256" }, { "name": "_totalSupply", "type": "uint256", "internalType": "uint256" }, { "name": "_bTokenDecimals", "type": "uint8", "internalType": "uint8" }], "outputs": [{ "name": "initialInvariant_", "type": "uint256", "internalType": "uint256" }], "stateMutability": "pure" }, { "type": "function", "name": "previewInvariantInitPrice", "inputs": [{ "name": "_initialInvariant", "type": "uint256", "internalType": "uint256" }, { "name": "_totalSupply", "type": "uint256", "internalType": "uint256" }, { "name": "_bTokenDecimals", "type": "uint8", "internalType": "uint8" }], "outputs": [{ "name": "launchPrice_", "type": "uint256", "internalType": "uint256" }], "stateMutability": "pure" }, { "type": "function", "name": "protocolClaimable", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "protocolFeePct", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "protocolFeeRecipient", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "quoteLeverage", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }, { "name": "_collateralIn", "type": "uint256", "internalType": "uint256" }, { "name": "_leverageFactor", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "targetCollateral_", "type": "uint256", "internalType": "uint256" }, { "name": "maxSwapReservesIn_", "type": "uint256", "internalType": "uint256" }, { "name": "expectedDebt_", "type": "uint256", "internalType": "uint256" }, { "name": "slippage_", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "reserve", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "address", "internalType": "contract ERC20" }], "stateMutability": "view" }, { "type": "function", "name": "reserveHoldings", "inputs": [{ "name": "_reserve", "type": "address", "internalType": "contract ERC20" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "settledReserves", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "stakedPosition", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }, { "name": "_user", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }, { "name": "", "type": "uint256", "internalType": "uint256" }, { "name": "", "type": "uint256", "internalType": "uint256" }, { "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "supportsInterface", "inputs": [{ "name": "_interfaceId", "type": "bytes4", "internalType": "bytes4" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "pure" }, { "type": "function", "name": "swapFee", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "timeToAdapt", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "timeToDistribute", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "tokensPerSecond", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "totalBTokens", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "totalCollateral", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "totalDebt", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "totalFeeShare", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "creator_", "type": "uint256", "internalType": "uint256" }, { "name": "staking_", "type": "uint256", "internalType": "uint256" }, { "name": "protocol_", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "totalReserves", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "totalStaked", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "totalSupply", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "withdrawable", "inputs": [{ "name": "_bToken", "type": "address", "internalType": "contract BToken" }, { "name": "_user", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "error", "name": "BLens_InvalidLeverageFactor", "inputs": [] }, { "type": "error", "name": "BLens_UnrepresentableLaunchPrice", "inputs": [] }, { "type": "error", "name": "Component_NotPermitted", "inputs": [] }, { "type": "error", "name": "InvalidConvexityExp", "inputs": [] }, { "type": "error", "name": "InvariantDecreased", "inputs": [{ "name": "prevInvariant", "type": "uint256", "internalType": "uint256" }, { "name": "newInvariant", "type": "uint256", "internalType": "uint256" }] }];
3394
1579
 
3395
1580
  // ../contracts/abis/mercury/bStaking.ts
3396
1581
  var bStaking = [
@@ -4651,6 +2836,223 @@ var ContractFactory = class {
4651
2836
 
4652
2837
  // ../contracts/index.ts
4653
2838
  var supportedChainIds = Object.keys(addressBook_default).map(Number);
2839
+ function encodeBaseLaunchCalls(input) {
2840
+ return [
2841
+ {
2842
+ to: input.relay,
2843
+ data: viem.encodeFunctionData({
2844
+ abi: mercuryAbis.bFactory,
2845
+ functionName: "createBToken",
2846
+ args: [input.name, input.symbol, input.totalSupply, input.salt]
2847
+ })
2848
+ },
2849
+ {
2850
+ to: input.bToken,
2851
+ data: viem.encodeFunctionData({
2852
+ abi: externalAbis.erc20,
2853
+ functionName: "approve",
2854
+ args: [input.relay, input.bTokenApprovalAmount]
2855
+ })
2856
+ }
2857
+ ];
2858
+ }
2859
+ function encodeZrpLaunchCalls(input) {
2860
+ return [
2861
+ ...encodeBaseLaunchCalls({
2862
+ ...input,
2863
+ bTokenApprovalAmount: input.params.initialPoolBTokens
2864
+ }),
2865
+ {
2866
+ to: input.relay,
2867
+ data: viem.encodeFunctionData({
2868
+ abi: mercuryAbis.bFactory,
2869
+ functionName: "createPoolFromInvariant",
2870
+ args: [input.params]
2871
+ })
2872
+ }
2873
+ ];
2874
+ }
2875
+ function encodeStandardLaunchCalls(input) {
2876
+ return [
2877
+ ...encodeBaseLaunchCalls({
2878
+ ...input,
2879
+ bTokenApprovalAmount: input.params.initialPoolBTokens
2880
+ }),
2881
+ {
2882
+ to: input.reserve,
2883
+ data: viem.encodeFunctionData({
2884
+ abi: externalAbis.erc20,
2885
+ functionName: "approve",
2886
+ args: [input.relay, input.params.initialPoolReserves]
2887
+ })
2888
+ },
2889
+ {
2890
+ to: input.relay,
2891
+ data: viem.encodeFunctionData({
2892
+ abi: mercuryAbis.bFactory,
2893
+ functionName: "createPool",
2894
+ args: [input.params]
2895
+ })
2896
+ }
2897
+ ];
2898
+ }
2899
+
2900
+ // src/launch/constants.ts
2901
+ var WAD = 10n ** 18n;
2902
+ var ZERO_BYTES32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
2903
+ var DEFAULT_SWAP_FEE_PCT = WAD / 100n;
2904
+ var MIN_SWAP_FEE_PCT = 1500000000000000n;
2905
+ var MAX_SWAP_FEE_PCT = WAD / 2n;
2906
+ var MIN_TOTAL_SUPPLY = 10000n * WAD;
2907
+ var MAX_TOTAL_SUPPLY = 20282409603651670423947251286015n;
2908
+ var MIN_INVARIANT = 3n * WAD;
2909
+
2910
+ // src/launch/validate.ts
2911
+ function normalizeSalt(salt) {
2912
+ if (!salt) return ZERO_BYTES32;
2913
+ if (!/^0x[a-fA-F0-9]{64}$/.test(salt)) {
2914
+ throw new Error("salt must be a bytes32 hex string");
2915
+ }
2916
+ return salt;
2917
+ }
2918
+ function validateAddress(address, label) {
2919
+ if (!viem.isAddress(address)) throw new Error(`${label} must be a valid address`);
2920
+ }
2921
+ function validateTokenText(name, symbol) {
2922
+ if (name.trim().length === 0) throw new Error("name is required");
2923
+ if (symbol.trim().length === 0) throw new Error("symbol is required");
2924
+ if (new TextEncoder().encode(name).length > 30) {
2925
+ throw new Error("name exceeds 30 bytes");
2926
+ }
2927
+ if (new TextEncoder().encode(symbol).length > 30) {
2928
+ throw new Error("symbol exceeds 30 bytes");
2929
+ }
2930
+ }
2931
+ function validateDecimals(decimals, label) {
2932
+ if (!Number.isInteger(decimals) || decimals < 0 || decimals > 18) {
2933
+ throw new Error(`${label} must be an integer between 0 and 18`);
2934
+ }
2935
+ }
2936
+ function resolveLaunchDefaults(input) {
2937
+ const mode = input.mode ?? "zrp";
2938
+ if (mode !== "zrp" && mode !== "standard") {
2939
+ throw new Error("mode must be zrp or standard");
2940
+ }
2941
+ validateTokenText(input.name, input.symbol);
2942
+ validateAddress(input.relay, "relay");
2943
+ validateAddress(input.bToken, "bToken");
2944
+ validateAddress(input.reserve, "reserve");
2945
+ validateAddress(input.creator, "creator");
2946
+ validateDecimals(input.reserveDecimals ?? 18, "reserveDecimals");
2947
+ const feeRecipient = input.feeRecipient ?? input.creator;
2948
+ validateAddress(feeRecipient, "feeRecipient");
2949
+ if (input.totalSupply < MIN_TOTAL_SUPPLY) {
2950
+ throw new Error("totalSupply is below the protocol minimum");
2951
+ }
2952
+ if (input.totalSupply > MAX_TOTAL_SUPPLY) {
2953
+ throw new Error("totalSupply exceeds the protocol maximum");
2954
+ }
2955
+ if (input.initialPoolBTokens <= 0n) {
2956
+ throw new Error("initialPoolBTokens must be greater than zero");
2957
+ }
2958
+ if (input.initialPoolBTokens > input.totalSupply) {
2959
+ throw new Error("initialPoolBTokens cannot exceed totalSupply");
2960
+ }
2961
+ const swapFeePct = input.swapFeePct ?? DEFAULT_SWAP_FEE_PCT;
2962
+ if (swapFeePct < MIN_SWAP_FEE_PCT || swapFeePct > MAX_SWAP_FEE_PCT) {
2963
+ throw new Error("swapFeePct is outside protocol bounds");
2964
+ }
2965
+ if (input.creatorFeePct < 0n || input.creatorFeePct > WAD) {
2966
+ throw new Error("creatorFeePct must be between 0 and 1e18");
2967
+ }
2968
+ if (mode === "zrp") {
2969
+ if (input.initialPoolBTokens !== input.totalSupply) {
2970
+ throw new Error("zrp launches require all BTokens in the pool");
2971
+ }
2972
+ if ((input.initialPoolReserves ?? 0n) !== 0n) {
2973
+ throw new Error("zrp launches require zero initial reserves");
2974
+ }
2975
+ } else {
2976
+ if ((input.initialPoolReserves ?? 0n) <= 0n) {
2977
+ throw new Error("standard launches require initialPoolReserves");
2978
+ }
2979
+ if (input.initialPoolBTokens >= input.totalSupply) {
2980
+ throw new Error("standard launches require circulating supply");
2981
+ }
2982
+ }
2983
+ return { mode, swapFeePct, feeRecipient };
2984
+ }
2985
+
2986
+ // src/launch/calls.ts
2987
+ function buildLaunchCalls(input) {
2988
+ const salt = normalizeSalt(input.salt);
2989
+ const { mode, swapFeePct, feeRecipient } = resolveLaunchDefaults(input);
2990
+ if (mode === "zrp") {
2991
+ const params2 = {
2992
+ bToken: input.bToken,
2993
+ initialPoolBTokens: input.initialPoolBTokens,
2994
+ reserve: input.reserve,
2995
+ initialInvariant: MIN_INVARIANT,
2996
+ creator: input.creator,
2997
+ feeRecipient,
2998
+ creatorFeePct: input.creatorFeePct,
2999
+ swapFeePct,
3000
+ createHook: true
3001
+ };
3002
+ return encodeZrpLaunchCalls({
3003
+ relay: input.relay,
3004
+ bToken: input.bToken,
3005
+ name: input.name,
3006
+ symbol: input.symbol,
3007
+ totalSupply: input.totalSupply,
3008
+ salt,
3009
+ params: params2
3010
+ });
3011
+ }
3012
+ const initialPoolReserves = input.initialPoolReserves ?? 0n;
3013
+ const circulatingSupply = input.totalSupply - input.initialPoolBTokens;
3014
+ const reservesWad = toWad(initialPoolReserves, input.reserveDecimals ?? 18);
3015
+ const circulatingWad = toWad(circulatingSupply, 18);
3016
+ const bookPrice = divWad(reservesWad, circulatingWad);
3017
+ const initialActivePrice = bookPrice + 1n;
3018
+ const initialBLV = 0n;
3019
+ const params = {
3020
+ bToken: input.bToken,
3021
+ initialPoolBTokens: input.initialPoolBTokens,
3022
+ reserve: input.reserve,
3023
+ initialPoolReserves,
3024
+ initialActivePrice,
3025
+ initialBLV,
3026
+ creator: input.creator,
3027
+ feeRecipient,
3028
+ creatorFeePct: input.creatorFeePct,
3029
+ swapFeePct,
3030
+ createHook: true,
3031
+ claimMerkleRoot: ZERO_BYTES32,
3032
+ initialCollateral: 0n,
3033
+ initialDebt: 0n
3034
+ };
3035
+ return encodeStandardLaunchCalls({
3036
+ relay: input.relay,
3037
+ bToken: input.bToken,
3038
+ reserve: input.reserve,
3039
+ name: input.name,
3040
+ symbol: input.symbol,
3041
+ totalSupply: input.totalSupply,
3042
+ salt,
3043
+ params
3044
+ });
3045
+ }
3046
+ function toWad(amount, decimals) {
3047
+ return amount * 10n ** BigInt(18 - decimals);
3048
+ }
3049
+ function divWad(numerator, denominator) {
3050
+ return numerator * WAD / denominator;
3051
+ }
3052
+ function validateLaunchCallInput(input) {
3053
+ normalizeSalt(input.salt);
3054
+ resolveLaunchDefaults(input);
3055
+ }
4654
3056
  var SDKError = class extends Error {
4655
3057
  kind = "unknown";
4656
3058
  component;
@@ -4836,11 +3238,15 @@ function valueForNative(useNative, amount) {
4836
3238
  }
4837
3239
 
4838
3240
  // src/baseline-sdk.ts
3241
+ var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
4839
3242
  var BaselineSDK = class _BaselineSDK {
4840
3243
  publicClient;
4841
3244
  walletClient;
4842
3245
  config;
4843
3246
  readFactory;
3247
+ calls = {
3248
+ launch: (input, opts) => this.launchCalls(input, opts)
3249
+ };
4844
3250
  getAccount(opts) {
4845
3251
  const account = opts?.account ?? this.walletClient?.account?.address;
4846
3252
  if (!account) {
@@ -4918,6 +3324,59 @@ var BaselineSDK = class _BaselineSDK {
4918
3324
  });
4919
3325
  return { hash };
4920
3326
  }
3327
+ async createPoolFromInvariant(params, opts) {
3328
+ const account = this.getAccount(opts);
3329
+ const hash = await simulateAndWrite({
3330
+ publicClient: this.publicClient,
3331
+ walletClient: this.walletClient,
3332
+ address: this.proxy,
3333
+ abi: mercuryAbis.bFactory,
3334
+ functionName: "createPoolFromInvariant",
3335
+ args: [params],
3336
+ account,
3337
+ confirmations: opts?.confirmations,
3338
+ onSimulateError: opts?.onSimulateError
3339
+ });
3340
+ return { hash };
3341
+ }
3342
+ async precomputeBTokenAddress(input) {
3343
+ const bToken = await this.publicClient.readContract({
3344
+ address: this.proxy,
3345
+ abi: mercuryAbis.bFactory,
3346
+ functionName: "precomputeBTokenAddress",
3347
+ args: [
3348
+ input.name,
3349
+ input.symbol,
3350
+ input.totalSupply,
3351
+ input.salt,
3352
+ input.deployer
3353
+ ]
3354
+ });
3355
+ return bToken;
3356
+ }
3357
+ async launchCalls(input, opts) {
3358
+ const account = this.getAccount(opts);
3359
+ const salt = input.salt ?? ZERO_BYTES32;
3360
+ validateLaunchCallInput({
3361
+ ...input,
3362
+ relay: this.proxy,
3363
+ bToken: "0x0000000000000000000000000000000000000000",
3364
+ salt
3365
+ });
3366
+ const bToken = await this.precomputeBTokenAddress({
3367
+ name: input.name,
3368
+ symbol: input.symbol,
3369
+ totalSupply: input.totalSupply,
3370
+ salt,
3371
+ deployer: account
3372
+ });
3373
+ return buildLaunchCalls({
3374
+ ...input,
3375
+ relay: this.proxy,
3376
+ bToken,
3377
+ salt
3378
+ });
3379
+ }
4921
3380
  // ---------- Swap quotes ----------
4922
3381
  async quoteBuyExactIn(bToken, reservesIn) {
4923
3382
  const [tokensOut, fee, slippage] = await this.publicClient.readContract({
@@ -5276,6 +3735,118 @@ var BaselineSDK = class _BaselineSDK {
5276
3735
  });
5277
3736
  }
5278
3737
  // ---------- Lens queries ----------
3738
+ async getBTokenInfo(bToken) {
3739
+ const bytecode = await this.publicClient.getBytecode({ address: bToken });
3740
+ const hasBytecode = !!bytecode && bytecode !== "0x";
3741
+ const results = await this.publicClient.multicall({
3742
+ allowFailure: true,
3743
+ contracts: [
3744
+ { address: bToken, abi: externalAbis.erc20, functionName: "name" },
3745
+ { address: bToken, abi: externalAbis.erc20, functionName: "symbol" },
3746
+ { address: bToken, abi: externalAbis.erc20, functionName: "decimals" },
3747
+ {
3748
+ address: bToken,
3749
+ abi: externalAbis.erc20,
3750
+ functionName: "totalSupply"
3751
+ },
3752
+ {
3753
+ address: this.proxy,
3754
+ abi: mercuryAbis.bLens,
3755
+ functionName: "reserve",
3756
+ args: [bToken]
3757
+ },
3758
+ {
3759
+ address: this.proxy,
3760
+ abi: mercuryAbis.bLens,
3761
+ functionName: "creator",
3762
+ args: [bToken]
3763
+ },
3764
+ {
3765
+ address: this.proxy,
3766
+ abi: mercuryAbis.bLens,
3767
+ functionName: "poolFeeRecipient",
3768
+ args: [bToken]
3769
+ },
3770
+ {
3771
+ address: this.proxy,
3772
+ abi: mercuryAbis.bLens,
3773
+ functionName: "creatorFeePct",
3774
+ args: [bToken]
3775
+ },
3776
+ {
3777
+ address: this.proxy,
3778
+ abi: mercuryAbis.bLens,
3779
+ functionName: "swapFee",
3780
+ args: [bToken]
3781
+ },
3782
+ {
3783
+ address: this.proxy,
3784
+ abi: mercuryAbis.bLens,
3785
+ functionName: "totalBTokens",
3786
+ args: [bToken]
3787
+ },
3788
+ {
3789
+ address: this.proxy,
3790
+ abi: mercuryAbis.bLens,
3791
+ functionName: "totalReserves",
3792
+ args: [bToken]
3793
+ },
3794
+ {
3795
+ address: this.proxy,
3796
+ abi: mercuryAbis.bLens,
3797
+ functionName: "getMaker",
3798
+ args: [bToken]
3799
+ },
3800
+ {
3801
+ address: this.proxy,
3802
+ abi: mercuryAbis.bLens,
3803
+ functionName: "getQuoteState",
3804
+ args: [bToken]
3805
+ }
3806
+ ]
3807
+ });
3808
+ const result = (index) => {
3809
+ const item = results[index];
3810
+ return item?.status === "success" ? item.result : void 0;
3811
+ };
3812
+ const name = result(0);
3813
+ const symbol = result(1);
3814
+ const decimals = result(2);
3815
+ const totalSupply = result(3);
3816
+ const reserve = result(4);
3817
+ const creator = result(5);
3818
+ const poolFeeRecipient = result(6);
3819
+ const creatorFeePct = result(7);
3820
+ const swapFee = result(8);
3821
+ const totalBTokens = result(9);
3822
+ const totalReserves = result(10);
3823
+ const maker = normalizeMaker(result(11));
3824
+ const reserveDecimals = normalizeQuoteState(
3825
+ result(12)
3826
+ )?.reserveDecimals;
3827
+ const hasBaselineState = reserve !== void 0 && reserve.toLowerCase() !== ZERO_ADDRESS && maker !== void 0;
3828
+ const status = !hasBytecode ? "not_deployed" : !hasBaselineState ? "contract_only" : maker.initialized ? "initialized" : "baseline_uninitialized";
3829
+ return {
3830
+ chainId: this.chainId,
3831
+ relay: this.proxy,
3832
+ bToken,
3833
+ status,
3834
+ bytecode: hasBytecode,
3835
+ name,
3836
+ symbol,
3837
+ decimals,
3838
+ totalSupply,
3839
+ reserve,
3840
+ reserveDecimals,
3841
+ creator,
3842
+ poolFeeRecipient,
3843
+ creatorFeePct,
3844
+ swapFee,
3845
+ totalBTokens,
3846
+ totalReserves,
3847
+ maker
3848
+ };
3849
+ }
5279
3850
  async getReserve(bToken) {
5280
3851
  const reserve = await this.publicClient.readContract({
5281
3852
  address: this.proxy,
@@ -5309,8 +3880,44 @@ var BaselineSDK = class _BaselineSDK {
5309
3880
  };
5310
3881
  }
5311
3882
  };
3883
+ function normalizeMaker(value) {
3884
+ if (!value) return void 0;
3885
+ const get = (key, index) => Array.isArray(value) ? value[index] : value[key];
3886
+ const initialized = get("initialized", 0);
3887
+ const blvPrice = get("blvPrice", 1);
3888
+ const swapFee = get("swapFee", 2);
3889
+ const maxCirc = get("maxCirc", 3);
3890
+ const maxReserves = get("maxReserves", 4);
3891
+ const convexityExp = get("convexityExp", 5);
3892
+ const lastInvariant = get("lastInvariant", 6);
3893
+ if (typeof initialized !== "boolean" || typeof blvPrice !== "bigint" || typeof swapFee !== "bigint" || typeof maxCirc !== "bigint" || typeof maxReserves !== "bigint" || typeof convexityExp !== "bigint" || typeof lastInvariant !== "bigint") {
3894
+ return void 0;
3895
+ }
3896
+ return {
3897
+ initialized,
3898
+ blvPrice,
3899
+ swapFee,
3900
+ maxCirc,
3901
+ maxReserves,
3902
+ convexityExp,
3903
+ lastInvariant
3904
+ };
3905
+ }
3906
+ function normalizeQuoteState(value) {
3907
+ if (!value) return void 0;
3908
+ const reserveDecimals = Array.isArray(value) ? value[6] : value.reserveDecimals;
3909
+ return typeof reserveDecimals === "number" ? { reserveDecimals } : void 0;
3910
+ }
3911
+ function serializeCalls(calls) {
3912
+ return calls.map((call) => ({
3913
+ to: call.to,
3914
+ data: call.data,
3915
+ value: viem.toHex(call.value ?? 0n)
3916
+ }));
3917
+ }
5312
3918
 
5313
3919
  exports.BaselineSDK = BaselineSDK;
5314
3920
  exports.SDKError = SDKError;
5315
3921
  exports.abis = mercuryAbis;
3922
+ exports.serializeCalls = serializeCalls;
5316
3923
  exports.supportedChainIds = supportedChainIds;