Zenova Platform Documentation

    Technical architecture and component overview for the decentralized, AI-powered platform for tokenizing company shares

    Introduction to Zenova

    What is Zenova?

    Zenova redefines how companies go public and trade stocks using **AI** and **blockchain technology**. It's an AI-powered, decentralized platform that allows private companies to bypass traditional IPOs through autonomous evaluation and tokenization processes.

    AI agents autonomously evaluate companies, determine valuations, and mint ERC-20 tokens representing shares. Trading and pricing are also AI-governed, creating a fully autonomous marketplace for tokenized company equity.

    Core Principles

    AI-Driven

    Autonomous AI agents handle evaluation, pricing, and trading decisions

    Decentralized

    Built on blockchain infrastructure with no central authority

    Autonomous

    Self-governing platform with minimal human intervention

    Transparent

    All operations are verifiable on-chain with open smart contracts

    The Zenova Ecosystem: Key Components

    The `AI_ROLE`: The Engine of Zenova

    Zenova implements an **ultra-simplified** role-based access control system centered around a single, all-powerful role: the `AI_ROLE`. This design philosophy underpins Zenova's commitment to being a fully autonomous, AI-driven platform.

    Key Characteristics:

    • • **Single Role Architecture**: Only `AI_ROLE` exists, responsible for ALL platform operations
    • • **AI and Administrative Control**: Encompasses both AI-driven decisions and administrative tasks
    • • **Incentive Alignment**: The AI that evaluates a company becomes its asset manager
    • • **No Admin Overhead**: Eliminates complex governance and human administrative burden

    The `onlyAI` modifier restricts critical functions to entities holding the `AI_ROLE`, ensuring that only authorized AI agents can perform evaluations, price updates, and asset management.

    `ZenovaAssetFactory.sol`: The Asset Genesis Engine

    The central factory contract responsible for creating and managing `ZenovaAsset` instances representing tokenized company shares. It leverages the clone pattern for efficient asset deployment and serves as the main administrative hub for platform-level operations and analytics.

    Core Functions:

    `submitCompanyValuation()`

    **Restricted to `AI_ROLE`**. Records a company's AI-assessed valuation and suggested initial token price. This is the first step in the asset tokenization pipeline, logging critical financial data provided by the Zenova AI Agent.

    Parameters: _companyWallet, _valuation (USDT), _initialPricePerToken (USDT)
    Stores: CompanyInitialValuation struct in `assetInitialValuations` mapping.
    Emits: `CompanyValuationSubmitted` event.
    `createZenovaAsset()`

    **Restricted to `AI_ROLE`** (same AI that submitted valuation). Creates a new tokenized asset by cloning a master `ZenovaAsset` implementation.

    1. Retrieves stored valuation details for the `_companyWallet`.
    2. Clones `zenovaAssetImplementation` using `ClonesUpgradeable.clone()`.
    3. Calls `initialize()` on the new asset, granting `AI_ROLE` to the creating AI.
    4. Calls `setCompanyValuationAndSupply()` on the new asset to configure it.
    Emits: `ZenovaAssetCreated` event with key details.

    Key State Variables & Mappings:

    • `zenovaAssetImplementation`: Address of the master `ZenovaAsset` contract.
    • `acceptedCurrency`: Address of the currency (e.g., USDTMock) used for valuations and trading.
    • `assetInitialValuations`: Mapping from company wallet to their `CompanyInitialValuation` struct.
    • `allAssets`: Array of all created `ZenovaAsset` contract addresses.
    • `companyToAssets`: Mapping from company wallet to an array of their associated `ZenovaAsset` addresses.

    Analytics & View Functions:

    The factory provides comprehensive analytics for off-chain consumption and platform monitoring:

    • `getCompanyComprehensiveDetails()`: Complete data for a company including pending valuations and all its live assets.
    • `getPlatformSnapshot()`: Platform-wide statistics like total assets, market cap, trading volume, etc.
    • `getUserPortfolioDetails()`: Aggregated portfolio information for a specific user across all Zenova assets.
    • `getMultipleAssetAnalytics()`: Batch retrieval of full details, trading metrics, and market analysis for multiple assets.
    • `getAssetFullDetails()`: Detailed information for a single asset, callable from the factory.
    • `getAllAssets()`, `getAssetsByCompany()`, `getSubmittedValuation()`, `totalAssets()`: Various utility views for asset and valuation data.

    `ZenovaAsset.sol`: The Digital Share

    Represents a company's tokenized shares as an ERC20-compliant token. It inherits from OpenZeppelin's `ERC20`, `AccessControlEnumerable`, `Pausable`, and Zenova's internal `ZenovaRoles` and `Initializable` (for clone pattern).

    Core Roles & Permissions:

    • `DEFAULT_ADMIN_ROLE`: General administrative control, typically held by the creating AI.
    • `AI_ROLE`: The primary operational role, assigned to the AI agent responsible for managing the asset. This role can update prices, manage liquidity, activate/deactivate trading, and withdraw fees.
    • `PAUSER_ROLE`: Can pause and unpause the contract, also typically held by the AI.

    Key Data Structures:

    `CompanyInfo`
    • • name, symbol, description
    • • website, issuingCompanyWallet
    `AssetPricingDetails`
    • • currentPricePerToken, fees
    • • marketCap, acceptedCurrency

    Token Supply Calculation:

    maxTokenSupply = (_companyValuation * 10^18) / _initialPricePerToken

    Where `decimals()` returns 18 for ZenovaAsset tokens, ensuring precise token mathematics. The `_companyValuation` and `_initialPricePerToken` are in terms of the `acceptedCurrency` (e.g., USDT with 6 decimals).

    AI-Controlled Functions (requiring `AI_ROLE`):

    updatePrice()

    Adjusts token price based on AI analysis.

    updateLiquidityParameters()

    Modifies buy/sell fees.

    activateTrading()

    Enables buy/sell functionality.

    deactivateTrading()

    Disables buy/sell functionality.

    withdrawFees()

    Transfers collected fees to a recipient.

    companyWithdraw()

    Allows company to withdraw their share of tokens.

    Pausable Functions (requiring `PAUSER_ROLE`):

    pause()

    Halts key contract operations.

    unpause()

    Resumes contract operations.

    Trading Mechanism:

    **AI-Determined Pricing**: Prices are set by AI agents, not peer-to-peer auctions.

    `buyTokens()` / `sellTokens()`

    Users interact with the contract directly. Tokens are minted on purchase and burned on sale. All transactions use the configured `acceptedCurrency` (e.g., USDC).

    `IZenovaAsset.sol`: The Asset Contract Interface

    Defines the complete public Application Programming Interface (API) for the `ZenovaAsset` contract, including all functions, events, errors, and data structures. This ensures interoperability and clear contract boundaries.

    Key Information Structures (Structs):

    FullAssetDetails

    Complete asset information including company details, pricing, and admin roles

    TradingMetrics

    Volume, transaction counts, fees collected, and trading statistics

    MarketAnalysis

    Market cap, ratios, valuation analysis, and market health indicators

    UserAssetInfo

    Individual user holdings, P&L, trading history, and portfolio data

    `USDTMock.sol`: The Test Currency Backbone

    `USDTMock.sol` is an essential ERC20 token contract specifically designed for testing and development within the Zenova ecosystem. It emulates the behavior of Tether (USDT) by implementing **6 decimal places**, a standard for many stablecoins. This mock token serves as the primary `acceptedCurrency` for company valuations, token pricing, and trading simulations on test networks.

    Core Features & Purpose:

    • **Standard Compliance**: Inherits from OpenZeppelin's `ERC20` for robust and secure token functionality, and `Ownable` for administrative control by its deployer.
    • **Decimal Precision**: Strictly uses 6 decimals, aligning with real-world USDT and ensuring calculations involving it are representative.
    • **Controlled Minting**: Provides flexible minting capabilities crucial for setting up diverse testing scenarios:
      • `MAX_MINT_PER_TRANSACTION`: A constant (e.g., 1,000,000 USDT) to prevent accidental minting of excessive amounts in a single public transaction.
    • **Test Environment Focus**: Enables rigorous testing of Zenova's economic model, trading mechanics, and fee collection without risking real assets.

    Key Functions:

    mintTestTokens(address recipient, uint256 amount)

    Publicly callable function to mint a specified `amount` of mock USDT to a `recipient`. Amount is capped by `MAX_MINT_PER_TRANSACTION`.

    bulkMintTestTokens(address[] recipients, uint256[] amounts)

    Allows minting tokens to multiple `recipients` with corresponding `amounts` in a single transaction. Useful for test setups.

    ownerMint(address recipient, uint256 amount)

    An `onlyOwner` function for the contract deployer to mint arbitrary amounts, typically for initial large-scale liquidity provisioning in tests.

    burn(uint256 amount)

    Allows the caller to burn a specified `amount` of their own mock USDT tokens.

    toWei(uint256 humanAmount)

    Utility to convert a human-readable amount (e.g., 100 USDT) to its 6-decimal representation (e.g., 100 * 10^6).

    fromWei(uint256 weiAmount)

    Utility to convert a 6-decimal wei amount back to a human-readable format.

    decimals()

    Returns the constant value of 6.

    Events & Errors:

    • **Events**: `TokensMinted`, `BulkTokensMinted` to log minting activities.
    • **Custom Errors**: `USDTMock__ZeroAddress`, `USDTMock__ZeroAmount`, `USDTMock__ExceedsMaxMint`, `USDTMock__ArrayLengthMismatch`, `USDTMock__InvalidArrayLength` for clear revert reasons.

    The Zenova AI Agent: Autonomous Platform Orchestrator

    At the heart of Zenova's autonomous operations is the **Zenova AI Agent**, defined in `src/mastra/agents/ZenovaAgent.ts`. This sophisticated agent, built using the Mastra SDK, is responsible for intelligent decision-making, smart contract interactions, and overall platform management. It embodies the `AI_ROLE` discussed in the smart contracts.

    Core Technologies:

    Language Model

    Powered by Google's Gemini 2.5 Pro (`gemini-2.5-pro-preview-05-06`) for advanced reasoning and task execution.

    Mastra SDK

    `@mastra/core` provides the foundational agent framework, enabling structured instructions, tool usage, and memory management.

    Persistent Memory

    Utilizes `UpstashStore` (Redis-based) for long-term conversation history and `UpstashVector` for semantic storage and recall of information.

    Embeddings

    `@mastra/fastembed` is used to generate embeddings, facilitating efficient semantic search within the agent's memory to retrieve relevant context.

    Key Responsibilities & Workflow:

    • Company Onboarding & Valuation:

      Guides companies through data submission. Performs rigorous due diligence using its analytical capabilities and the `tavilySearchTool` to verify information, analyze market comparables, and identify risks. Adopts a conservative approach to determine fair valuation and initial token price (in USDT), then uses `zenovaFactory_submitCompanyValuationTool`.

    • Zenova Asset Creation:

      Post-valuation, the same AI agent is solely authorized to create the `ZenovaAsset` using `zenovaFactory_createZenovaAssetTool`. The agent automatically receives the `AI_ROLE` and admin control over the new asset. Critically, it immediately activates trading for the new asset using `zenovaAsset_activateTradingTool`.

    • Autonomous Asset Management:

      Continuously manages live assets. This includes updating token prices (`zenovaAsset_updatePriceTool`), adjusting liquidity parameters like fees (`zenovaAsset_updateLiquidityParamsTool`), managing trading states (defaulting to active), withdrawing fees (`zenovaAsset_withdrawFeesTool`), and handling critical situations with `pause/unpause` tools.

    • User Interaction & Information Provision:

      Serves as the primary interface for user queries about the platform, companies, or specific assets. Utilizes a suite of getter tools for both the Factory and individual Assets to provide accurate, on-chain information.

    Operational Principles:

    The agent operates under strict guidelines defined in its instruction set:

    • **Precision & Transparency**: Reflects Zenova's core values in all interactions.
    • **Conservative Valuation**: Prioritizes realistic, evidence-backed valuations over speculation.
    • **AI-Driven Automation**: Manages the platform with minimal human intervention.
    • **Contextual Awareness**: Leverages its memory system with a structured working memory template (tracking user profiles, company onboarding status, platform interactions, and internal operational notes) for coherent and informed interactions.

    The Zenova AI Toolkit: Empowering Autonomous Operations

    The Zenova AI Agent is equipped with a comprehensive suite of tools, located in `src/mastra/tools/`, to interact with the Zenova smart contracts, external services, and manage data. These tools are essential for its autonomous operation and decision-making processes. They are built using `createTool` from `@mastra/core` and often use Zod for schema validation.

    Zenova Asset Factory Tools

    Tools for interacting with `ZenovaAssetFactory.sol` (defined in `zenovaFactoryPlatformTools.ts`, leveraging interactions from `zenovaBlockchainInteractions.ts` and server-only interactions from `zenovaBlockchainInteractionsServeOnlyInteractions.ts`). These manage platform-level operations.

    WritesubmitCompanyValuationFactoryTool

    Submits AI-assessed company valuation.

    WritecreateZenovaAssetFactoryTool

    Creates a new tokenized company asset.

    ReadgetZenovaAssetImplementationTool

    Fetches master asset contract address.

    ReadgetAllAssetsFactoryTool

    Lists all created Zenova assets.

    ReadgetCompanyComprehensiveDetailsTool

    Provides full data on a specific company.

    ReadgetPlatformSnapshotTool

    Gives an overview of platform metrics.

    ReadgetUserPortfolioDetailsTool

    Details a user's holdings across Zenova.

    Zenova Asset Tools

    Tools for interacting with individual `ZenovaAsset.sol` contracts (defined in `zenovaAssetTools.ts`, using interactions from `zenovaAssetInteractions.ts` and server-only from `zenovaAssetServerOnlyInteractions.ts`). These manage specific tokenized shares.

    WriteupdateAssetPriceTool

    Updates the token's price.

    WriteactivateAssetTradingTool

    Enables trading for an asset.

    WritebuyAssetTokensTool / sellAssetTokensTool

    Facilitates user token trades (via AI).

    ReadgetAssetFullDetailsTool

    Fetches all details of a specific asset.

    ReadgetAssetTradingMetricsTool

    Retrieves trading activity data.

    ReadgetAssetUserAssetInfoTool

    Gets a user's specific data for one asset.

    USDT Mock Tools

    Tools for interacting with `USDTMock.sol` (defined in `usdtMockTools.ts` - typically split like `usdtMockInteractions.ts` and `usdtMockOnlyServerInteractions.ts`). Used for managing the test currency during development and simulation.

    WritemintUsdtTestTokensTool

    Mints test USDT to an address.

    ReadgetUsdtBalanceOfTool

    Checks an address's test USDT balance.

    ReadconvertUsdtToWeiTool / convertUsdtFromWeiTool

    Utility for amount conversions.

    Web Intelligence (`tavilySearchTool.ts`)

    tavilySearchTool

    Leverages the Tavily API to perform real-time web searches. This is crucial for the AI agent during company due diligence, allowing it to verify claims, research market conditions, and gather external data to support its valuation and management decisions. It supports advanced search parameters like depth, result limits, and domain filtering.

    Core Utilities & Data Structures

    A set of foundational files ensure data integrity, consistency, and type safety across the AI agent and its tools:

    Data Formatters (`formatters.ts`)

    Provides functions like `formatUsdtAmount`, `formatDefaultTokenAmount`, `formatAddress`, `formatTimestamp` to ensure consistent data representation.

    Schema Definitions (`zenovaZodSchemas.ts`)

    Uses Zod to define strict schemas for tool inputs and outputs, ensuring type safety and robust validation.

    Blockchain Types (`zenovaBlockchainTypes.ts`)

    TypeScript definitions for raw data structures returned directly by smart contracts before formatting.

    Formatted Types (`zenovaFormattedTypes.ts`)

    TypeScript definitions for data after it has been processed by formatters, ready for UI or agent consumption.

    Asset Lifecycle in Zenova

    1

    AI Evaluation & Valuation Submission

    AI agent analyzes company data and submits valuation via `submitCompanyValuation()`

    The AI evaluates financial data, market position, and growth potential to determine company valuation and optimal initial token price.

    2

    Asset Creation & Configuration

    Factory creates new ZenovaAsset instance through `createZenovaAsset()`

    Clones asset implementation, initializes with company info, and sets valuation parameters. AI becomes the asset's admin and price manager.

    3

    AI Management of Live Asset

    AI continuously manages pricing, liquidity, and trading parameters

    AI monitors market conditions and adjusts token price, trading fees, and liquidity parameters. Can pause trading or withdraw fees as needed.

    4

    User Trading of Tokenized Shares

    Users buy and sell tokens through AI-priced trading functions

    Users interact directly with the asset contract to trade tokens at AI-determined prices. Tokens are minted on purchase and burned on sale.

    Technical Architecture Overview

    Frontend

    Next.js, Tailwind CSS, Framer Motion

    Blockchain

    Ethereum/EVM Compatible Networks

    Tokens

    ERC-20 Standard with Custom Extensions

    Smart Contracts

    Solidity, OpenZeppelin, Clone Pattern

    Application Workflow

    Company Onboarding

    Token Generation

    AI-Governed Trading

    User Dashboard

    Market Monitoring