Skip to content

IFIF Factory Indexer

Comprehensive real-time indexing for the IFIF Factory contract, providing complete factory operations tracking, project deployment monitoring, system management analytics, and infrastructure oversight.

Overview

The IFIF Factory indexer processes all factory-related events from the Factory contract, transforming raw blockchain events into structured, queryable data. It provides real-time tracking of project deployments, token deployments, system updates, and comprehensive analytics for factory operations and system administration.

Features

🔍 Event Processing

  • Deployed: Project deployment tracking with initial configuration
  • TokenDeployed: Token deployment linking to projects
  • ImplementationUpdated: Factory implementation upgrades
  • TokenImplementationUpdated: Token implementation upgrades
  • CoreUpdated: Whitelist and DEX router updates
  • BaseURIUpdated: Base URI configuration changes
  • DeploymentDetailsUpdated: Project name and symbol updates
  • RoleHelperUpdated: Role helper contract changes

📊 Data Analytics

  • Factory deployment statistics
  • System configuration tracking
  • Administrative operation history
  • Daily deployment metrics
  • Implementation upgrade monitoring

🛡️ Data Integrity

  • Duplicate event prevention
  • Transaction-level consistency
  • Type-safe data validation
  • Comprehensive error handling
  • Framework compliance (no return statements)

Database Schema

factoryDeployment Table

Core project deployment tracking from the factory.

{
  id: Hash,                     // Event ID
  chainId: number,              // Chain ID of the blockchain
  projectId: number,            // Unique project ID (composite primary key with chainId)
  projectAddress: Address,      // Deployed project contract address
  projectName: string,          // Project name
  projectSymbol: string,        // Project symbol
  currentImplementation: Address, // Implementation used for deployment
  version: number,              // Project version (1 for v1, 2 for v2)
  timestamp: bigint,            // Deployment timestamp
  blockNumber: bigint,          // Block number
  transactionHash: Hash         // Transaction hash
}
Use Cases:
  • Project deployment history
  • Factory operation analytics
  • Implementation tracking
  • Deployment verification

tokenDeployment Table

Token deployment tracking from factory events.

{
  id: Hash,                     // Event ID (composite primary key with chainId)
  chainId: number,              // Chain ID of the blockchain
  projectId: number,            // Sequential project identifier
  tokenAddress: Address,        // Deployed token contract address
  projectAddress: Address,      // Associated project contract address
  tokenImplementation: Address, // Token implementation used
  mintAmount: bigint,           // Initial token mint amount
  timestamp: bigint,            // Deployment timestamp
  blockNumber: bigint,          // Block number
  transactionHash: Hash         // Transaction hash
}
Use Cases:
  • Token deployment tracking
  • Project-token linking
  • Mint amount verification
  • Token implementation monitoring

factorySystemUpdate Table

System configuration and upgrade tracking.

{
  id: Hash,                        // Event ID (composite primary key with chainId)
  chainId: number,                 // Chain ID of the blockchain
  updateType: number,              // Update type (FactorySystemUpdateType enum as integer)
  newValue: Hash,                  // New value for the update (address for contracts, hash for URIs)
  timestamp: bigint,               // Update timestamp
  blockNumber: bigint,             // Block number
  transactionHash: Hash            // Transaction hash
}
Update Types:
  • IMPLEMENTATION - Factory implementation upgrades
  • TOKEN_IMPLEMENTATION - Token implementation upgrades
  • WHITELIST - Whitelist contract updates
  • DEX_ROUTER - DEX router contract updates
  • BASE_URI - Base URI configuration updates
  • ROLE_HELPER - Role helper contract updates
  • DEX_ROUTER - DEX router updates
  • BASE_URI - Base URI configuration changes
  • ROLE_HELPER - Role helper contract updates
Use Cases:
  • System configuration tracking
  • Infrastructure upgrade monitoring
  • Administrative oversight
  • Security monitoring

deploymentDetailsUpdate Table

Project metadata update tracking.

{
  id: Hash,                 // Event ID (composite primary key with chainId)
  chainId: number,          // Chain ID of the blockchain
  projectId: number,        // Project ID being updated
  projectAddress: Address,  // Project contract address
  updatedBy: Address,       // Update initiator
  oldProjectName: string | null,   // Previous project name
  newProjectName: string,   // New project name
  oldProjectSymbol: string | null, // Previous project symbol
  newProjectSymbol: string, // New project symbol
  timestamp: bigint,        // Update timestamp
  blockNumber: bigint,      // Block number
  transactionHash: Hash     // Transaction hash
}
Use Cases:
  • Project metadata audit trails
  • Name/symbol change tracking
  • Administrative operation monitoring
  • Project evolution history

dailyMetric Table

Daily factory analytics aggregation (shared with IFIF indexer).

{
  id: string,               // Date string "YYYY-MM-DD" (composite primary key with chainId)
  chainId: number,          // Chain ID of the blockchain
  newProjects: number,      // New projects deployed
  totalVolume: bigint,      // Total investment volume (from IFIF indexer)
  newInvestors: number,     // New unique investors (from IFIF indexer)
  nftOperations: number,    // Total NFT operations (from IFIF indexer)
  tokensClaimed: bigint     // Total tokens claimed (from IFIF indexer)
}
Use Cases:
  • Daily factory analytics
  • Deployment trend tracking
  • Platform growth monitoring
  • Business intelligence

GraphQL API

Core Queries

Get Factory Deployments

query FactoryDeployments($limit: Int = 10) {
  factoryDeployments(
    limit: $limit
    orderBy: "timestamp"
    orderDirection: "desc"
  ) {
    items {
      id
      projectId
      projectAddress
      projectName
      projectSymbol
      currentImplementation
      timestamp
      blockNumber
    }
  }
}

Get Token Deployments

query TokenDeployments($projectId: Int!) {
  tokenDeployments(where: { projectId: $projectId }) {
    items {
      id
      tokenAddress
      projectAddress
      tokenImplementation
      mintAmount
      timestamp
      blockNumber
    }
  }
}

Get System Updates

query SystemUpdates($updateType: Int!) {
  factorySystemUpdates(
    where: { updateType: $updateType }
    orderBy: "timestamp"
    orderDirection: "desc"
  ) {
    items {
      id
      updateType
      newValue
      timestamp
      blockNumber
      transactionHash
    }
  }
}

Get Deployment Details Updates

query DeploymentDetailsUpdates($projectId: Int!) {
  deploymentDetailsUpdates(
    where: { projectId: $projectId }
    orderBy: "timestamp"
    orderDirection: "desc"
  ) {
    items {
      id
      updatedBy
      oldProjectName
      newProjectName
      oldProjectSymbol
      newProjectSymbol
      timestamp
      blockNumber
    }
  }
}

Get Daily Deployment Metrics

query DailyDeploymentMetrics($limit: Int = 30) {
  dailyMetrics(
    limit: $limit
    orderBy: "id"
    orderDirection: "desc"
    where: { newProjects: { gt: 0 } }
  ) {
    items {
      id
      newProjects
      totalVolume
      newInvestors
      nftOperations
      tokensClaimed
    }
  }
}

Advanced Queries

Get Project Deployment by Address

query ProjectByAddress($address: String!) {
  factoryDeployments(where: { projectAddress: $address }) {
    items {
      id
      projectId
      projectName
      projectSymbol
      currentImplementation
      timestamp
      blockNumber
    }
  }
}

Get Recent System Updates

query RecentSystemUpdates($limit: Int = 20) {
  factorySystemUpdates(
    limit: $limit
    orderBy: "timestamp"
    orderDirection: "desc"
  ) {
    items {
      id
      updateType
      newValue
      timestamp
      blockNumber
      transactionHash
    }
  }
}

Get Projects by Implementation

query ProjectsByImplementation($implementation: String!) {
  factoryDeployments(
    where: { currentImplementation: $implementation }
  ) {
    items {
      id
      projectId
      projectAddress
      projectName
      projectSymbol
      timestamp
    }
  }
}

Get Factory Analytics Summary

query FactoryAnalytics {
  factoryDeployments {
    items {
      id
      projectId
      timestamp
    }
  }
  tokenDeployments {
    items {
      id
      mintAmount
      timestamp
    }
  }
  factorySystemUpdates {
    items {
      id
      updateType
      timestamp
    }
  }
}

System Update Types

Implementation Updates

Monitor factory and token implementation upgrades for security and functionality tracking.

// Factory implementation upgrade
{
  updateType: FactorySystemUpdateType.IMPLEMENTATION,
  newValue: "0x..." // New implementation address
}
 
// Token implementation upgrade
{
  updateType: FactorySystemUpdateType.TOKEN_IMPLEMENTATION,
  newValue: "0x..." // New token implementation address
}

Core System Updates

Track critical infrastructure component updates.

// Whitelist contract update
{
  updateType: FactorySystemUpdateType.WHITELIST,
  newValue: "0x..." // New whitelist contract address
}
 
// DEX router update
{
  updateType: FactorySystemUpdateType.DEX_ROUTER,
  newValue: "0x..." // New DEX router address
}

Configuration Updates

Monitor system configuration changes.

// Base URI update
{
  updateType: FactorySystemUpdateType.BASE_URI,
  newValue: "0x..." // Hash of new base URI
}
 
// Role helper update
{
  updateType: FactorySystemUpdateType.ROLE_HELPER,
  newValue: "0x..." // New role helper contract address
}

Performance Optimizations

Framework Compliance

  • No Return Statements: All event handlers use conditional logic for Ponder framework compliance
  • Efficient Queries: Optimized database queries with proper indexing
  • Error Handling: Comprehensive try-catch blocks with graceful fallbacks

Data Integrity

  • Duplicate Prevention: Event ID-based deduplication using composite primary keys where needed
  • Conditional Processing: Only process events when required data exists
  • Type Safety: Full TypeScript integration with contract ABI validation

Analytics Performance

  • Aggregated Metrics: Pre-calculated daily deployment statistics
  • Optimized Indexes: Strategic database indexing for common queries
  • Simplified Schema: Consolidated system updates for better performance

Integration Examples

Factory Dashboard Integration

// Get complete factory overview
const factoryData = await ponder.query(`
  query FactoryOverview {
    factoryDeployments(limit: 20, orderBy: "timestamp", orderDirection: "desc") {
      items { ...deploymentFields }
    }
    tokenDeployments(limit: 10, orderBy: "timestamp", orderDirection: "desc") {
      items { ...tokenFields }
    }
    factorySystemUpdates(limit: 10, orderBy: "timestamp", orderDirection: "desc") {
      items { ...updateFields }
    }
  }
`);

Project Tracking Integration

// Track specific project through factory
const projectTracking = await ponder.query(`
  query ProjectTracking($projectId: Int!) {
    factoryDeployment(where: { projectId: $projectId }) {
      ...deploymentFields
    }
    tokenDeployments(where: { projectId: $projectId }) {
      items { ...tokenFields }
    }
    deploymentDetailsUpdates(where: { projectId: $projectId }) {
      items { ...updateFields }
    }
  }
`);

System Administration Integration

// Monitor system updates and changes
const systemMonitoring = await ponder.query(`
  query SystemMonitoring {
    factorySystemUpdates(orderBy: "timestamp", orderDirection: "desc") {
      items { ...systemUpdateFields }
    }
    deploymentDetailsUpdates(limit: 20, orderBy: "timestamp", orderDirection: "desc") {
      items { ...detailsUpdateFields }
    }
  }
`);

Analytics Integration

// Get factory deployment analytics
const factoryAnalytics = await ponder.query(`
  query FactoryAnalytics {
    dailyMetrics(limit: 30, orderBy: "id", orderDirection: "desc") {
      items { ...dailyMetricFields }
    }
    factoryDeployments {
      items { 
        timestamp
        currentImplementation
      }
    }
  }
`);

Administrative Monitoring

Security Tracking

Monitor critical system component updates:

  • Implementation upgrades
  • Whitelist contract changes
  • Role helper updates
  • DEX router modifications

Deployment Analytics

Track factory performance:

  • Daily deployment statistics
  • Implementation usage patterns
  • Token deployment rates
  • Project metadata updates

System Health

Monitor factory operations:

  • Successful deployment rates
  • System update frequency
  • Administrative activity patterns
  • Infrastructure stability