← Back to home

oya

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

Problem Statement

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.

Solution

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 ConceptOya 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 ComponentsFrontend (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 includeAIAssistantUI.jsx,ChatPane.jsx,Composer.jsxfor message input,Message.jsx, andConversationRow.jsx. I also added folder support, templates, search viaSearchModal.jsx, and user settings withSettingsPopover.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 throughPersonaCard.tsx.I integrated the OpenRouter API insrc/lib/openrouter/openrouter.tsfor LLM interactions and built auxiliary tools like a calculator, filesystem, and random number generator inside thetools/directory. For testing, I used mock data inmockData.js.Blockchain features are accessible on the/arenapage which integrates with SwapArena viasrc/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.tsfor 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.SwapArena Contracts (swap-arena-contracts/ - Foundry Project):I created a Uniswap V4 hook contract calledSwapArena.solthat 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 includeBexClub.sol,Swapper.sol, andCounter.solfor club features, swapping logic, and counters.For testing, I developed mocks likeMockER20.s.soland 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.General Contracts (contracts/ - Foundry Project):I set up a separate Foundry project for utility contracts like randomness and basic testing deployments.Key contracts includeRandom.sol—which uses the Pyth Network for on-chain entropy and randomness (deployed on Optimism Sepolia)—along withCounter.solfor simple testing,CoinFlip.s.sol, andDeployChatMatch.s.solpossibly related to chat matchmaking or games.I have scripts and tests such asRandomNumber.s.sol,Counter.s.sol, andCounter.t.solto 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 IntegrationI 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.

Hackathon

ETHGlobal New Delhi

2025

Contributors