@steerprotocol/sdk 3.4.3 → 3.6.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.mjs CHANGED
@@ -16376,6 +16376,47 @@ const FIND_ALL_VAULTS_BY_PROTOCOL = (batchSize = 1e3, timestamp, beaconNames) =>
16376
16376
  }
16377
16377
  }`;
16378
16378
  };
16379
+ const FIND_VAULT_BY_ADDRESS = (vaultAddress) => `query {
16380
+ vaults(first: 1, where: { id: "${vaultAddress}" }) {
16381
+ id
16382
+ name
16383
+ token0
16384
+ token1
16385
+ pool
16386
+ weeklyFeeAPR
16387
+ token0Symbol
16388
+ token0Decimals
16389
+ token1Symbol
16390
+ token1Decimals
16391
+ totalValueLockedToken0
16392
+ totalValueLockedToken1
16393
+ token0Balance
16394
+ token1Balance
16395
+ totalLPTokensIssued
16396
+ createdAt
16397
+ feeTier
16398
+ strategyToken {
16399
+ id
16400
+ name
16401
+ creator {
16402
+ id
16403
+ }
16404
+ admin
16405
+ executionBundle
16406
+ }
16407
+ positions(first: 1, orderBy: timestamp, orderDirection: desc) {
16408
+ id
16409
+ upperTick
16410
+ lowerTick
16411
+ relativeWeight
16412
+ }
16413
+ fees0
16414
+ fees1
16415
+ beaconName
16416
+ payloadIpfs
16417
+ deployer
16418
+ }
16419
+ }`;
16379
16420
  /**
16380
16421
  * Utility class for fetching vault data from Steer subgraphs
16381
16422
  */
@@ -16506,6 +16547,29 @@ var SubgraphVaultClient = class {
16506
16547
  };
16507
16548
  }
16508
16549
  /**
16550
+ * Fetches one vault by its address without enumerating the chain's vault set.
16551
+ */
16552
+ async getVaultByAddress(options) {
16553
+ const { subgraphUrl, chainId, vaultAddress } = options;
16554
+ if (!vaultAddress) throw new Error("vaultAddress is required for an address lookup");
16555
+ const vault = (await (await fetch(subgraphUrl, {
16556
+ method: "POST",
16557
+ headers: {
16558
+ "Content-Type": "application/json",
16559
+ ...subgraphUrl.includes("sentio") && this.SENTIO_API_KEY ? { "api-key": this.SENTIO_API_KEY } : {}
16560
+ },
16561
+ body: JSON.stringify({
16562
+ query: FIND_VAULT_BY_ADDRESS(vaultAddress.toLowerCase()),
16563
+ variables: {}
16564
+ })
16565
+ })).json())?.data?.vaults?.[0];
16566
+ if (!vault) return null;
16567
+ return this.transformSubgraphVaultToVaultNode({
16568
+ ...vault,
16569
+ lpPriceData: this.createMockLpPriceData(vault)
16570
+ }, chainId, /* @__PURE__ */ new Map());
16571
+ }
16572
+ /**
16509
16573
  * Fetch vault data from subgraph
16510
16574
  */
16511
16575
  async getAllVaultsFromSubgraph(options) {
@@ -20489,6 +20553,45 @@ var VaultClient = class extends SubgraphClient {
20489
20553
  }
20490
20554
  return apiFilter;
20491
20555
  }
20556
+ transformApiVaultNode(vault) {
20557
+ return {
20558
+ id: vault.id,
20559
+ chainId: vault.chainId,
20560
+ vaultAddress: vault.vaultAddress,
20561
+ protocol: vault.protocol,
20562
+ beaconName: vault.beaconName,
20563
+ protocolBaseType: vault.protocolBaseType,
20564
+ name: vault.name || "",
20565
+ feeApr: vault.feeApr || void 0,
20566
+ stakingApr: vault.stakingApr || void 0,
20567
+ merklApr: vault.merklApr || void 0,
20568
+ pool: {
20569
+ id: vault.pool?.id || "",
20570
+ poolAddress: vault.pool?.poolAddress || "",
20571
+ feeTier: vault.pool?.feeTier || "",
20572
+ tick: void 0,
20573
+ liquidity: void 0,
20574
+ volumeUSD: void 0,
20575
+ totalValueLockedUSD: void 0
20576
+ },
20577
+ token0: {
20578
+ id: vault.token0?.id || "",
20579
+ symbol: vault.token0?.symbol || "",
20580
+ name: vault.token0?.name || "",
20581
+ decimals: vault.token0?.decimals || 0,
20582
+ address: vault.token0?.address || "",
20583
+ chainId: vault.token0?.chainId || 0
20584
+ },
20585
+ token1: {
20586
+ id: vault.token1?.id || "",
20587
+ symbol: vault.token1?.symbol || "",
20588
+ name: vault.token1?.name || "",
20589
+ decimals: vault.token1?.decimals || 0,
20590
+ address: vault.token1?.address || "",
20591
+ chainId: vault.token1?.chainId || 0
20592
+ }
20593
+ };
20594
+ }
20492
20595
  vaultMatchesProtocolFilter(vault, protocolFilter, resolvedProtocol) {
20493
20596
  const normalizedFilter = this.normalizeProtocolValue(protocolFilter);
20494
20597
  const normalizedBeaconName = this.normalizeProtocolValue(vault.beaconName);
@@ -20672,43 +20775,7 @@ var VaultClient = class extends SubgraphClient {
20672
20775
  data: {
20673
20776
  edges: response.data.vaults.edges.map((edge) => ({
20674
20777
  cursor: edge.cursor,
20675
- node: {
20676
- id: edge.node.id,
20677
- chainId: edge.node.chainId,
20678
- vaultAddress: edge.node.vaultAddress,
20679
- protocol: edge.node.protocol,
20680
- beaconName: edge.node.beaconName,
20681
- protocolBaseType: edge.node.protocolBaseType,
20682
- name: edge.node.name || "",
20683
- feeApr: edge.node.feeApr || void 0,
20684
- stakingApr: edge.node.stakingApr || void 0,
20685
- merklApr: edge.node.merklApr || void 0,
20686
- pool: {
20687
- id: edge.node.pool?.id || "",
20688
- poolAddress: edge.node.pool?.poolAddress || "",
20689
- feeTier: edge.node.pool?.feeTier || "",
20690
- tick: void 0,
20691
- liquidity: void 0,
20692
- volumeUSD: void 0,
20693
- totalValueLockedUSD: void 0
20694
- },
20695
- token0: {
20696
- id: edge.node.token0?.id || "",
20697
- symbol: edge.node.token0?.symbol || "",
20698
- name: edge.node.token0?.name || "",
20699
- decimals: edge.node.token0?.decimals || 0,
20700
- address: edge.node.token0?.address || "",
20701
- chainId: edge.node.token0?.chainId || 0
20702
- },
20703
- token1: {
20704
- id: edge.node.token1?.id || "",
20705
- symbol: edge.node.token1?.symbol || "",
20706
- name: edge.node.token1?.name || "",
20707
- decimals: edge.node.token1?.decimals || 0,
20708
- address: edge.node.token1?.address || "",
20709
- chainId: edge.node.token1?.chainId || 0
20710
- }
20711
- }
20778
+ node: this.transformApiVaultNode(edge.node)
20712
20779
  })),
20713
20780
  pageInfo: {
20714
20781
  hasNextPage: response.data.vaults.pageInfo.hasNextPage,
@@ -21245,21 +21312,62 @@ var VaultClient = class extends SubgraphClient {
21245
21312
  };
21246
21313
  }
21247
21314
  async getVaultByAddress(vaultAddress, filter) {
21248
- const response = await this.searchVaults({
21249
- ...filter,
21250
- vaultAddress
21251
- });
21252
- if (!response.success || !response.data) return {
21315
+ const chainId = filter?.chainId;
21316
+ const normalizedVaultAddress = this.normalizeAddress(vaultAddress);
21317
+ if (!chainId) return {
21253
21318
  data: null,
21254
- status: response.status,
21255
- success: response.success,
21256
- error: response.error
21319
+ status: 400,
21320
+ success: false,
21321
+ error: "chainId is required for a direct vault address lookup"
21257
21322
  };
21258
- return {
21259
- data: response.data[0] || null,
21260
- status: 200,
21261
- success: true
21323
+ if (!normalizedVaultAddress || !isAddress(vaultAddress)) return {
21324
+ data: null,
21325
+ status: 400,
21326
+ success: false,
21327
+ error: "vaultAddress must be a valid EVM address"
21262
21328
  };
21329
+ try {
21330
+ const chain = chainIdToName(chainId);
21331
+ const subgraphUrl = chain ? steerSubgraphConfig[chain] : void 0;
21332
+ if (!subgraphUrl) throw new Error(`No subgraph configured for chainId: ${chainId}`);
21333
+ const node = await this.subgraphVaultClient.getVaultByAddress({
21334
+ subgraphUrl,
21335
+ chainId,
21336
+ vaultAddress: normalizedVaultAddress
21337
+ });
21338
+ return {
21339
+ data: node ? this.filterVaultNodes([node], {
21340
+ ...filter,
21341
+ vaultAddress: normalizedVaultAddress
21342
+ })[0] || null : null,
21343
+ status: 200,
21344
+ success: true
21345
+ };
21346
+ } catch (error) {
21347
+ console.warn("Direct subgraph vault lookup failed, falling back to the API:", error);
21348
+ }
21349
+ try {
21350
+ const response = await this.apiClient.vault({
21351
+ id: normalizedVaultAddress,
21352
+ chainId
21353
+ });
21354
+ const vault = response.data?.vault;
21355
+ return {
21356
+ data: vault ? this.filterVaultNodes([this.transformApiVaultNode(vault)], {
21357
+ ...filter,
21358
+ vaultAddress: normalizedVaultAddress
21359
+ })[0] || null : null,
21360
+ status: response.status,
21361
+ success: true
21362
+ };
21363
+ } catch (error) {
21364
+ return {
21365
+ data: null,
21366
+ status: 500,
21367
+ success: false,
21368
+ error: error instanceof Error ? error.message : "Direct vault lookup failed"
21369
+ };
21370
+ }
21263
21371
  }
21264
21372
  async getVaultsForPool(poolAddress, filter) {
21265
21373
  return this.searchVaults({
@@ -24414,7 +24522,7 @@ const PROVENANCE_BY_VARIANT = Object.freeze({
24414
24522
  "integral-v1": provenance$1(SDK_CONFIG_URL, "https://github.com/cryptoalgebra/Algebra/blob/3eae63f432a889fca5b000e9bd61078c6f923995/src/core/contracts/interfaces/IAlgebraFactory.sol"),
24415
24523
  "integral-v2": provenance$1(SDK_CONFIG_URL, "https://github.com/cryptoalgebra/Algebra/blob/62f01348af24b96d7d16f6b56fbaa61e512ba1c5/src/core/contracts/interfaces/IAlgebraFactory.sol", "https://github.com/cryptoalgebra/Algebra/blob/62f01348af24b96d7d16f6b56fbaa61e512ba1c5/src/periphery/contracts/interfaces/IAlgebraCustomPoolEntryPoint.sol")
24416
24524
  });
24417
- function deployment$1(input) {
24525
+ function deployment$2(input) {
24418
24526
  const shape = input.variant === "directional" ? {
24419
24527
  adapter: "algebra-directional-pair-v1",
24420
24528
  version: 1,
@@ -24456,179 +24564,179 @@ function deployment$1(input) {
24456
24564
  * a runtime fallback.
24457
24565
  */
24458
24566
  const ALGEBRA_LIFECYCLE_DEPLOYMENTS = Object.freeze([
24459
- deployment$1({
24567
+ deployment$2({
24460
24568
  chainId: ChainId.Polygon,
24461
24569
  protocol: Protocol.QuickSwap,
24462
24570
  variant: "legacy",
24463
24571
  factory: "0x411b0fAcC3489691f28ad58c47006AF5E3Ab3A28"
24464
24572
  }),
24465
- deployment$1({
24573
+ deployment$2({
24466
24574
  chainId: ChainId.PolygonzkEVM,
24467
24575
  protocol: Protocol.QuickSwap,
24468
24576
  variant: "legacy",
24469
24577
  factory: "0x4B9f4d2435Ef65559567e5DbFC1BbB37abC43B57"
24470
24578
  }),
24471
- deployment$1({
24579
+ deployment$2({
24472
24580
  chainId: ChainId.Zircuit,
24473
24581
  protocol: Protocol.Ocelex,
24474
24582
  variant: "legacy",
24475
24583
  factory: "0x03057ae6294292b299a1863420edD65e0197AFEf"
24476
24584
  }),
24477
- deployment$1({
24585
+ deployment$2({
24478
24586
  chainId: ChainId.Arbitrum,
24479
24587
  protocol: Protocol.Camelot,
24480
24588
  variant: "directional",
24481
24589
  factory: "0x1a3c9B1d2F0529D97f2afC5136Cc23e58f1FD35B"
24482
24590
  }),
24483
- deployment$1({
24591
+ deployment$2({
24484
24592
  chainId: ChainId.Apechain,
24485
24593
  protocol: Protocol.Camelot,
24486
24594
  variant: "directional",
24487
24595
  factory: "0x1a3c9B1d2F0529D97f2afC5136Cc23e58f1FD35B"
24488
24596
  }),
24489
- deployment$1({
24597
+ deployment$2({
24490
24598
  chainId: ChainId.Linea,
24491
24599
  protocol: Protocol.Lynex,
24492
24600
  variant: "legacy",
24493
24601
  factory: "0x622b2c98123D303ae067DB4925CD6282B3A08D0F"
24494
24602
  }),
24495
- deployment$1({
24603
+ deployment$2({
24496
24604
  chainId: ChainId.BSC,
24497
24605
  protocol: Protocol.Thena,
24498
24606
  variant: "legacy",
24499
24607
  factory: "0x306F06C147f064A010530292A1EB6737c3e378e4"
24500
24608
  }),
24501
- deployment$1({
24609
+ deployment$2({
24502
24610
  chainId: ChainId.Metis,
24503
24611
  protocol: Protocol.Hercules,
24504
24612
  variant: "directional",
24505
24613
  factory: "0xC5BfA92f27dF36d268422EE314a1387bB5ffB06A"
24506
24614
  }),
24507
- deployment$1({
24615
+ deployment$2({
24508
24616
  chainId: ChainId.XLayer,
24509
24617
  protocol: Protocol.QuickSwapAlgebra,
24510
24618
  variant: "legacy",
24511
24619
  factory: "0xd2480162Aa7F02Ead7BF4C127465446150D58452"
24512
24620
  }),
24513
- deployment$1({
24621
+ deployment$2({
24514
24622
  chainId: ChainId.Moonbeam,
24515
24623
  protocol: Protocol.StellaSwap,
24516
24624
  variant: "legacy",
24517
24625
  factory: "0xabE1655110112D0E45EF91e94f8d757e4ddBA59C"
24518
24626
  }),
24519
- deployment$1({
24627
+ deployment$2({
24520
24628
  chainId: ChainId.Mode,
24521
24629
  protocol: Protocol.Kim,
24522
24630
  variant: "integral-v1",
24523
24631
  factory: "0xB5F00c2C5f8821155D8ed27E31932CFD9DB3C5D5"
24524
24632
  }),
24525
- deployment$1({
24633
+ deployment$2({
24526
24634
  chainId: ChainId.Base,
24527
24635
  protocol: Protocol.Kim,
24528
24636
  variant: "integral-v1",
24529
24637
  factory: "0x2F0d41f94d5D1550b79A83D2fe85C82d68c5a3ca"
24530
24638
  }),
24531
- deployment$1({
24639
+ deployment$2({
24532
24640
  chainId: ChainId.Telos,
24533
24641
  protocol: Protocol.Swapsicle,
24534
24642
  variant: "integral-v1",
24535
24643
  factory: "0xA09BAbf9A48003ae9b9333966a8Bda94d820D0d9"
24536
24644
  }),
24537
- deployment$1({
24645
+ deployment$2({
24538
24646
  chainId: ChainId.Blast,
24539
24647
  protocol: Protocol.Fenix,
24540
24648
  variant: "integral-v1",
24541
24649
  factory: "0x7a44CD060afC1B6F4c80A2B9b37f4473E74E25Df"
24542
24650
  }),
24543
- deployment$1({
24651
+ deployment$2({
24544
24652
  chainId: ChainId.Taiko,
24545
24653
  protocol: Protocol.Henjin,
24546
24654
  variant: "integral-v1",
24547
24655
  factory: "0x42B08e7a9211482d3643a126a7dF1895448d3509",
24548
24656
  customPoolEntryPoint: "0x441013A52DDedc8D02eB9B90F7A555F6848188b5"
24549
24657
  }),
24550
- deployment$1({
24658
+ deployment$2({
24551
24659
  chainId: ChainId.Sonic,
24552
24660
  protocol: Protocol.SilverSwap,
24553
24661
  variant: "integral-v1",
24554
24662
  factory: "0xb860200BD68dc39cEAfd6ebb82883f189f4CdA76"
24555
24663
  }),
24556
- deployment$1({
24664
+ deployment$2({
24557
24665
  chainId: ChainId.Nibiru,
24558
24666
  protocol: Protocol.SilverSwap,
24559
24667
  variant: "integral-v1",
24560
24668
  factory: "0xb860200BD68dc39cEAfd6ebb82883f189f4CdA76"
24561
24669
  }),
24562
- deployment$1({
24670
+ deployment$2({
24563
24671
  chainId: ChainId.Zeta,
24564
24672
  protocol: Protocol.Beam,
24565
24673
  variant: "integral-v1",
24566
24674
  factory: "0x28b5244B6CA7Cb07f2f7F40edE944c07C2395603"
24567
24675
  }),
24568
- deployment$1({
24676
+ deployment$2({
24569
24677
  chainId: ChainId.Core,
24570
24678
  protocol: Protocol.Glyph,
24571
24679
  variant: "integral-v1",
24572
24680
  factory: "0x74EfE55beA4988e7D92D03EFd8ddB8BF8b7bD597"
24573
24681
  }),
24574
- deployment$1({
24682
+ deployment$2({
24575
24683
  chainId: ChainId.Hyperevm,
24576
24684
  protocol: Protocol.Nest,
24577
24685
  variant: "integral-v1",
24578
24686
  factory: "0xF77Bd082c627aA54591cF2f2EaA811fd1AB3b1F3"
24579
24687
  }),
24580
- deployment$1({
24688
+ deployment$2({
24581
24689
  chainId: ChainId.Soneium,
24582
24690
  protocol: Protocol.QuickSwapIntegral,
24583
24691
  variant: "integral-v2",
24584
24692
  factory: "0x8Ff309F68F6Caf77a78E9C20d2Af7Ed4bE2D7093"
24585
24693
  }),
24586
- deployment$1({
24694
+ deployment$2({
24587
24695
  chainId: ChainId.Base,
24588
24696
  protocol: Protocol.QuickSwapIntegral,
24589
24697
  variant: "integral-v2",
24590
24698
  factory: "0xC5396866754799B9720125B104AE01d935Ab9C7b",
24591
24699
  customPoolEntryPoint: "0xb9ce7698cE3dCf21cc88bf7dCc1fE20C85E4226E"
24592
24700
  }),
24593
- deployment$1({
24701
+ deployment$2({
24594
24702
  chainId: ChainId.Polygon,
24595
24703
  protocol: Protocol.QuickSwapIntegral,
24596
24704
  variant: "integral-v2",
24597
24705
  factory: "0x134c1dBE4860A9cAaf89002574fFe814772D9904",
24598
24706
  customPoolEntryPoint: "0xfcfE065bc131Fa8Bb31A227b2fF4F0EC47D3F1a2"
24599
24707
  }),
24600
- deployment$1({
24708
+ deployment$2({
24601
24709
  chainId: ChainId.Bera,
24602
24710
  protocol: Protocol.Wasabee,
24603
24711
  variant: "integral-v2",
24604
24712
  factory: "0x7d53327D78EFD0b463bd8d7dc938C52402323b95"
24605
24713
  }),
24606
- deployment$1({
24714
+ deployment$2({
24607
24715
  chainId: ChainId.Ronin,
24608
24716
  protocol: Protocol.KatanaIntegral,
24609
24717
  variant: "integral-v2",
24610
24718
  factory: "0x7ecaf729C6FFb04448aA89A722cA370724BF70De"
24611
24719
  }),
24612
- deployment$1({
24720
+ deployment$2({
24613
24721
  chainId: ChainId.Avalanche,
24614
24722
  protocol: Protocol.Blackhole,
24615
24723
  variant: "integral-v2",
24616
24724
  factory: "0x512eb749541B7cf294be882D636218c84a5e9E5F"
24617
24725
  }),
24618
- deployment$1({
24726
+ deployment$2({
24619
24727
  chainId: ChainId.Mainnet,
24620
24728
  protocol: Protocol.Cypher,
24621
24729
  variant: "integral-v2",
24622
24730
  factory: "0xfb8Ed3485EfA29a0e4bed93351dD51B59fC4b0f0",
24623
24731
  customPoolEntryPoint: "0x79616564DB0294ecBa5912f1cE985FD1c11eeF51"
24624
24732
  }),
24625
- deployment$1({
24733
+ deployment$2({
24626
24734
  chainId: ChainId.Flare,
24627
24735
  protocol: Protocol.SparkIntegral,
24628
24736
  variant: "integral-v2",
24629
24737
  factory: "0x805488DaA81c1b9e7C5cE3f1DCeA28F21448EC6A"
24630
24738
  }),
24631
- deployment$1({
24739
+ deployment$2({
24632
24740
  chainId: ChainId.Base,
24633
24741
  protocol: Protocol.Hydrex,
24634
24742
  variant: "integral-v2",
@@ -24661,6 +24769,164 @@ function validateAlgebraLifecycleDeployment(value) {
24661
24769
  return configured;
24662
24770
  }
24663
24771
  //#endregion
24772
+ //#region src/pool-lifecycle/capabilities/aerodrome-slipstream.ts
24773
+ const factoryRegistry = getAddress("0x5C3F18F06CC09CA1910767A34a20F771039E37C0");
24774
+ const voter = getAddress("0x16613524e02aD97edfef371Bc883F2f5D6c480A5");
24775
+ const originalFactory = getAddress("0x5e7BB104d84c7CB9B682AaC2F3d509f5F406809A");
24776
+ function deployment$1(input) {
24777
+ return Object.freeze({
24778
+ supported: true,
24779
+ schemaVersion: 1,
24780
+ family: "aerodrome-slipstream",
24781
+ adapter: "aerodrome-slipstream-factory-v1",
24782
+ version: 1,
24783
+ ...input
24784
+ });
24785
+ }
24786
+ const AERODROME_SLIPSTREAM_LIFECYCLE_DEPLOYMENTS = Object.freeze([
24787
+ deployment$1({
24788
+ chainId: ChainId.Base,
24789
+ protocol: Protocol.Aerodrome,
24790
+ generation: 1,
24791
+ latest: false,
24792
+ factory: originalFactory,
24793
+ factoryRuntimeCodeHash: "0x7340cf80843bd721bcaefbfc050e38304cb4174c239e6e914e3056f27f39b11c",
24794
+ poolImplementation: getAddress("0xeC8E5342B19977B4eF8892e02D8DAEcfa1315831"),
24795
+ poolImplementationRuntimeCodeHash: "0x772fb5c610b40a122036f544e5b9b5bce6becb19db9524331289d1aaed2d5888",
24796
+ poolProxyRuntimeCodeHash: "0xacd6710f7037ad095b1e4d5f8ee5b2681069cb4dd316e77e4e0cb8f85716a2a1",
24797
+ factoryRegistry,
24798
+ voter,
24799
+ legacyCLFactory: null,
24800
+ sourceVerification: Object.freeze({
24801
+ sourceRevision: "0x4ef07edcf5aaac5c22bcef6718c77e0416e7e472",
24802
+ compilerVersion: "0.7.6+commit.7338295f",
24803
+ optimizer: Object.freeze({
24804
+ enabled: true,
24805
+ runs: 200
24806
+ }),
24807
+ executableRuntimeMatch: true,
24808
+ immutableAnchors: Object.freeze({
24809
+ factoryRegistry,
24810
+ voter,
24811
+ poolImplementation: getAddress("0xeC8E5342B19977B4eF8892e02D8DAEcfa1315831"),
24812
+ legacyCLFactory: null
24813
+ })
24814
+ }),
24815
+ provenance: Object.freeze({
24816
+ source: "official-deployment",
24817
+ urls: Object.freeze([
24818
+ "https://github.com/aerodrome-finance/slipstream/commit/37eead2c7e5302a204dec78bfa0775bbb8ff48a2",
24819
+ "https://github.com/aerodrome-finance/slipstream/blob/4ef07edcf5aaac5c22bcef6718c77e0416e7e472/contracts/core/CLFactory.sol",
24820
+ "https://github.com/aerodrome-finance/slipstream/blob/4ef07edcf5aaac5c22bcef6718c77e0416e7e472/contracts/core/CLPool.sol",
24821
+ "https://basescan.org/address/0x5e7BB104d84c7CB9B682AaC2F3d509f5F406809A#code"
24822
+ ])
24823
+ })
24824
+ }),
24825
+ deployment$1({
24826
+ chainId: ChainId.Base,
24827
+ protocol: Protocol.AerodromeV2,
24828
+ generation: 2,
24829
+ latest: false,
24830
+ factory: getAddress("0xaDe65c38CD4849aDBA595a4323a8C7DdfE89716a"),
24831
+ factoryRuntimeCodeHash: "0x0e72100f63ce8e32c95370fa9636d38c8cf434a820f2a7a69985e50930d2cb85",
24832
+ poolImplementation: getAddress("0x942e97a4c6FdC38B4CD1c0298D37d81fDD8E5A16"),
24833
+ poolImplementationRuntimeCodeHash: "0x916bc5496cc07ea86289bc3a08a90f93dcae34686be6634f6e89ef260c3df4fa",
24834
+ poolProxyRuntimeCodeHash: "0x18308290b554b22918ea53c7e4e49eb871181d182749bf9e3a65ef949d3be808",
24835
+ factoryRegistry,
24836
+ voter,
24837
+ legacyCLFactory: originalFactory,
24838
+ sourceVerification: Object.freeze({
24839
+ sourceRevision: "0xaa539f4cdb59212aaf846cce60f6ac5e9470c157",
24840
+ compilerVersion: "0.7.6+commit.7338295f",
24841
+ optimizer: Object.freeze({
24842
+ enabled: true,
24843
+ runs: 200
24844
+ }),
24845
+ executableRuntimeMatch: true,
24846
+ immutableAnchors: Object.freeze({
24847
+ factoryRegistry,
24848
+ voter,
24849
+ poolImplementation: getAddress("0x942e97a4c6FdC38B4CD1c0298D37d81fDD8E5A16"),
24850
+ legacyCLFactory: originalFactory
24851
+ })
24852
+ }),
24853
+ provenance: Object.freeze({
24854
+ source: "official-deployment",
24855
+ urls: Object.freeze([
24856
+ "https://github.com/aerodrome-finance/slipstream/commit/aa539f4cdb59212aaf846cce60f6ac5e9470c157",
24857
+ "https://github.com/aerodrome-finance/slipstream/blob/aa539f4cdb59212aaf846cce60f6ac5e9470c157/contracts/core/CLFactory.sol",
24858
+ "https://github.com/aerodrome-finance/slipstream/blob/aa539f4cdb59212aaf846cce60f6ac5e9470c157/contracts/core/CLPool.sol",
24859
+ "https://github.com/aerodrome-finance/slipstream/blob/aa539f4cdb59212aaf846cce60f6ac5e9470c157/script/constants/output/DeployCL-Base-Gauge-Caps.json",
24860
+ "https://basescan.org/address/0xaDe65c38CD4849aDBA595a4323a8C7DdfE89716a#code"
24861
+ ])
24862
+ })
24863
+ }),
24864
+ deployment$1({
24865
+ chainId: ChainId.Base,
24866
+ protocol: Protocol.AerodromeV3,
24867
+ generation: 3,
24868
+ latest: true,
24869
+ factory: getAddress("0xf8f2eB4940CFE7d13603DDDD87f123820Fc061Ef"),
24870
+ factoryRuntimeCodeHash: "0x4961963494e47f363617ab9a0f3999a28b33c519e51392952db06350cce700bd",
24871
+ poolImplementation: getAddress("0xc770898522D2A9c8Da7A10D63989b6b58305B665"),
24872
+ poolImplementationRuntimeCodeHash: "0xe63484f408c701770737a3c40e435c8183c66b1663f3a8777ce44dd73aff339b",
24873
+ poolProxyRuntimeCodeHash: "0xad8972486d67a48db1f32f254a4c2f4be28df0b5f399559d1e7cd8fbcfbedc96",
24874
+ factoryRegistry,
24875
+ voter,
24876
+ legacyCLFactory: originalFactory,
24877
+ sourceVerification: Object.freeze({
24878
+ sourceRevision: "0x618c88df58f1fa271e9b3bc6bc476a4c37d068dd",
24879
+ compilerVersion: "0.7.6+commit.7338295f",
24880
+ optimizer: Object.freeze({
24881
+ enabled: true,
24882
+ runs: 200
24883
+ }),
24884
+ executableRuntimeMatch: true,
24885
+ immutableAnchors: Object.freeze({
24886
+ factoryRegistry,
24887
+ voter,
24888
+ poolImplementation: getAddress("0xc770898522D2A9c8Da7A10D63989b6b58305B665"),
24889
+ legacyCLFactory: originalFactory
24890
+ })
24891
+ }),
24892
+ provenance: Object.freeze({
24893
+ source: "official-deployment",
24894
+ urls: Object.freeze([
24895
+ "https://github.com/aerodrome-finance/slipstream/commit/618c88df58f1fa271e9b3bc6bc476a4c37d068dd",
24896
+ "https://github.com/aerodrome-finance/slipstream/blob/618c88df58f1fa271e9b3bc6bc476a4c37d068dd/contracts/core/CLFactory.sol",
24897
+ "https://github.com/aerodrome-finance/slipstream/blob/618c88df58f1fa271e9b3bc6bc476a4c37d068dd/contracts/core/CLPool.sol",
24898
+ "https://github.com/aerodrome-finance/slipstream/blob/618c88df58f1fa271e9b3bc6bc476a4c37d068dd/script/constants/output/DeployCL-Base-MinUnstake.json",
24899
+ "https://basescan.org/address/0xf8f2eB4940CFE7d13603DDDD87f123820Fc061Ef#code"
24900
+ ])
24901
+ })
24902
+ })
24903
+ ]);
24904
+ const registry = buildCheckedRegistry(AERODROME_SLIPSTREAM_LIFECYCLE_DEPLOYMENTS, (item) => `${item.chainId}:${item.protocol}`, "Aerodrome Slipstream lifecycle deployment");
24905
+ function resolveAerodromeSlipstreamLifecycleDeployment(params) {
24906
+ return registry[`${params.chainId}:${params.protocol}`];
24907
+ }
24908
+ /** Resolve the only factory generation that is eligible for a new pool deployment. */
24909
+ function resolveLatestAerodromeSlipstreamLifecycleDeployment(chainId) {
24910
+ return AERODROME_SLIPSTREAM_LIFECYCLE_DEPLOYMENTS.find((item) => item.chainId === chainId && item.latest);
24911
+ }
24912
+ function assertLatestAerodromeSlipstreamLifecycleDeployment(value) {
24913
+ const configured = validateAerodromeSlipstreamLifecycleDeployment(value);
24914
+ if (!configured.latest) throw new PoolLifecycleError("UNSUPPORTED_DEPLOYMENT", `Aerodrome Slipstream generation ${configured.generation} is read/verification-only; new pools must use the latest generation.`);
24915
+ return configured;
24916
+ }
24917
+ /** Reject mutable or forged deployment metadata at every public boundary. */
24918
+ function validateAerodromeSlipstreamLifecycleDeployment(value) {
24919
+ const candidate = value;
24920
+ const configured = typeof candidate?.chainId === "number" && typeof candidate.protocol === "string" ? resolveAerodromeSlipstreamLifecycleDeployment({
24921
+ chainId: candidate.chainId,
24922
+ protocol: candidate.protocol
24923
+ }) : void 0;
24924
+ try {
24925
+ if (configured && candidate.supported === true && candidate.schemaVersion === configured.schemaVersion && candidate.family === configured.family && candidate.adapter === configured.adapter && candidate.version === configured.version && candidate.generation === configured.generation && candidate.latest === configured.latest && getAddress(candidate.factory) === configured.factory && candidate.factoryRuntimeCodeHash === configured.factoryRuntimeCodeHash && getAddress(candidate.poolImplementation) === configured.poolImplementation && candidate.poolImplementationRuntimeCodeHash === configured.poolImplementationRuntimeCodeHash && candidate.poolProxyRuntimeCodeHash === configured.poolProxyRuntimeCodeHash && getAddress(candidate.factoryRegistry) === configured.factoryRegistry && getAddress(candidate.voter) === configured.voter && (configured.legacyCLFactory === null ? candidate.legacyCLFactory === null : getAddress(candidate.legacyCLFactory) === configured.legacyCLFactory)) return configured;
24926
+ } catch {}
24927
+ throw new PoolLifecycleError("UNSUPPORTED_DEPLOYMENT", `Aerodrome Slipstream lifecycle deployment is not configured for chain ${String(candidate?.chainId)} and protocol ${String(candidate?.protocol)}.`);
24928
+ }
24929
+ //#endregion
24664
24930
  //#region src/pool-lifecycle/capabilities/v3.ts
24665
24931
  const STANDARD_V3_POOL_INIT_CODE_HASH = "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54";
24666
24932
  const SDK_CONFIG_ROOT = "https://github.com/SteerProtocol/sdk/blob/2dfaa0ee00bb80be684206f73e67b8d35f8ce9ff/src/const/amm/configs/protocols";
@@ -25340,7 +25606,8 @@ function buildLifecycleRegistry() {
25340
25606
  return buildCheckedRegistry([
25341
25607
  ...Object.values(V3_LIFECYCLE_DEPLOYMENTS).filter((deployment) => deployment !== void 0),
25342
25608
  ...CURRENT_V4_LIFECYCLE_DEPLOYMENTS,
25343
- ...ALGEBRA_LIFECYCLE_DEPLOYMENTS
25609
+ ...ALGEBRA_LIFECYCLE_DEPLOYMENTS,
25610
+ ...AERODROME_SLIPSTREAM_LIFECYCLE_DEPLOYMENTS
25344
25611
  ], deploymentKey, "pool lifecycle deployment");
25345
25612
  }
25346
25613
  /**
@@ -25409,6 +25676,29 @@ const algebraIntegralPoolStateAbi = parseAbi(["function globalState() view retur
25409
25676
  */
25410
25677
  const algebraCustomPoolEntryPointAbi = parseAbi(["function factory() view returns (address)", "function createCustomPool(address deployer,address creator,address tokenA,address tokenB,bytes data) returns (address customPool)"]);
25411
25678
  //#endregion
25679
+ //#region src/pool-lifecycle/abis/aerodrome-slipstream.ts
25680
+ /** Exact Base Aerodrome Slipstream CLFactory lifecycle surface. */
25681
+ const aerodromeSlipstreamFactoryAbi = parseAbi([
25682
+ "event PoolCreated(address indexed token0,address indexed token1,int24 indexed tickSpacing,address pool)",
25683
+ "function getPool(address tokenA,address tokenB,int24 tickSpacing) view returns (address pool)",
25684
+ "function tickSpacingToFee(int24 tickSpacing) view returns (uint24 fee)",
25685
+ "function poolImplementation() view returns (address)",
25686
+ "function factoryRegistry() view returns (address)",
25687
+ "function voter() view returns (address)",
25688
+ "function legacyCLFactory() view returns (address)",
25689
+ "function isPool(address pool) view returns (bool)",
25690
+ "function createPool(address tokenA,address tokenB,int24 tickSpacing,uint160 sqrtPriceX96) returns (address pool)"
25691
+ ]);
25692
+ /** Exact Aerodrome Slipstream CLPool lifecycle read and event surface. */
25693
+ const aerodromeSlipstreamPoolAbi = parseAbi([
25694
+ "event Initialize(uint160 sqrtPriceX96,int24 tick)",
25695
+ "function factory() view returns (address)",
25696
+ "function token0() view returns (address)",
25697
+ "function token1() view returns (address)",
25698
+ "function tickSpacing() view returns (int24)",
25699
+ "function slot0() view returns (uint160 sqrtPriceX96,int24 tick,uint16 observationIndex,uint16 observationCardinality,uint16 observationCardinalityNext,bool unlocked)"
25700
+ ]);
25701
+ //#endregion
25412
25702
  //#region src/pool-lifecycle/abis/v3.ts
25413
25703
  /** Minimal canonical Uniswap V3-compatible factory ABI used by pool lifecycle flows. */
25414
25704
  const v3FactoryAbi = [
@@ -25682,8 +25972,8 @@ function assertAlgebraInitialPrice(key, price) {
25682
25972
  }
25683
25973
  //#endregion
25684
25974
  //#region src/pool-lifecycle/algebra/inspect.ts
25685
- const ZERO = getAddress("0x0000000000000000000000000000000000000000");
25686
- async function requireCode(client, address, label, blockNumber) {
25975
+ const ZERO$2 = getAddress("0x0000000000000000000000000000000000000000");
25976
+ async function requireCode$1(client, address, label, blockNumber) {
25687
25977
  const code = await client.getCode({
25688
25978
  address,
25689
25979
  blockNumber
@@ -25699,7 +25989,7 @@ async function inspectAlgebraCustomPoolEntryPoint(params) {
25699
25989
  const blockNumber = params.blockNumber ?? await params.publicClient.getBlockNumber();
25700
25990
  const entryPoint = deployment.customPoolEntryPoint;
25701
25991
  const factory = deployment.factory;
25702
- await requireCode(params.publicClient, entryPoint, "Algebra custom pool entry point", blockNumber);
25992
+ await requireCode$1(params.publicClient, entryPoint, "Algebra custom pool entry point", blockNumber);
25703
25993
  const entryFactory = getAddress(await params.publicClient.readContract({
25704
25994
  address: entryPoint,
25705
25995
  abi: algebraCustomPoolEntryPointAbi,
@@ -25722,9 +26012,9 @@ async function inspectAlgebraPool(params) {
25722
26012
  const blockNumber = params.blockNumber ?? await publicClient.getBlockNumber();
25723
26013
  const factory = getAddress(deployment.factory);
25724
26014
  await Promise.all([
25725
- requireCode(publicClient, factory, "Algebra factory", blockNumber),
25726
- requireCode(publicClient, key.token0, "token0", blockNumber),
25727
- requireCode(publicClient, key.token1, "token1", blockNumber)
26015
+ requireCode$1(publicClient, factory, "Algebra factory", blockNumber),
26016
+ requireCode$1(publicClient, key.token0, "token0", blockNumber),
26017
+ requireCode$1(publicClient, key.token1, "token1", blockNumber)
25728
26018
  ]);
25729
26019
  const factoryAbi = deployment.createPool === "pair-with-plugin-data" ? algebraIntegralPluginDataFactoryAbi : deployment.variant === "integral-v1" ? algebraIntegralPairFactoryAbi : algebraPairFactoryAbi;
25730
26020
  const [poolRaw, poolDeployerRaw] = await Promise.all([publicClient.readContract({
@@ -25740,8 +26030,8 @@ async function inspectAlgebraPool(params) {
25740
26030
  blockNumber
25741
26031
  })]);
25742
26032
  const poolDeployer = getAddress(poolDeployerRaw);
25743
- if (poolDeployer === ZERO) throw new PoolLifecycleError("DEPLOYMENT_MISMATCH", `Algebra factory ${factory} reports a zero pool deployer.`);
25744
- await requireCode(publicClient, poolDeployer, "Algebra pool deployer", blockNumber);
26033
+ if (poolDeployer === ZERO$2) throw new PoolLifecycleError("DEPLOYMENT_MISMATCH", `Algebra factory ${factory} reports a zero pool deployer.`);
26034
+ await requireCode$1(publicClient, poolDeployer, "Algebra pool deployer", blockNumber);
25745
26035
  let defaultTickSpacing = null;
25746
26036
  let defaultFee = null;
25747
26037
  if (deployment.variant === "integral-v1") {
@@ -25770,7 +26060,7 @@ async function inspectAlgebraPool(params) {
25770
26060
  }
25771
26061
  if (defaultTickSpacing !== null && (!Number.isInteger(defaultTickSpacing) || defaultTickSpacing <= 0)) throw new PoolLifecycleError("DEPLOYMENT_MISMATCH", `Algebra factory ${factory} reports invalid default tick spacing.`);
25772
26062
  const poolAddress = getAddress(poolRaw);
25773
- if (poolAddress === ZERO) return {
26063
+ if (poolAddress === ZERO$2) return {
25774
26064
  schemaVersion: 1,
25775
26065
  blockNumber,
25776
26066
  deployment,
@@ -25786,7 +26076,7 @@ async function inspectAlgebraPool(params) {
25786
26076
  pluginConfig: null,
25787
26077
  unlocked: null
25788
26078
  };
25789
- await requireCode(publicClient, poolAddress, "Algebra pool", blockNumber);
26079
+ await requireCode$1(publicClient, poolAddress, "Algebra pool", blockNumber);
25790
26080
  const [actualFactoryRaw, token0Raw, token1Raw, tickSpacingRaw] = await Promise.all([
25791
26081
  publicClient.readContract({
25792
26082
  address: poolAddress,
@@ -25854,7 +26144,7 @@ async function inspectAlgebraPool(params) {
25854
26144
  pluginConfig = Number(state[3]);
25855
26145
  unlocked = state[5];
25856
26146
  const pluginAddress = getAddress(pluginRaw);
25857
- plugin = pluginAddress === ZERO ? null : pluginAddress;
26147
+ plugin = pluginAddress === ZERO$2 ? null : pluginAddress;
25858
26148
  } else {
25859
26149
  const state = await publicClient.readContract({
25860
26150
  address: poolAddress,
@@ -26028,29 +26318,29 @@ async function prepareAlgebraPool(params) {
26028
26318
  }
26029
26319
  //#endregion
26030
26320
  //#region src/pool-lifecycle/algebra/types.ts
26031
- function invalid$1(message) {
26321
+ function invalid$2(message) {
26032
26322
  throw new PoolLifecycleError("INVALID_INPUT", message);
26033
26323
  }
26034
- function record$1(value, label) {
26035
- if (!value || typeof value !== "object" || Array.isArray(value)) return invalid$1(`${label} must be an object.`);
26324
+ function record$2(value, label) {
26325
+ if (!value || typeof value !== "object" || Array.isArray(value)) return invalid$2(`${label} must be an object.`);
26036
26326
  return value;
26037
26327
  }
26038
26328
  function address$1(value, label, nullable = false) {
26039
26329
  if (nullable && value === null) return null;
26040
- if (typeof value !== "string" || !isAddress(value, { strict: true })) return invalid$1(`${label} must be a valid address.`);
26330
+ if (typeof value !== "string" || !isAddress(value, { strict: true })) return invalid$2(`${label} must be a valid address.`);
26041
26331
  const result = getAddress(value);
26042
- if (result === "0x0000000000000000000000000000000000000000") return invalid$1(`${label} must not be zero.`);
26332
+ if (result === "0x0000000000000000000000000000000000000000") return invalid$2(`${label} must not be zero.`);
26043
26333
  return result;
26044
26334
  }
26045
- function hex(value, label) {
26046
- if (typeof value !== "string" || !/^0x(?:[0-9a-fA-F]{2})*$/.test(value)) return invalid$1(`${label} must be hex bytes.`);
26335
+ function hex$1(value, label) {
26336
+ if (typeof value !== "string" || !/^0x(?:[0-9a-fA-F]{2})*$/.test(value)) return invalid$2(`${label} must be hex bytes.`);
26047
26337
  return value;
26048
26338
  }
26049
26339
  function key(value) {
26050
- const item = record$1(value, "Algebra key");
26340
+ const item = record$2(value, "Algebra key");
26051
26341
  const token0 = address$1(item.token0, "Algebra token0");
26052
26342
  const token1 = address$1(item.token1, "Algebra token1");
26053
- if (BigInt(token0) >= BigInt(token1)) return invalid$1("Algebra tokens must be canonically ordered and distinct.");
26343
+ if (BigInt(token0) >= BigInt(token1)) return invalid$2("Algebra tokens must be canonically ordered and distinct.");
26054
26344
  return {
26055
26345
  token0,
26056
26346
  token1
@@ -26058,30 +26348,30 @@ function key(value) {
26058
26348
  }
26059
26349
  /** Re-derive target and calldata after a plan crosses a UI/CLI/JSON boundary. */
26060
26350
  function validatePreparedAlgebraPoolAction(value) {
26061
- const action = record$1(value, "Prepared Algebra action");
26062
- if (action.schemaVersion !== 1 || action.kind !== "algebra-create" && action.kind !== "algebra-initialize") return invalid$1("Prepared Algebra action kind or schema version is unsupported.");
26063
- if (typeof action.protocol !== "string") return invalid$1("Algebra action protocol must be a string.");
26064
- const tx = record$1(action.transaction, "Algebra transaction");
26065
- if (!Number.isSafeInteger(tx.chainId) || Number(tx.chainId) <= 0) return invalid$1("Algebra chainId must be a positive safe integer.");
26066
- if (tx.value !== 0n) return invalid$1("Algebra lifecycle transactions must have zero value.");
26351
+ const action = record$2(value, "Prepared Algebra action");
26352
+ if (action.schemaVersion !== 1 || action.kind !== "algebra-create" && action.kind !== "algebra-initialize") return invalid$2("Prepared Algebra action kind or schema version is unsupported.");
26353
+ if (typeof action.protocol !== "string") return invalid$2("Algebra action protocol must be a string.");
26354
+ const tx = record$2(action.transaction, "Algebra transaction");
26355
+ if (!Number.isSafeInteger(tx.chainId) || Number(tx.chainId) <= 0) return invalid$2("Algebra chainId must be a positive safe integer.");
26356
+ if (tx.value !== 0n) return invalid$2("Algebra lifecycle transactions must have zero value.");
26067
26357
  const to = address$1(tx.to, "Algebra transaction target");
26068
- const data = hex(tx.data, "Algebra calldata");
26358
+ const data = hex$1(tx.data, "Algebra calldata");
26069
26359
  const deployment = resolveAlgebraLifecycleDeployment({
26070
26360
  chainId: Number(tx.chainId),
26071
26361
  protocol: action.protocol
26072
26362
  });
26073
26363
  if (!deployment) throw new PoolLifecycleError("UNSUPPORTED_DEPLOYMENT", `No Algebra lifecycle deployment is configured for chain ${tx.chainId} and protocol ${action.protocol}.`);
26074
- const identity = record$1(action.identity, "Algebra identity");
26364
+ const identity = record$2(action.identity, "Algebra identity");
26075
26365
  const poolKey = key(identity.key);
26076
- if (identity.family !== "algebra" || identity.adapter !== deployment.adapter || identity.version !== deployment.version || identity.variant !== deployment.variant || identity.chainId !== deployment.chainId || address$1(identity.factory, "Algebra identity factory") !== getAddress(deployment.factory)) return invalid$1("Algebra identity does not match the configured deployment.");
26077
- const expected = record$1(action.expected, "Algebra expectation");
26078
- const preflight = record$1(action.preflight, "Algebra preflight");
26079
- if (typeof preflight.blockNumber !== "bigint" || preflight.blockNumber < 0n) return invalid$1("Algebra preflight blockNumber must be a non-negative bigint.");
26366
+ if (identity.family !== "algebra" || identity.adapter !== deployment.adapter || identity.version !== deployment.version || identity.variant !== deployment.variant || identity.chainId !== deployment.chainId || address$1(identity.factory, "Algebra identity factory") !== getAddress(deployment.factory)) return invalid$2("Algebra identity does not match the configured deployment.");
26367
+ const expected = record$2(action.expected, "Algebra expectation");
26368
+ const preflight = record$2(action.preflight, "Algebra preflight");
26369
+ if (typeof preflight.blockNumber !== "bigint" || preflight.blockNumber < 0n) return invalid$2("Algebra preflight blockNumber must be a non-negative bigint.");
26080
26370
  let expectedTo;
26081
26371
  let expectedData;
26082
26372
  if (action.kind === "algebra-create") {
26083
- if (identity.poolAddress !== null || expected.sqrtPriceX96 !== null || preflight.status !== "absent" || preflight.poolAddress !== null || preflight.sqrtPriceX96 !== 0n) return invalid$1("Algebra create cannot bind an existing pool or price.");
26084
- const pluginData = hex(expected.pluginData, "Algebra plugin data");
26373
+ if (identity.poolAddress !== null || expected.sqrtPriceX96 !== null || preflight.status !== "absent" || preflight.poolAddress !== null || preflight.sqrtPriceX96 !== 0n) return invalid$2("Algebra create cannot bind an existing pool or price.");
26374
+ const pluginData = hex$1(expected.pluginData, "Algebra plugin data");
26085
26375
  expectedTo = getAddress(deployment.factory);
26086
26376
  expectedData = deployment.createPool === "pair-with-plugin-data" ? encodeFunctionData({
26087
26377
  abi: algebraIntegralPluginDataFactoryAbi,
@@ -26098,11 +26388,11 @@ function validatePreparedAlgebraPoolAction(value) {
26098
26388
  });
26099
26389
  } else {
26100
26390
  const pool = address$1(identity.poolAddress, "Algebra pool address");
26101
- if (expected.pluginData !== null || typeof expected.sqrtPriceX96 !== "bigint" || preflight.status !== "uninitialized" || address$1(preflight.poolAddress, "Algebra preflight pool") !== pool || preflight.sqrtPriceX96 !== 0n) return invalid$1("Algebra initialize expectation is invalid.");
26391
+ if (expected.pluginData !== null || typeof expected.sqrtPriceX96 !== "bigint" || preflight.status !== "uninitialized" || address$1(preflight.poolAddress, "Algebra preflight pool") !== pool || preflight.sqrtPriceX96 !== 0n) return invalid$2("Algebra initialize expectation is invalid.");
26102
26392
  try {
26103
26393
  validateSqrtPriceX96(expected.sqrtPriceX96);
26104
26394
  } catch (error) {
26105
- return invalid$1(error instanceof Error ? error.message : "Invalid Algebra price.");
26395
+ return invalid$2(error instanceof Error ? error.message : "Invalid Algebra price.");
26106
26396
  }
26107
26397
  expectedTo = pool;
26108
26398
  expectedData = encodeFunctionData({
@@ -26111,7 +26401,7 @@ function validatePreparedAlgebraPoolAction(value) {
26111
26401
  args: [expected.sqrtPriceX96]
26112
26402
  });
26113
26403
  }
26114
- if (to !== expectedTo || data.toLowerCase() !== expectedData.toLowerCase()) return invalid$1("Algebra transaction does not match its trusted deployment and expectation.");
26404
+ if (to !== expectedTo || data.toLowerCase() !== expectedData.toLowerCase()) return invalid$2("Algebra transaction does not match its trusted deployment and expectation.");
26115
26405
  return deployment;
26116
26406
  }
26117
26407
  function deserializePreparedAlgebraPoolAction(serialized) {
@@ -26389,6 +26679,528 @@ async function verifyAlgebraPoolAction(params) {
26389
26679
  }
26390
26680
  }
26391
26681
  //#endregion
26682
+ //#region src/pool-lifecycle/aerodrome-slipstream/key.ts
26683
+ function canonicalizeAerodromeSlipstreamPoolKey(key) {
26684
+ let tokenA;
26685
+ let tokenB;
26686
+ try {
26687
+ tokenA = getAddress(key.tokenA);
26688
+ tokenB = getAddress(key.tokenB);
26689
+ } catch {
26690
+ throw new PoolLifecycleError("INVALID_INPUT", "Slipstream pool tokens must be valid addresses.");
26691
+ }
26692
+ if (tokenA === tokenB || tokenA === "0x0000000000000000000000000000000000000000" || tokenB === "0x0000000000000000000000000000000000000000") throw new PoolLifecycleError("INVALID_INPUT", "Slipstream pool tokens must be distinct non-zero addresses.");
26693
+ if (!Number.isSafeInteger(key.tickSpacing) || key.tickSpacing <= 0 || key.tickSpacing >= 16384) throw new PoolLifecycleError("INVALID_INPUT", "Slipstream tick spacing must be an int24 between 1 and 16383.");
26694
+ return BigInt(tokenA) < BigInt(tokenB) ? {
26695
+ token0: tokenA,
26696
+ token1: tokenB,
26697
+ tickSpacing: key.tickSpacing
26698
+ } : {
26699
+ token0: tokenB,
26700
+ token1: tokenA,
26701
+ tickSpacing: key.tickSpacing
26702
+ };
26703
+ }
26704
+ function assertAerodromeSlipstreamInitialPrice(value) {
26705
+ if (typeof value !== "bigint" || value <= 0n || value >= 1n << 160n) throw new PoolLifecycleError("INVALID_INPUT", "Slipstream sqrtPriceX96 must be a non-zero uint160.");
26706
+ return value;
26707
+ }
26708
+ //#endregion
26709
+ //#region src/pool-lifecycle/aerodrome-slipstream/types.ts
26710
+ function invalid$1(message) {
26711
+ throw new PoolLifecycleError("INVALID_INPUT", message);
26712
+ }
26713
+ function record$1(value, label) {
26714
+ if (!value || typeof value !== "object" || Array.isArray(value)) return invalid$1(`${label} must be an object.`);
26715
+ return value;
26716
+ }
26717
+ function nonZeroAddress(value, label) {
26718
+ if (typeof value !== "string" || !isAddress(value, { strict: true })) return invalid$1(`${label} must be a valid address.`);
26719
+ const address = getAddress(value);
26720
+ if (address === "0x0000000000000000000000000000000000000000") return invalid$1(`${label} must not be zero.`);
26721
+ return address;
26722
+ }
26723
+ function hex(value, label) {
26724
+ if (typeof value !== "string" || !/^0x(?:[0-9a-fA-F]{2})*$/.test(value)) return invalid$1(`${label} must be hex bytes.`);
26725
+ return value;
26726
+ }
26727
+ /** Re-derive all trusted calldata after a plan crosses a JSON boundary. */
26728
+ function validatePreparedAerodromeSlipstreamPoolAction(value) {
26729
+ const action = record$1(value, "Prepared Slipstream action");
26730
+ if (action.schemaVersion !== 1 || action.kind !== "aerodrome-slipstream-create-and-initialize" || typeof action.protocol !== "string") return invalid$1("Slipstream action kind, protocol, or schema version is unsupported.");
26731
+ const transaction = record$1(action.transaction, "Slipstream transaction");
26732
+ if (!Number.isSafeInteger(transaction.chainId) || Number(transaction.chainId) <= 0 || transaction.value !== 0n) return invalid$1("Slipstream transaction chainId or value is invalid.");
26733
+ const deployment = resolveAerodromeSlipstreamLifecycleDeployment({
26734
+ chainId: Number(transaction.chainId),
26735
+ protocol: action.protocol
26736
+ });
26737
+ if (!deployment) throw new PoolLifecycleError("UNSUPPORTED_DEPLOYMENT", "No Slipstream lifecycle deployment is configured for this action.");
26738
+ const identity = record$1(action.identity, "Slipstream identity");
26739
+ const key = canonicalizeAerodromeSlipstreamPoolKey({
26740
+ tokenA: nonZeroAddress(record$1(identity.key, "Slipstream key").token0, "Slipstream token0"),
26741
+ tokenB: nonZeroAddress(record$1(identity.key, "Slipstream key").token1, "Slipstream token1"),
26742
+ tickSpacing: Number(record$1(identity.key, "Slipstream key").tickSpacing)
26743
+ });
26744
+ if (identity.family !== deployment.family || identity.adapter !== deployment.adapter || identity.version !== deployment.version || identity.chainId !== deployment.chainId || nonZeroAddress(identity.factory, "Slipstream factory") !== deployment.factory || identity.poolAddress !== null) return invalid$1("Slipstream identity does not match the configured deployment.");
26745
+ const sqrtPriceX96 = assertAerodromeSlipstreamInitialPrice(record$1(action.expected, "Slipstream expectation").sqrtPriceX96);
26746
+ const preflight = record$1(action.preflight, "Slipstream preflight");
26747
+ if (typeof preflight.blockNumber !== "bigint" || preflight.blockNumber < 0n || preflight.status !== "absent" || preflight.poolAddress !== null) return invalid$1("Slipstream action must be bound to an absent pool preflight.");
26748
+ const expectedData = encodeFunctionData({
26749
+ abi: aerodromeSlipstreamFactoryAbi,
26750
+ functionName: "createPool",
26751
+ args: [
26752
+ key.token0,
26753
+ key.token1,
26754
+ key.tickSpacing,
26755
+ sqrtPriceX96
26756
+ ]
26757
+ });
26758
+ if (nonZeroAddress(transaction.to, "Slipstream transaction target") !== deployment.factory || hex(transaction.data, "Slipstream transaction calldata").toLowerCase() !== expectedData.toLowerCase()) return invalid$1("Slipstream transaction does not match its trusted deployment and expectation.");
26759
+ return deployment;
26760
+ }
26761
+ function deserializePreparedAerodromeSlipstreamPoolAction(serialized) {
26762
+ const action = deserializePreparedPoolAction(serialized);
26763
+ validatePreparedAerodromeSlipstreamPoolAction(action);
26764
+ return action;
26765
+ }
26766
+ //#endregion
26767
+ //#region src/pool-lifecycle/aerodrome-slipstream/inspect.ts
26768
+ const ZERO$1 = getAddress("0x0000000000000000000000000000000000000000");
26769
+ async function requireRuntimeHash(client, address, expected, label, blockNumber) {
26770
+ const code = await client.getCode({
26771
+ address,
26772
+ blockNumber
26773
+ });
26774
+ if (!code || code === "0x") throw new PoolLifecycleError("CONTRACT_NOT_DEPLOYED", `${label} ${address} has no bytecode at block ${blockNumber}.`);
26775
+ if (keccak256(code) !== expected) throw new PoolLifecycleError("DEPLOYMENT_MISMATCH", `${label} ${address} runtime hash does not match the configured deployment.`);
26776
+ }
26777
+ async function requireCode(client, address, label, blockNumber) {
26778
+ const code = await client.getCode({
26779
+ address,
26780
+ blockNumber
26781
+ });
26782
+ if (!code || code === "0x") throw new PoolLifecycleError("CONTRACT_NOT_DEPLOYED", `${label} ${address} has no bytecode at block ${blockNumber}.`);
26783
+ }
26784
+ async function inspectAerodromeSlipstreamPool(params) {
26785
+ const deployment = validateAerodromeSlipstreamLifecycleDeployment(params.deployment);
26786
+ const key = canonicalizeAerodromeSlipstreamPoolKey(params.key);
26787
+ if (await params.publicClient.getChainId() !== deployment.chainId) throw new PoolLifecycleError("CHAIN_MISMATCH", `Public client chain does not match Slipstream deployment chain ${deployment.chainId}.`);
26788
+ const blockNumber = params.blockNumber ?? await params.publicClient.getBlockNumber();
26789
+ await Promise.all([
26790
+ requireRuntimeHash(params.publicClient, deployment.factory, deployment.factoryRuntimeCodeHash, "Slipstream factory", blockNumber),
26791
+ requireRuntimeHash(params.publicClient, deployment.poolImplementation, deployment.poolImplementationRuntimeCodeHash, "Slipstream pool implementation", blockNumber),
26792
+ requireCode(params.publicClient, key.token0, "token0", blockNumber),
26793
+ requireCode(params.publicClient, key.token1, "token1", blockNumber)
26794
+ ]);
26795
+ const [implementation, factoryRegistry, voter, enabledFee, pool, legacyCLFactory] = await Promise.all([
26796
+ params.publicClient.readContract({
26797
+ address: deployment.factory,
26798
+ abi: aerodromeSlipstreamFactoryAbi,
26799
+ functionName: "poolImplementation",
26800
+ blockNumber
26801
+ }),
26802
+ params.publicClient.readContract({
26803
+ address: deployment.factory,
26804
+ abi: aerodromeSlipstreamFactoryAbi,
26805
+ functionName: "factoryRegistry",
26806
+ blockNumber
26807
+ }),
26808
+ params.publicClient.readContract({
26809
+ address: deployment.factory,
26810
+ abi: aerodromeSlipstreamFactoryAbi,
26811
+ functionName: "voter",
26812
+ blockNumber
26813
+ }),
26814
+ params.publicClient.readContract({
26815
+ address: deployment.factory,
26816
+ abi: aerodromeSlipstreamFactoryAbi,
26817
+ functionName: "tickSpacingToFee",
26818
+ args: [key.tickSpacing],
26819
+ blockNumber
26820
+ }),
26821
+ params.publicClient.readContract({
26822
+ address: deployment.factory,
26823
+ abi: aerodromeSlipstreamFactoryAbi,
26824
+ functionName: "getPool",
26825
+ args: [
26826
+ key.token0,
26827
+ key.token1,
26828
+ key.tickSpacing
26829
+ ],
26830
+ blockNumber
26831
+ }),
26832
+ deployment.legacyCLFactory === null ? Promise.resolve(null) : params.publicClient.readContract({
26833
+ address: deployment.factory,
26834
+ abi: aerodromeSlipstreamFactoryAbi,
26835
+ functionName: "legacyCLFactory",
26836
+ blockNumber
26837
+ })
26838
+ ]);
26839
+ if (getAddress(implementation) !== deployment.poolImplementation || getAddress(factoryRegistry) !== deployment.factoryRegistry || getAddress(voter) !== deployment.voter || deployment.legacyCLFactory !== null && getAddress(legacyCLFactory) !== deployment.legacyCLFactory) throw new PoolLifecycleError("DEPLOYMENT_MISMATCH", "Slipstream factory immutable deployment references do not match configuration.");
26840
+ const fee = Number(enabledFee);
26841
+ if (!Number.isSafeInteger(fee) || fee <= 0) throw new PoolLifecycleError("INVALID_INPUT", `Slipstream tick spacing ${key.tickSpacing} is not enabled.`);
26842
+ const poolAddress = getAddress(pool);
26843
+ if (poolAddress === ZERO$1) return {
26844
+ schemaVersion: 1,
26845
+ blockNumber,
26846
+ deployment,
26847
+ key,
26848
+ enabledFee: fee,
26849
+ status: "absent",
26850
+ poolAddress: null,
26851
+ sqrtPriceX96: 0n,
26852
+ tick: null
26853
+ };
26854
+ const [isPool, actualFactory, token0, token1, tickSpacing, slot0] = await Promise.all([
26855
+ params.publicClient.readContract({
26856
+ address: deployment.factory,
26857
+ abi: aerodromeSlipstreamFactoryAbi,
26858
+ functionName: "isPool",
26859
+ args: [poolAddress],
26860
+ blockNumber
26861
+ }),
26862
+ params.publicClient.readContract({
26863
+ address: poolAddress,
26864
+ abi: aerodromeSlipstreamPoolAbi,
26865
+ functionName: "factory",
26866
+ blockNumber
26867
+ }),
26868
+ params.publicClient.readContract({
26869
+ address: poolAddress,
26870
+ abi: aerodromeSlipstreamPoolAbi,
26871
+ functionName: "token0",
26872
+ blockNumber
26873
+ }),
26874
+ params.publicClient.readContract({
26875
+ address: poolAddress,
26876
+ abi: aerodromeSlipstreamPoolAbi,
26877
+ functionName: "token1",
26878
+ blockNumber
26879
+ }),
26880
+ params.publicClient.readContract({
26881
+ address: poolAddress,
26882
+ abi: aerodromeSlipstreamPoolAbi,
26883
+ functionName: "tickSpacing",
26884
+ blockNumber
26885
+ }),
26886
+ params.publicClient.readContract({
26887
+ address: poolAddress,
26888
+ abi: aerodromeSlipstreamPoolAbi,
26889
+ functionName: "slot0",
26890
+ blockNumber
26891
+ })
26892
+ ]);
26893
+ await requireRuntimeHash(params.publicClient, poolAddress, deployment.poolProxyRuntimeCodeHash, "Slipstream pool proxy", blockNumber);
26894
+ if (!isPool || getAddress(actualFactory) !== deployment.factory || getAddress(token0) !== key.token0 || getAddress(token1) !== key.token1 || Number(tickSpacing) !== key.tickSpacing || slot0[0] === 0n) throw new PoolLifecycleError("DEPLOYMENT_MISMATCH", `Slipstream pool ${poolAddress} does not match the configured factory, key, or initialized state.`);
26895
+ return {
26896
+ schemaVersion: 1,
26897
+ blockNumber,
26898
+ deployment,
26899
+ key,
26900
+ enabledFee: fee,
26901
+ status: "initialized",
26902
+ poolAddress,
26903
+ sqrtPriceX96: slot0[0],
26904
+ tick: Number(slot0[1])
26905
+ };
26906
+ }
26907
+ //#endregion
26908
+ //#region src/pool-lifecycle/aerodrome-slipstream/actions.ts
26909
+ function assertAbsentPreflight(deployment, key, preflight) {
26910
+ if (preflight.schemaVersion !== 1 || preflight.deployment !== deployment || preflight.key.token0 !== key.token0 || preflight.key.token1 !== key.token1 || preflight.key.tickSpacing !== key.tickSpacing || preflight.status !== "absent" || preflight.poolAddress !== null || preflight.sqrtPriceX96 !== 0n || preflight.tick !== null) throw new PoolLifecycleError("INVALID_INPUT", "Slipstream preflight does not prove this pool key is absent.");
26911
+ }
26912
+ function buildAerodromeSlipstreamCreateAndInitializeTransaction(params) {
26913
+ const deployment = assertLatestAerodromeSlipstreamLifecycleDeployment(params.deployment);
26914
+ const key = canonicalizeAerodromeSlipstreamPoolKey(params.key);
26915
+ const sqrtPriceX96 = assertAerodromeSlipstreamInitialPrice(params.initialPrice);
26916
+ assertAbsentPreflight(deployment, key, params.preflight);
26917
+ return {
26918
+ schemaVersion: 1,
26919
+ kind: "aerodrome-slipstream-create-and-initialize",
26920
+ protocol: deployment.protocol,
26921
+ transaction: {
26922
+ chainId: deployment.chainId,
26923
+ to: deployment.factory,
26924
+ data: encodeFunctionData({
26925
+ abi: aerodromeSlipstreamFactoryAbi,
26926
+ functionName: "createPool",
26927
+ args: [
26928
+ key.token0,
26929
+ key.token1,
26930
+ key.tickSpacing,
26931
+ sqrtPriceX96
26932
+ ]
26933
+ }),
26934
+ value: 0n
26935
+ },
26936
+ identity: {
26937
+ family: deployment.family,
26938
+ adapter: deployment.adapter,
26939
+ version: deployment.version,
26940
+ chainId: deployment.chainId,
26941
+ factory: getAddress(deployment.factory),
26942
+ key,
26943
+ poolAddress: null
26944
+ },
26945
+ expected: { sqrtPriceX96 },
26946
+ preflight: {
26947
+ blockNumber: params.preflight.blockNumber,
26948
+ status: "absent",
26949
+ poolAddress: null
26950
+ }
26951
+ };
26952
+ }
26953
+ async function prepareAerodromeSlipstreamPool(params) {
26954
+ const deployment = assertLatestAerodromeSlipstreamLifecycleDeployment(params.deployment);
26955
+ const snapshot = await inspectAerodromeSlipstreamPool({
26956
+ ...params,
26957
+ deployment
26958
+ });
26959
+ const sqrtPriceX96 = assertAerodromeSlipstreamInitialPrice(params.initialPrice);
26960
+ if (snapshot.status === "absent") return {
26961
+ status: "ready",
26962
+ snapshot,
26963
+ action: buildAerodromeSlipstreamCreateAndInitializeTransaction({
26964
+ deployment: snapshot.deployment,
26965
+ key: params.key,
26966
+ initialPrice: sqrtPriceX96,
26967
+ preflight: snapshot
26968
+ })
26969
+ };
26970
+ if (snapshot.sqrtPriceX96 !== sqrtPriceX96) throw new PoolLifecycleError("POOL_STATE_MISMATCH", `Slipstream pool ${snapshot.poolAddress} is already initialized at a different price.`);
26971
+ return {
26972
+ status: "already-initialized-matching",
26973
+ snapshot,
26974
+ action: null
26975
+ };
26976
+ }
26977
+ /** Prepare a new pool only through the newest verified factory in this family. */
26978
+ async function prepareLatestAerodromeSlipstreamPool(params) {
26979
+ const deployment = resolveLatestAerodromeSlipstreamLifecycleDeployment(params.chainId);
26980
+ if (!deployment) throw new PoolLifecycleError("UNSUPPORTED_DEPLOYMENT", `No latest Aerodrome Slipstream lifecycle deployment is configured for chain ${params.chainId}.`);
26981
+ return prepareAerodromeSlipstreamPool({
26982
+ ...params,
26983
+ deployment
26984
+ });
26985
+ }
26986
+ //#endregion
26987
+ //#region src/pool-lifecycle/aerodrome-slipstream/simulate.ts
26988
+ const ZERO = getAddress("0x0000000000000000000000000000000000000000");
26989
+ async function simulateAerodromeSlipstreamPoolAction(params) {
26990
+ if (!isAddress(params.account, { strict: true }) || getAddress(params.account) === ZERO) throw new PoolLifecycleError("INVALID_INPUT", "Simulation account must be a non-zero EVM address.");
26991
+ const deployment = validatePreparedAerodromeSlipstreamPoolAction(params.action);
26992
+ const blockNumber = params.blockNumber ?? await params.publicClient.getBlockNumber();
26993
+ const snapshot = await inspectAerodromeSlipstreamPool({
26994
+ publicClient: params.publicClient,
26995
+ deployment,
26996
+ key: {
26997
+ tokenA: params.action.identity.key.token0,
26998
+ tokenB: params.action.identity.key.token1,
26999
+ tickSpacing: params.action.identity.key.tickSpacing
27000
+ },
27001
+ blockNumber
27002
+ });
27003
+ if (snapshot.status !== "absent") throw new PoolLifecycleError("POOL_STATE_MISMATCH", `Slipstream pool already exists at ${snapshot.poolAddress}; refresh the action.`);
27004
+ try {
27005
+ const request = {
27006
+ account: getAddress(params.account),
27007
+ to: params.action.transaction.to,
27008
+ data: params.action.transaction.data,
27009
+ value: 0n,
27010
+ blockNumber
27011
+ };
27012
+ const [call, gasEstimate] = await Promise.all([params.publicClient.call({
27013
+ ...request,
27014
+ batch: false
27015
+ }), params.publicClient.estimateGas(request)]);
27016
+ if (!call.data || call.data === "0x") throw new PoolLifecycleError("SIMULATION_FAILED", "Slipstream create simulation returned no pool address.");
27017
+ return {
27018
+ transaction: params.action.transaction,
27019
+ blockNumber,
27020
+ returnData: call.data,
27021
+ returnedPoolAddress: getAddress(decodeFunctionResult({
27022
+ abi: aerodromeSlipstreamFactoryAbi,
27023
+ functionName: "createPool",
27024
+ data: call.data
27025
+ })),
27026
+ gasEstimate
27027
+ };
27028
+ } catch (error) {
27029
+ if (error instanceof PoolLifecycleError) throw error;
27030
+ throw new PoolLifecycleError("SIMULATION_FAILED", error instanceof Error ? error.message : "Slipstream action simulation failed.", error);
27031
+ }
27032
+ }
27033
+ //#endregion
27034
+ //#region src/pool-lifecycle/aerodrome-slipstream/verify.ts
27035
+ function assertCanonicalLog(log, receipt) {
27036
+ if (log.transactionHash !== receipt.transactionHash || log.blockHash !== receipt.blockHash || log.blockNumber !== receipt.blockNumber || log.transactionIndex !== receipt.transactionIndex || log.removed !== false) throw new PoolLifecycleError("POOL_STATE_MISMATCH", "Slipstream lifecycle log does not belong to the canonical receipt.");
27037
+ }
27038
+ function decodeAerodromeSlipstreamPoolActionReceipt(action, receipt) {
27039
+ validatePreparedAerodromeSlipstreamPoolAction(action);
27040
+ const created = [];
27041
+ const initialized = [];
27042
+ for (const log of receipt.logs) {
27043
+ if (getAddress(log.address) === action.identity.factory) try {
27044
+ const event = decodeEventLog({
27045
+ abi: aerodromeSlipstreamFactoryAbi,
27046
+ eventName: "PoolCreated",
27047
+ data: log.data,
27048
+ topics: log.topics
27049
+ });
27050
+ if (getAddress(event.args.token0) === action.identity.key.token0 && getAddress(event.args.token1) === action.identity.key.token1 && Number(event.args.tickSpacing) === action.identity.key.tickSpacing) {
27051
+ assertCanonicalLog(log, receipt);
27052
+ created.push({
27053
+ poolAddress: getAddress(event.args.pool),
27054
+ logIndex: log.logIndex
27055
+ });
27056
+ }
27057
+ } catch (error) {
27058
+ if (error instanceof PoolLifecycleError) throw error;
27059
+ }
27060
+ try {
27061
+ const event = decodeEventLog({
27062
+ abi: aerodromeSlipstreamPoolAbi,
27063
+ eventName: "Initialize",
27064
+ data: log.data,
27065
+ topics: log.topics
27066
+ });
27067
+ assertCanonicalLog(log, receipt);
27068
+ initialized.push({
27069
+ poolAddress: getAddress(log.address),
27070
+ sqrtPriceX96: event.args.sqrtPriceX96,
27071
+ tick: Number(event.args.tick),
27072
+ logIndex: log.logIndex
27073
+ });
27074
+ } catch (error) {
27075
+ if (error instanceof PoolLifecycleError) throw error;
27076
+ }
27077
+ }
27078
+ if (created.length > 1 || initialized.length > 1) throw new PoolLifecycleError("POOL_STATE_MISMATCH", "Receipt contains duplicate matching Slipstream lifecycle events.");
27079
+ return {
27080
+ receiptStatus: receipt.status,
27081
+ poolCreated: created[0] ?? null,
27082
+ initialization: initialized[0] ?? null
27083
+ };
27084
+ }
27085
+ async function verifyAerodromeSlipstreamPoolAction(params) {
27086
+ const deployment = validatePreparedAerodromeSlipstreamPoolAction(params.action);
27087
+ let receipt;
27088
+ try {
27089
+ const [chainId, transaction, canonical] = await Promise.all([
27090
+ params.publicClient.getChainId(),
27091
+ params.publicClient.getTransaction({ hash: params.receipt.transactionHash }),
27092
+ params.publicClient.getTransactionReceipt({ hash: params.receipt.transactionHash })
27093
+ ]);
27094
+ if (chainId !== deployment.chainId || canonical.transactionHash !== params.receipt.transactionHash || canonical.blockHash !== params.receipt.blockHash || transaction.to === null || transaction.value !== 0n || getAddress(transaction.to) !== params.action.transaction.to || transaction.input.toLowerCase() !== params.action.transaction.data.toLowerCase()) return {
27095
+ verified: false,
27096
+ outcome: "wrong-deployment",
27097
+ blockNumber: params.receipt.blockNumber,
27098
+ identity: params.action.identity,
27099
+ state: null,
27100
+ evidence: {
27101
+ receiptStatus: params.receipt.status,
27102
+ poolCreated: null,
27103
+ initialization: null
27104
+ },
27105
+ warnings: ["Canonical transaction does not match the prepared Slipstream action."]
27106
+ };
27107
+ receipt = canonical;
27108
+ } catch (error) {
27109
+ return {
27110
+ verified: false,
27111
+ outcome: "verification-unavailable",
27112
+ blockNumber: params.receipt.blockNumber,
27113
+ identity: params.action.identity,
27114
+ state: null,
27115
+ evidence: {
27116
+ receiptStatus: params.receipt.status,
27117
+ poolCreated: null,
27118
+ initialization: null
27119
+ },
27120
+ warnings: [error instanceof Error ? error.message : "Could not load canonical transaction evidence."]
27121
+ };
27122
+ }
27123
+ let evidence;
27124
+ try {
27125
+ evidence = decodeAerodromeSlipstreamPoolActionReceipt(params.action, receipt);
27126
+ } catch (error) {
27127
+ return {
27128
+ verified: false,
27129
+ outcome: "wrong-deployment",
27130
+ blockNumber: receipt.blockNumber,
27131
+ identity: params.action.identity,
27132
+ state: null,
27133
+ evidence: {
27134
+ receiptStatus: receipt.status,
27135
+ poolCreated: null,
27136
+ initialization: null
27137
+ },
27138
+ warnings: [error instanceof Error ? error.message : "Invalid receipt evidence."]
27139
+ };
27140
+ }
27141
+ if (receipt.status === "reverted") return {
27142
+ verified: false,
27143
+ outcome: "reverted",
27144
+ blockNumber: receipt.blockNumber,
27145
+ identity: params.action.identity,
27146
+ state: null,
27147
+ evidence,
27148
+ warnings: []
27149
+ };
27150
+ try {
27151
+ const snapshot = await inspectAerodromeSlipstreamPool({
27152
+ publicClient: params.publicClient,
27153
+ deployment,
27154
+ key: {
27155
+ tokenA: params.action.identity.key.token0,
27156
+ tokenB: params.action.identity.key.token1,
27157
+ tickSpacing: params.action.identity.key.tickSpacing
27158
+ },
27159
+ blockNumber: receipt.blockNumber
27160
+ });
27161
+ const identity = {
27162
+ ...params.action.identity,
27163
+ poolAddress: snapshot.poolAddress
27164
+ };
27165
+ if (!evidence.poolCreated || !evidence.initialization || snapshot.status !== "initialized" || evidence.poolCreated.poolAddress !== snapshot.poolAddress || evidence.initialization.poolAddress !== snapshot.poolAddress || evidence.initialization.sqrtPriceX96 !== params.action.expected.sqrtPriceX96) return {
27166
+ verified: false,
27167
+ outcome: "wrong-deployment",
27168
+ blockNumber: receipt.blockNumber,
27169
+ identity,
27170
+ state: snapshot,
27171
+ evidence,
27172
+ warnings: ["Receipt evidence does not prove the expected atomic Slipstream lifecycle."]
27173
+ };
27174
+ return snapshot.sqrtPriceX96 === params.action.expected.sqrtPriceX96 ? {
27175
+ verified: true,
27176
+ outcome: "created-and-initialized",
27177
+ blockNumber: receipt.blockNumber,
27178
+ identity,
27179
+ state: snapshot,
27180
+ evidence,
27181
+ warnings: []
27182
+ } : {
27183
+ verified: true,
27184
+ outcome: "initialized-then-price-moved",
27185
+ blockNumber: receipt.blockNumber,
27186
+ identity,
27187
+ state: snapshot,
27188
+ evidence,
27189
+ warnings: ["Pool price moved after initialization in the receipt block."]
27190
+ };
27191
+ } catch (error) {
27192
+ return {
27193
+ verified: false,
27194
+ outcome: "wrong-deployment",
27195
+ blockNumber: receipt.blockNumber,
27196
+ identity: params.action.identity,
27197
+ state: null,
27198
+ evidence,
27199
+ warnings: [error instanceof Error ? error.message : "Slipstream state verification failed."]
27200
+ };
27201
+ }
27202
+ }
27203
+ //#endregion
26392
27204
  //#region src/pool-lifecycle/v3/types.ts
26393
27205
  function invalidPreparedAction(message) {
26394
27206
  throw new PoolLifecycleError("INVALID_INPUT", message);
@@ -28034,6 +28846,6 @@ async function verifyV4PoolAction(params) {
28034
28846
  * See {@link SmartRewards} for detailed API documentation.
28035
28847
  */
28036
28848
  //#endregion
28037
- export { AERODROME_PROTOCOLS, ALGEBRA_INTEGRAL_PROTOCOLS, ALGEBRA_INTEGRAL_V_2_0_PROTOCOLS, ALGEBRA_LIFECYCLE_DEPLOYMENTS, ALGEBRA_PROTOCOLS, AMMType, API_URLS, AlgebgraHookBeacons, CURRENT_V4_LIFECYCLE_DEPLOYMENTS, Chain, ChainId, DIRECTIONAL_ALGEBRA_PROTOCOLS, FEE_MANAGER_ABI, FeeManagerClient, MAX_SQRT_RATIO, MIN_SQRT_RATIO, MultiPositionManagers, POOLSHARK_PROTOCOLS, POOL_LIFECYCLE_DEPLOYMENTS, PREPARED_POOL_ACTION_SERIALIZATION_VERSION, PoolClient, PoolLifecycleError, Protocol, QuickSwapQuoterV2, QuoterV2AlgebgraIntegral, QuoterV2AlgebgraIntegral21, QuoterV2Factory, QuoterV2Shadow, QuoterV2Thick, SHADOW_PROTOCOLS, SingleAssetDepositClient, SmartRewards, StakingClient, StakingProtocol, SteerClient, StrykePositionManagers, SubgraphClient, SubgraphVaultClient, TEST_UNISWAP_JIT_HOOK_BEACON, UNISWAP_V4_BEACON_NAMES, UNISWAP_V4_HOOK_BEACON_NAMES, UNISWAP_V4_NO_ORACLE_BEACON, UniswapHookBeacons, UniswapV3PoolABI, UniswapV3QuoterABI, UniswapV4Beacons, V3_CONFIG_PROTOCOLS, V3_LIFECYCLE_DEPLOYMENTS, V4_ALL_HOOK_MASK, V4_DYNAMIC_FEE_FLAG, V4_LIFECYCLE_DEPLOYMENTS, V4_LIFECYCLE_DEPLOYMENTS_BY_ID, V4_MAX_STATIC_FEE, V4_MAX_TICK_SPACING, V4_ZERO_ADDRESS, VAULT_FEES_ABI, VaultClient, abis, algebraCustomPoolEntryPointAbi, algebraDirectionalPoolStateAbi, algebraIntegralPairFactoryAbi, algebraIntegralPluginDataFactoryAbi, algebraIntegralPoolStateAbi, algebraLegacyPoolStateAbi, algebraPairFactoryAbi, algebraPoolBaseAbi, apechainAddresses, arbitrumAddresses, arbitrumgoerliAddresses, arthswapConfig, assertAlgebraInitialPrice, assertPreparedV3PoolAction, assertPreparedV4PoolAction, assertV3InitialPrice, assertV4InitialPrice, astarAddresses, astarzkevmAddresses, avalancheAddresses, bartiotestAddresses, baseAddresses, baseSwapConfig, basexConfig, beraAddresses, bittensorAddresses, bittensorUniV3Config, blastAddresses, bscAddresses, buildAlgebraCreatePoolTransaction, buildAlgebraInitializePoolTransaction, buildV3CreateAndInitializeTransaction, buildV3CreatePoolTransaction, buildV3InitializePoolTransaction, buildV4InitializePoolTransaction, calculateLimitPrice, calculateSwapAmount, camelotConfig, canonicalizeAlgebraPoolKey, canonicalizeV3PoolKey, canonicalizeV4PoolKey, celoAddresses, chainIdToName, chainNameToId, crustConfig, decodeAlgebraPoolActionReceipt, decodeV3PoolActionReceipt, decodeV4PoolActionReceipt, deprecatedBundlesURL, deserializePreparedAlgebraPoolAction, deserializePreparedPoolAction, deserializePreparedV3PoolAction, deserializePreparedV4PoolAction, determineSwapDirection, encodeCurrencyInitialSqrtPriceX96, encodeInitialSqrtPriceX96, encodeSqrtRatioX96, equilibreConfig, erc1155Abi, erc20Abi, erc721Abi, estimateLpTokens, ethAddresses, evmosAddresses, fantomAddresses, fenixConfig, filecoinAddresses, flareAddresses, forgeConfig, fusionxConfig, getAmmConfig, getAmmConfigByChainId, getApiUrl, getBeaconNameByProtocol, getContractAddressByChainIdAndContractName, getExpectedParamType, getFactoryAddress, getInitCodeHash, getNFTManagerAddress, getNetworkByChainId, getPoolHelperByChainId, getPoolSlot0, getProtcolTypeByAmmType, getProtocolBySubgraph, getProtocolConfigByBeacon, getProtocolContractAddresses, getProtocolInfoByChainId, getProtocolInfoByName, getProtocolSubgraphURL, getProtocolTypeByBeacon, getProtocolsForChainId, getQuoterV2Address, getStabilityVaultsPeripheryAddress, getStabilityVaultsSubgraphUrl, getSubgraphUrlByChainId, getSupportedChainByChainId, getSupportedChainIds, getSupportedChains, getSwapRouterAddress, getTheGraphResolverUrl, getTickLensAddress, getUniswapV4BeaconSupportedChains, getV4LifecycleDeploymentId, getV4PoolId, getVaultExecutionContext, getVaultReserves, glyphConfig, goerliAddresses, hemiAddresses, henjinConfig, herculesConfig, horizaConfig, inspectAlgebraCustomPoolEntryPoint, inspectAlgebraPool, inspectV3Pool, inspectV4Pool, integerSqrt, isAerodromeVault, isAlgebraDirectionProtocol, isAlgebraIntegral21QuoteParams, isAlgebraIntegralProtocol, isAlgebraIntegralV2Protocol, isAlgebraProtocol, isAlgebraProtocolBySubgraph, isAlgebraQuoteParams, isPoolSharkProtocol, isShadowProtocol, isShadowQuoteParams, isSingleAssetDepositSupported, isThickQuoteParams, isThickV2Protocol, isUniswapQuoteParams, isUniswapV4Beacon, isUniswapV4BeaconAvailableOnChain, isUniswapV4HookBeacon, isValidStakingProtocol, katanaAddresses, katanaConfig, kavaAddresses, kimConfig, kinetixConfig, lineaAddresses, linehubConfig, localhostAddresses, lynexConfig, maiaConfig, mantaAddresses, mantleAddresses, metaVaultConfig, metisAddresses, modeAddresses, moonbeamAddresses, mumbaiAddresses, nestVaultConfig, networks, normalizeProtocol, novaswapConfig, okxtestnetAddresses, optimismAddresses, optimismgoerliAddresses, pancakeSwapConfig, parseExactDecimal, polygonAddresses, polyzkevmAddresses, poolsharkConfig, prepareAlgebraPool, prepareV3CreateAndInitialize, prepareV3CreatePool, prepareV3InitializePool, prepareV4Initialize, quickSwapAlgebraConfig, quickSwapConfig, quickSwapIntegralConfig, quickSwapUniv3Config, resolveAlgebraLifecycleDeployment, resolveCurrentV4LifecycleDeployment, resolvePoolLifecycleDeployment, resolveV3LifecycleDeployment, resolveV4LifecycleDeployment, resolveV4LifecycleDeploymentById, retroConfig, robinhoodAddresses, rootstockAddresses, sagaAddresses, scrollAddresses, seiAddresses, serializePreparedPoolAction, shadowConfig, shouldValidateUniswapV4VaultHook, simulateAlgebraPoolAction, simulateSwap, simulateV3PoolAction, simulateV4PoolAction, singleTokenDepositAbi, soneiumAddresses, sonicAddresses, sortErc20Pair, sortEvmCurrencyPair, spark32Config, sparkConfig, stabilityVaultsConfig, steerSubgraphConfig, supswapConfig, sushiConfig, swapmodeConfig, swapsicleConfig, taikoAddresses, telosAddresses, thenaConfig, thickConfig, thrusterConfig, thundercoreAddresses, uniAddresses, uniswapConfig, v3FactoryAbi, v3PoolAbi, v3PoolInitializerAbi, v4PoolKeysEqual, v4PoolManagerAbi, v4StateViewAbi, validateAlgebraLifecycleDeployment, validatePreparedAlgebraPoolAction, validatePreparedV3PoolAction, validatePreparedV4PoolAction, validateQuoteParams, validateSqrtPriceX96, validateSwapParams, validateV4LifecycleDeployment, validateV4PoolKey, verifyAlgebraPoolAction, verifyV3PoolAction, verifyV4PoolAction, xlayerAddresses, zetaAddresses, zircuitAddresses };
28849
+ export { AERODROME_PROTOCOLS, AERODROME_SLIPSTREAM_LIFECYCLE_DEPLOYMENTS, ALGEBRA_INTEGRAL_PROTOCOLS, ALGEBRA_INTEGRAL_V_2_0_PROTOCOLS, ALGEBRA_LIFECYCLE_DEPLOYMENTS, ALGEBRA_PROTOCOLS, AMMType, API_URLS, AlgebgraHookBeacons, CURRENT_V4_LIFECYCLE_DEPLOYMENTS, Chain, ChainId, DIRECTIONAL_ALGEBRA_PROTOCOLS, FEE_MANAGER_ABI, FeeManagerClient, MAX_SQRT_RATIO, MIN_SQRT_RATIO, MultiPositionManagers, POOLSHARK_PROTOCOLS, POOL_LIFECYCLE_DEPLOYMENTS, PREPARED_POOL_ACTION_SERIALIZATION_VERSION, PoolClient, PoolLifecycleError, Protocol, QuickSwapQuoterV2, QuoterV2AlgebgraIntegral, QuoterV2AlgebgraIntegral21, QuoterV2Factory, QuoterV2Shadow, QuoterV2Thick, SHADOW_PROTOCOLS, SingleAssetDepositClient, SmartRewards, StakingClient, StakingProtocol, SteerClient, StrykePositionManagers, SubgraphClient, SubgraphVaultClient, TEST_UNISWAP_JIT_HOOK_BEACON, UNISWAP_V4_BEACON_NAMES, UNISWAP_V4_HOOK_BEACON_NAMES, UNISWAP_V4_NO_ORACLE_BEACON, UniswapHookBeacons, UniswapV3PoolABI, UniswapV3QuoterABI, UniswapV4Beacons, V3_CONFIG_PROTOCOLS, V3_LIFECYCLE_DEPLOYMENTS, V4_ALL_HOOK_MASK, V4_DYNAMIC_FEE_FLAG, V4_LIFECYCLE_DEPLOYMENTS, V4_LIFECYCLE_DEPLOYMENTS_BY_ID, V4_MAX_STATIC_FEE, V4_MAX_TICK_SPACING, V4_ZERO_ADDRESS, VAULT_FEES_ABI, VaultClient, abis, aerodromeSlipstreamFactoryAbi, aerodromeSlipstreamPoolAbi, algebraCustomPoolEntryPointAbi, algebraDirectionalPoolStateAbi, algebraIntegralPairFactoryAbi, algebraIntegralPluginDataFactoryAbi, algebraIntegralPoolStateAbi, algebraLegacyPoolStateAbi, algebraPairFactoryAbi, algebraPoolBaseAbi, apechainAddresses, arbitrumAddresses, arbitrumgoerliAddresses, arthswapConfig, assertAerodromeSlipstreamInitialPrice, assertAlgebraInitialPrice, assertLatestAerodromeSlipstreamLifecycleDeployment, assertPreparedV3PoolAction, assertPreparedV4PoolAction, assertV3InitialPrice, assertV4InitialPrice, astarAddresses, astarzkevmAddresses, avalancheAddresses, bartiotestAddresses, baseAddresses, baseSwapConfig, basexConfig, beraAddresses, bittensorAddresses, bittensorUniV3Config, blastAddresses, bscAddresses, buildAerodromeSlipstreamCreateAndInitializeTransaction, buildAlgebraCreatePoolTransaction, buildAlgebraInitializePoolTransaction, buildV3CreateAndInitializeTransaction, buildV3CreatePoolTransaction, buildV3InitializePoolTransaction, buildV4InitializePoolTransaction, calculateLimitPrice, calculateSwapAmount, camelotConfig, canonicalizeAerodromeSlipstreamPoolKey, canonicalizeAlgebraPoolKey, canonicalizeV3PoolKey, canonicalizeV4PoolKey, celoAddresses, chainIdToName, chainNameToId, crustConfig, decodeAerodromeSlipstreamPoolActionReceipt, decodeAlgebraPoolActionReceipt, decodeV3PoolActionReceipt, decodeV4PoolActionReceipt, deprecatedBundlesURL, deserializePreparedAerodromeSlipstreamPoolAction, deserializePreparedAlgebraPoolAction, deserializePreparedPoolAction, deserializePreparedV3PoolAction, deserializePreparedV4PoolAction, determineSwapDirection, encodeCurrencyInitialSqrtPriceX96, encodeInitialSqrtPriceX96, encodeSqrtRatioX96, equilibreConfig, erc1155Abi, erc20Abi, erc721Abi, estimateLpTokens, ethAddresses, evmosAddresses, fantomAddresses, fenixConfig, filecoinAddresses, flareAddresses, forgeConfig, fusionxConfig, getAmmConfig, getAmmConfigByChainId, getApiUrl, getBeaconNameByProtocol, getContractAddressByChainIdAndContractName, getExpectedParamType, getFactoryAddress, getInitCodeHash, getNFTManagerAddress, getNetworkByChainId, getPoolHelperByChainId, getPoolSlot0, getProtcolTypeByAmmType, getProtocolBySubgraph, getProtocolConfigByBeacon, getProtocolContractAddresses, getProtocolInfoByChainId, getProtocolInfoByName, getProtocolSubgraphURL, getProtocolTypeByBeacon, getProtocolsForChainId, getQuoterV2Address, getStabilityVaultsPeripheryAddress, getStabilityVaultsSubgraphUrl, getSubgraphUrlByChainId, getSupportedChainByChainId, getSupportedChainIds, getSupportedChains, getSwapRouterAddress, getTheGraphResolverUrl, getTickLensAddress, getUniswapV4BeaconSupportedChains, getV4LifecycleDeploymentId, getV4PoolId, getVaultExecutionContext, getVaultReserves, glyphConfig, goerliAddresses, hemiAddresses, henjinConfig, herculesConfig, horizaConfig, inspectAerodromeSlipstreamPool, inspectAlgebraCustomPoolEntryPoint, inspectAlgebraPool, inspectV3Pool, inspectV4Pool, integerSqrt, isAerodromeVault, isAlgebraDirectionProtocol, isAlgebraIntegral21QuoteParams, isAlgebraIntegralProtocol, isAlgebraIntegralV2Protocol, isAlgebraProtocol, isAlgebraProtocolBySubgraph, isAlgebraQuoteParams, isPoolSharkProtocol, isShadowProtocol, isShadowQuoteParams, isSingleAssetDepositSupported, isThickQuoteParams, isThickV2Protocol, isUniswapQuoteParams, isUniswapV4Beacon, isUniswapV4BeaconAvailableOnChain, isUniswapV4HookBeacon, isValidStakingProtocol, katanaAddresses, katanaConfig, kavaAddresses, kimConfig, kinetixConfig, lineaAddresses, linehubConfig, localhostAddresses, lynexConfig, maiaConfig, mantaAddresses, mantleAddresses, metaVaultConfig, metisAddresses, modeAddresses, moonbeamAddresses, mumbaiAddresses, nestVaultConfig, networks, normalizeProtocol, novaswapConfig, okxtestnetAddresses, optimismAddresses, optimismgoerliAddresses, pancakeSwapConfig, parseExactDecimal, polygonAddresses, polyzkevmAddresses, poolsharkConfig, prepareAerodromeSlipstreamPool, prepareAlgebraPool, prepareLatestAerodromeSlipstreamPool, prepareV3CreateAndInitialize, prepareV3CreatePool, prepareV3InitializePool, prepareV4Initialize, quickSwapAlgebraConfig, quickSwapConfig, quickSwapIntegralConfig, quickSwapUniv3Config, resolveAerodromeSlipstreamLifecycleDeployment, resolveAlgebraLifecycleDeployment, resolveCurrentV4LifecycleDeployment, resolveLatestAerodromeSlipstreamLifecycleDeployment, resolvePoolLifecycleDeployment, resolveV3LifecycleDeployment, resolveV4LifecycleDeployment, resolveV4LifecycleDeploymentById, retroConfig, robinhoodAddresses, rootstockAddresses, sagaAddresses, scrollAddresses, seiAddresses, serializePreparedPoolAction, shadowConfig, shouldValidateUniswapV4VaultHook, simulateAerodromeSlipstreamPoolAction, simulateAlgebraPoolAction, simulateSwap, simulateV3PoolAction, simulateV4PoolAction, singleTokenDepositAbi, soneiumAddresses, sonicAddresses, sortErc20Pair, sortEvmCurrencyPair, spark32Config, sparkConfig, stabilityVaultsConfig, steerSubgraphConfig, supswapConfig, sushiConfig, swapmodeConfig, swapsicleConfig, taikoAddresses, telosAddresses, thenaConfig, thickConfig, thrusterConfig, thundercoreAddresses, uniAddresses, uniswapConfig, v3FactoryAbi, v3PoolAbi, v3PoolInitializerAbi, v4PoolKeysEqual, v4PoolManagerAbi, v4StateViewAbi, validateAerodromeSlipstreamLifecycleDeployment, validateAlgebraLifecycleDeployment, validatePreparedAerodromeSlipstreamPoolAction, validatePreparedAlgebraPoolAction, validatePreparedV3PoolAction, validatePreparedV4PoolAction, validateQuoteParams, validateSqrtPriceX96, validateSwapParams, validateV4LifecycleDeployment, validateV4PoolKey, verifyAerodromeSlipstreamPoolAction, verifyAlgebraPoolAction, verifyV3PoolAction, verifyV4PoolAction, xlayerAddresses, zetaAddresses, zircuitAddresses };
28038
28850
 
28039
28851
  //# sourceMappingURL=index.mjs.map