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