UNPKG

wildcard-sdk

Version:

Node.js SDK for interacting with the Wildcard Deployer contract

8,151 lines 248 kB
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esm = (fn, res) => function __init() {
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/abis/v2/deployer-abi.ts
var DEPLOYER_ABI;
var init_deployer_abi = __esm({
  "src/abis/v2/deployer-abi.ts"() {
    "use strict";
    DEPLOYER_ABI = [
      {
        inputs: [
          { internalType: "address", name: "_stateView", type: "address" },
          { internalType: "address", name: "_lplocker", type: "address" },
          { internalType: "address", name: "_universalRouter", type: "address" },
          { internalType: "address", name: "_permit2", type: "address" },
          { internalType: "address", name: "_poolManager", type: "address" },
          { internalType: "address", name: "_quoter", type: "address" },
          { internalType: "address", name: "_owner", type: "address" }
        ],
        stateMutability: "nonpayable",
        type: "constructor"
      },
      { inputs: [], name: "BothTokensLaunched", type: "error" },
      { inputs: [], name: "ETHBalanceTooLowForSwap", type: "error" },
      { inputs: [], name: "ETHTransferFailed", type: "error" },
      { inputs: [], name: "FailedToPullTokens", type: "error" },
      { inputs: [], name: "FailedToTransferTokens", type: "error" },
      { inputs: [], name: "IncorrectETHAmount", type: "error" },
      { inputs: [], name: "InsufficientOutputAmount", type: "error" },
      { inputs: [], name: "InvalidBaseToken", type: "error" },
      { inputs: [], name: "InvalidCaller", type: "error" },
      { inputs: [], name: "InvalidCurveParameters", type: "error" },
      { inputs: [], name: "InvalidTokenDetails", type: "error" },
      {
        inputs: [{ internalType: "address", name: "owner", type: "address" }],
        name: "OwnableInvalidOwner",
        type: "error"
      },
      {
        inputs: [{ internalType: "address", name: "account", type: "address" }],
        name: "OwnableUnauthorizedAccount",
        type: "error"
      },
      {
        inputs: [
          { internalType: "uint256", name: "amountOut", type: "uint256" },
          { internalType: "uint256", name: "effectiveAmountIn", type: "uint256" }
        ],
        name: "QuoteAmount",
        type: "error"
      },
      { inputs: [], name: "QuoteNotImplemented", type: "error" },
      { inputs: [], name: "Reentrancy", type: "error" },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "SafeERC20FailedOperation",
        type: "error"
      },
      { inputs: [], name: "TokenAlreadyLaunched", type: "error" },
      { inputs: [], name: "TokenNotLaunched", type: "error" },
      { inputs: [], name: "TokenStateNotSet", type: "error" },
      {
        anonymous: false,
        inputs: [
          {
            indexed: true,
            internalType: "address",
            name: "token",
            type: "address"
          },
          {
            indexed: false,
            internalType: "bool",
            name: "whitelisted",
            type: "bool"
          }
        ],
        name: "BaseTokenWhitelisted",
        type: "event"
      },
      {
        anonymous: false,
        inputs: [
          {
            indexed: true,
            internalType: "address",
            name: "previousOwner",
            type: "address"
          },
          {
            indexed: true,
            internalType: "address",
            name: "newOwner",
            type: "address"
          }
        ],
        name: "OwnershipTransferStarted",
        type: "event"
      },
      {
        anonymous: false,
        inputs: [
          {
            indexed: true,
            internalType: "address",
            name: "previousOwner",
            type: "address"
          },
          {
            indexed: true,
            internalType: "address",
            name: "newOwner",
            type: "address"
          }
        ],
        name: "OwnershipTransferred",
        type: "event"
      },
      {
        inputs: [],
        name: "MAX_FEE_RECEIVER_COUNT",
        outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "MIN_VESTING_START_TIME",
        outputs: [{ internalType: "uint64", name: "", type: "uint64" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [
          {
            components: [
              { internalType: "address", name: "creator", type: "address" },
              { internalType: "address", name: "baseToken", type: "address" },
              { internalType: "string", name: "name", type: "string" },
              { internalType: "string", name: "symbol", type: "string" },
              { internalType: "string", name: "image", type: "string" },
              { internalType: "string", name: "appIdentifier", type: "string" },
              { internalType: "uint256", name: "teamSupply", type: "uint256" },
              { internalType: "uint64", name: "vestingStartTime", type: "uint64" },
              { internalType: "uint64", name: "vestingDuration", type: "uint64" },
              { internalType: "address", name: "vestingWallet", type: "address" },
              {
                internalType: "uint256",
                name: "bondingCurveSupply",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "liquidityPoolSupply",
                type: "uint256"
              },
              { internalType: "uint256", name: "totalSupply", type: "uint256" },
              {
                internalType: "uint256",
                name: "bondingCurveBuyFee",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "bondingCurveSellFee",
                type: "uint256"
              },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "bondingCurveFeeSplits",
                type: "tuple[]"
              },
              {
                components: [
                  { internalType: "uint256[]", name: "prices", type: "uint256[]" },
                  { internalType: "uint256", name: "numSteps", type: "uint256" },
                  { internalType: "uint256", name: "stepSize", type: "uint256" }
                ],
                internalType: "struct PriceCurve",
                name: "bondingCurveParams",
                type: "tuple"
              },
              { internalType: "bool", name: "allowForcedGraduation", type: "bool" },
              { internalType: "bool", name: "allowAutoGraduation", type: "bool" },
              {
                internalType: "uint256",
                name: "graduationFeeBps",
                type: "uint256"
              },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "graduationFeeSplits",
                type: "tuple[]"
              },
              { internalType: "uint24", name: "poolFees", type: "uint24" },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "poolFeeSplits",
                type: "tuple[]"
              },
              {
                internalType: "uint256",
                name: "surgeFeeStartingTime",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "surgeFeeDuration",
                type: "uint256"
              },
              { internalType: "uint256", name: "maxSurgeFeeBps", type: "uint256" }
            ],
            internalType: "struct StateManager.TokenDeploymentConfig",
            name: "tokenDeploymentConfig",
            type: "tuple"
          }
        ],
        name: "_validateTokenDeploymentConfig",
        outputs: [],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "acceptOwnership",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "", type: "address" }],
        name: "appIdentifiers",
        outputs: [{ internalType: "string", name: "", type: "string" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "token", type: "address" },
          { internalType: "uint256", name: "amountIn", type: "uint256" }
        ],
        name: "buyQuote",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "token", type: "address" },
          { internalType: "uint256", name: "amountIn", type: "uint256" },
          { internalType: "uint256", name: "amountOutMin", type: "uint256" },
          { internalType: "address", name: "to", type: "address" }
        ],
        name: "buyToken",
        outputs: [],
        stateMutability: "payable",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "claimFee",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "getTokenPrice",
        outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "token", type: "address" },
          { internalType: "bool", name: "allowPreGraduation", type: "bool" }
        ],
        name: "graduateToken",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "isBaseTokenWhitelisted",
        outputs: [{ internalType: "bool", name: "", type: "bool" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [
          {
            components: [
              { internalType: "address", name: "creator", type: "address" },
              { internalType: "address", name: "baseToken", type: "address" },
              { internalType: "string", name: "name", type: "string" },
              { internalType: "string", name: "symbol", type: "string" },
              { internalType: "string", name: "image", type: "string" },
              { internalType: "string", name: "appIdentifier", type: "string" },
              { internalType: "uint256", name: "teamSupply", type: "uint256" },
              { internalType: "uint64", name: "vestingStartTime", type: "uint64" },
              { internalType: "uint64", name: "vestingDuration", type: "uint64" },
              { internalType: "address", name: "vestingWallet", type: "address" },
              {
                internalType: "uint256",
                name: "bondingCurveSupply",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "liquidityPoolSupply",
                type: "uint256"
              },
              { internalType: "uint256", name: "totalSupply", type: "uint256" },
              {
                internalType: "uint256",
                name: "bondingCurveBuyFee",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "bondingCurveSellFee",
                type: "uint256"
              },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "bondingCurveFeeSplits",
                type: "tuple[]"
              },
              {
                components: [
                  { internalType: "uint256[]", name: "prices", type: "uint256[]" },
                  { internalType: "uint256", name: "numSteps", type: "uint256" },
                  { internalType: "uint256", name: "stepSize", type: "uint256" }
                ],
                internalType: "struct PriceCurve",
                name: "bondingCurveParams",
                type: "tuple"
              },
              { internalType: "bool", name: "allowForcedGraduation", type: "bool" },
              { internalType: "bool", name: "allowAutoGraduation", type: "bool" },
              {
                internalType: "uint256",
                name: "graduationFeeBps",
                type: "uint256"
              },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "graduationFeeSplits",
                type: "tuple[]"
              },
              { internalType: "uint24", name: "poolFees", type: "uint24" },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "poolFeeSplits",
                type: "tuple[]"
              },
              {
                internalType: "uint256",
                name: "surgeFeeStartingTime",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "surgeFeeDuration",
                type: "uint256"
              },
              { internalType: "uint256", name: "maxSurgeFeeBps", type: "uint256" }
            ],
            internalType: "struct StateManager.TokenDeploymentConfig",
            name: "tokenDeploymentConfig",
            type: "tuple"
          },
          { internalType: "bytes32", name: "salt", type: "bytes32" }
        ],
        name: "launchToken",
        outputs: [{ internalType: "address", name: "", type: "address" }],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "token", type: "address" },
          { internalType: "int24", name: "tickSpacing", type: "int24" },
          { internalType: "int24", name: "startingTick", type: "int24" },
          { internalType: "int24", name: "endingTick", type: "int24" },
          { internalType: "int24", name: "targetTick", type: "int24" },
          { internalType: "bool", name: "allowPreGraduation", type: "bool" }
        ],
        name: "launchV4Pool",
        outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [],
        name: "lplocker",
        outputs: [
          {
            internalType: "contract ILpLockerWithOwnable",
            name: "",
            type: "address"
          }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "owner",
        outputs: [{ internalType: "address", name: "", type: "address" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "pendingOwner",
        outputs: [{ internalType: "address", name: "", type: "address" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "permit2",
        outputs: [{ internalType: "contract IPermit2", name: "", type: "address" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "poolManager",
        outputs: [
          { internalType: "contract IPoolManager", name: "", type: "address" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "owner", type: "address" },
          { internalType: "bytes32", name: "salt", type: "bytes32" }
        ],
        name: "predictTokenAddress",
        outputs: [
          { internalType: "address", name: "addr", type: "address" },
          { internalType: "bool", name: "exists", type: "bool" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "quoter",
        outputs: [
          { internalType: "contract IV4Quoter", name: "", type: "address" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "relinquishStateManager",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [],
        name: "renounceOwnership",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "token", type: "address" },
          { internalType: "uint256", name: "amountIn", type: "uint256" }
        ],
        name: "sellQuote",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "token", type: "address" },
          { internalType: "uint256", name: "amountIn", type: "uint256" },
          { internalType: "uint256", name: "amountOutMin", type: "uint256" },
          { internalType: "address", name: "to", type: "address" }
        ],
        name: "sellToken",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "creator", type: "address" },
          { internalType: "string", name: "appIdentifier", type: "string" }
        ],
        name: "setAppIdentifier",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "token", type: "address" },
          { internalType: "bool", name: "whitelisted", type: "bool" }
        ],
        name: "setBaseTokenWhitelist",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [
          {
            internalType: "address",
            name: "_protocolFeeRecipient",
            type: "address"
          }
        ],
        name: "setProtocolFeeRecipient",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [],
        name: "stateManager",
        outputs: [
          { internalType: "contract StateManager", name: "", type: "address" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
        name: "transferOwnership",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [],
        name: "universalRouter",
        outputs: [
          { internalType: "contract IUniversalRouter", name: "", type: "address" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "", type: "address" }],
        name: "whitelistedBaseTokens",
        outputs: [{ internalType: "bool", name: "", type: "bool" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "destination", type: "address" },
          { internalType: "address", name: "token", type: "address" }
        ],
        name: "withdrawFunds",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      { stateMutability: "payable", type: "receive" }
    ];
  }
});

// src/abis/v2/statemanager-abi.ts
var STATEMANAGER_ABI;
var init_statemanager_abi = __esm({
  "src/abis/v2/statemanager-abi.ts"() {
    "use strict";
    STATEMANAGER_ABI = [
      {
        inputs: [
          { internalType: "address", name: "initialOwner", type: "address" },
          { internalType: "address", name: "permit2Address", type: "address" },
          { internalType: "address", name: "_positionManager", type: "address" },
          { internalType: "address", name: "_stateView", type: "address" },
          {
            internalType: "address",
            name: "_protocolFeeRecipient",
            type: "address"
          },
          { internalType: "address", name: "_tokenIdRecipient", type: "address" }
        ],
        stateMutability: "nonpayable",
        type: "constructor"
      },
      { inputs: [], name: "CurveSupplyExhausted", type: "error" },
      { inputs: [], name: "FailedToPullTokens", type: "error" },
      { inputs: [], name: "FailedToTransferTokens", type: "error" },
      { inputs: [], name: "InsufficientETHSent", type: "error" },
      { inputs: [], name: "InsufficientInputAmount", type: "error" },
      { inputs: [], name: "InsufficientTokenBalanceInBondingCurve", type: "error" },
      { inputs: [], name: "InvalidBondingCurveSupply", type: "error" },
      { inputs: [], name: "InvalidFeeSplits", type: "error" },
      { inputs: [], name: "InvalidPriceX96", type: "error" },
      { inputs: [], name: "InvalidToken0Amount", type: "error" },
      { inputs: [], name: "InvalidTokenBalance", type: "error" },
      { inputs: [], name: "InvalidTokenSupply", type: "error" },
      { inputs: [], name: "NoFeeToClaim", type: "error" },
      { inputs: [], name: "NotEnoughTokensToSell", type: "error" },
      {
        inputs: [{ internalType: "address", name: "owner", type: "address" }],
        name: "OwnableInvalidOwner",
        type: "error"
      },
      {
        inputs: [{ internalType: "address", name: "account", type: "address" }],
        name: "OwnableUnauthorizedAccount",
        type: "error"
      },
      { inputs: [], name: "PriceCurveOutOfBounds", type: "error" },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "SafeERC20FailedOperation",
        type: "error"
      },
      { inputs: [], name: "SlippageExceeded", type: "error" },
      { inputs: [], name: "StartTickTooLarge", type: "error" },
      {
        inputs: [
          { internalType: "uint256", name: "subBy", type: "uint256" },
          { internalType: "uint256", name: "sqrtTargetPrice", type: "uint256" }
        ],
        name: "SubByTooLarge",
        type: "error"
      },
      { inputs: [], name: "TickNotMultipleOfSpacing", type: "error" },
      { inputs: [], name: "TickTooLarge", type: "error" },
      { inputs: [], name: "TickTooSmall", type: "error" },
      { inputs: [], name: "TokenAlreadyDeployed", type: "error" },
      { inputs: [], name: "TokenAlreadyGraduated", type: "error" },
      { inputs: [], name: "TokenInGraduationProcess", type: "error" },
      { inputs: [], name: "TokenNotReadyForGraduation", type: "error" },
      { inputs: [], name: "UnexpectedCrash", type: "error" },
      {
        anonymous: false,
        inputs: [
          {
            indexed: true,
            internalType: "address",
            name: "token",
            type: "address"
          },
          { indexed: true, internalType: "bool", name: "isBuy", type: "bool" },
          { indexed: true, internalType: "address", name: "to", type: "address" },
          {
            indexed: false,
            internalType: "address",
            name: "from",
            type: "address"
          },
          {
            indexed: false,
            internalType: "uint256",
            name: "amountIn",
            type: "uint256"
          },
          {
            indexed: false,
            internalType: "uint256",
            name: "amountOut",
            type: "uint256"
          },
          {
            indexed: false,
            internalType: "uint256",
            name: "feeAmount",
            type: "uint256"
          }
        ],
        name: "BondingCurveSwap",
        type: "event"
      },
      {
        anonymous: false,
        inputs: [
          {
            indexed: true,
            internalType: "address",
            name: "previousOwner",
            type: "address"
          },
          {
            indexed: true,
            internalType: "address",
            name: "newOwner",
            type: "address"
          }
        ],
        name: "OwnershipTransferStarted",
        type: "event"
      },
      {
        anonymous: false,
        inputs: [
          {
            indexed: true,
            internalType: "address",
            name: "previousOwner",
            type: "address"
          },
          {
            indexed: true,
            internalType: "address",
            name: "newOwner",
            type: "address"
          }
        ],
        name: "OwnershipTransferred",
        type: "event"
      },
      {
        anonymous: false,
        inputs: [
          {
            indexed: false,
            internalType: "address",
            name: "token0",
            type: "address"
          },
          {
            indexed: false,
            internalType: "address",
            name: "token1",
            type: "address"
          },
          {
            indexed: false,
            internalType: "uint256",
            name: "uniswapTokenId",
            type: "uint256"
          }
        ],
        name: "PoolLaunched",
        type: "event"
      },
      {
        anonymous: false,
        inputs: [
          {
            indexed: true,
            internalType: "address",
            name: "token",
            type: "address"
          },
          {
            indexed: false,
            internalType: "uint256",
            name: "mintedBondingCurveTokens",
            type: "uint256"
          },
          {
            indexed: false,
            internalType: "uint256",
            name: "collectedBaseTokens",
            type: "uint256"
          }
        ],
        name: "TokenGraduated",
        type: "event"
      },
      {
        anonymous: false,
        inputs: [
          {
            indexed: false,
            internalType: "address",
            name: "token",
            type: "address"
          },
          {
            components: [
              { internalType: "address", name: "creator", type: "address" },
              { internalType: "address", name: "baseToken", type: "address" },
              { internalType: "string", name: "name", type: "string" },
              { internalType: "string", name: "symbol", type: "string" },
              { internalType: "string", name: "image", type: "string" },
              { internalType: "string", name: "appIdentifier", type: "string" },
              { internalType: "uint256", name: "teamSupply", type: "uint256" },
              { internalType: "uint64", name: "vestingStartTime", type: "uint64" },
              { internalType: "uint64", name: "vestingDuration", type: "uint64" },
              { internalType: "address", name: "vestingWallet", type: "address" },
              {
                internalType: "uint256",
                name: "bondingCurveSupply",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "liquidityPoolSupply",
                type: "uint256"
              },
              { internalType: "uint256", name: "totalSupply", type: "uint256" },
              {
                internalType: "uint256",
                name: "bondingCurveBuyFee",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "bondingCurveSellFee",
                type: "uint256"
              },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "bondingCurveFeeSplits",
                type: "tuple[]"
              },
              {
                components: [
                  { internalType: "uint256[]", name: "prices", type: "uint256[]" },
                  { internalType: "uint256", name: "numSteps", type: "uint256" },
                  { internalType: "uint256", name: "stepSize", type: "uint256" }
                ],
                internalType: "struct PriceCurve",
                name: "bondingCurveParams",
                type: "tuple"
              },
              { internalType: "bool", name: "allowForcedGraduation", type: "bool" },
              { internalType: "bool", name: "allowAutoGraduation", type: "bool" },
              {
                internalType: "uint256",
                name: "graduationFeeBps",
                type: "uint256"
              },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "graduationFeeSplits",
                type: "tuple[]"
              },
              { internalType: "uint24", name: "poolFees", type: "uint24" },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "poolFeeSplits",
                type: "tuple[]"
              },
              {
                internalType: "uint256",
                name: "surgeFeeStartingTime",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "surgeFeeDuration",
                type: "uint256"
              },
              { internalType: "uint256", name: "maxSurgeFeeBps", type: "uint256" }
            ],
            indexed: false,
            internalType: "struct StateManager.TokenDeploymentConfig",
            name: "config",
            type: "tuple"
          }
        ],
        name: "TokenLaunched",
        type: "event"
      },
      {
        anonymous: false,
        inputs: [
          {
            indexed: true,
            internalType: "address",
            name: "token",
            type: "address"
          }
        ],
        name: "TokenReadyForGraduation",
        type: "event"
      },
      {
        inputs: [],
        name: "PROTOCOL_FEE_SHARE",
        outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "acceptOwnership",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "", type: "address" }],
        name: "bondingCurveFeeAccumulated",
        outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "buyer", type: "address" },
          { internalType: "address", name: "token", type: "address" },
          { internalType: "uint256", name: "amountIn", type: "uint256" },
          { internalType: "uint256", name: "amountOutMin", type: "uint256" },
          { internalType: "address", name: "to", type: "address" }
        ],
        name: "buyToken",
        outputs: [
          { internalType: "uint256", name: "", type: "uint256" },
          { internalType: "bool", name: "", type: "bool" }
        ],
        stateMutability: "payable",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "claimFee",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "getAutoGraduationParams",
        outputs: [
          { internalType: "int24", name: "tickSpacing", type: "int24" },
          { internalType: "int24", name: "startingTick", type: "int24" },
          { internalType: "int24", name: "endTick", type: "int24" },
          { internalType: "int24", name: "targetTick", type: "int24" },
          { internalType: "uint24", name: "poolFee", type: "uint24" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "getBaseToken",
        outputs: [{ internalType: "address", name: "", type: "address" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "token", type: "address" },
          { internalType: "uint256", name: "amountIn", type: "uint256" }
        ],
        name: "getBuyQuote",
        outputs: [
          { internalType: "uint256", name: "", type: "uint256" },
          { internalType: "uint256", name: "", type: "uint256" },
          { internalType: "uint256", name: "", type: "uint256" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "getPoolKey",
        outputs: [
          {
            components: [
              { internalType: "Currency", name: "currency0", type: "address" },
              { internalType: "Currency", name: "currency1", type: "address" },
              { internalType: "uint24", name: "fee", type: "uint24" },
              { internalType: "int24", name: "tickSpacing", type: "int24" },
              { internalType: "contract IHooks", name: "hooks", type: "address" }
            ],
            internalType: "struct PoolKey",
            name: "",
            type: "tuple"
          }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "token", type: "address" },
          { internalType: "uint256", name: "amountIn", type: "uint256" }
        ],
        name: "getSellQuote",
        outputs: [
          { internalType: "uint256", name: "", type: "uint256" },
          { internalType: "uint256", name: "", type: "uint256" },
          { internalType: "uint256", name: "", type: "uint256" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [
          {
            components: [
              { internalType: "address", name: "creator", type: "address" },
              { internalType: "address", name: "baseToken", type: "address" },
              { internalType: "string", name: "name", type: "string" },
              { internalType: "string", name: "symbol", type: "string" },
              { internalType: "string", name: "image", type: "string" },
              { internalType: "string", name: "appIdentifier", type: "string" },
              { internalType: "uint256", name: "teamSupply", type: "uint256" },
              { internalType: "uint64", name: "vestingStartTime", type: "uint64" },
              { internalType: "uint64", name: "vestingDuration", type: "uint64" },
              { internalType: "address", name: "vestingWallet", type: "address" },
              {
                internalType: "uint256",
                name: "bondingCurveSupply",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "liquidityPoolSupply",
                type: "uint256"
              },
              { internalType: "uint256", name: "totalSupply", type: "uint256" },
              {
                internalType: "uint256",
                name: "bondingCurveBuyFee",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "bondingCurveSellFee",
                type: "uint256"
              },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "bondingCurveFeeSplits",
                type: "tuple[]"
              },
              {
                components: [
                  { internalType: "uint256[]", name: "prices", type: "uint256[]" },
                  { internalType: "uint256", name: "numSteps", type: "uint256" },
                  { internalType: "uint256", name: "stepSize", type: "uint256" }
                ],
                internalType: "struct PriceCurve",
                name: "bondingCurveParams",
                type: "tuple"
              },
              { internalType: "bool", name: "allowForcedGraduation", type: "bool" },
              { internalType: "bool", name: "allowAutoGraduation", type: "bool" },
              {
                internalType: "uint256",
                name: "graduationFeeBps",
                type: "uint256"
              },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "graduationFeeSplits",
                type: "tuple[]"
              },
              { internalType: "uint24", name: "poolFees", type: "uint24" },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "poolFeeSplits",
                type: "tuple[]"
              },
              {
                internalType: "uint256",
                name: "surgeFeeStartingTime",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "surgeFeeDuration",
                type: "uint256"
              },
              { internalType: "uint256", name: "maxSurgeFeeBps", type: "uint256" }
            ],
            internalType: "struct StateManager.TokenDeploymentConfig",
            name: "config",
            type: "tuple"
          }
        ],
        name: "getSurgeFee",
        outputs: [{ internalType: "uint256", name: "fee", type: "uint256" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "getTokenDeploymentConfig",
        outputs: [
          {
            components: [
              { internalType: "address", name: "creator", type: "address" },
              { internalType: "address", name: "baseToken", type: "address" },
              { internalType: "string", name: "name", type: "string" },
              { internalType: "string", name: "symbol", type: "string" },
              { internalType: "string", name: "image", type: "string" },
              { internalType: "string", name: "appIdentifier", type: "string" },
              { internalType: "uint256", name: "teamSupply", type: "uint256" },
              { internalType: "uint64", name: "vestingStartTime", type: "uint64" },
              { internalType: "uint64", name: "vestingDuration", type: "uint64" },
              { internalType: "address", name: "vestingWallet", type: "address" },
              {
                internalType: "uint256",
                name: "bondingCurveSupply",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "liquidityPoolSupply",
                type: "uint256"
              },
              { internalType: "uint256", name: "totalSupply", type: "uint256" },
              {
                internalType: "uint256",
                name: "bondingCurveBuyFee",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "bondingCurveSellFee",
                type: "uint256"
              },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "bondingCurveFeeSplits",
                type: "tuple[]"
              },
              {
                components: [
                  { internalType: "uint256[]", name: "prices", type: "uint256[]" },
                  { internalType: "uint256", name: "numSteps", type: "uint256" },
                  { internalType: "uint256", name: "stepSize", type: "uint256" }
                ],
                internalType: "struct PriceCurve",
                name: "bondingCurveParams",
                type: "tuple"
              },
              { internalType: "bool", name: "allowForcedGraduation", type: "bool" },
              { internalType: "bool", name: "allowAutoGraduation", type: "bool" },
              {
                internalType: "uint256",
                name: "graduationFeeBps",
                type: "uint256"
              },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "graduationFeeSplits",
                type: "tuple[]"
              },
              { internalType: "uint24", name: "poolFees", type: "uint24" },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "poolFeeSplits",
                type: "tuple[]"
              },
              {
                internalType: "uint256",
                name: "surgeFeeStartingTime",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "surgeFeeDuration",
                type: "uint256"
              },
              { internalType: "uint256", name: "maxSurgeFeeBps", type: "uint256" }
            ],
            internalType: "struct StateManager.TokenDeploymentConfig",
            name: "",
            type: "tuple"
          }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "getTokenPrice",
        outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "getTokenState",
        outputs: [
          {
            components: [
              { internalType: "bool", name: "isGraduated", type: "bool" },
              {
                internalType: "uint256",
                name: "tokensInBondingCurve",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "baseTokensInBondingCurve",
                type: "uint256"
              },
              { internalType: "address", name: "poolAddress", type: "address" },
              { internalType: "uint256", name: "uniswapTokenId", type: "uint256" }
            ],
            internalType: "struct StateManager.TokenState",
            name: "",
            type: "tuple"
          }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "getTokenSupply",
        outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "token", type: "address" },
          { internalType: "bool", name: "allowPreGraduation", type: "bool" }
        ],
        name: "graduateToken",
        outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "isGraduated",
        outputs: [{ internalType: "bool", name: "", type: "bool" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "token", type: "address" },
          { internalType: "int24", name: "tickSpacing", type: "int24" },
          { internalType: "int24", name: "startingTick", type: "int24" },
          { internalType: "int24", name: "endingTick", type: "int24" },
          { internalType: "int24", name: "targetTick", type: "int24" },
          { internalType: "bool", name: "allowPreGraduation", type: "bool" }
        ],
        name: "launchV4Pool",
        outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [],
        name: "owner",
        outputs: [{ internalType: "address", name: "", type: "address" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "pendingOwner",
        outputs: [{ internalType: "address", name: "", type: "address" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "permit2",
        outputs: [{ internalType: "contract IPermit2", name: "", type: "address" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "poolFeeSplits",
        outputs: [
          {
            components: [
              { internalType: "address", name: "recipient", type: "address" },
              { internalType: "uint256", name: "bps", type: "uint256" }
            ],
            internalType: "struct FeeSplit[]",
            name: "",
            type: "tuple[]"
          }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "", type: "address" }],
        name: "poolKeys",
        outputs: [
          { internalType: "Currency", name: "currency0", type: "address" },
          { internalType: "Currency", name: "currency1", type: "address" },
          { internalType: "uint24", name: "fee", type: "uint24" },
          { internalType: "int24", name: "tickSpacing", type: "int24" },
          { internalType: "contract IHooks", name: "hooks", type: "address" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "positionManager",
        outputs: [
          { internalType: "contract IPositionManager", name: "", type: "address" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "protocolFeeRecipient",
        outputs: [{ internalType: "address", name: "", type: "address" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "renounceOwnership",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "buyer", type: "address" },
          { internalType: "address", name: "token", type: "address" },
          { internalType: "uint256", name: "amountIn", type: "uint256" },
          { internalType: "uint256", name: "amountOutMin", type: "uint256" },
          { internalType: "address", name: "to", type: "address" }
        ],
        name: "sellToken",
        outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [
          {
            internalType: "address",
            name: "_protocolFeeRecipient",
            type: "address"
          }
        ],
        name: "setProtocolFeeRecipient",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "token", type: "address" },
          {
            components: [
              { internalType: "address", name: "creator", type: "address" },
              { internalType: "address", name: "baseToken", type: "address" },
              { internalType: "string", name: "name", type: "string" },
              { internalType: "string", name: "symbol", type: "string" },
              { internalType: "string", name: "image", type: "string" },
              { internalType: "string", name: "appIdentifier", type: "string" },
              { internalType: "uint256", name: "teamSupply", type: "uint256" },
              { internalType: "uint64", name: "vestingStartTime", type: "uint64" },
              { internalType: "uint64", name: "vestingDuration", type: "uint64" },
              { internalType: "address", name: "vestingWallet", type: "address" },
              {
                internalType: "uint256",
                name: "bondingCurveSupply",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "liquidityPoolSupply",
                type: "uint256"
              },
              { internalType: "uint256", name: "totalSupply", type: "uint256" },
              {
                internalType: "uint256",
                name: "bondingCurveBuyFee",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "bondingCurveSellFee",
                type: "uint256"
              },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "bondingCurveFeeSplits",
                type: "tuple[]"
              },
              {
                components: [
                  { internalType: "uint256[]", name: "prices", type: "uint256[]" },
                  { internalType: "uint256", name: "numSteps", type: "uint256" },
                  { internalType: "uint256", name: "stepSize", type: "uint256" }
                ],
                internalType: "struct PriceCurve",
                name: "bondingCurveParams",
                type: "tuple"
              },
              { internalType: "bool", name: "allowForcedGraduation", type: "bool" },
              { internalType: "bool", name: "allowAutoGraduation", type: "bool" },
              {
                internalType: "uint256",
                name: "graduationFeeBps",
                type: "uint256"
              },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "graduationFeeSplits",
                type: "tuple[]"
              },
              { internalType: "uint24", name: "poolFees", type: "uint24" },
              {
                components: [
                  { internalType: "address", name: "recipient", type: "address" },
                  { internalType: "uint256", name: "bps", type: "uint256" }
                ],
                internalType: "struct FeeSplit[]",
                name: "poolFeeSplits",
                type: "tuple[]"
              },
              {
                internalType: "uint256",
                name: "surgeFeeStartingTime",
                type: "uint256"
              },
              {
                internalType: "uint256",
                name: "surgeFeeDuration",
                type: "uint256"
              },
              { internalType: "uint256", name: "maxSurgeFeeBps", type: "uint256" }
            ],
            internalType: "struct StateManager.TokenDeploymentConfig",
            name: "config",
            type: "tuple"
          }
        ],
        name: "setTokenDeploymentConfig",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "_tokenIdRecipient", type: "address" }
        ],
        name: "setTokenIdRecipient",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [],
        name: "stateView",
        outputs: [
          { internalType: "contract IStateView", name: "", type: "address" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "", type: "address" }],
        name: "tokenDeploymentConfigs",
        outputs: [
          { internalType: "address", name: "creator", type: "address" },
          { internalType: "address", name: "baseToken", type: "address" },
          { internalType: "string", name: "name", type: "string" },
          { internalType: "string", name: "symbol", type: "string" },
          { internalType: "string", name: "image", type: "string" },
          { internalType: "string", name: "appIdentifier", type: "string" },
          { internalType: "uint256", name: "teamSupply", type: "uint256" },
          { internalType: "uint64", name: "vestingStartTime", type: "uint64" },
          { internalType: "uint64", name: "vestingDuration", type: "uint64" },
          { internalType: "address", name: "vestingWallet", type: "address" },
          { internalType: "uint256", name: "bondingCurveSupply", type: "uint256" },
          { internalType: "uint256", name: "liquidityPoolSupply", type: "uint256" },
          { internalType: "uint256", name: "totalSupply", type: "uint256" },
          { internalType: "uint256", name: "bondingCurveBuyFee", type: "uint256" },
          { internalType: "uint256", name: "bondingCurveSellFee", type: "uint256" },
          {
            components: [
              { internalType: "uint256[]", name: "prices", type: "uint256[]" },
              { internalType: "uint256", name: "numSteps", type: "uint256" },
              { internalType: "uint256", name: "stepSize", type: "uint256" }
            ],
            internalType: "struct PriceCurve",
            name: "bondingCurveParams",
            type: "tuple"
          },
          { internalType: "bool", name: "allowForcedGraduation", type: "bool" },
          { internalType: "bool", name: "allowAutoGraduation", type: "bool" },
          { internalType: "uint256", name: "graduationFeeBps", type: "uint256" },
          { internalType: "uint24", name: "poolFees", type: "uint24" },
          {
            internalType: "uint256",
            name: "surgeFeeStartingTime",
            type: "uint256"
          },
          { internalType: "uint256", name: "surgeFeeDuration", type: "uint256" },
          { internalType: "uint256", name: "maxSurgeFeeBps", type: "uint256" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "tokenIdRecipient",
        outputs: [{ internalType: "address", name: "", type: "address" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "", type: "address" }],
        name: "tokenStates",
        outputs: [
          { internalType: "bool", name: "isGraduated", type: "bool" },
          {
            internalType: "uint256",
            name: "tokensInBondingCurve",
            type: "uint256"
          },
          {
            internalType: "uint256",
            name: "baseTokensInBondingCurve",
            type: "uint256"
          },
          { internalType: "address", name: "poolAddress", type: "address" },
          { internalType: "uint256", name: "uniswapTokenId", type: "uint256" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
        name: "transferOwnership",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      }
    ];
  }
});

// src/abis/v2/lp-locker-abi.ts
var LP_LOCKER_ABI;
var init_lp_locker_abi = __esm({
  "src/abis/v2/lp-locker-abi.ts"() {
    "use strict";
    LP_LOCKER_ABI = [
      {
        inputs: [
          { internalType: "address", name: "_positionManager", type: "address" },
          { internalType: "address", name: "_stateView", type: "address" },
          { internalType: "address", name: "_owner", type: "address" }
        ],
        stateMutability: "nonpayable",
        type: "constructor"
      },
      {
        inputs: [{ internalType: "address", name: "owner", type: "address" }],
        name: "OwnableInvalidOwner",
        type: "error"
      },
      {
        inputs: [{ internalType: "address", name: "account", type: "address" }],
        name: "OwnableUnauthorizedAccount",
        type: "error"
      },
      { inputs: [], name: "TokenNotSet", type: "error" },
      {
        anonymous: false,
        inputs: [
          {
            indexed: true,
            internalType: "address",
            name: "previousOwner",
            type: "address"
          },
          {
            indexed: true,
            internalType: "address",
            name: "newOwner",
            type: "address"
          }
        ],
        name: "OwnershipTransferStarted",
        type: "event"
      },
      {
        anonymous: false,
        inputs: [
          {
            indexed: true,
            internalType: "address",
            name: "previousOwner",
            type: "address"
          },
          {
            indexed: true,
            internalType: "address",
            name: "newOwner",
            type: "address"
          }
        ],
        name: "OwnershipTransferred",
        type: "event"
      },
      {
        inputs: [],
        name: "acceptOwnership",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "collectFees",
        outputs: [
          { internalType: "uint256", name: "baseTokenFee", type: "uint256" },
          { internalType: "uint256", name: "tokenFee", type: "uint256" }
        ],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "computeUnclaimedFees",
        outputs: [
          { internalType: "uint256", name: "fee0", type: "uint256" },
          { internalType: "uint256", name: "fee1", type: "uint256" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "getSqrtPriceX96",
        outputs: [{ internalType: "uint160", name: "", type: "uint160" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "token", type: "address" }],
        name: "getTokenParams",
        outputs: [
          { internalType: "uint256", name: "poolTokenId", type: "uint256" },
          { internalType: "address", name: "baseToken", type: "address" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "owner",
        outputs: [{ internalType: "address", name: "", type: "address" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "pendingOwner",
        outputs: [{ internalType: "address", name: "", type: "address" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "positionManager",
        outputs: [
          { internalType: "contract IPositionManager", name: "", type: "address" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [],
        name: "renounceOwnership",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [
          { internalType: "address", name: "token", type: "address" },
          { internalType: "uint256", name: "poolTokenId", type: "uint256" },
          { internalType: "address", name: "baseToken", type: "address" }
        ],
        name: "setTokenParams",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      },
      {
        inputs: [],
        name: "stateView",
        outputs: [
          { internalType: "contract IStateView", name: "", type: "address" }
        ],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "", type: "address" }],
        name: "tokenToBaseToken",
        outputs: [{ internalType: "address", name: "", type: "address" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "", type: "address" }],
        name: "tokenToPoolTokenId",
        outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
        stateMutability: "view",
        type: "function"
      },
      {
        inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
        name: "transferOwnership",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function"
      }
    ];
  }
});

// src/abis/v3/deployer-abi.ts
var DEPLOYER_ABI2;
var init_deployer_abi2 = __esm({
  "src/abis/v3/deployer-abi.ts"() {
    "use strict";
    DEPLOYER_ABI2 = [
      {
        type: "constructor",
        inputs: [
          {
            name: "_stateView",
            type: "address",
            internalType: "address"
          },
          {
            name: "_lplocker",
            type: "address",
            internalType: "address"
          },
          {
            name: "_universalRouter",
            type: "address",
            internalType: "address"
          },
          {
            name: "_permit2",
            type: "address",
            internalType: "address"
          },
          {
            name: "_poolManager",
            type: "address",
            internalType: "address"
          },
          {
            name: "_quoter",
            type: "address",
            internalType: "address"
          },
          {
            name: "_owner",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "nonpayable"
      },
      {
        type: "receive",
        stateMutability: "payable"
      },
      {
        type: "function",
        name: "MIN_VESTING_START_TIME",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "uint64",
            internalType: "uint64"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "_validateTokenDeploymentConfig",
        inputs: [
          {
            name: "tokenDeploymentConfig",
            type: "tuple",
            internalType: "struct TokenDeploymentConfig",
            components: [
              {
                name: "creator",
                type: "address",
                internalType: "address"
              },
              {
                name: "baseToken",
                type: "address",
                internalType: "address"
              },
              {
                name: "name",
                type: "string",
                internalType: "string"
              },
              {
                name: "symbol",
                type: "string",
                internalType: "string"
              },
              {
                name: "image",
                type: "string",
                internalType: "string"
              },
              {
                name: "appIdentifier",
                type: "string",
                internalType: "string"
              },
              {
                name: "teamSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "vestingStartTime",
                type: "uint64",
                internalType: "uint64"
              },
              {
                name: "vestingDuration",
                type: "uint64",
                internalType: "uint64"
              },
              {
                name: "vestingWallet",
                type: "address",
                internalType: "address"
              },
              {
                name: "bondingCurveSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "liquidityPoolSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "totalSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveBuyFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveSellFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "bondingCurveParams",
                type: "tuple",
                internalType: "struct PriceCurve",
                components: [
                  {
                    name: "prices",
                    type: "uint256[]",
                    internalType: "uint256[]"
                  },
                  {
                    name: "numSteps",
                    type: "uint256",
                    internalType: "uint256"
                  },
                  {
                    name: "stepSize",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "allowForcedGraduation",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "allowAutoGraduation",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "graduationFeeBps",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "graduationFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "poolFees",
                type: "uint24",
                internalType: "uint24"
              },
              {
                name: "poolFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "surgeFeeStartingTime",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "surgeFeeDuration",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "maxSurgeFeeBps",
                type: "uint256",
                internalType: "uint256"
              }
            ]
          },
          {
            name: "salt",
            type: "bytes32",
            internalType: "bytes32"
          }
        ],
        outputs: [],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "acceptOwnership",
        inputs: [],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "appIdentifiers",
        inputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "string",
            internalType: "string"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "buyQuote",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "amountIn",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "buyToken",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "amountIn",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "amountOutMin",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "to",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [],
        stateMutability: "payable"
      },
      {
        type: "function",
        name: "claimFee",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "emergencyEjectToken",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "to",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "finalizeEmergencyRescue",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "uniswapTokenId",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "poolKey",
            type: "tuple",
            internalType: "struct PoolKey",
            components: [
              {
                name: "currency0",
                type: "address",
                internalType: "Currency"
              },
              {
                name: "currency1",
                type: "address",
                internalType: "Currency"
              },
              {
                name: "fee",
                type: "uint24",
                internalType: "uint24"
              },
              {
                name: "tickSpacing",
                type: "int24",
                internalType: "int24"
              },
              {
                name: "hooks",
                type: "address",
                internalType: "contract IHooks"
              }
            ]
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "getTokenPrice",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "graduateToken",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "allowPreGraduation",
            type: "bool",
            internalType: "bool"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "isBaseTokenWhitelisted",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "bool",
            internalType: "bool"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "launchToken",
        inputs: [
          {
            name: "tokenDeploymentConfig",
            type: "tuple",
            internalType: "struct TokenDeploymentConfig",
            components: [
              {
                name: "creator",
                type: "address",
                internalType: "address"
              },
              {
                name: "baseToken",
                type: "address",
                internalType: "address"
              },
              {
                name: "name",
                type: "string",
                internalType: "string"
              },
              {
                name: "symbol",
                type: "string",
                internalType: "string"
              },
              {
                name: "image",
                type: "string",
                internalType: "string"
              },
              {
                name: "appIdentifier",
                type: "string",
                internalType: "string"
              },
              {
                name: "teamSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "vestingStartTime",
                type: "uint64",
                internalType: "uint64"
              },
              {
                name: "vestingDuration",
                type: "uint64",
                internalType: "uint64"
              },
              {
                name: "vestingWallet",
                type: "address",
                internalType: "address"
              },
              {
                name: "bondingCurveSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "liquidityPoolSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "totalSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveBuyFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveSellFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "bondingCurveParams",
                type: "tuple",
                internalType: "struct PriceCurve",
                components: [
                  {
                    name: "prices",
                    type: "uint256[]",
                    internalType: "uint256[]"
                  },
                  {
                    name: "numSteps",
                    type: "uint256",
                    internalType: "uint256"
                  },
                  {
                    name: "stepSize",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "allowForcedGraduation",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "allowAutoGraduation",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "graduationFeeBps",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "graduationFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "poolFees",
                type: "uint24",
                internalType: "uint24"
              },
              {
                name: "poolFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "surgeFeeStartingTime",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "surgeFeeDuration",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "maxSurgeFeeBps",
                type: "uint256",
                internalType: "uint256"
              }
            ]
          },
          {
            name: "salt",
            type: "bytes32",
            internalType: "bytes32"
          }
        ],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "launchV4Pool",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "tickSpacing",
            type: "int24",
            internalType: "int24"
          },
          {
            name: "startingTick",
            type: "int24",
            internalType: "int24"
          },
          {
            name: "endingTick",
            type: "int24",
            internalType: "int24"
          },
          {
            name: "targetTick",
            type: "int24",
            internalType: "int24"
          },
          {
            name: "allowPreGraduation",
            type: "bool",
            internalType: "bool"
          }
        ],
        outputs: [
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "lplocker",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "contract ILpLockerWithOwnable"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "owner",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "pendingOwner",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "permit2",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "contract IPermit2"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "poolManager",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "contract IPoolManager"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "predictTokenAddress",
        inputs: [
          {
            name: "owner",
            type: "address",
            internalType: "address"
          },
          {
            name: "salt",
            type: "bytes32",
            internalType: "bytes32"
          }
        ],
        outputs: [
          {
            name: "addr",
            type: "address",
            internalType: "address"
          },
          {
            name: "exists",
            type: "bool",
            internalType: "bool"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "quoter",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "contract IV4Quoter"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "relinquishStateManager",
        inputs: [],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "renounceOwnership",
        inputs: [],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "sellQuote",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "amountIn",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "sellToken",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "amountIn",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "amountOutMin",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "to",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "setAppIdentifier",
        inputs: [
          {
            name: "creator",
            type: "address",
            internalType: "address"
          },
          {
            name: "appIdentifier",
            type: "string",
            internalType: "string"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "setBaseTokenWhitelist",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "whitelisted",
            type: "bool",
            internalType: "bool"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "setProtocolFeeRecipient",
        inputs: [
          {
            name: "_protocolFeeRecipient",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "stateManager",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "contract StateManager"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "transferOwnership",
        inputs: [
          {
            name: "newOwner",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "universalRouter",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "contract IUniversalRouter"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "updateTokenFeeSplits",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "feeUpdate",
            type: "tuple",
            internalType: "struct Deployer.TokenFeeUpdate",
            components: [
              {
                name: "bondingCurveBuyFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveSellFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "graduationFeeBps",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "graduationFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "poolFees",
                type: "uint24",
                internalType: "uint24"
              },
              {
                name: "poolFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              }
            ]
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "whitelistedBaseTokens",
        inputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "bool",
            internalType: "bool"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "withdrawFunds",
        inputs: [
          {
            name: "destination",
            type: "address",
            internalType: "address"
          },
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "event",
        name: "BaseTokenWhitelisted",
        inputs: [
          {
            name: "token",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "whitelisted",
            type: "bool",
            indexed: false,
            internalType: "bool"
          }
        ],
        anonymous: false
      },
      {
        type: "event",
        name: "OwnershipTransferStarted",
        inputs: [
          {
            name: "previousOwner",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "newOwner",
            type: "address",
            indexed: true,
            internalType: "address"
          }
        ],
        anonymous: false
      },
      {
        type: "event",
        name: "OwnershipTransferred",
        inputs: [
          {
            name: "previousOwner",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "newOwner",
            type: "address",
            indexed: true,
            internalType: "address"
          }
        ],
        anonymous: false
      },
      {
        type: "event",
        name: "FeeClaimed",
        inputs: [
          {
            name: "token",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "recipient",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "feeToken",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "amount",
            type: "uint256",
            indexed: false,
            internalType: "uint256"
          },
          {
            name: "graduated",
            type: "bool",
            indexed: false,
            internalType: "bool"
          }
        ],
        anonymous: false
      },
      {
        type: "error",
        name: "BothTokensLaunched",
        inputs: []
      },
      {
        type: "error",
        name: "ETHBalanceTooLowForSwap",
        inputs: []
      },
      {
        type: "error",
        name: "ETHTransferFailed",
        inputs: []
      },
      {
        type: "error",
        name: "IncorrectETHAmount",
        inputs: []
      },
      {
        type: "error",
        name: "InsufficientOutputAmount",
        inputs: []
      },
      {
        type: "error",
        name: "InvalidBaseToken",
        inputs: []
      },
      {
        type: "error",
        name: "InvalidCaller",
        inputs: []
      },
      {
        type: "error",
        name: "InvalidCurveParameters",
        inputs: []
      },
      {
        type: "error",
        name: "InvalidTokenDetails",
        inputs: []
      },
      {
        type: "error",
        name: "OwnableInvalidOwner",
        inputs: [
          {
            name: "owner",
            type: "address",
            internalType: "address"
          }
        ]
      },
      {
        type: "error",
        name: "OwnableUnauthorizedAccount",
        inputs: [
          {
            name: "account",
            type: "address",
            internalType: "address"
          }
        ]
      },
      {
        type: "error",
        name: "QuoteAmount",
        inputs: [
          {
            name: "amountOut",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "effectiveAmountIn",
            type: "uint256",
            internalType: "uint256"
          }
        ]
      },
      {
        type: "error",
        name: "QuoteNotImplemented",
        inputs: []
      },
      {
        type: "error",
        name: "Reentrancy",
        inputs: []
      },
      {
        type: "error",
        name: "TokenAlreadyLaunched",
        inputs: []
      },
      {
        type: "error",
        name: "TokenNotLaunched",
        inputs: []
      },
      {
        type: "error",
        name: "TokenStateNotSet",
        inputs: []
      }
    ];
  }
});

// src/abis/v3/lp-locker-abi.ts
var LP_LOCKER_ABI2;
var init_lp_locker_abi2 = __esm({
  "src/abis/v3/lp-locker-abi.ts"() {
    "use strict";
    LP_LOCKER_ABI2 = [
      {
        type: "constructor",
        inputs: [
          {
            name: "_positionManager",
            type: "address",
            internalType: "address"
          },
          {
            name: "_stateView",
            type: "address",
            internalType: "address"
          },
          {
            name: "_owner",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "acceptOwnership",
        inputs: [],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "collectFees",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "baseTokenFee",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "tokenFee",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "computeUnclaimedFees",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "fee0",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "fee1",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "getSqrtPriceX96",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "uint160",
            internalType: "uint160"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "getTokenParams",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "poolTokenId",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "baseToken",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "owner",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "pendingOwner",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "positionManager",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "contract IPositionManager"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "renounceOwnership",
        inputs: [],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "setTokenParams",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "poolTokenId",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "baseToken",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "stateView",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "contract IStateView"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "tokenToBaseToken",
        inputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "tokenToPoolTokenId",
        inputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "transferOwnership",
        inputs: [
          {
            name: "newOwner",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "event",
        name: "OwnershipTransferStarted",
        inputs: [
          {
            name: "previousOwner",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "newOwner",
            type: "address",
            indexed: true,
            internalType: "address"
          }
        ],
        anonymous: false
      },
      {
        type: "event",
        name: "OwnershipTransferred",
        inputs: [
          {
            name: "previousOwner",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "newOwner",
            type: "address",
            indexed: true,
            internalType: "address"
          }
        ],
        anonymous: false
      },
      {
        type: "error",
        name: "OwnableInvalidOwner",
        inputs: [
          {
            name: "owner",
            type: "address",
            internalType: "address"
          }
        ]
      },
      {
        type: "error",
        name: "OwnableUnauthorizedAccount",
        inputs: [
          {
            name: "account",
            type: "address",
            internalType: "address"
          }
        ]
      },
      {
        type: "error",
        name: "TokenNotSet",
        inputs: []
      }
    ];
  }
});

// src/abis/v3/statemanager-abi.ts
var STATEMANAGER_ABI2;
var init_statemanager_abi2 = __esm({
  "src/abis/v3/statemanager-abi.ts"() {
    "use strict";
    STATEMANAGER_ABI2 = [
      {
        type: "constructor",
        inputs: [
          {
            name: "initialOwner",
            type: "address",
            internalType: "address"
          },
          {
            name: "permit2Address",
            type: "address",
            internalType: "address"
          },
          {
            name: "_positionManager",
            type: "address",
            internalType: "address"
          },
          {
            name: "_stateView",
            type: "address",
            internalType: "address"
          },
          {
            name: "_protocolFeeRecipient",
            type: "address",
            internalType: "address"
          },
          {
            name: "_tokenIdRecipient",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "PROTOCOL_FEE_SHARE",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "acceptOwnership",
        inputs: [],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "bondingCurveFeeAccumulated",
        inputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "buyToken",
        inputs: [
          {
            name: "buyer",
            type: "address",
            internalType: "address"
          },
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "amountIn",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "amountOutMin",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "to",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "",
            type: "bool",
            internalType: "bool"
          }
        ],
        stateMutability: "payable"
      },
      {
        type: "function",
        name: "claimFee",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "emergencyEject",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "to",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "finalizeEmergencyRescue",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "uniswapTokenId",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "poolKey",
            type: "tuple",
            internalType: "struct PoolKey",
            components: [
              {
                name: "currency0",
                type: "address",
                internalType: "Currency"
              },
              {
                name: "currency1",
                type: "address",
                internalType: "Currency"
              },
              {
                name: "fee",
                type: "uint24",
                internalType: "uint24"
              },
              {
                name: "tickSpacing",
                type: "int24",
                internalType: "int24"
              },
              {
                name: "hooks",
                type: "address",
                internalType: "contract IHooks"
              }
            ]
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "getAutoGraduationParams",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "tickSpacing",
            type: "int24",
            internalType: "int24"
          },
          {
            name: "startingTick",
            type: "int24",
            internalType: "int24"
          },
          {
            name: "endTick",
            type: "int24",
            internalType: "int24"
          },
          {
            name: "targetTick",
            type: "int24",
            internalType: "int24"
          },
          {
            name: "poolFee",
            type: "uint24",
            internalType: "uint24"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "getBaseToken",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "getBuyQuote",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "amountIn",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        outputs: [
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "getPoolKey",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "tuple",
            internalType: "struct PoolKey",
            components: [
              {
                name: "currency0",
                type: "address",
                internalType: "Currency"
              },
              {
                name: "currency1",
                type: "address",
                internalType: "Currency"
              },
              {
                name: "fee",
                type: "uint24",
                internalType: "uint24"
              },
              {
                name: "tickSpacing",
                type: "int24",
                internalType: "int24"
              },
              {
                name: "hooks",
                type: "address",
                internalType: "contract IHooks"
              }
            ]
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "getSellQuote",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "amountIn",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        outputs: [
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "getSurgeFee",
        inputs: [
          {
            name: "config",
            type: "tuple",
            internalType: "struct TokenDeploymentConfig",
            components: [
              {
                name: "creator",
                type: "address",
                internalType: "address"
              },
              {
                name: "baseToken",
                type: "address",
                internalType: "address"
              },
              {
                name: "name",
                type: "string",
                internalType: "string"
              },
              {
                name: "symbol",
                type: "string",
                internalType: "string"
              },
              {
                name: "image",
                type: "string",
                internalType: "string"
              },
              {
                name: "appIdentifier",
                type: "string",
                internalType: "string"
              },
              {
                name: "teamSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "vestingStartTime",
                type: "uint64",
                internalType: "uint64"
              },
              {
                name: "vestingDuration",
                type: "uint64",
                internalType: "uint64"
              },
              {
                name: "vestingWallet",
                type: "address",
                internalType: "address"
              },
              {
                name: "bondingCurveSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "liquidityPoolSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "totalSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveBuyFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveSellFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "bondingCurveParams",
                type: "tuple",
                internalType: "struct PriceCurve",
                components: [
                  {
                    name: "prices",
                    type: "uint256[]",
                    internalType: "uint256[]"
                  },
                  {
                    name: "numSteps",
                    type: "uint256",
                    internalType: "uint256"
                  },
                  {
                    name: "stepSize",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "allowForcedGraduation",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "allowAutoGraduation",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "graduationFeeBps",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "graduationFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "poolFees",
                type: "uint24",
                internalType: "uint24"
              },
              {
                name: "poolFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "surgeFeeStartingTime",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "surgeFeeDuration",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "maxSurgeFeeBps",
                type: "uint256",
                internalType: "uint256"
              }
            ]
          }
        ],
        outputs: [
          {
            name: "fee",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "getTokenDeploymentConfig",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "tuple",
            internalType: "struct TokenDeploymentConfig",
            components: [
              {
                name: "creator",
                type: "address",
                internalType: "address"
              },
              {
                name: "baseToken",
                type: "address",
                internalType: "address"
              },
              {
                name: "name",
                type: "string",
                internalType: "string"
              },
              {
                name: "symbol",
                type: "string",
                internalType: "string"
              },
              {
                name: "image",
                type: "string",
                internalType: "string"
              },
              {
                name: "appIdentifier",
                type: "string",
                internalType: "string"
              },
              {
                name: "teamSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "vestingStartTime",
                type: "uint64",
                internalType: "uint64"
              },
              {
                name: "vestingDuration",
                type: "uint64",
                internalType: "uint64"
              },
              {
                name: "vestingWallet",
                type: "address",
                internalType: "address"
              },
              {
                name: "bondingCurveSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "liquidityPoolSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "totalSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveBuyFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveSellFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "bondingCurveParams",
                type: "tuple",
                internalType: "struct PriceCurve",
                components: [
                  {
                    name: "prices",
                    type: "uint256[]",
                    internalType: "uint256[]"
                  },
                  {
                    name: "numSteps",
                    type: "uint256",
                    internalType: "uint256"
                  },
                  {
                    name: "stepSize",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "allowForcedGraduation",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "allowAutoGraduation",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "graduationFeeBps",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "graduationFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "poolFees",
                type: "uint24",
                internalType: "uint24"
              },
              {
                name: "poolFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "surgeFeeStartingTime",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "surgeFeeDuration",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "maxSurgeFeeBps",
                type: "uint256",
                internalType: "uint256"
              }
            ]
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "getTokenPrice",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "getTokenState",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "tuple",
            internalType: "struct TokenState",
            components: [
              {
                name: "isGraduated",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "tokensInBondingCurve",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "baseTokensInBondingCurve",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "poolAddress",
                type: "address",
                internalType: "address"
              },
              {
                name: "uniswapTokenId",
                type: "uint256",
                internalType: "uint256"
              }
            ]
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "getTokenSupply",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "graduateToken",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "allowPreGraduation",
            type: "bool",
            internalType: "bool"
          }
        ],
        outputs: [
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "isGraduated",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "bool",
            internalType: "bool"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "launchV4Pool",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "tickSpacing",
            type: "int24",
            internalType: "int24"
          },
          {
            name: "startingTick",
            type: "int24",
            internalType: "int24"
          },
          {
            name: "endingTick",
            type: "int24",
            internalType: "int24"
          },
          {
            name: "targetTick",
            type: "int24",
            internalType: "int24"
          },
          {
            name: "allowPreGraduation",
            type: "bool",
            internalType: "bool"
          }
        ],
        outputs: [
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "owner",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "pendingOwner",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "permit2",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "contract IPermit2"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "poolFeeSplits",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "tuple[]",
            internalType: "struct FeeSplit[]",
            components: [
              {
                name: "recipient",
                type: "address",
                internalType: "address"
              },
              {
                name: "bps",
                type: "uint256",
                internalType: "uint256"
              }
            ]
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "poolKeys",
        inputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "currency0",
            type: "address",
            internalType: "Currency"
          },
          {
            name: "currency1",
            type: "address",
            internalType: "Currency"
          },
          {
            name: "fee",
            type: "uint24",
            internalType: "uint24"
          },
          {
            name: "tickSpacing",
            type: "int24",
            internalType: "int24"
          },
          {
            name: "hooks",
            type: "address",
            internalType: "contract IHooks"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "positionManager",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "contract IPositionManager"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "protocolFeeRecipient",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "renounceOwnership",
        inputs: [],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "sellToken",
        inputs: [
          {
            name: "buyer",
            type: "address",
            internalType: "address"
          },
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "amountIn",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "amountOutMin",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "to",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "setProtocolFeeRecipient",
        inputs: [
          {
            name: "_protocolFeeRecipient",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "setTokenDeploymentConfig",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "config",
            type: "tuple",
            internalType: "struct TokenDeploymentConfig",
            components: [
              {
                name: "creator",
                type: "address",
                internalType: "address"
              },
              {
                name: "baseToken",
                type: "address",
                internalType: "address"
              },
              {
                name: "name",
                type: "string",
                internalType: "string"
              },
              {
                name: "symbol",
                type: "string",
                internalType: "string"
              },
              {
                name: "image",
                type: "string",
                internalType: "string"
              },
              {
                name: "appIdentifier",
                type: "string",
                internalType: "string"
              },
              {
                name: "teamSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "vestingStartTime",
                type: "uint64",
                internalType: "uint64"
              },
              {
                name: "vestingDuration",
                type: "uint64",
                internalType: "uint64"
              },
              {
                name: "vestingWallet",
                type: "address",
                internalType: "address"
              },
              {
                name: "bondingCurveSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "liquidityPoolSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "totalSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveBuyFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveSellFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "bondingCurveParams",
                type: "tuple",
                internalType: "struct PriceCurve",
                components: [
                  {
                    name: "prices",
                    type: "uint256[]",
                    internalType: "uint256[]"
                  },
                  {
                    name: "numSteps",
                    type: "uint256",
                    internalType: "uint256"
                  },
                  {
                    name: "stepSize",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "allowForcedGraduation",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "allowAutoGraduation",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "graduationFeeBps",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "graduationFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "poolFees",
                type: "uint24",
                internalType: "uint24"
              },
              {
                name: "poolFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "surgeFeeStartingTime",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "surgeFeeDuration",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "maxSurgeFeeBps",
                type: "uint256",
                internalType: "uint256"
              }
            ]
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "setTokenIdRecipient",
        inputs: [
          {
            name: "_tokenIdRecipient",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "stateView",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "contract IStateView"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "tokenDeploymentConfigs",
        inputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "creator",
            type: "address",
            internalType: "address"
          },
          {
            name: "baseToken",
            type: "address",
            internalType: "address"
          },
          {
            name: "name",
            type: "string",
            internalType: "string"
          },
          {
            name: "symbol",
            type: "string",
            internalType: "string"
          },
          {
            name: "image",
            type: "string",
            internalType: "string"
          },
          {
            name: "appIdentifier",
            type: "string",
            internalType: "string"
          },
          {
            name: "teamSupply",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "vestingStartTime",
            type: "uint64",
            internalType: "uint64"
          },
          {
            name: "vestingDuration",
            type: "uint64",
            internalType: "uint64"
          },
          {
            name: "vestingWallet",
            type: "address",
            internalType: "address"
          },
          {
            name: "bondingCurveSupply",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "liquidityPoolSupply",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "totalSupply",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "bondingCurveBuyFee",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "bondingCurveSellFee",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "bondingCurveParams",
            type: "tuple",
            internalType: "struct PriceCurve",
            components: [
              {
                name: "prices",
                type: "uint256[]",
                internalType: "uint256[]"
              },
              {
                name: "numSteps",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "stepSize",
                type: "uint256",
                internalType: "uint256"
              }
            ]
          },
          {
            name: "allowForcedGraduation",
            type: "bool",
            internalType: "bool"
          },
          {
            name: "allowAutoGraduation",
            type: "bool",
            internalType: "bool"
          },
          {
            name: "graduationFeeBps",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "poolFees",
            type: "uint24",
            internalType: "uint24"
          },
          {
            name: "surgeFeeStartingTime",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "surgeFeeDuration",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "maxSurgeFeeBps",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "tokenIdRecipient",
        inputs: [],
        outputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "tokenStates",
        inputs: [
          {
            name: "",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [
          {
            name: "isGraduated",
            type: "bool",
            internalType: "bool"
          },
          {
            name: "tokensInBondingCurve",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "baseTokensInBondingCurve",
            type: "uint256",
            internalType: "uint256"
          },
          {
            name: "poolAddress",
            type: "address",
            internalType: "address"
          },
          {
            name: "uniswapTokenId",
            type: "uint256",
            internalType: "uint256"
          }
        ],
        stateMutability: "view"
      },
      {
        type: "function",
        name: "transferOwnership",
        inputs: [
          {
            name: "newOwner",
            type: "address",
            internalType: "address"
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "function",
        name: "updateTokenDeploymentConfig",
        inputs: [
          {
            name: "token",
            type: "address",
            internalType: "address"
          },
          {
            name: "config",
            type: "tuple",
            internalType: "struct TokenDeploymentConfig",
            components: [
              {
                name: "creator",
                type: "address",
                internalType: "address"
              },
              {
                name: "baseToken",
                type: "address",
                internalType: "address"
              },
              {
                name: "name",
                type: "string",
                internalType: "string"
              },
              {
                name: "symbol",
                type: "string",
                internalType: "string"
              },
              {
                name: "image",
                type: "string",
                internalType: "string"
              },
              {
                name: "appIdentifier",
                type: "string",
                internalType: "string"
              },
              {
                name: "teamSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "vestingStartTime",
                type: "uint64",
                internalType: "uint64"
              },
              {
                name: "vestingDuration",
                type: "uint64",
                internalType: "uint64"
              },
              {
                name: "vestingWallet",
                type: "address",
                internalType: "address"
              },
              {
                name: "bondingCurveSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "liquidityPoolSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "totalSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveBuyFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveSellFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "bondingCurveParams",
                type: "tuple",
                internalType: "struct PriceCurve",
                components: [
                  {
                    name: "prices",
                    type: "uint256[]",
                    internalType: "uint256[]"
                  },
                  {
                    name: "numSteps",
                    type: "uint256",
                    internalType: "uint256"
                  },
                  {
                    name: "stepSize",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "allowForcedGraduation",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "allowAutoGraduation",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "graduationFeeBps",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "graduationFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "poolFees",
                type: "uint24",
                internalType: "uint24"
              },
              {
                name: "poolFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "surgeFeeStartingTime",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "surgeFeeDuration",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "maxSurgeFeeBps",
                type: "uint256",
                internalType: "uint256"
              }
            ]
          }
        ],
        outputs: [],
        stateMutability: "nonpayable"
      },
      {
        type: "event",
        name: "BondingCurveSwap",
        inputs: [
          {
            name: "token",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "isBuy",
            type: "bool",
            indexed: true,
            internalType: "bool"
          },
          {
            name: "to",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "from",
            type: "address",
            indexed: false,
            internalType: "address"
          },
          {
            name: "amountIn",
            type: "uint256",
            indexed: false,
            internalType: "uint256"
          },
          {
            name: "amountOut",
            type: "uint256",
            indexed: false,
            internalType: "uint256"
          },
          {
            name: "feeAmount",
            type: "uint256",
            indexed: false,
            internalType: "uint256"
          }
        ],
        anonymous: false
      },
      {
        type: "event",
        name: "OwnershipTransferStarted",
        inputs: [
          {
            name: "previousOwner",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "newOwner",
            type: "address",
            indexed: true,
            internalType: "address"
          }
        ],
        anonymous: false
      },
      {
        type: "event",
        name: "OwnershipTransferred",
        inputs: [
          {
            name: "previousOwner",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "newOwner",
            type: "address",
            indexed: true,
            internalType: "address"
          }
        ],
        anonymous: false
      },
      {
        type: "event",
        name: "PoolLaunched",
        inputs: [
          {
            name: "token0",
            type: "address",
            indexed: false,
            internalType: "address"
          },
          {
            name: "token1",
            type: "address",
            indexed: false,
            internalType: "address"
          },
          {
            name: "uniswapTokenId",
            type: "uint256",
            indexed: false,
            internalType: "uint256"
          }
        ],
        anonymous: false
      },
      {
        type: "event",
        name: "TokenEmergencyEjected",
        inputs: [
          {
            name: "token",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "liquidityTokens",
            type: "uint256",
            indexed: false,
            internalType: "uint256"
          },
          {
            name: "baseTokens",
            type: "uint256",
            indexed: false,
            internalType: "uint256"
          }
        ],
        anonymous: false
      },
      {
        type: "event",
        name: "TokenEmergencyRescued",
        inputs: [
          {
            name: "token",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "uniswapTokenId",
            type: "uint256",
            indexed: false,
            internalType: "uint256"
          },
          {
            name: "poolKey",
            type: "tuple",
            indexed: false,
            internalType: "struct PoolKey",
            components: [
              {
                name: "currency0",
                type: "address",
                internalType: "Currency"
              },
              {
                name: "currency1",
                type: "address",
                internalType: "Currency"
              },
              {
                name: "fee",
                type: "uint24",
                internalType: "uint24"
              },
              {
                name: "tickSpacing",
                type: "int24",
                internalType: "int24"
              },
              {
                name: "hooks",
                type: "address",
                internalType: "contract IHooks"
              }
            ]
          }
        ],
        anonymous: false
      },
      {
        type: "event",
        name: "TokenGraduated",
        inputs: [
          {
            name: "token",
            type: "address",
            indexed: true,
            internalType: "address"
          },
          {
            name: "mintedBondingCurveTokens",
            type: "uint256",
            indexed: false,
            internalType: "uint256"
          },
          {
            name: "collectedBaseTokens",
            type: "uint256",
            indexed: false,
            internalType: "uint256"
          }
        ],
        anonymous: false
      },
      {
        type: "event",
        name: "TokenLaunched",
        inputs: [
          {
            name: "token",
            type: "address",
            indexed: false,
            internalType: "address"
          },
          {
            name: "config",
            type: "tuple",
            indexed: false,
            internalType: "struct TokenDeploymentConfig",
            components: [
              {
                name: "creator",
                type: "address",
                internalType: "address"
              },
              {
                name: "baseToken",
                type: "address",
                internalType: "address"
              },
              {
                name: "name",
                type: "string",
                internalType: "string"
              },
              {
                name: "symbol",
                type: "string",
                internalType: "string"
              },
              {
                name: "image",
                type: "string",
                internalType: "string"
              },
              {
                name: "appIdentifier",
                type: "string",
                internalType: "string"
              },
              {
                name: "teamSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "vestingStartTime",
                type: "uint64",
                internalType: "uint64"
              },
              {
                name: "vestingDuration",
                type: "uint64",
                internalType: "uint64"
              },
              {
                name: "vestingWallet",
                type: "address",
                internalType: "address"
              },
              {
                name: "bondingCurveSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "liquidityPoolSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "totalSupply",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveBuyFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveSellFee",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "bondingCurveFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "bondingCurveParams",
                type: "tuple",
                internalType: "struct PriceCurve",
                components: [
                  {
                    name: "prices",
                    type: "uint256[]",
                    internalType: "uint256[]"
                  },
                  {
                    name: "numSteps",
                    type: "uint256",
                    internalType: "uint256"
                  },
                  {
                    name: "stepSize",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "allowForcedGraduation",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "allowAutoGraduation",
                type: "bool",
                internalType: "bool"
              },
              {
                name: "graduationFeeBps",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "graduationFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "poolFees",
                type: "uint24",
                internalType: "uint24"
              },
              {
                name: "poolFeeSplits",
                type: "tuple[]",
                internalType: "struct FeeSplit[]",
                components: [
                  {
                    name: "recipient",
                    type: "address",
                    internalType: "address"
                  },
                  {
                    name: "bps",
                    type: "uint256",
                    internalType: "uint256"
                  }
                ]
              },
              {
                name: "surgeFeeStartingTime",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "surgeFeeDuration",
                type: "uint256",
                internalType: "uint256"
              },
              {
                name: "maxSurgeFeeBps",
                type: "uint256",
                internalType: "uint256"
              }
            ]
          }
        ],
        anonymous: false
      },
      {
        type: "event",
        name: "TokenReadyForGraduation",
        inputs: [
          {
            name: "token",
            type: "address",
            indexed: true,
            internalType: "address"
          }
        ],
        anonymous: false
      },
      {
        type: "error",
        name: "InsufficientETHSent",
        inputs: []
      },
      {
        type: "error",
        name: "InsufficientTokenBalanceInBondingCurve",
        inputs: []
      },
      {
        type: "error",
        name: "InvalidBondingCurveSupply",
        inputs: []
      },
      {
        type: "error",
        name: "InvalidOperation",
        inputs: []
      },
      {
        type: "error",
        name: "InvalidTokenBalance",
        inputs: []
      },
      {
        type: "error",
        name: "InvalidTokenSupply",
        inputs: []
      },
      {
        type: "error",
        name: "NoFeeToClaim",
        inputs: []
      },
      {
        type: "error",
        name: "OwnableInvalidOwner",
        inputs: [
          {
            name: "owner",
            type: "address",
            internalType: "address"
          }
        ]
      },
      {
        type: "error",
        name: "OwnableUnauthorizedAccount",
        inputs: [
          {
            name: "account",
            type: "address",
            internalType: "address"
          }
        ]
      },
      {
        type: "error",
        name: "PriceCurveOutOfBounds",
        inputs: []
      },
      {
        type: "error",
        name: "SlippageExceeded",
        inputs: []
      },
      {
        type: "error",
        name: "TokenAlreadyDeployed",
        inputs: []
      },
      {
        type: "error",
        name: "TokenAlreadyGraduated",
        inputs: []
      },
      {
        type: "error",
        name: "TokenInGraduationProcess",
        inputs: []
      },
      {
        type: "error",
        name: "TokenNotReadyForGraduation",
        inputs: []
      }
    ];
  }
});

// src/abis/index.ts
var ABIS;
var init_abis = __esm({
  "src/abis/index.ts"() {
    "use strict";
    init_deployer_abi();
    init_statemanager_abi();
    init_lp_locker_abi();
    init_deployer_abi2();
    init_lp_locker_abi2();
    init_statemanager_abi2();
    ABIS = {
      v2: {
        DEPLOYER_ABI,
        STATEMANAGER_ABI,
        LP_LOCKER_ABI
      },
      v3: {
        DEPLOYER_ABI: DEPLOYER_ABI2,
        STATEMANAGER_ABI: STATEMANAGER_ABI2,
        LP_LOCKER_ABI: LP_LOCKER_ABI2
      }
    };
  }
});

// src/config.ts
var LATEST_VERSION, CONTRACTS, SUPPORTED_BASE_TOKENS;
var init_config = __esm({
  "src/config.ts"() {
    "use strict";
    LATEST_VERSION = "v3";
    CONTRACTS = {
      v2: {
        "base-sepolia": {
          DEPLOYER_ADDRESS: "0xa24A0a0BcF100415261cAA60D1C7A7b68D6cdA79",
          STATE_MANAGER_ADDRESS: "0x6d39f47465696c74138207616Ad1Fcd4E276cdDA",
          LP_LOCKER_ADDRESS: "0xc068a5c4552dC9703bA2020F27791eAfb6ad3aac"
        },
        "base-mainnet": {
          DEPLOYER_ADDRESS: "0xF7cb0460771FB72Ad07C34B6744b36aA51399068",
          STATE_MANAGER_ADDRESS: "0x032625946994d7719481a1841a066b355B65a1F7",
          LP_LOCKER_ADDRESS: "0x60B284a349DEF0C34D8271db74B3E48229f4f659"
        }
      },
      v3: {
        "base-sepolia": {
          DEPLOYER_ADDRESS: "0x7A503121f654950Efd3FF29a9eB48666dAf3Cb5B",
          STATE_MANAGER_ADDRESS: "0x8807e3d35B5BF2668D1508A417fe812fd699a386",
          LP_LOCKER_ADDRESS: "0xc58b8697FA02e84E11d3Aed842AE4E06A21b5aC4"
        },
        "base-mainnet": {
          DEPLOYER_ADDRESS: "0x065EE5e9Ab0A4A382a5763f935176B880d512b06",
          STATE_MANAGER_ADDRESS: "0xC67348A3a3F51f8d4BEE9EB792614b7AD4248786",
          LP_LOCKER_ADDRESS: "0x44C7CFf0C5472963Fa50ea8002b17DA53688C736"
        }
      }
    };
    SUPPORTED_BASE_TOKENS = [
      {
        chainId: 8453,
        address: "0x0000000000000000000000000000000000000000",
        name: "Ethereum",
        symbol: "ETH",
        decimals: 18,
        logoURI: "https://static.optimism.io/data/ETH/logo.svg"
      },
      {
        chainId: 8453,
        address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        name: "USD Coin",
        symbol: "USDC",
        decimals: 6,
        logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png"
      },
      {
        chainId: 84532,
        address: "0x0000000000000000000000000000000000000000",
        name: "Ethereum",
        symbol: "ETH",
        decimals: 18,
        logoURI: "https://static.optimism.io/data/ETH/logo.svg"
      },
      {
        chainId: 84532,
        address: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
        name: "USD Coin",
        symbol: "USDC",
        decimals: 6,
        logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png"
      },
      {
        chainId: 84532,
        address: "0xCA11121e2e8D5f5C183eEa0261a85D9bb06587C7",
        name: "USDC Monk",
        symbol: "USDC",
        decimals: 6
      }
    ];
  }
});

// src/clients/ethers/ether-deployer-sdk-read.ts
var import_ethers, DeployerReader;
var init_ether_deployer_sdk_read = __esm({
  "src/clients/ethers/ether-deployer-sdk-read.ts"() {
    "use strict";
    import_ethers = require("ethers");
    init_abis();
    init_config();
    DeployerReader = class {
      contract;
      stateManagerContract;
      lpLockerContract;
      provider;
      DEPLOYER_ABI;
      STATEMANAGER_ABI;
      LP_LOCKER_ABI;
      constructor(config) {
        if (!config.rpcUrl) throw new Error("RPC URL is required");
        const networkContracts = CONTRACTS[config.version ?? LATEST_VERSION][config.network];
        if (!networkContracts)
          throw new Error(`Unsupported network: ${config.network}`);
        const abiVersion = ABIS[config.version ?? LATEST_VERSION];
        if (!abiVersion)
          throw new Error(`Unsupported ABI version: ${config.version}`);
        this.DEPLOYER_ABI = abiVersion.DEPLOYER_ABI;
        this.STATEMANAGER_ABI = abiVersion.STATEMANAGER_ABI;
        this.LP_LOCKER_ABI = abiVersion.LP_LOCKER_ABI;
        this.provider = new import_ethers.ethers.JsonRpcProvider(config.rpcUrl);
        this.contract = new import_ethers.ethers.Contract(
          networkContracts.DEPLOYER_ADDRESS,
          this.DEPLOYER_ABI,
          this.provider
        );
        this.stateManagerContract = new import_ethers.ethers.Contract(
          networkContracts.STATE_MANAGER_ADDRESS,
          this.STATEMANAGER_ABI,
          this.provider
        );
        this.lpLockerContract = new import_ethers.ethers.Contract(
          networkContracts.LP_LOCKER_ADDRESS,
          this.LP_LOCKER_ABI,
          this.provider
        );
      }
      async getBuyQuote(token, amountIn) {
        try {
          await this.contract.buyQuote.estimateGas(token, (0, import_ethers.parseEther)(amountIn), {
            from: null
          });
        } catch (error) {
          const decodedError = this.contract.interface.decodeErrorResult(
            "QuoteAmount",
            error.data
          );
          return {
            amountOut: decodedError.amountOut,
            amountInUsed: decodedError.effectiveAmountIn
          };
        }
        throw new Error("buy quote did not throw");
      }
      async getSellQuote(token, amountIn) {
        try {
          await this.contract.sellQuote.estimateGas(token, (0, import_ethers.parseEther)(amountIn), {
            from: null
          });
        } catch (error) {
          const decodedError = this.contract.interface.decodeErrorResult(
            "QuoteAmount",
            error.data
          );
          return {
            amountOut: decodedError.amountOut,
            amountInUsed: decodedError.effectiveAmountIn
          };
        }
        throw new Error("sell quote did not throw");
      }
      async getTokenPrice(token) {
        return Number(await this.contract.getTokenPrice(token)) / 10 ** 36;
      }
      async getPredictedTokenAddress(owner, salt) {
        const [addr, exists] = await this.contract.predictTokenAddress(owner, salt);
        return { addr, exists };
      }
      async getOwner() {
        return await this.contract.owner();
      }
      async isBaseTokenWhitelisted(token) {
        return await this.contract.isBaseTokenWhitelisted(token);
      }
      async getTokenState(token) {
        const result = await this.stateManagerContract.getTokenState(token);
        const [
          tokensInBondingCurve,
          baseTokensInBondingCurve,
          lastPrice,
          totalFees,
          isGraduated,
          poolAddress
        ] = result;
        return {
          tokensInBondingCurve: BigInt(tokensInBondingCurve),
          baseTokensInBondingCurve: BigInt(baseTokensInBondingCurve),
          lastPrice: BigInt(lastPrice),
          totalFees: BigInt(totalFees),
          isGraduated,
          poolAddress
          // Ensure this is a valid address format
        };
      }
      async getProtocolFeeShare() {
        return Number(await this.stateManagerContract.PROTOCOL_FEE_SHARE());
      }
      async getBondingCurveFeeAccumulated(token) {
        return (0, import_ethers.formatEther)(
          await this.stateManagerContract.bondingCurveFeeAccumulated(token)
        );
      }
      async getComputerUnclamiedFee(token) {
        return await this.lpLockerContract.computeUnclaimedFees(token);
      }
      async getAutoGraduationParams(token) {
        const result = await this.stateManagerContract.getAutoGraduationParams(token);
        return {
          tickSpacing: Number(result[0]),
          startingTick: Number(result[1]),
          endTick: Number(result[2]),
          targetTick: Number(result[3]),
          poolFee: Number(result[4])
        };
      }
      async getBaseToken(token) {
        return await this.stateManagerContract.getBaseToken(token);
      }
      async getPoolKey(token) {
        const result = await this.stateManagerContract.getPoolKey(token);
        return {
          token0: result.currency0,
          // Ensure this is a valid address format
          token1: result.currency1,
          // Ensure this is a valid address format
          tickSpacing: Number(result.tickSpacing),
          fee: Number(result.fee)
        };
      }
      async getSurgeFee(config) {
        return (0, import_ethers.formatEther)(await this.stateManagerContract.getSurgeFee(config));
      }
      async getTokenDeploymentConfig(token) {
        const result = await this.stateManagerContract.getTokenDeploymentConfig(token);
        return {
          creator: result.creator,
          baseToken: result.baseToken,
          name: result.name,
          symbol: result.symbol,
          image: result.image,
          teamSupply: result.teamSupply.toString(),
          bondingCurveSupply: result.bondingCurveSupply.toString(),
          liquidityPoolSupply: result.liquidityPoolSupply.toString(),
          totalSupply: result.totalSupply.toString(),
          bondingCurveBuyFee: result.bondingCurveBuyFee,
          bondingCurveSellFee: result.bondingCurveSellFee,
          allowAutoGraduation: result.allowAutoGraduation,
          allowForcedGraduation: result.allowForcedGraduation,
          graduationFeeBps: result.graduationFeeBps,
          poolFees: result.poolFees,
          surgeFeeStartingTime: result.surgeFeeStartingTime.toString(),
          surgeFeeDuration: result.surgeFeeDuration.toString(),
          maxSurgeFeeBps: result.maxSurgeFeeBps,
          bondingCurveFeeSplits: result.bondingCurveFeeSplits.map((split) => ({
            recipient: split.recipient,
            bps: split.bps
          })),
          graduationFeeSplits: result.graduationFeeSplits.map((split) => ({
            recipient: split.recipient,
            bps: split.bps
          })),
          poolFeeSplits: result.poolFeeSplits.map((split) => ({
            recipient: split.recipient,
            bps: split.bps
          })),
          bondingCurveParams: result.bondingCurveParams,
          vestingStartTime: result.vestingStartTime?.toString() || "0",
          vestingDuration: result.vestingDuration?.toString() || "0",
          vestingWallet: result.vestingWallet,
          appIdentifier: result.appIdentifier || ""
        };
      }
      async getTokenSupply(token) {
        return (0, import_ethers.formatEther)(await this.stateManagerContract.getTokenSupply(token));
      }
      async isGraduated(token) {
        return await this.stateManagerContract.isGraduated(token);
      }
      async getProtocolFeeRecipient() {
        return await this.stateManagerContract.protocolFeeRecipient();
      }
      async getPoolFeeSplits(token) {
        const splits = await this.stateManagerContract.poolFeeSplits(token);
        return splits.map((split) => ({
          recipient: split.recipient,
          bps: split.bps
        }));
      }
      async getFees(token) {
        const [configResult, bondingResult, unclaimedResult] = await Promise.allSettled([
          this.getTokenDeploymentConfig(token),
          this.stateManagerContract.bondingCurveFeeAccumulated(token),
          this.lpLockerContract.computeUnclaimedFees(token)
        ]);
        const errors = [];
        const config = configResult.status === "fulfilled" ? configResult.value : (errors.push("token config fetch failed"), void 0);
        const bondingCurveFeeAccumulated = bondingResult.status === "fulfilled" ? bondingResult.value : (errors.push("bondingCurveFeeAccumulated failed"), void 0);
        const computeUnclaimedFee = unclaimedResult.status === "fulfilled" ? unclaimedResult.value : [0n, 0n];
        if (errors.length) {
          throw new Error(errors.join("\n"));
        }
        let baseTokenDecimals = 18;
        if (config.baseToken !== "0x0000000000000000000000000000000000000000") {
          const erc20Contract = new import_ethers.ethers.Contract(
            config.baseToken,
            ["function decimals() view returns (uint8)"],
            this.provider
          );
          baseTokenDecimals = await erc20Contract.decimals();
        }
        const tokenFeeShare = {};
        const bondingCurveFeeShare = {};
        const poolFeeShares = {};
        const bondingFee = BigInt(bondingCurveFeeAccumulated);
        const [uniswapBaseFee, uniswapTokenFee] = computeUnclaimedFee;
        for (const { recipient, bps } of config.bondingCurveFeeSplits) {
          bondingCurveFeeShare[recipient] = {
            baseFee: bondingFee * bps / 10000n,
            tokenFee: 0n
          };
        }
        for (const { recipient, bps } of config.poolFeeSplits) {
          poolFeeShares[recipient] = {
            uniswapBaseFee: uniswapBaseFee * bps / 10000n,
            uniswapTokenFee: uniswapTokenFee * bps / 10000n
          };
        }
        for (const recipient in bondingCurveFeeShare) {
          tokenFeeShare[recipient] = {
            baseTokenFeeShare: (0, import_ethers.formatUnits)(
              bondingCurveFeeShare[recipient].baseFee + poolFeeShares[recipient].uniswapBaseFee,
              baseTokenDecimals
            ),
            tokenFeeShare: (0, import_ethers.formatEther)(
              bondingCurveFeeShare[recipient].tokenFee + poolFeeShares[recipient].uniswapTokenFee
            ),
            bondingCurveBaseTokenFee: (0, import_ethers.formatUnits)(
              bondingCurveFeeShare[recipient].baseFee,
              baseTokenDecimals
            ),
            uniswapBaseTokenFee: (0, import_ethers.formatEther)(
              poolFeeShares[recipient].uniswapBaseFee
            ),
            uniswapTokenFee: (0, import_ethers.formatEther)(poolFeeShares[recipient].uniswapTokenFee)
          };
        }
        return {
          tokenFeeShare,
          bondingCurveFeeAccumulated: {
            baseFee: (0, import_ethers.formatEther)(bondingFee),
            tokenFee: "0"
            // Currently our contract doesn't accumulate fees in token, only in base token
          },
          lpFeeAccumulated: {
            baseFee: (0, import_ethers.formatEther)(computeUnclaimedFee[0]),
            tokenFee: (0, import_ethers.formatEther)(computeUnclaimedFee[1])
          }
        };
      }
      async getPositionManager() {
        return await this.stateManagerContract.positionManager();
      }
      async getStateView() {
        return await this.stateManagerContract.stateView();
      }
      async getTokenIdRecipient() {
        return await this.stateManagerContract.tokenIdRecipient();
      }
      async getTokenDeploymentConfigsMapping(token) {
        return await this.getTokenDeploymentConfig(token);
      }
      async getTokenStatesMapping(token) {
        return await this.getTokenState(token);
      }
      static formatEther(wei) {
        return (0, import_ethers.formatEther)(wei);
      }
      static parseEther(ether) {
        return (0, import_ethers.parseEther)(ether);
      }
    };
  }
});

// src/utils/helper.ts
function extractEventArgument({
  logs,
  eventName,
  argumentName,
  abi
}) {
  const iface = new import_ethers2.Interface(abi);
  for (const log of logs) {
    try {
      const parsedLog = iface.parseLog({
        topics: log.topics,
        data: log.data
      });
      if (parsedLog?.name === eventName) {
        return parsedLog.args?.[argumentName]?.toString() ?? null;
      }
    } catch {
    }
  }
  return null;
}
function generateSalt() {
  const array = crypto.getRandomValues(new Uint8Array(32));
  return "0x" + Array.from(array).map((b) => b.toString(16).padStart(2, "0")).join("");
}
var import_ethers2;
var init_helper = __esm({
  "src/utils/helper.ts"() {
    "use strict";
    import_ethers2 = require("ethers");
  }
});

// src/utils/validators.ts
function validateLaunchTokenBondingCurveParams(params) {
  const { bondingCurveSupply, bondingCurveParams } = params;
  const { numSteps, stepSize, prices } = bondingCurveParams;
  const expectedSupply = BigInt(numSteps) * BigInt(stepSize);
  if (BigInt(bondingCurveSupply) !== expectedSupply) {
    throw new Error(
      `Validation Error: bondingCurveSupply (${bondingCurveSupply}) must equal numSteps * stepSize (${expectedSupply}).`
    );
  }
  if (prices.length !== Number(numSteps)) {
    throw new Error(
      `Validation Error: The number of prices (${prices.length}) must equal numSteps (${numSteps}).`
    );
  }
}
function ensureProtocolFee(name, isFeeZero, splitArray) {
  const protocolFeeRecipient = "0x136F342DBC00Dc105B23ecC40b1134830720f721";
  if (splitArray.length === 0 && isFeeZero) {
    return [];
  }
  const providedBps = splitArray.reduce((acc, split) => acc + split.bps, 0n);
  if (providedBps !== 10000n) {
    throw new Error(`Validation Error: The sum of bps must be 10,000 for ${name}, got ${providedBps}.`);
  }
  const totalBps = 10000n;
  const protocolFeeBps = 500n;
  const hasProtocolFee = splitArray.some(
    (split) => split.recipient.toLowerCase() === protocolFeeRecipient.toLowerCase()
  );
  if (hasProtocolFee) return splitArray;
  const adjustedSplits = splitArray.map((split) => ({
    recipient: split.recipient,
    bps: split.bps * (totalBps - protocolFeeBps) / totalBps
    // preserve total 10,000
  }));
  const currentTotal = adjustedSplits.reduce(
    (acc, split) => acc + split.bps,
    0n
  );
  const remainder = totalBps - protocolFeeBps - currentTotal;
  if (adjustedSplits.length > 0) {
    adjustedSplits[0].bps += remainder;
  }
  return [
    ...adjustedSplits,
    {
      recipient: protocolFeeRecipient,
      bps: protocolFeeBps
    }
  ];
}
function validateFeeSplitArray(feeSplits, name) {
  const protocolFeeRecipient = "0x136F342DBC00Dc105B23ecC40b1134830720f721";
  if (feeSplits.length > 0) {
    const hasProtocolFee = feeSplits.some(
      (split) => split.recipient.toLowerCase() === protocolFeeRecipient.toLowerCase()
    );
    if (!hasProtocolFee) {
      throw new Error(
        `${name} must include the protocol fee recipient (${protocolFeeRecipient}) with ${500} bps.`
      );
    }
  }
}
function validateSalt(salt) {
  if (!(0, import_ethers3.isHexString)(salt, 32)) {
    throw new Error("Invalid salt: must be a 32-byte hex string (0x-prefixed)");
  }
}
function processLaunchTokenParams(params, salt) {
  params.bondingCurveFeeSplits = ensureProtocolFee(
    "bondingCurveFeeSplits",
    BigInt(params.bondingCurveBuyFee) === 0n && BigInt(params.bondingCurveSellFee) === 0n,
    params.bondingCurveFeeSplits
  );
  params.poolFeeSplits = ensureProtocolFee(
    "poolFeeSplits",
    params.poolFees === 0,
    params.poolFeeSplits
  );
  params.graduationFeeSplits = ensureProtocolFee(
    "graduationFeeSplits",
    BigInt(params.graduationFeeBps) === 0n,
    params.graduationFeeSplits
  );
  validateLaunchTokenBondingCurveParams(params);
  validateFeeSplitArray(
    params.bondingCurveFeeSplits,
    "bondingCurveFeeSplits"
  );
  validateFeeSplitArray(params.poolFeeSplits, "poolFeeSplits");
  validateFeeSplitArray(params.graduationFeeSplits, "graduationFeeSplits");
  const config = buildTokenDeploymentConfig(params);
  const finalSalt = salt ?? generateSalt();
  validateSalt(finalSalt);
  return { config, salt: finalSalt };
}
function buildTokenDeploymentConfig(params) {
  const totalSupply = (BigInt(params.teamSupply) + BigInt(params.bondingCurveSupply) + BigInt(params.liquidityPoolSupply)).toString();
  return {
    creator: params.creator,
    baseToken: params.baseToken,
    name: params.name,
    symbol: params.symbol,
    image: params.image,
    appIdentifier: "",
    teamSupply: BigInt(params.teamSupply),
    vestingStartTime: params.vestingStartTime ? BigInt(params.vestingStartTime) : BigInt(0),
    vestingDuration: params.vestingDuration ? BigInt(params.vestingDuration) : BigInt(0),
    vestingWallet: params.vestingWallet ? params.vestingWallet : "0x0000000000000000000000000000000000000000",
    bondingCurveSupply: BigInt(params.bondingCurveSupply),
    liquidityPoolSupply: BigInt(params.liquidityPoolSupply),
    totalSupply: BigInt(totalSupply),
    bondingCurveBuyFee: BigInt(params.bondingCurveBuyFee),
    bondingCurveSellFee: BigInt(params.bondingCurveSellFee),
    bondingCurveFeeSplits: params.bondingCurveFeeSplits.map((split) => ({
      recipient: split.recipient,
      bps: split.bps
    })),
    bondingCurveParams: {
      prices: params.bondingCurveParams.prices.map((price) => BigInt(price)),
      numSteps: BigInt(params.bondingCurveParams.numSteps),
      stepSize: BigInt(params.bondingCurveParams.stepSize)
    },
    allowAutoGraduation: params.allowAutoGraduation,
    allowForcedGraduation: params.allowForcedGraduation,
    graduationFeeBps: BigInt(params.graduationFeeBps),
    graduationFeeSplits: params.graduationFeeSplits.map((split) => ({
      recipient: split.recipient,
      bps: split.bps
    })),
    poolFees: params.poolFees,
    poolFeeSplits: params.poolFeeSplits.map((split) => ({
      recipient: split.recipient,
      bps: split.bps
    })),
    surgeFeeStartingTime: BigInt(Math.floor(Date.now() / 1e3)),
    surgeFeeDuration: BigInt(params.surgeFeeDuration),
    maxSurgeFeeBps: BigInt(params.maxSurgeFeeBps)
  };
}
var import_ethers3;
var init_validators = __esm({
  "src/utils/validators.ts"() {
    "use strict";
    import_ethers3 = require("ethers");
    init_helper();
  }
});

// src/clients/ethers/ether-deployer-sdk-write.ts
var import_ethers4, ERC20_ABI, DeployerWriter;
var init_ether_deployer_sdk_write = __esm({
  "src/clients/ethers/ether-deployer-sdk-write.ts"() {
    "use strict";
    import_ethers4 = require("ethers");
    init_abis();
    init_config();
    init_helper();
    init_validators();
    ERC20_ABI = [
      "function approve(address spender, uint256 amount) returns (bool)"
    ];
    DeployerWriter = class {
      contract;
      provider;
      signer;
      DEPLOYER_ABI;
      STATEMANAGER_ABI;
      constructor(config) {
        if (!config.rpcUrl) throw new Error("RPC URL is required");
        const networkContracts = CONTRACTS[config.version ?? LATEST_VERSION][config.network];
        if (!networkContracts)
          throw new Error(`Unsupported network: ${config.network}`);
        const abiVersion = ABIS[config.version ?? LATEST_VERSION];
        if (!abiVersion)
          throw new Error(`Unsupported ABI version: ${config.version}`);
        this.DEPLOYER_ABI = abiVersion.DEPLOYER_ABI;
        this.STATEMANAGER_ABI = abiVersion.STATEMANAGER_ABI;
        this.provider = new import_ethers4.ethers.JsonRpcProvider(config.rpcUrl);
        if (config.privateKey) {
          this.signer = new import_ethers4.ethers.Wallet(config.privateKey, this.provider);
        } else if (config.signer) {
          this.signer = config.signer;
        }
        const signerOrProvider = this.signer || this.provider;
        this.contract = new import_ethers4.ethers.Contract(
          networkContracts.DEPLOYER_ADDRESS,
          this.DEPLOYER_ABI,
          signerOrProvider
        );
      }
      /**
       * Buy a token by sending base tokens to the bonding curve
       * @param params Parameters including token address, input amount, minimum output amount, and recipient
       * @param options Optional transaction parameters like gas limit and gas price
       * @returns Transaction response
       */
      async buyToken(params, options) {
        if (!this.signer)
          throw new Error("Signer is required for buy transactions");
        const value = params.value ? (0, import_ethers4.parseEther)(params.value) : (0, import_ethers4.parseEther)(params.amountIn);
        const txOverrides = {
          value
        };
        if (options?.gasPrice) txOverrides.gasPrice = options.gasPrice;
        const estimatedGas = await this.contract.buyToken.estimateGas(
          params.token,
          (0, import_ethers4.parseEther)(params.amountIn),
          (0, import_ethers4.parseEther)(params.amountOutMin),
          params.to,
          txOverrides
        );
        const gasLimit = options?.gasLimit || estimatedGas * 12n / 10n;
        const tx = await this.contract.buyToken(
          params.token,
          (0, import_ethers4.parseEther)(params.amountIn),
          (0, import_ethers4.parseEther)(params.amountOutMin),
          params.to,
          {
            ...txOverrides,
            gasLimit
          }
        );
        const receipt = await tx.wait();
        if (receipt.status !== 1) {
          throw new Error(`Transaction failed: ${receipt.transactionHash}`);
        }
        console.log("Buy transaction confirmed:", receipt.transactionHash);
        return {
          success: receipt.status === 1,
          transactionHash: receipt.hash,
          receipt
        };
      }
      /**
       * Sell tokens from the bonding curve
       * @param params Parameters including token address, input amount, minimum output amount, and recipient
       * @param options Optional transaction parameters like gas limit and gas price
       * @returns Transaction response
       */
      async sellToken(params, options) {
        if (!this.signer)
          throw new Error("Signer is required for sell transactions");
        const txOverrides = {};
        if (options?.gasPrice) txOverrides.gasPrice = options.gasPrice;
        const estimatedGas = await this.contract.sellToken.estimateGas(
          params.token,
          (0, import_ethers4.parseEther)(params.amountIn),
          (0, import_ethers4.parseEther)(params.amountOutMin),
          params.to,
          txOverrides
        );
        const gasLimit = options?.gasLimit || estimatedGas * 12n / 10n;
        const sellTx = await this.contract.sellToken(
          params.token,
          (0, import_ethers4.parseEther)(params.amountIn),
          (0, import_ethers4.parseEther)(params.amountOutMin),
          params.to,
          {
            ...txOverrides,
            gasLimit
          }
        );
        const receipt = await sellTx.wait();
        if (receipt.status !== 1) {
          throw new Error(`Transaction failed: ${receipt.transactionHash}`);
        }
        console.log("Sell transaction confirmed:", receipt.transactionHash);
        return {
          success: receipt.status === 1,
          transactionHash: receipt.hash,
          receipt
        };
      }
      /**
       * Approve the deployer contract to spend a specific token on the user's behalf
       * @param token ERC20 token address
       * @param amount Amount to approve
       * @param options Optional transaction parameters like gas limit and gas price
       * @returns Transaction response
       */
      async approveToken(token, amount, options) {
        if (!this.signer)
          throw new Error("Signer is required for approving tokens");
        const txOptions = {
          gasLimit: options?.gasLimit || 5e5
        };
        if (options?.gasPrice) txOptions.gasPrice = options.gasPrice;
        const erc20Contract = new import_ethers4.Contract(token, ERC20_ABI, this.signer);
        const deployerAddress = await this.contract.getAddress();
        return await erc20Contract.approve(
          deployerAddress,
          (0, import_ethers4.parseEther)(amount),
          txOptions
        );
      }
      /**
       * Approve the deployer contract to spend tokens and then sell them in a single flow
       * @param params Parameters including token address, input amount, minimum output amount, and recipient
       * @param options Optional transaction parameters like gas limit and gas price
       * @returns Sell transaction response
       */
      async approveAndSell(params, options) {
        if (!this.signer)
          throw new Error("Signer is required for approve and sell transactions");
        console.log("Approving token...");
        const approvalTx = await this.approveToken(
          params.token,
          params.amountIn,
          options
        );
        console.log("Approval transaction sent. Waiting for confirmation...");
        await approvalTx.wait();
        console.log("Token approved successfully.");
        console.log("Selling token...");
        const sellTx = await this.sellToken(params, options);
        console.log("Sell transaction sent.");
        return sellTx;
      }
      /**
       * Claim accumulated bonding curve fees for a specific token
       * @param token Token address
       * @param options Optional transaction parameters like gas limit and gas price
       * @returns Transaction response
       */
      async claimFee(token, options) {
        if (!this.signer) throw new Error("Signer is required for claiming fees");
        const txOptions = {};
        if (options?.gasPrice) {
          txOptions.gasPrice = options.gasPrice;
        }
        if (options?.gasLimit) {
          txOptions.gasLimit = options.gasLimit;
        } else {
          try {
            const estimatedGas = await this.contract.claimFee.estimateGas(
              token,
              txOptions
            );
            txOptions.gasLimit = estimatedGas * 120n / 100n;
          } catch (err) {
            console.warn(
              "Gas estimation for claimFee failed. Using fallback gasLimit.",
              err
            );
            txOptions.gasLimit = 10000000n;
          }
        }
        return await this.contract.claimFee(token, txOptions);
      }
      /**
       * Launch a new token using the bonding curve
       * @param params Token launch parameters including supplies, fees, and configuration
       * @param options Optional transaction parameters like gas limit and gas price
       * @returns Transaction response
       * Protocol fee in basis points (bps).
       * Required. This fee will automatically be allocated to the protocol.
       * Example: 500 = 5%
       */
      async launchToken(params, salt, options) {
        if (!this.signer)
          throw new Error("Signer is required for launching tokens");
        const { config, salt: finalSalt } = processLaunchTokenParams(params, salt);
        const txOverrides = {};
        if (options?.gasPrice) txOverrides.gasPrice = options.gasPrice;
        let gasLimit = 7000000n;
        try {
          const estimatedGas = await this.contract.launchToken.estimateGas(
            config,
            finalSalt,
            txOverrides
          );
          gasLimit = estimatedGas * 12n / 10n;
        } catch (err) {
          console.warn(
            "Gas estimation for launchToken failed. Using fallback gasLimit.",
            err
          );
        }
        const tx = await this.contract.launchToken(config, finalSalt, {
          ...txOverrides,
          gasLimit
        });
        const receipt = await tx.wait();
        const createdTokenAddress = extractEventArgument({
          logs: receipt.logs,
          eventName: "TokenLaunched",
          argumentName: "token",
          abi: this.STATEMANAGER_ABI
        });
        if (!createdTokenAddress) {
          throw new Error("TokenLaunched event not found");
        }
        return { tx, createdTokenAddress };
      }
      /**
       * Graduate a token from the bonding curve (can allow forced graduation)
       * @param token Token address
       * @param allowPreGraduation Allow forced graduation if true
       * @param options Optional transaction parameters like gas limit and gas price
       * @returns Transaction response
       */
      async graduateToken(token, allowPreGraduation = false, options) {
        if (!this.signer)
          throw new Error("Signer is required for graduating tokens");
        const txOverrides = {};
        if (options?.gasPrice) txOverrides.gasPrice = options.gasPrice;
        let gasLimit = 1000000n;
        try {
          const estimatedGas = await this.contract.graduateToken.estimateGas(
            token,
            allowPreGraduation,
            txOverrides
          );
          gasLimit = estimatedGas * 12n / 10n;
        } catch (err) {
          console.warn(
            "Gas estimation for graduateToken failed. Using fallback gasLimit.",
            err
          );
        }
        return await this.contract.graduateToken(token, allowPreGraduation, {
          ...txOverrides,
          gasLimit
        });
      }
      /**
       * Set the whitelist status of a base token
       * @param token Token address
       * @param whitelisted Boolean flag to whitelist (true) or remove from whitelist (false)
       * @param options Optional transaction parameters like gas limit and gas price
       * @returns Transaction response
       */
      async setBaseTokenWhitelist(token, whitelisted, options) {
        if (!this.signer)
          throw new Error("Signer is required for setting base token whitelist");
        const txOptions = {
          gasLimit: options?.gasLimit || 5e5
        };
        if (options?.gasPrice) txOptions.gasPrice = options.gasPrice;
        return await this.contract.setBaseTokenWhitelist(
          token,
          whitelisted,
          txOptions
        );
      }
      /**
       * Relinquish control of the state manager to the protocol
       * @param options Optional transaction parameters like gas limit and gas price
       * @returns Transaction response
       */
      async relinquishStateManager(options) {
        if (!this.signer)
          throw new Error("Signer is required to relinquish state manager");
        const txOptions = {
          gasLimit: options?.gasLimit || 5e5
        };
        if (options?.gasPrice) txOptions.gasPrice = options.gasPrice;
        return await this.contract.relinquishStateManager(txOptions);
      }
      /**
       * Withdraw residual (dust) base tokens from the contract
       * @param options Optional transaction parameters like gas limit and gas price
       * @returns Transaction response
       */
      async withdrawDust(options) {
        if (!this.signer) throw new Error("Signer is required to withdraw dust");
        const txOptions = {
          gasLimit: options?.gasLimit || 5e5
        };
        if (options?.gasPrice) txOptions.gasPrice = options.gasPrice;
        return await this.contract.withdrawDust(txOptions);
      }
      async waitForTransaction(txHash) {
        if (!this.provider) throw new Error("Provider is not initialized");
        try {
          const receipt = await this.provider.waitForTransaction(txHash);
          return receipt;
        } catch (error) {
          console.error("Error waiting for transaction receipt:", error);
          throw error;
        }
      }
    };
  }
});

// src/clients/ethers/index.ts
var ethers_exports = {};
__export(ethers_exports, {
  EthersDeployer: () => EthersDeployer
});
var EthersDeployer;
var init_ethers = __esm({
  "src/clients/ethers/index.ts"() {
    "use strict";
    init_ether_deployer_sdk_read();
    init_ether_deployer_sdk_write();
    EthersDeployer = class {
      read;
      write;
      constructor(config) {
        this.read = new DeployerReader(config);
        this.write = new DeployerWriter(config);
      }
    };
  }
});

// src/clients/viem/viem-deployer-read.ts
var import_viem, ViemDeployerReader;
var init_viem_deployer_read = __esm({
  "src/clients/viem/viem-deployer-read.ts"() {
    "use strict";
    import_viem = require("viem");
    init_config();
    init_abis();
    ViemDeployerReader = class {
      publicClient;
      deployerAddress;
      stateManagerAddress;
      lpLockerAddress;
      DEPLOYER_ABI;
      STATEMANAGER_ABI;
      LP_LOCKER_ABI;
      constructor(config) {
        if (!config.rpcUrl) throw new Error("RPC URL is required");
        const networkContracts = CONTRACTS[config.version ?? LATEST_VERSION][config.network];
        if (!networkContracts)
          throw new Error(`Unsupported network: ${config.network}`);
        const abiVersion = ABIS[config.version ?? LATEST_VERSION];
        if (!abiVersion)
          throw new Error(`Unsupported ABI version: ${config.version}`);
        this.DEPLOYER_ABI = abiVersion.DEPLOYER_ABI;
        this.STATEMANAGER_ABI = abiVersion.STATEMANAGER_ABI;
        this.LP_LOCKER_ABI = abiVersion.LP_LOCKER_ABI;
        this.publicClient = (0, import_viem.createPublicClient)({
          transport: (0, import_viem.http)(config.rpcUrl)
        });
        this.deployerAddress = networkContracts.DEPLOYER_ADDRESS;
        this.stateManagerAddress = networkContracts.STATE_MANAGER_ADDRESS;
        this.lpLockerAddress = networkContracts.LP_LOCKER_ADDRESS;
      }
      async callDeployer(functionName, args) {
        return await this.publicClient.readContract({
          address: this.deployerAddress,
          abi: this.DEPLOYER_ABI,
          functionName,
          args
        });
      }
      async callStateManager(functionName, args) {
        return await this.publicClient.readContract({
          address: this.stateManagerAddress,
          abi: this.STATEMANAGER_ABI,
          functionName,
          args
        });
      }
      async callLpLocker(functionName, args) {
        return await this.publicClient.readContract({
          address: this.lpLockerAddress,
          abi: this.LP_LOCKER_ABI,
          functionName,
          args
        });
      }
      async getBuyQuote(token, amountIn) {
        try {
          await this.publicClient.simulateContract({
            address: this.deployerAddress,
            account: this.deployerAddress,
            abi: this.DEPLOYER_ABI,
            functionName: "buyQuote",
            args: [token, (0, import_viem.parseEther)(amountIn)]
          });
          throw new Error("buy quote did not throw as expected");
        } catch (error) {
          if (error instanceof import_viem.BaseError) {
            const revertError = error.walk(
              (err) => err instanceof import_viem.ContractFunctionRevertedError
            );
            if (revertError instanceof import_viem.ContractFunctionRevertedError && revertError.data?.args) {
              const [amountOut, effectiveAmountIn] = revertError.data.args;
              return {
                amountOut,
                amountInUsed: effectiveAmountIn
              };
            }
          }
          console.error("Unexpected error:", error);
          throw new Error("buy quote did not throw as expected");
        }
      }
      async getSellQuote(token, amountIn) {
        try {
          await this.publicClient.simulateContract({
            address: this.deployerAddress,
            account: this.deployerAddress,
            abi: this.DEPLOYER_ABI,
            functionName: "sellQuote",
            args: [token, (0, import_viem.parseEther)(amountIn)]
          });
          throw new Error("sell quote did not throw as expected");
        } catch (error) {
          if (error instanceof import_viem.BaseError) {
            const revertError = error.walk(
              (err) => err instanceof import_viem.ContractFunctionRevertedError
            );
            if (revertError instanceof import_viem.ContractFunctionRevertedError && revertError.data?.args) {
              const [amountOut, effectiveAmountIn] = revertError.data.args;
              return {
                amountOut,
                amountInUsed: effectiveAmountIn
              };
            }
          }
          console.error("Unexpected error:", error);
          throw new Error("sell quote did not throw as expected");
        }
      }
      async getTokenPrice(token) {
        return Number(await this.callDeployer("getTokenPrice", [token])) / 10 ** 36;
      }
      async getPredictedTokenAddress(owner, salt) {
        const [addr, exists] = await this.callDeployer("predictTokenAddress", [
          owner,
          salt
        ]);
        return { addr, exists };
      }
      async getOwner() {
        return await this.callDeployer("owner", []);
      }
      async isBaseTokenWhitelisted(token) {
        return await this.callDeployer("isBaseTokenWhitelisted", [token]);
      }
      async getTokenState(token) {
        const result = await this.callStateManager("getTokenState", [token]);
        return {
          tokensInBondingCurve: BigInt(result.tokensInBondingCurve),
          baseTokensInBondingCurve: BigInt(result.baseTokensInBondingCurve),
          // lastPrice: result.lastPrice ? BigInt(result.lastPrice) : 0n, // in your log, 'lastPrice' was missing, so provide fallback
          // totalFees: result.totalFees ? BigInt(result.totalFees) : 0n, // same here
          isGraduated: result.isGraduated,
          // your ABI returns 'isGraduated' not 'graduated'
          poolAddress: result.poolAddress
        };
      }
      async getProtocolFeeShare() {
        return Number(await this.callStateManager("PROTOCOL_FEE_SHARE", []));
      }
      async getBondingCurveFeeAccumulated(token) {
        const result = await this.callStateManager("bondingCurveFeeAccumulated", [
          token
        ]);
        return (0, import_viem.formatEther)(result);
      }
      async getComputeUnclamiedFee(token) {
        const result = await this.callLpLocker("computeUnclaimedFees", [token]);
        return (0, import_viem.formatEther)(result);
      }
      async getAutoGraduationParams(token) {
        const result = await this.callStateManager("getAutoGraduationParams", [
          token
        ]);
        return {
          tickSpacing: Number(result[0]),
          startingTick: Number(result[1]),
          endTick: Number(result[2]),
          targetTick: Number(result[3]),
          poolFee: Number(result[4])
        };
      }
      async getBaseToken(token) {
        return await this.callStateManager("getBaseToken", [token]);
      }
      async getPoolKey(token) {
        const result = await this.callStateManager("getPoolKey", [token]);
        return {
          token0: result.currency0,
          token1: result.currency1,
          tickSpacing: Number(result.tickSpacing),
          fee: Number(result.fee)
        };
      }
      async getSurgeFee(config) {
        const result = await this.callStateManager("getSurgeFee", [config]);
        return (0, import_viem.formatEther)(result);
      }
      async getTokenDeploymentConfig(token) {
        const result = await this.callStateManager("getTokenDeploymentConfig", [
          token
        ]);
        return {
          creator: result.creator,
          baseToken: result.baseToken,
          name: result.name,
          symbol: result.symbol,
          image: result.image,
          teamSupply: result.teamSupply.toString(),
          bondingCurveSupply: result.bondingCurveSupply.toString(),
          liquidityPoolSupply: result.liquidityPoolSupply.toString(),
          totalSupply: result.totalSupply.toString(),
          bondingCurveBuyFee: result.bondingCurveBuyFee,
          bondingCurveSellFee: result.bondingCurveSellFee,
          allowAutoGraduation: result.allowAutoGraduation,
          allowForcedGraduation: result.allowForcedGraduation,
          graduationFeeBps: result.graduationFeeBps,
          poolFees: result.poolFees,
          surgeFeeStartingTime: result.surgeFeeStartingTime.toString(),
          surgeFeeDuration: result.surgeFeeDuration.toString(),
          maxSurgeFeeBps: result.maxSurgeFeeBps,
          bondingCurveFeeSplits: result.bondingCurveFeeSplits.map((split) => ({
            recipient: split.recipient,
            bps: split.bps
          })),
          graduationFeeSplits: result.graduationFeeSplits.map((split) => ({
            recipient: split.recipient,
            bps: split.bps
          })),
          poolFeeSplits: result.poolFeeSplits.map((split) => ({
            recipient: split.recipient,
            bps: split.bps
          })),
          bondingCurveParams: result.bondingCurveParams,
          vestingStartTime: result.vestingStartTime?.toString() || "0",
          vestingDuration: result.vestingDuration?.toString() || "0",
          vestingWallet: result.vestingWallet,
          appIdentifier: result.appIdentifier || ""
        };
      }
      async getTokenSupply(token) {
        const result = await this.callStateManager("getTokenSupply", [token]);
        return (0, import_viem.formatEther)(result);
      }
      async isGraduated(token) {
        return await this.callStateManager("isGraduated", [token]);
      }
      async getProtocolFeeRecipient() {
        return await this.callStateManager("protocolFeeRecipient", []);
      }
      async getPoolFeeSplits(token) {
        const splits = await this.callStateManager("poolFeeSplits", [token]);
        return splits.map((split) => ({
          recipient: split.recipient,
          bps: split.bps
        }));
      }
      async getFees(token) {
        const [configResult, bondingResult, unclaimedResult] = await Promise.allSettled([
          this.getTokenDeploymentConfig(token),
          this.callStateManager("bondingCurveFeeAccumulated", [token]),
          this.callLpLocker("computeUnclaimedFees", [token])
        ]);
        const errors = [];
        const config = configResult.status === "fulfilled" ? configResult.value : (errors.push("token config fetch failed"), void 0);
        const bondingCurveFeeAccumulated = bondingResult.status === "fulfilled" ? bondingResult.value : (errors.push("bondingCurveFeeAccumulated failed"), void 0);
        const computeUnclaimedFee = unclaimedResult.status === "fulfilled" ? unclaimedResult.value : [0n, 0n];
        if (errors.length) {
          throw new Error(errors.join("\n"));
        }
        let baseTokenDecimals = 18;
        if (config.baseToken !== "0x0000000000000000000000000000000000000000") {
          baseTokenDecimals = await this.publicClient.readContract({
            address: config.baseToken,
            abi: [
              {
                name: "decimals",
                type: "function",
                stateMutability: "view",
                inputs: [],
                outputs: [{ type: "uint8" }]
              }
            ],
            functionName: "decimals"
          });
        }
        const bondingFee = BigInt(bondingCurveFeeAccumulated);
        const [uniswapBaseFee, uniswapTokenFee] = computeUnclaimedFee;
        const bondingCurveFeeShare = {};
        const poolFeeShares = {};
        const tokenFeeShare = {};
        for (const { recipient, bps } of config.bondingCurveFeeSplits) {
          bondingCurveFeeShare[recipient] = {
            baseFee: bondingFee * bps / 10000n,
            tokenFee: 0n
          };
        }
        for (const { recipient, bps } of config.poolFeeSplits) {
          poolFeeShares[recipient] = {
            uniswapBaseFee: uniswapBaseFee * bps / 10000n,
            uniswapTokenFee: uniswapTokenFee * bps / 10000n
          };
        }
        for (const recipient in bondingCurveFeeShare) {
          tokenFeeShare[recipient] = {
            baseTokenFeeShare: (0, import_viem.formatUnits)(
              bondingCurveFeeShare[recipient].baseFee + (poolFeeShares[recipient]?.uniswapBaseFee || 0n),
              baseTokenDecimals
            ),
            tokenFeeShare: (0, import_viem.formatEther)(
              bondingCurveFeeShare[recipient].tokenFee + (poolFeeShares[recipient]?.uniswapTokenFee || 0n)
            ),
            bondingCurveBaseTokenFee: (0, import_viem.formatUnits)(
              bondingCurveFeeShare[recipient].baseFee,
              baseTokenDecimals
            ),
            uniswapBaseTokenFee: (0, import_viem.formatEther)(
              poolFeeShares[recipient]?.uniswapBaseFee || 0n
            ),
            uniswapTokenFee: (0, import_viem.formatEther)(
              poolFeeShares[recipient]?.uniswapTokenFee || 0n
            )
          };
        }
        return {
          tokenFeeShare,
          bondingCurveFeeAccumulated: {
            baseFee: (0, import_viem.formatEther)(bondingFee),
            tokenFee: "0"
            // Currently our contract doesn't accumulate fees in token, only in base token
          },
          lpFeeAccumulated: {
            baseFee: (0, import_viem.formatEther)(uniswapBaseFee),
            tokenFee: (0, import_viem.formatEther)(uniswapTokenFee)
          }
        };
      }
      async getPositionManager() {
        return await this.callStateManager("positionManager", []);
      }
      async getStateView() {
        return await this.callStateManager("stateView", []);
      }
      async getTokenIdRecipient() {
        return await this.callStateManager("tokenIdRecipient", []);
      }
      async getTokenDeploymentConfigsMapping(token) {
        return await this.getTokenDeploymentConfig(token);
      }
      async getTokenStatesMapping(token) {
        return await this.getTokenState(token);
      }
    };
  }
});

// src/clients/viem/viem-deployer-write.ts
var import_viem2, import_accounts, import_chains, import_actions, ViemDeployerWriter;
var init_viem_deployer_write = __esm({
  "src/clients/viem/viem-deployer-write.ts"() {
    "use strict";
    import_viem2 = require("viem");
    import_accounts = require("viem/accounts");
    import_chains = require("viem/chains");
    init_config();
    import_actions = require("viem/actions");
    init_abis();
    init_helper();
    init_validators();
    ViemDeployerWriter = class {
      config;
      publicClient;
      walletClient;
      deployerAddress;
      stateManagerAddress;
      DEPLOYER_ABI;
      STATEMANAGER_ABI;
      constructor(config) {
        this.config = config;
        if (!config.rpcUrl) throw new Error("RPC URL is required");
        const networkContracts = CONTRACTS[config.version ?? LATEST_VERSION][config.network];
        if (!networkContracts)
          throw new Error(`Unsupported network: ${config.network}`);
        const abiVersion = ABIS[config.version ?? LATEST_VERSION];
        if (!abiVersion)
          throw new Error(`Unsupported ABI version: ${config.version}`);
        this.DEPLOYER_ABI = abiVersion.DEPLOYER_ABI;
        this.STATEMANAGER_ABI = abiVersion.STATEMANAGER_ABI;
        this.deployerAddress = networkContracts.DEPLOYER_ADDRESS;
        this.stateManagerAddress = networkContracts.STATE_MANAGER_ADDRESS;
        this.publicClient = (0, import_viem2.createPublicClient)({
          transport: (0, import_viem2.http)(config.rpcUrl)
        });
        if (config.walletClient) {
          this.walletClient = config.walletClient;
        } else if (config.privateKey) {
          const account = (0, import_accounts.privateKeyToAccount)(config.privateKey);
          this.walletClient = (0, import_viem2.createWalletClient)({
            account,
            transport: (0, import_viem2.http)(config.rpcUrl),
            chain: config.network === "base-sepolia" ? import_chains.baseSepolia : import_chains.base
          });
        } else {
          throw new Error(
            "ViemDeployerWriter requires either a walletClient or a privateKey"
          );
        }
      }
      buildTxOptions(options) {
        const txOptions = {};
        if (options?.gasLimit) txOptions.gasLimit = options.gasLimit;
        if (options?.gasPrice) txOptions.gasPrice = options.gasPrice;
        return txOptions;
      }
      async buyToken(params, options) {
        const args = [
          params.token,
          (0, import_viem2.parseEther)(params.amountIn),
          (0, import_viem2.parseEther)(params.amountOutMin),
          params.to
        ];
        const value = (0, import_viem2.parseEther)(params.value || params.amountIn);
        const overrides = {
          value,
          ...this.buildTxOptions(options)
        };
        let gasPrice;
        try {
          gasPrice = await this.publicClient.estimateGas({
            account: this.walletClient.account?.address,
            address: this.deployerAddress,
            abi: this.DEPLOYER_ABI,
            functionName: "buyToken",
            args,
            ...overrides
          });
          gasPrice = gasPrice * 12n / 10n;
        } catch (err) {
          console.warn("Gas estimation failed, proceeding without it.", err);
          gasPrice = void 0;
        }
        const hash = await this.walletClient.writeContract({
          address: this.deployerAddress,
          abi: this.DEPLOYER_ABI,
          functionName: "buyToken",
          args,
          ...overrides,
          gasPrice
        });
        const receipt = await (0, import_actions.waitForTransactionReceipt)(this.publicClient, {
          hash
        });
        return {
          hash,
          success: receipt.status,
          receipt
        };
      }
      async sellToken(params, options) {
        const args = [
          params.token,
          (0, import_viem2.parseEther)(params.amountIn),
          (0, import_viem2.parseEther)(params.amountOutMin),
          params.to
        ];
        const txOverrides = {
          ...this.buildTxOptions(options)
        };
        let gasPrice;
        if (options?.gasPrice) {
          gasPrice = options.gasPrice;
        } else {
          try {
            gasPrice = await this.publicClient.estimateGas({
              account: this.walletClient.account?.address,
              address: this.deployerAddress,
              abi: this.DEPLOYER_ABI,
              functionName: "sellToken",
              args,
              ...txOverrides
            });
            gasPrice = gasPrice * 12n / 10n;
          } catch (err) {
            console.warn(
              "Gas estimation failed for sellToken. Using fallback.",
              err
            );
            gasPrice = void 0;
          }
        }
        const hash = await this.walletClient.writeContract({
          address: this.deployerAddress,
          abi: this.DEPLOYER_ABI,
          functionName: "sellToken",
          args,
          ...txOverrides,
          gasPrice
        });
        const receipt = await (0, import_actions.waitForTransactionReceipt)(this.publicClient, {
          hash
        });
        return {
          hash,
          success: receipt.status === "success",
          receipt
        };
      }
      async approveToken(token, amount, options) {
        const ERC20_ABI2 = [
          {
            inputs: [
              { internalType: "address", name: "spender", type: "address" },
              { internalType: "uint256", name: "amount", type: "uint256" }
            ],
            name: "approve",
            outputs: [{ internalType: "bool", name: "", type: "bool" }],
            stateMutability: "nonpayable",
            type: "function"
          }
        ];
        const tx = await this.walletClient.writeContract({
          address: token,
          abi: ERC20_ABI2,
          functionName: "approve",
          args: [this.deployerAddress, (0, import_viem2.parseEther)(amount)],
          ...this.buildTxOptions(options)
        });
        return tx;
      }
      async approveAndSell(params, options) {
        await this.approveToken(params.token, params.amountIn, options);
        console.log("\u2705 Approval successful");
        const result = await this.sellToken(params, options);
        console.log("\u{1F4E4} Sell transaction sent:", result.hash);
        return {
          hash: result.hash,
          success: result.success,
          receipt: result.receipt
        };
      }
      async claimFee(token, options) {
        let gasPrice;
        if (options?.gasPrice) {
          gasPrice = options.gasPrice;
        } else {
          try {
            const estimatedGas = await this.publicClient.estimateContractGas({
              address: this.deployerAddress,
              abi: this.DEPLOYER_ABI,
              functionName: "claimFee",
              args: [token],
              account: this.walletClient.account.address
            });
            gasPrice = estimatedGas * 120n / 100n;
          } catch (err) {
            console.warn(
              "Gas estimation for claimFee failed. Falling back to 7M",
              err
            );
            gasPrice = 10000000n;
          }
        }
        const tx = await this.walletClient.writeContract({
          address: this.deployerAddress,
          abi: this.DEPLOYER_ABI,
          functionName: "claimFee",
          args: [token],
          gasPrice,
          ...this.buildTxOptions(options)
        });
        return tx;
      }
      /**
       * Launch a new token using the bonding curve
       * @param params Token launch parameters including supplies, fees, and configuration
       * @param options Optional transaction parameters like gas limit and gas price
       * @returns Transaction response
       * Protocol fee in basis points (bps).
       * Required. This fee will automatically be allocated to the protocol.
       * Example: 500 = 5%
       */
      async launchToken(params, salt, options) {
        const { config, salt: finalSalt } = processLaunchTokenParams(params, salt);
        const args = [config, finalSalt];
        const txOverrides = this.buildTxOptions(options);
        let gasPrice;
        if (options?.gasPrice) {
          gasPrice = options.gasPrice;
        } else {
          try {
            gasPrice = await this.publicClient.estimateGas({
              account: this.walletClient.account?.address,
              address: this.deployerAddress,
              abi: this.DEPLOYER_ABI,
              functionName: "launchToken",
              args,
              ...txOverrides
            });
            gasPrice = gasPrice * 12n / 10n;
          } catch (err) {
            console.warn(
              "Gas estimation failed for launchToken. Using fallback.",
              err
            );
            gasPrice = void 0;
          }
        }
        const hash = await this.walletClient.writeContract({
          address: this.deployerAddress,
          abi: this.DEPLOYER_ABI,
          functionName: "launchToken",
          args,
          ...txOverrides,
          gasPrice
        });
        const receipt = await (0, import_actions.waitForTransactionReceipt)(this.walletClient, {
          hash
        });
        const createdTokenAddress = extractEventArgument({
          logs: receipt.logs,
          eventName: "TokenLaunched",
          argumentName: "token",
          abi: this.STATEMANAGER_ABI
        });
        if (!createdTokenAddress) {
          throw new Error("TokenLaunched event not found");
        }
        return { tx: hash, createdTokenAddress };
      }
      async graduateToken(token, allowPreGraduation = false, options) {
        const args = [token, allowPreGraduation];
        const txOverrides = this.buildTxOptions(options);
        let gasPrice;
        if (options?.gasPrice) {
          gasPrice = options.gasPrice;
        } else {
          try {
            gasPrice = await this.publicClient.estimateGas({
              account: this.walletClient.account?.address,
              address: this.deployerAddress,
              abi: this.DEPLOYER_ABI,
              functionName: "graduateToken",
              args,
              ...txOverrides
            });
            gasPrice = gasPrice * 12n / 10n;
          } catch (err) {
            console.warn(
              "Gas estimation failed for graduateToken. Proceeding without explicit gas.",
              err
            );
            gasPrice = void 0;
          }
        }
        const hash = await this.walletClient.writeContract({
          address: this.deployerAddress,
          abi: this.DEPLOYER_ABI,
          functionName: "graduateToken",
          args,
          ...txOverrides,
          gasPrice
        });
        const receipt = await (0, import_actions.waitForTransactionReceipt)(this.publicClient, {
          hash
        });
        return {
          success: receipt.status === "success",
          receipt
        };
      }
      async setBaseTokenWhitelist(token, whitelisted, options) {
        const tx = await this.walletClient.writeContract({
          address: this.deployerAddress,
          abi: this.DEPLOYER_ABI,
          functionName: "setBaseTokenWhitelist",
          args: [token, whitelisted],
          ...this.buildTxOptions(options)
        });
        return tx;
      }
      async relinquishStateManager(options) {
        const tx = await this.walletClient.writeContract({
          address: this.deployerAddress,
          abi: this.DEPLOYER_ABI,
          functionName: "relinquishStateManager",
          args: [],
          ...this.buildTxOptions(options)
        });
        return tx;
      }
      async withdrawDust(options) {
        const tx = await this.walletClient.writeContract({
          address: this.deployerAddress,
          abi: this.DEPLOYER_ABI,
          functionName: "withdrawDust",
          args: [],
          ...this.buildTxOptions(options)
        });
        return tx;
      }
      async waitForTransaction(txHash) {
        try {
          const receipt = await (0, import_actions.waitForTransactionReceipt)(this.publicClient, {
            hash: txHash
          });
          return receipt;
        } catch (error) {
          console.error("Error waiting for transaction receipt:", error);
          throw error;
        }
      }
    };
  }
});

// src/clients/viem/index.ts
var viem_exports = {};
__export(viem_exports, {
  ViemDeployer: () => ViemDeployer
});
var ViemDeployer;
var init_viem = __esm({
  "src/clients/viem/index.ts"() {
    "use strict";
    init_viem_deployer_read();
    init_viem_deployer_write();
    ViemDeployer = class {
      read;
      write;
      constructor(config) {
        this.read = new ViemDeployerReader(config);
        if (config.walletClient || config.privateKey) {
          this.write = new ViemDeployerWriter(config);
        } else {
          this.write = null;
          console.warn(
            "[ViemDeployer] No walletClient or privateKey provided. Writer methods are disabled."
          );
        }
      }
    };
  }
});

// src/index.ts
var index_exports = {};
__export(index_exports, {
  BondingCurve: () => curvemath_exports,
  DEPLOYER_ABI: () => DEPLOYER_ABI2,
  DeployerSDK: () => DeployerSDK,
  EthersDeployer: () => EthersDeployer,
  STATEMANAGER_ABI: () => STATEMANAGER_ABI2,
  ViemDeployer: () => ViemDeployer
});
module.exports = __toCommonJS(index_exports);

// src/deployer-sdk.ts
var DeployerSDK = class {
  static async getDeployer(config) {
    if (config.client === "ethers") {
      const { EthersDeployer: EthersDeployer2 } = await Promise.resolve().then(() => (init_ethers(), ethers_exports));
      return new EthersDeployer2(config);
    } else if (config.client === "viem") {
      const { ViemDeployer: ViemDeployer2 } = await Promise.resolve().then(() => (init_viem(), viem_exports));
      return new ViemDeployer2(config);
    }
    throw new Error('Unsupported client type. Use "ethers" or "viem".');
  }
};

// src/index.ts
init_ethers();
init_viem();

// src/curve/curvemath.ts
var curvemath_exports = {};
__export(curvemath_exports, {
  CurveType: () => CurveType,
  DEFAULT_TICK_SPACING: () => DEFAULT_TICK_SPACING,
  InvalidPriceCurveInput: () => InvalidPriceCurveInput,
  MINTED_TOKEN_DECIMALS: () => MINTED_TOKEN_DECIMALS,
  SCALE_EXPONENT: () => SCALE_EXPONENT,
  SCALE_FACTOR: () => SCALE_FACTOR,
  SCALE_FACTOR_SQRT: () => SCALE_FACTOR_SQRT,
  acceleratingPowerCurve: () => acceleratingPowerCurve,
  analyzeCurve: () => analyzeCurve,
  analyzeCurveUntil: () => analyzeCurveUntil,
  customCurve: () => customCurve,
  flatCurve: () => flatCurve,
  formatBaseTokenAmountForCurve: () => formatBaseTokenAmountForCurve,
  formatCurveToBaseTokenStringAmount: () => formatCurveToBaseTokenStringAmount,
  getBaseTokenDetails: () => getBaseTokenDetails,
  initlaizeCurve: () => initlaizeCurve,
  linearCurve: () => linearCurve,
  offsetPriceToSqrtPriceX96: () => offsetPriceToSqrtPriceX96,
  quadraticCurve: () => quadraticCurve,
  sqrtCurve: () => sqrtCurve,
  validateTokenGraduatable: () => validateTokenGraduatable
});

// src/curve/tickmath.ts
var TickMathError = class extends Error {
  constructor(message) {
    super(message);
    this.name = "TickMathError";
  }
};
var InvalidTick = class extends TickMathError {
  tick;
  constructor(tick) {
    super(`Invalid tick: ${tick}`);
    this.name = "InvalidTick";
    this.tick = tick;
  }
};
var InvalidSqrtPrice = class extends TickMathError {
  sqrtPriceX96;
  constructor(sqrtPriceX96) {
    super(`Invalid sqrt price: ${sqrtPriceX96}`);
    this.name = "InvalidSqrtPrice";
    this.sqrtPriceX96 = sqrtPriceX96;
  }
};
var InvalidTokenAmount = class extends TickMathError {
  tokenAmount;
  constructor(tokenAmount) {
    super(`Invalid token amount: ${tokenAmount}`);
    this.name = "InvalidTokenAmount";
    this.tokenAmount = tokenAmount;
  }
};
var SubByTooLarge = class extends TickMathError {
  subBy;
  sqrtTargetPrice;
  constructor(subBy, sqrtTargetPrice) {
    super(`Subtraction is greater than the price target: ${subBy} > ${sqrtTargetPrice}`);
    this.name = "SubByTooLarge";
    this.subBy = subBy;
    this.sqrtTargetPrice = sqrtTargetPrice;
  }
};
var StartTickTooLow = class extends TickMathError {
  startTick;
  targetTick;
  constructor(startTick, targetTick) {
    super(`Start tick is too low: ${startTick} < ${targetTick}`);
    this.name = "StartTickTooLow";
    this.startTick = startTick;
    this.targetTick = targetTick;
  }
};
var StartTickTooHigh = class extends TickMathError {
  startTick;
  targetTick;
  constructor(startTick, targetTick) {
    super(`Start tick is too high: ${startTick} > ${targetTick}`);
    this.name = "StartTickTooHigh";
    this.startTick = startTick;
    this.targetTick = targetTick;
  }
};
var MIN_TICK = -887272n;
var MAX_TICK = 887272n;
var MIN_SQRT_RATIO = 4295128739n;
var MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342n;
var MAX_SQRT_RATIO_MINUS_MIN_SQRT_RATIO_MINUS_ONE = MAX_SQRT_RATIO - MIN_SQRT_RATIO - 1n;
var maxUsableTick = (tickSpacing) => {
  return MAX_TICK / tickSpacing * tickSpacing;
};
var getSqrtPriceAtTick = (tick) => {
  if (tick < 0) {
    tick = tick >= -(1n << 23n) ? tick : tick | ~((1n << 24n) - 1n);
  } else {
    tick = tick < 1n << 23n ? tick : tick & (1n << 24n) - 1n;
  }
  const absTick = tick < 0n ? -tick : tick;
  if (absTick > MAX_TICK) {
    throw new InvalidTick(tick);
  }
  let price;
  if ((absTick & 0x1n) !== 0n) {
    price = 0xFFFCB933BD6FAD37AA2D162D1A594001n;
  } else {
    price = 1n << 128n;
  }
  if ((absTick & 0x2n) !== 0n) {
    price = price * 0xFFF97272373D413259A46990580E213An >> 128n;
  }
  if ((absTick & 0x4n) !== 0n) {
    price = price * 0xFFF2E50F5F656932EF12357CF3C7FDCCn >> 128n;
  }
  if ((absTick & 0x8n) !== 0n) {
    price = price * 0xFFE5CACA7E10E4E61C3624EAA0941CD0n >> 128n;
  }
  if ((absTick & 0x10n) !== 0n) {
    price = price * 0xFFCB9843D60F6159C9DB58835C926644n >> 128n;
  }
  if ((absTick & 0x20n) !== 0n) {
    price = price * 0xFF973B41FA98C081472E6896DFB254C0n >> 128n;
  }
  if ((absTick & 0x40n) !== 0n) {
    price = price * 0xFF2EA16466C96A3843EC78B326B52861n >> 128n;
  }
  if ((absTick & 0x80n) !== 0n) {
    price = price * 0xFE5DEE046A99A2A811C461F1969C3053n >> 128n;
  }
  if ((absTick & 0x100n) !== 0n) {
    price = price * 0xFCBE86C7900A88AEDCFFC83B479AA3A4n >> 128n;
  }
  if ((absTick & 0x200n) !== 0n) {
    price = price * 0xF987A7253AC413176F2B074CF7815E54n >> 128n;
  }
  if ((absTick & 0x400n) !== 0n) {
    price = price * 0xF3392B0822B70005940C7A398E4B70F3n >> 128n;
  }
  if ((absTick & 0x800n) !== 0n) {
    price = price * 0xE7159475A2C29B7443B29C7FA6E889D9n >> 128n;
  }
  if ((absTick & 0x1000n) !== 0n) {
    price = price * 0xD097F3BDFD2022B8845AD8F792AA5825n >> 128n;
  }
  if ((absTick & 0x2000n) !== 0n) {
    price = price * 0xA9F746462D870FDF8A65DC1F90E061E5n >> 128n;
  }
  if ((absTick & 0x4000n) !== 0n) {
    price = price * 0x70D869A156D2A1B890BB3DF62BAF32F7n >> 128n;
  }
  if ((absTick & 0x8000n) !== 0n) {
    price = price * 0x31BE135F97D08FD981231505542FCFA6n >> 128n;
  }
  if ((absTick & 0x10000n) !== 0n) {
    price = price * 0x9AA508B5B7A84E1C677DE54F3E99BC9n >> 128n;
  }
  if ((absTick & 0x20000n) !== 0n) {
    price = price * 0x5D6AF8DEDB81196699C329225EE604n >> 128n;
  }
  if ((absTick & 0x40000n) !== 0n) {
    price = price * 0x2216E584F5FA1EA926041BEDFE98n >> 128n;
  }
  if ((absTick & 0x80000n) !== 0n) {
    price = price * 0x48A170391F7DC42444E8FA2n >> 128n;
  }
  if (tick > 0n) {
    price = ((1n << 256n) - 1n) / price;
  }
  const sqrtPriceX96 = price + (1n << 32n) - 1n >> 32n;
  return sqrtPriceX96;
};
var mostSignificantBit = (x) => {
  if (x === 0n) return 0n;
  let msb = 0n;
  let value = x;
  while (value > 1n) {
    value >>= 1n;
    msb++;
  }
  return msb;
};
var getTickAtSqrtPrice = (sqrtPriceX96) => {
  if (sqrtPriceX96 - MIN_SQRT_RATIO > MAX_SQRT_RATIO_MINUS_MIN_SQRT_RATIO_MINUS_ONE) {
    throw new InvalidSqrtPrice(sqrtPriceX96);
  }
  const price = sqrtPriceX96 << 32n;
  let r = price;
  const msb = mostSignificantBit(r);
  if (msb >= 128n) {
    r = price >> msb - 127n;
  } else {
    r = price << 127n - msb;
  }
  let log2 = msb - 128n << 64n;
  for (let i = 0; i < 14; i++) {
    r = r * r >> 127n;
    const f = r >> 128n;
    log2 = log2 | f << 63n - BigInt(i);
    r = r >> f;
  }
  const logSqrt10001 = log2 * 255738958999603826347141n;
  let tickLow = logSqrt10001 - 3402992956809132418596140100660247210n >> 128n;
  let tickHi = logSqrt10001 + 291339464771989622907027621153398088495n >> 128n;
  tickLow = tickLow > MAX_TICK ? MAX_TICK : tickLow < MIN_TICK ? MIN_TICK : tickLow;
  tickHi = tickHi > MAX_TICK ? MAX_TICK : tickHi < MIN_TICK ? MIN_TICK : tickHi;
  if (tickLow === tickHi) {
    return tickLow;
  } else {
    return getSqrtPriceAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;
  }
};
var invertSqrtPriceX96 = (sqrtPriceX96) => {
  const tick = getTickAtSqrtPrice(sqrtPriceX96);
  return getSqrtPriceAtTick(-tick);
};
var quantizeTick = (tick, tickSpacing, round = false) => {
  if (round) {
    const absTick = tick >= 0n ? tick : -tick;
    const absMod = absTick % tickSpacing;
    const absResult = absMod > tickSpacing / 2n ? absTick + (tickSpacing - absMod) : absTick - absMod;
    return tick >= 0n ? absResult : -absResult;
  }
  return tick - tick % tickSpacing;
};
var assertTickInRange = (tick, tickSpacing = 200n) => {
  if (tick < MIN_TICK || tick > MAX_TICK) {
    throw new InvalidTick(tick);
  }
  if (tick % tickSpacing !== 0n) {
    throw new InvalidTick(tick);
  }
};
var getTargetPriceAndHooksSimple = (priceX96, numToken0, numToken1, tickSpacing = 60n) => {
  if (priceX96 < MIN_SQRT_RATIO || priceX96 > MAX_SQRT_RATIO) {
    throw new InvalidSqrtPrice(priceX96);
  }
  const targetTick = quantizeTick(
    getTickAtSqrtPrice(priceX96),
    tickSpacing,
    true
  );
  assertTickInRange(targetTick, tickSpacing);
  const endTick = maxUsableTick(tickSpacing);
  assertTickInRange(endTick, tickSpacing);
  const sqrtTargetPrice = getSqrtPriceAtTick(targetTick);
  const sqrtEndPrice = getSqrtPriceAtTick(endTick);
  const sqrtPriceRange = invertSqrtPriceX96(sqrtTargetPrice) - invertSqrtPriceX96(sqrtEndPrice);
  if (numToken0 <= 0n) {
    throw new InvalidTokenAmount(numToken0);
  }
  const subBy = sqrtPriceRange * numToken1 / numToken0;
  if (subBy > sqrtTargetPrice) {
    throw new SubByTooLarge(subBy, sqrtTargetPrice);
  }
  const sqrtStartPriceX96 = sqrtTargetPrice - subBy;
  if (sqrtStartPriceX96 < MIN_SQRT_RATIO) {
    throw new StartTickTooLow(sqrtStartPriceX96, MIN_SQRT_RATIO);
  }
  if (sqrtStartPriceX96 > MAX_SQRT_RATIO) {
    throw new StartTickTooHigh(sqrtStartPriceX96, MAX_SQRT_RATIO);
  }
  let startTick = getTickAtSqrtPrice(sqrtStartPriceX96);
  startTick = quantizeTick(startTick, tickSpacing, true);
  if (startTick > targetTick) {
    throw new Error(
      `start_tick should be less than target_tick: ${startTick} <= ${targetTick}`
    );
  }
  assertTickInRange(startTick, tickSpacing);
  assertTickInRange(targetTick, tickSpacing);
  return [startTick, targetTick, endTick];
};
var minTokens = (priceX96, numToken1, tickSpacing = 60n) => {
  if (priceX96 < MIN_SQRT_RATIO || priceX96 > MAX_SQRT_RATIO) {
    throw new Error("Invalid price_x96");
  }
  const targetTick = quantizeTick(
    getTickAtSqrtPrice(priceX96),
    tickSpacing,
    true
  );
  assertTickInRange(targetTick, tickSpacing);
  const endTick = maxUsableTick(tickSpacing);
  assertTickInRange(endTick, tickSpacing);
  const sqrtTargetPrice = getSqrtPriceAtTick(targetTick);
  const sqrtEndPrice = getSqrtPriceAtTick(endTick);
  const sqrtPriceRange = invertSqrtPriceX96(sqrtTargetPrice) - invertSqrtPriceX96(sqrtEndPrice);
  if (numToken1 <= 0n) {
    throw new Error("Base token must be non-zero");
  }
  const numTokenMin = ceilDiv(sqrtPriceRange * numToken1, sqrtTargetPrice + MIN_SQRT_RATIO);
  const numTokenMinWithBuffer = numTokenMin * 10000n / 9999n;
  return numTokenMinWithBuffer;
};
var ceilDiv = (numerator, denominator) => {
  return (numerator + denominator - 1n) / denominator;
};
var priceToSqrtPriceX96 = (price) => {
  return BigInt(Math.floor(Math.sqrt(Number(price)) * Math.pow(2, 96)));
};

// src/curve/bigintmath.ts
var sqrt = (N) => {
  if (N < 0n) return BigInt(Math.sqrt(-1));
  let aprx;
  if (N < 9007199254740991n) {
    aprx = BigInt(Math.floor(Math.sqrt(Number(N))));
    if (aprx ** 2n > N) aprx--;
    return aprx;
  }
  ;
  const base32 = N.toString(32);
  const len = base32.length * 5 - 5 + parseInt(base32[0], 32).toString(2).length;
  function approx(a1, len2) {
    if (len2 < 53) {
      let aprx2 = BigInt(Math.floor(Math.sqrt(Number(a1))));
      if (aprx2 ** 2n > a1) aprx2--;
      return aprx2;
    }
    let base2 = Math.floor(len2 / 2) - len2 % 2;
    if (base2 % 2 == 1) base2--;
    let b1 = a1 >> BigInt(base2), b0 = BigInt.asUintN(base2, a1), r1 = approx(b1, len2 - base2), r0 = ((b1 - r1 ** 2n << BigInt(base2)) + b0) / (2n * r1);
    return (r1 << BigInt(base2 / 2)) + (r0 >> BigInt(base2 / 2));
  }
  aprx = approx(N, len);
  if (aprx ** 2n > N) aprx--;
  return aprx;
};

// src/curve/curvemath.ts
init_config();

// src/utils/parseUnits.ts
var InvalidDecimalNumberError = class extends Error {
  name;
  constructor({ value }) {
    super(`Number \`${value}\` is not a valid decimal number.`);
    this.name = "InvalidDecimalNumberError";
  }
};
function parseUnits(value, decimals) {
  if (!/^(-?)([0-9]*)\.?([0-9]*)$/.test(value))
    throw new InvalidDecimalNumberError({ value });
  let [integer, fraction = "0"] = value.split(".");
  const negative = integer.startsWith("-");
  if (negative) integer = integer.slice(1);
  fraction = fraction.replace(/(0+)$/, "");
  if (decimals === 0) {
    if (Math.round(Number(`.${fraction}`)) === 1)
      integer = `${BigInt(integer) + 1n}`;
    fraction = "";
  } else if (fraction.length > decimals) {
    const [left, unit, right] = [
      fraction.slice(0, decimals - 1),
      fraction.slice(decimals - 1, decimals),
      fraction.slice(decimals)
    ];
    const rounded = Math.round(Number(`${unit}.${right}`));
    if (rounded > 9)
      fraction = `${BigInt(left) + BigInt(1)}0`.padStart(left.length + 1, "0");
    else fraction = `${left}${rounded}`;
    if (fraction.length > decimals) {
      fraction = fraction.slice(1);
      integer = `${BigInt(integer) + 1n}`;
    }
    fraction = fraction.slice(0, decimals);
  } else {
    fraction = fraction.padEnd(decimals, "0");
  }
  return BigInt(`${negative ? "-" : ""}${integer}${fraction}`);
}

// src/utils/formatUnits.ts
function formatUnits3(value, decimals) {
  let display = value.toString();
  const negative = display.startsWith("-");
  if (negative) display = display.slice(1);
  display = display.padStart(decimals, "0");
  let [integer, fraction] = [
    display.slice(0, display.length - decimals),
    display.slice(display.length - decimals)
  ];
  fraction = fraction.replace(/(0+)$/, "");
  return `${negative ? "-" : ""}${integer || "0"}${fraction ? `.${fraction}` : ""}`;
}

// src/curve/curvemath.ts
var MINTED_TOKEN_DECIMALS = 18n;
var SCALE_EXPONENT = 36n;
var SCALE_FACTOR = 10n ** SCALE_EXPONENT;
var SCALE_FACTOR_SQRT = 10n ** (SCALE_EXPONENT / 2n);
var DEFAULT_TICK_SPACING = 200n;
var CurveType = /* @__PURE__ */ ((CurveType2) => {
  CurveType2["FLAT"] = "flat";
  CurveType2["LINEAR"] = "linear";
  CurveType2["QUADRATIC"] = "quadratic";
  CurveType2["CUBIC"] = "cubic";
  CurveType2["SQUARE_ROOT"] = "square_root";
  return CurveType2;
})(CurveType || {});
var initlaizeCurve = (curveType, startPrice, endPrice, numSteps, approxBondingCurveSupply) => {
  if (numSteps < 1n) {
    throw new Error("Num steps must be greater than 0");
  }
  const actualBondingCurveSupply = approxBondingCurveSupply / numSteps * numSteps;
  switch (curveType) {
    case "flat" /* FLAT */:
      if (startPrice !== endPrice || numSteps !== 1n) {
        throw new Error(
          "Flat curve must have startPrice === endPrice and numSteps === 1"
        );
      }
      return flatCurve(startPrice, actualBondingCurveSupply);
    case "linear" /* LINEAR */:
      return linearCurve(
        startPrice,
        endPrice,
        numSteps,
        actualBondingCurveSupply
      );
    case "quadratic" /* QUADRATIC */:
      return quadraticCurve(
        startPrice,
        endPrice,
        numSteps,
        actualBondingCurveSupply
      );
    case "cubic" /* CUBIC */:
      return acceleratingPowerCurve(
        startPrice,
        endPrice,
        numSteps,
        actualBondingCurveSupply
      );
    case "square_root" /* SQUARE_ROOT */:
      return sqrtCurve(
        startPrice,
        endPrice,
        numSteps,
        actualBondingCurveSupply
      );
    default:
      throw new Error("Invalid curve type");
  }
};
var getBaseTokenDetails = (baseTokenChainId, baseTokenAddress) => {
  const baseToken = SUPPORTED_BASE_TOKENS.find(
    (token) => token.chainId === baseTokenChainId && token.address === baseTokenAddress
  );
  if (!baseToken) {
    throw new Error("Base token not found");
  }
  return baseToken;
};
var formatBaseTokenAmountForCurve = (baseTokenAmountFormattedString, baseTokenChainId, baseTokenAddress) => {
  const baseToken = getBaseTokenDetails(baseTokenChainId, baseTokenAddress);
  const decimals = SCALE_EXPONENT + BigInt(baseToken.decimals) - MINTED_TOKEN_DECIMALS;
  const baseTokenAmount = parseUnits(
    baseTokenAmountFormattedString,
    Number(decimals)
  );
  return baseTokenAmount;
};
var formatCurveToBaseTokenStringAmount = (curvePrice, baseTokenChainId, baseTokenAddress) => {
  const baseToken = getBaseTokenDetails(baseTokenChainId, baseTokenAddress);
  const decimals = SCALE_EXPONENT + BigInt(baseToken.decimals) - MINTED_TOKEN_DECIMALS;
  return formatUnits3(curvePrice, Number(decimals));
};
function flatCurve(startPrice, totalSupply) {
  return {
    prices: [startPrice],
    numSteps: 1n,
    stepSize: totalSupply
  };
}
function linearCurve(startPrice, endPrice, numSteps, bondingCurveSupply) {
  _validate(bondingCurveSupply, numSteps, startPrice, endPrice);
  const prices = [];
  const stepSize = bondingCurveSupply / numSteps;
  const diff = endPrice - startPrice;
  const denom = numSteps - 1n;
  const loMult = diff / denom;
  const hiMult = loMult + 1n;
  const hiCutoff = diff % denom;
  let currentPrice = startPrice;
  for (let i = 0n; i < numSteps; i++) {
    prices.push(currentPrice);
    if (i < hiCutoff) {
      currentPrice += hiMult;
    } else {
      currentPrice += loMult;
    }
  }
  if (prices[0] !== startPrice) {
    throw new Error("Price curve does not start at startPrice");
  }
  if (prices[prices.length - 1] !== endPrice) {
    throw new Error("Price curve does not end at endPrice");
  }
  return {
    prices,
    numSteps,
    stepSize
  };
}
function quadraticCurve(startPrice, endPrice, numSteps, bondingCurveSupply) {
  _validate(bondingCurveSupply, numSteps, startPrice, endPrice);
  const prices = [];
  const diff = endPrice - startPrice;
  const denom = (numSteps - 1n) * (numSteps - 1n);
  let idx2 = 0n;
  for (let i = 0n; i < numSteps; i++) {
    prices.push(startPrice + diff * idx2 / denom);
    idx2 += 2n * i + 1n;
  }
  if (prices[0] !== startPrice) {
    throw new Error("Price curve does not start at startPrice");
  }
  if (prices[prices.length - 1] !== endPrice) {
    throw new Error("Price curve does not end at endPrice");
  }
  return {
    prices,
    numSteps,
    stepSize: bondingCurveSupply / numSteps
  };
}
function acceleratingPowerCurve(startPrice, endPrice, numSteps, bondingCurveSupply) {
  _validate(bondingCurveSupply, numSteps, startPrice, endPrice);
  const prices = [];
  const diff = endPrice - startPrice;
  const denom = numSteps - 1n;
  const denom3 = denom * denom * denom;
  let i2 = 0n;
  let i3 = 0n;
  for (let i = 0n; i < numSteps; i++) {
    prices.push(startPrice + diff * i3 / denom3);
    i3 += 3n * (i2 + i) + 1n;
    i2 += 2n * i + 1n;
  }
  if (prices[0] !== startPrice) {
    throw new Error("Price curve does not start at startPrice");
  }
  if (prices[prices.length - 1] !== endPrice) {
    throw new Error("Price curve does not end at endPrice");
  }
  return {
    prices,
    numSteps,
    stepSize: bondingCurveSupply / numSteps
  };
}
function sqrtCurve(startPrice, endPrice, numSteps, bondingCurveSupply) {
  _validate(bondingCurveSupply, numSteps, startPrice, endPrice);
  const prices = [];
  const diff = endPrice - startPrice;
  for (let i = 0n; i < numSteps; i++) {
    prices.push(startPrice + sqrt(diff * diff * i / numSteps));
  }
  prices[prices.length - 1] = endPrice;
  if (prices[0] !== startPrice) {
    throw new Error("Price curve does not start at startPrice");
  }
  if (prices[prices.length - 1] !== endPrice) {
    throw new Error("Price curve does not end at endPrice");
  }
  return {
    prices,
    numSteps,
    stepSize: bondingCurveSupply / numSteps
  };
}
function customCurve(prices, bondingCurveSupply) {
  return {
    prices,
    numSteps: BigInt(prices.length),
    stepSize: bondingCurveSupply / BigInt(prices.length)
  };
}
function analyzeCurve(curve) {
  const baseTokenAccumulatedPerStep = curve.prices.map(
    (price) => price * curve.stepSize / 10n ** 36n
  );
  const baseTokenAccumulated = baseTokenAccumulatedPerStep.reduce(
    (a, b) => a + b,
    0n
  );
  const minLiquidityPoolSupply = minTokens(
    offsetPriceToSqrtPriceX96(curve.prices[curve.prices.length - 1]),
    baseTokenAccumulated,
    DEFAULT_TICK_SPACING
  );
  return {
    bondingCurveSupply: curve.stepSize * curve.numSteps,
    baseTokenAccumulated,
    minLiquidityPoolSupply
  };
}
function analyzeCurveUntil(curve, tokensConsumed) {
  let ethAccumulated = 0n;
  for (let i = 0n; i < curve.numSteps; i++) {
    if (curve.stepSize > tokensConsumed) {
      ethAccumulated += curve.prices[Number(i)] * tokensConsumed / 10n ** 36n;
      break;
    } else {
      ethAccumulated += curve.prices[Number(i)] * curve.stepSize / 10n ** 36n;
      tokensConsumed -= curve.stepSize;
    }
  }
  return ethAccumulated;
}
var InvalidPriceCurveInput = class extends Error {
  constructor() {
    super(
      "Invalid price curve input: numSteps must be > 1, startPrice must be < endPrice, and bonding curve supply must be divisible by numSteps"
    );
    this.name = "InvalidPriceCurveInput";
  }
};
function _validate(bondingCurveSupply, numSteps, startPrice, endPrice) {
  if (numSteps <= 1n || startPrice >= endPrice || bondingCurveSupply % numSteps !== 0n) {
    throw new InvalidPriceCurveInput();
  }
}
var validateTokenGraduatable = (priceCurve, graduationFeeBps, liquidityPoolSupply) => {
  const tickSpacing = DEFAULT_TICK_SPACING;
  const priceOffseted = priceCurve.prices[priceCurve.prices.length - 1];
  const priceX96 = offsetPriceToSqrtPriceX96(priceOffseted);
  const curveAnalysis = analyzeCurve(priceCurve);
  const baseTokenAmount = curveAnalysis.baseTokenAccumulated;
  const baseTokenGraduationFee = baseTokenAmount * graduationFeeBps / 10000n;
  const baseTokenAfterFees = baseTokenAmount - baseTokenGraduationFee;
  try {
    getTargetPriceAndHooksSimple(
      priceX96,
      liquidityPoolSupply,
      baseTokenAfterFees,
      tickSpacing
    );
  } catch (e) {
    if (e instanceof StartTickTooLow || e instanceof InvalidTokenAmount || e instanceof SubByTooLarge) {
      throw new Error(
        "Please increase target price or increase liquidity pool supply"
      );
    }
    if (e instanceof StartTickTooHigh) {
      throw new Error(
        "Please decrease target price or increase bonding curve supply"
      );
    }
    throw e;
  }
};
var offsetPriceToSqrtPriceX96 = (price) => {
  return priceToSqrtPriceX96(price) / SCALE_FACTOR_SQRT;
};

// src/index.ts
init_deployer_abi2();
init_statemanager_abi2();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  BondingCurve,
  DEPLOYER_ABI,
  DeployerSDK,
  EthersDeployer,
  STATEMANAGER_ABI,
  ViemDeployer
});
//# sourceMappingURL=index.cjs.map