oya

OYA, multiple AI personas, not just one, each with their own strengths

oya

Created At

ETHGlobal New Delhi

Project Description

Oya is an AI-driven chat and gaming platform where users engage with specialized AI personas, each tailored to different strengths or themes (e.g., professional advice, kid-friendly interactions, or character-based roleplay). The "multiple AI personas, not just one, each with their own strengths" aligns directly with the frontend's design, enabling diverse conversational experiences. Blockchain integration adds gamification through "SwapArena," turning token swaps into competitive prediction markets or quests, rewarding users for market predictions.

How it's Made

The Oya project is a full-stack application I built, combining a Next.js frontend web app with blockchain smart contracts developed using Foundry. My focus was on creating an interactive platform featuring multiple AI personas—like Butler, Kids, Lara, Little Kozo, and Professional—that users can engage with via chat interactions. I integrated decentralized finance (DeFi) elements such as trading quests through Uniswap V4 hooks. Here’s a high-level overview of the structure and purpose of the project:

Core Concept

Oya is an AI-driven chat and gaming platform where I designed users to interact with specialized AI personas, each tailored to different strengths or themes, like professional advice, kid-friendly conversations, or character-based roleplay. I intentionally created multiple AI personas rather than just one, each with unique strengths supporting diverse conversational experiences. Blockchain elements gamify the experience through “SwapArena,” which turns token swaps into competitive prediction markets or quests, rewarding users for their market predictions.

Key Components

  1. Frontend (website/ - Next.js App):

    • I used Next.js with the App Router, TypeScript, Tailwind CSS, and shadcn/ui components for the UI, including buttons, popovers, and badges.
    • The core AI chat interface components I built include AIAssistantUI.jsx, ChatPane.jsx, Composer.jsx for message input, Message.jsx, and ConversationRow.jsx. I also added folder support, templates, search via SearchModal.jsx, and user settings with SettingsPopover.jsx.
    • Each AI persona has its own dedicated page, such as /butler, /kids, /lara, /little-kozo, /professional, /testChat, and /arena, likely routing to specialized AI models or prompts through PersonaCard.tsx.
    • I integrated the OpenRouter API in src/lib/openrouter/openrouter.ts for LLM interactions and built auxiliary tools like a calculator, filesystem, and random number generator inside the tools/ directory. For testing, I used mock data in mockData.js.
    • Blockchain features are accessible on the /arena page which integrates with SwapArena via src/lib/swap-arena.ts. I included public persona images as assets.
    • The app has sidebar navigation, a theme toggle, and API routes including /api/chat/route.ts for backend chat requests.
    • I set up a standard Next.js dev workflow and deployed the app on Vercel.
    • The frontend provides a user-friendly web interface that blends AI chat experiences with DeFi interactions, emphasizing persona-based conversations.
  2. SwapArena Contracts (swap-arena-contracts/ - Foundry Project):

    • I created a Uniswap V4 hook contract called SwapArena.sol that gamifies token swaps within liquidity pools. Users stake BEX tokens predicting buy vs. sell dominance over 24-hour quests. Winners share the stakes of losers after a small fee.
    • Supporting contracts include BexClub.sol, Swapper.sol, and Counter.sol for club features, swapping logic, and counters.
    • For testing, I developed mocks like MockER20.s.sol and scripts for deployment on Base Sepolia (deploy.sh), pool creation/minting (mint.sh, add.sh), and swapping (swap.sh).
    • I tested everything thoroughly using Forge with fixtures, utilities, and hooks, integrating with Uniswap V4, OpenZeppelin libraries, and Forge-std.
    • The contracts are deployed on Base Sepolia and add competitive DeFi layers where AI chats can guide quests or market predictions.
  3. General Contracts (contracts/ - Foundry Project):

    • I set up a separate Foundry project for utility contracts like randomness and basic testing deployments.
    • Key contracts include Random.sol—which uses the Pyth Network for on-chain entropy and randomness (deployed on Optimism Sepolia)—along with Counter.sol for simple testing, CoinFlip.s.sol, and DeployChatMatch.s.sol possibly related to chat matchmaking or games.
    • I have scripts and tests such as RandomNumber.s.sol, Counter.s.sol, and Counter.t.sol to validate functionality.
    • The dependencies include Forge-std, Uniswap hooks, and OpenZeppelin.
    • This project underpins backend blockchain utilities for secure randomness, supporting AI-driven features like random chat responses or matchmaking.

Overall Architecture and Integration

  • I use a monorepo structure, with shared dependencies managed via package.json/pnpm-lock.yaml and self-contained subdirectories for contracts and frontend.
  • The synergy between AI and blockchain is key: AI personas on the frontend interact with smart contracts, for example, an AI “arena” persona might analyze market data, suggest stakes, or simulate quests using Pyth-provided randomness.
  • The tech stack includes Next.js 14+, React, TypeScript, OpenRouter for AI on the frontend, and Solidity 0.8.24 with Foundry, Uniswap V4, and Pyth Entropy on the blockchain backend.
  • I manage dependencies with pnpm and use Git submodules for libraries.
  • Development is ongoing with deployed contracts on Base Sepolia and Optimism Sepolia, along with a bootstrapped Next.js app. Some deployment scripts note known issues like token approval fixes pending.
  • Users can engage with AI personas for advice or entertainment and then join blockchain quests in the arena, blending AI companionship with DeFi gaming rewards.

This modular project centers on AI personas as the main user-facing element with blockchain delivering interactive, reward-based features. If a deeper exploration, like code reviews or feature expansions, is needed, I can provide specific details.

background image mobile

Join the mailing list

Get the latest news and updates