TokenFactory ABI

The minimal ABI required to interact with the InkyPump TokenFactory contract.
[
  {
    "inputs": [
      {
        "components": [
          { "internalType": "string", "name": "name", "type": "string" },
          { "internalType": "string", "name": "ticker", "type": "string" },
          { "internalType": "string", "name": "description", "type": "string" },
          { "internalType": "string", "name": "imageUrl", "type": "string" },
          { "internalType": "string", "name": "telegram", "type": "string" },
          { "internalType": "string", "name": "twitter", "type": "string" },
          { "internalType": "string", "name": "website", "type": "string" },
          { "internalType": "address", "name": "owner", "type": "address" },
          { "internalType": "uint40", "name": "createdAt", "type": "uint40" }
        ],
        "internalType": "struct TokenFactory.TokenMetadata",
        "name": "metadata",
        "type": "tuple"
      },
      { "internalType": "string", "name": "_referral", "type": "string" }
    ],
    "name": "createToken",
    "outputs": [
      { "internalType": "address", "name": "tokenAddress", "type": "address" }
    ],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "components": [
          { "internalType": "string", "name": "name", "type": "string" },
          { "internalType": "string", "name": "ticker", "type": "string" },
          { "internalType": "string", "name": "description", "type": "string" },
          { "internalType": "string", "name": "imageUrl", "type": "string" },
          { "internalType": "string", "name": "telegram", "type": "string" },
          { "internalType": "string", "name": "twitter", "type": "string" },
          { "internalType": "string", "name": "website", "type": "string" },
          { "internalType": "address", "name": "owner", "type": "address" },
          { "internalType": "uint40", "name": "createdAt", "type": "uint40" }
        ],
        "internalType": "struct TokenFactory.TokenMetadata",
        "name": "metadata",
        "type": "tuple"
      },
      { "internalType": "string", "name": "_referral", "type": "string" }
    ],
    "name": "createAndBuyToken",
    "outputs": [
      { "internalType": "address", "name": "tokenAddress", "type": "address" }
    ],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      { "internalType": "address", "name": "tokenAddress", "type": "address" },
      { "internalType": "string", "name": "_referral", "type": "string" }
    ],
    "name": "buy",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      { "internalType": "address", "name": "tokenAddress", "type": "address" },
      { "internalType": "uint256", "name": "amount", "type": "uint256" },
      { "internalType": "string", "name": "_referral", "type": "string" }
    ],
    "name": "sell",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      { "internalType": "address", "name": "tokenAddress", "type": "address" },
      { "internalType": "uint256", "name": "ethAmount", "type": "uint256" }
    ],
    "name": "getQuoteBuy",
    "outputs": [
      { "internalType": "uint256", "name": "", "type": "uint256" }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      { "internalType": "address", "name": "tokenAddress", "type": "address" },
      { "internalType": "uint256", "name": "tokenAmount", "type": "uint256" }
    ],
    "name": "getQuoteSell",
    "outputs": [
      { "internalType": "uint256", "name": "", "type": "uint256" }
    ],
    "stateMutability": "view",
    "type": "function"
  }
]

Events

[
  {
    "anonymous": false,
    "inputs": [
      { "indexed": true, "internalType": "address", "name": "token", "type": "address" },
      {
        "indexed": false,
        "components": [
          { "internalType": "string", "name": "name", "type": "string" },
          { "internalType": "string", "name": "ticker", "type": "string" },
          { "internalType": "string", "name": "description", "type": "string" },
          { "internalType": "string", "name": "imageUrl", "type": "string" },
          { "internalType": "string", "name": "telegram", "type": "string" },
          { "internalType": "string", "name": "twitter", "type": "string" },
          { "internalType": "string", "name": "website", "type": "string" },
          { "internalType": "address", "name": "owner", "type": "address" },
          { "internalType": "uint40", "name": "createdAt", "type": "uint40" }
        ],
        "internalType": "struct TokenFactory.TokenMetadata",
        "name": "metadata",
        "type": "tuple"
      },
      { "indexed": false, "internalType": "string", "name": "referral", "type": "string" }
    ],
    "name": "TokenCreated",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      { "indexed": true, "internalType": "address", "name": "token", "type": "address" },
      { "indexed": true, "internalType": "address", "name": "pair", "type": "address" },
      { "indexed": false, "internalType": "enum TokenFactory.TransactionType", "name": "txType", "type": "uint8" },
      {
        "indexed": false,
        "components": [
          { "internalType": "uint256", "name": "price", "type": "uint256" },
          { "internalType": "uint256", "name": "totalSupply", "type": "uint256" },
          { "internalType": "uint40", "name": "timestamp", "type": "uint40" }
        ],
        "internalType": "struct TokenFactory.TokenPriceData",
        "name": "priceData",
        "type": "tuple"
      },
      {
        "indexed": false,
        "components": [
          { "internalType": "address", "name": "trader", "type": "address" },
          { "internalType": "uint256", "name": "tokenAmount", "type": "uint256" },
          { "internalType": "uint256", "name": "ethAmount", "type": "uint256" }
        ],
        "internalType": "struct TokenFactory.TransactionData",
        "name": "txData",
        "type": "tuple"
      },
      { "indexed": false, "internalType": "string", "name": "referral", "type": "string" }
    ],
    "name": "TokenPriceUpdate",
    "type": "event"
  }
]

Error Definitions

[
  { "inputs": [], "name": "InsufficientETH", "type": "error" },
  { "inputs": [], "name": "InvalidAmount", "type": "error" },
  { "inputs": [{ "internalType": "string", "name": "field", "type": "string" }], "name": "InvalidMetadata", "type": "error" },
  { "inputs": [], "name": "TokenNotFunding", "type": "error" },
  { "inputs": [], "name": "ETHTransferFailed", "type": "error" },
  { "inputs": [], "name": "NoFeeAvailable", "type": "error" },
  { "inputs": [], "name": "FeeTooHigh", "type": "error" }
]

Usage Example

import { ethers } from 'ethers'
import FACTORY_ABI from './abi.json'

const TOKEN_FACTORY_ADDRESS = "0x1D74317d760f2c72A94386f50E8D10f2C902b899"

const provider = new ethers.providers.Web3Provider(window.ethereum)
const signer = provider.getSigner()

const factory = new ethers.Contract(
  TOKEN_FACTORY_ADDRESS,
  FACTORY_ABI,
  signer
)

Type Definitions

interface TokenMetadata {
  name: string
  ticker: string
  description: string
  imageUrl: string
  telegram: string
  twitter: string
  website: string
  owner: string
  createdAt: number
}

enum TokenState {
  NOT_CREATED = 0,
  FUNDING = 1,
  TRADING = 2
}

enum TransactionType {
  BUY = 0,
  SELL = 1,
  ADD_LIQUIDITY = 2
}

interface TokenPriceData {
  price: BigNumber
  totalSupply: BigNumber
  timestamp: number
}

interface TransactionData {
  trader: string
  tokenAmount: BigNumber
  ethAmount: BigNumber
}

Constants

const MAX_SUPPLY = ethers.utils.parseEther("1000000000")
const INITIAL_SUPPLY = ethers.utils.parseEther("200000000")
const FUNDING_SUPPLY = ethers.utils.parseEther("800000000")
const FUNDING_GOAL = ethers.utils.parseEther("3")
const CREATION_FEE = ethers.utils.parseEther("0.001")
This ABI includes only the essential functions needed for interacting with the TokenFactory contract. Administrative functions are excluded for security.