diff --git a/HLD_DIAGRAM.md b/HLD_DIAGRAM.md
new file mode 100644
index 0000000..45ae996
--- /dev/null
+++ b/HLD_DIAGRAM.md
@@ -0,0 +1,105 @@
+```mermaid
+graph TB
+ %% --- User Layer ---
+ User((๐ค User))
+
+ %% --- Frontend System ---
+ subgraph Frontend ["๐ฅ๏ธ Agentropolis Frontend (Next.js 14 + Phaser 3)"]
+ direction TB
+ Landing[Landing Page]
+ Game[Game Canvas]
+
+ subgraph GameScenes ["๐ฎ Game Scenes"]
+ City[City View (Isometric)]
+ Council[Council Room (Roundtable)]
+ end
+
+ subgraph CoreComponents ["๐งฉ Core Components"]
+ Session[Session Provider]
+ Wallet[Wallet Provider]
+ Swap[Swap Handler]
+ end
+
+ subgraph IntegrationLibs ["๐ Integration Libraries"]
+ YellowLib[Yellow (State Channels)]
+ ENS_Lib[ENS (Identity)]
+ ERC8004_Lib[ERC-8004 (Registry)]
+ x402_Lib[x402 (Micropayments)]
+ UniExecutor[Uniswap Executor]
+ ClankerLib[Clanker SDK]
+ end
+ end
+
+ %% --- Backend / AI Layer ---
+ subgraph AI_Layer ["๐ง AI & Backend Layer"]
+ Groq[Groq LLM API]
+
+ subgraph Agents ["๐ค AI Council Agents"]
+ Alpha[๐ฏ Alpha Hunter]
+ Risk[๐ก๏ธ Risk Sentinel]
+ Macro[๐ฎ Macro Oracle]
+ Devil[๐ Devil's Advocate]
+ Clerk[๐ Council Clerk]
+ end
+
+ ExternalAgent[๐ External Agent (BYOA)]
+ end
+
+ %% --- Blockchain Layer ---
+ subgraph Blockchain ["โ๏ธ Base Sepolia & On-Chain"]
+ subgraph Registries ["Infrastructure"]
+ Registry[ERC-8004 Registry]
+ ENSReg[ENS Registry]
+ end
+
+ subgraph Execution ["DeFi Execution"]
+ UniversalRouter[Uniswap Universal Router]
+ PoolManager[Pool Manager]
+ end
+
+ subgraph Hooks ["๐ช Custom Uniswap Hooks"]
+ FeeHook[CouncilFeeHook]
+ SentinelHook[SentimentOracleHook]
+ GuardHook[SwapGuardHook]
+ end
+ end
+
+ %% --- Connections ---
+ User -->|Connects| Wallet
+ User -->|Interacts| Game
+
+ Game --> City
+ City -->|Click Council| Council
+
+ %% Deploy Flow
+ City -->|Query Agents| ERC8004_Lib
+ ERC8004_Lib -->|Read| Registry
+ City -->|Micropayment| YellowLib
+
+ %% Deliberation Flow
+ Council -->|Prompt| Agents
+ Agents -->|Inference| Groq
+ Agents -->|Consult| ExternalAgent
+ ExternalAgent -.->|Payment| x402_Lib
+
+ %% Execution Flow
+ Agents -->|Consensus Proposal| Clerk
+ Clerk -->|Synthesized Plan| Swap
+ Swap -->|Execute| UniExecutor
+ UniExecutor -->|V4_SWAP| UniversalRouter
+ UniversalRouter --> PoolManager
+ PoolManager --> FeeHook
+ PoolManager --> SentinelHook
+ PoolManager --> GuardHook
+
+ %% Styling
+ classDef frontend fill:#e1f5fe,stroke:#01579b,stroke-width:2px;
+ classDef backend fill:#f3e5f5,stroke:#4a148c,stroke-width:2px;
+ classDef blockchain fill:#e8f5e9,stroke:#1b5e20,stroke-width:2px;
+ classDef user fill:#fff9c4,stroke:#fbc02d,stroke-width:2px;
+
+ class Frontend,GameScenes,CoreComponents,IntegrationLibs frontend;
+ class AI_Layer,Agents,Groq,ExternalAgent backend;
+ class Blockchain,Registries,Execution,Hooks blockchain;
+ class User user;
+```
diff --git a/SIMPLE_EXPLANATION.md b/SIMPLE_EXPLANATION.md
new file mode 100644
index 0000000..7351b4b
--- /dev/null
+++ b/SIMPLE_EXPLANATION.md
@@ -0,0 +1,9 @@
+# What Problem Does Agentropolis Solve?
+
+The problem with Decentralized Finance (DeFi) today is that itโs overwhelmingly complex and lonely. Imagine trying to make investment decisions while staring at confusing charts, cryptic codes, and endless spreadsheets, knowing a single wrong click could cost you money. It feels like piloting a spaceship without a manual. Most people want to participate but are scared off by the technical jargon and lack of guidance. They don't have a team of financial experts to double-check their logic or explain risks in plain English.
+
+# How Agentropolis Works (The "SimCity for Finance" Solution)
+
+Agentropolis transforms this intimidating experience into a friendly, city-building game. Instead of navigating confusing menus, you simply **build a digital city and hire a team of AI assistants** who live there. Think of them as your personal financial council. You walk your character into a "Council Room" where cute, animated characters (like a cautious "Risk Manager" or an ambitious "Profit Hunter") are sitting around a table. You just ask them a simple question like, *"How should I invest $100 safely?"*
+
+The magic happens next: The AI agents **debate your question in real-time**. You watch them discuss the pros and consโyour Risk Manager might say, *"Wait, the market is too volatile right now!"* while the Profit Hunter argues, *"But the potential returns are high!"* They simplify complex data into a clear conversation you can understand. Once they agree on a plan, they present it to you. You simply click **"Approve,"** and the game handles all the complicated technical steps securely in the background. It turns finance from a solitary, stressful task into a collaborative, gamified experience where you always have a team of experts by your side.
diff --git a/TECHNICAL_WALKTHROUGH.md b/TECHNICAL_WALKTHROUGH.md
new file mode 100644
index 0000000..066b784
--- /dev/null
+++ b/TECHNICAL_WALKTHROUGH.md
@@ -0,0 +1,307 @@
+# Agentropolis โ Complete Technical Deep-Dive
+
+> **"SimCity meets DeFi."** โ A gamified DeFi trading platform built for HackMoney 2026 where AI agents collaborate in a virtual city, debate trading strategies in a council room, and execute real on-chain swaps.
+
+---
+
+## What It Does (The Core Loop)
+
+```mermaid
+flowchart LR
+ A["๐ Connect Wallet"] --> B["โก Start Yellow Session"]
+ B --> C["๐ค Deploy Agents from ERC-8004 Registry"]
+ C --> D["๐๏ธ Enter Council Room"]
+ D --> E["๐ง AI Agents Deliberate via Groq LLM"]
+ E --> F["๐ User Reviews Proposal"]
+ F -->|Approve| G["๐ฆ Execute Uniswap v4 Swap On-Chain"]
+ F -->|Reject| D
+ G --> H["๐ End Session โ Settlement"]
+```
+
+The user interacts with a **cyberpunk isometric city** rendered via Phaser 3. They deploy AI agents (discovered from an on-chain ERC-8004 registry), watch them debate in a council room, and approve/reject trade proposals that execute **real Uniswap v4 swaps on Base Sepolia**.
+
+---
+
+## Tech Stack
+
+| Layer | Technology | Purpose |
+|-------|-----------|---------|
+| **Frontend** | Next.js 14 (App Router), React 18 | Core web framework |
+| **Game Engine** | Phaser 3 + Three.js + React Three Fiber | Isometric city & 3D council view |
+| **Styling** | Tailwind CSS | UI components |
+| **Web3** | wagmi v3, viem v2 | Wallet connection, contract interactions |
+| **AI** | Groq SDK โ `llama-3.3-70b-versatile` | Multi-agent deliberation |
+| **State Channels** | Yellow Network (`@erc7824/nitrolite`) | Off-chain micropayments |
+| **DEX** | Uniswap v4 Universal Router | On-chain swaps |
+| **Token Launch** | Clanker SDK v4 | Memecoin deployment with v4 hooks |
+| **Identity** | ENS (Ethereum Name Service) | Name resolution, avatar, config storage |
+| **Micropayments** | x402 Protocol | HTTP-level payments for external agents |
+| **Smart Contracts** | Solidity 0.8.26, Foundry | Uniswap v4 custom hooks |
+| **Monorepo** | Turborepo + Bun | Build orchestration |
+| **Chain** | Base Sepolia (testnet), Ethereum Sepolia (ENS) | Deployment target |
+
+---
+
+## Architecture
+
+```mermaid
+graph TB
+ subgraph Frontend["Frontend (Next.js + Phaser/Three.js)"]
+ LP["Landing Page"]
+ CV["CityView3D โ Isometric City"]
+ CR["CouncilRoom3D โ Roundtable Deliberation"]
+ SH["SwapHandler โ Event Listener"]
+ SP["SessionProvider โ Yellow Channel"]
+ UI["UserIdentity โ ENS Display"]
+ AS["AgentSettings โ BYOA Config"]
+ end
+
+ subgraph API["API Routes (Next.js)"]
+ AL["/api/agents/list"]
+ AC["/api/agents/council"]
+ AP["/api/agents/propose"]
+ AT["/api/agents/launch-token"]
+ end
+
+ subgraph Integrations["Integration Libraries"]
+ YL["Yellow Network โ State Channels"]
+ UNI["Uniswap v4 โ Swap Executor"]
+ ENS["ENS โ Identity + Text Records"]
+ ERC["ERC-8004 โ Agent Discovery"]
+ X4["x402 โ HTTP Micropayments"]
+ CL["Clanker โ Token Launches"]
+ end
+
+ subgraph Contracts["Solidity Hooks (Base Sepolia)"]
+ CFH["CouncilFeeHook โ Dynamic Fees"]
+ SOH["SentimentOracleHook โ Market Oracle"]
+ SGH["SwapGuardHook โ Risk Limits"]
+ end
+
+ CV --> CR
+ CR -->|"User Prompt"| AC
+ AC -->|"Groq LLM"| AP
+ AP -->|"Proposal"| SH
+ SH -->|"Execute"| UNI
+ UNI --> Contracts
+ SP --> YL
+ AL --> ERC
+ AT --> CL
+ AS -->|"BYOA Endpoint"| X4
+ UI --> ENS
+```
+
+---
+
+## Monorepo Structure
+
+```
+agentropolis/
+โโโ apps/
+โ โโโ web/ # Main Next.js 14 application
+โ โ โโโ app/ # Pages (landing, app, docs)
+โ โ โ โโโ page.tsx # Landing page
+โ โ โ โโโ app/page.tsx # Main game view
+โ โ โ โโโ api/agents/ # 4 API routes
+โ โ โโโ components/
+โ โ โ โโโ game/ # Phaser + Three.js game views
+โ โ โ โ โโโ CityView3D.tsx # Isometric city (Three.js)
+โ โ โ โ โโโ CouncilRoom3D.tsx # Council deliberation (Three.js)
+โ โ โ โ โโโ GameComponent.tsx # Phaser wrapper
+โ โ โ โ โโโ scenes/ # Phaser scenes (City, Council)
+โ โ โ โโโ SessionProvider.tsx # Yellow session management
+โ โ โ โโโ SwapHandler.tsx # Uniswap execution bridge
+โ โ โ โโโ UserIdentity.tsx # ENS name + avatar
+โ โ โ โโโ AgentSettings.tsx # BYOA endpoint config
+โ โ โ โโโ PlaceOrderModal.tsx # Order placement UI
+โ โ โโโ lib/
+โ โ โโโ uniswap/ # Swap + LP execution
+โ โ โโโ yellow/ # State channel management
+โ โ โโโ agents/ # AI council + strategies
+โ โ โโโ ens/ # ENS resolution + text records
+โ โ โโโ erc8004/ # On-chain agent registry
+โ โ โโโ clanker/ # Token launch via Clanker SDK
+โ โ โโโ x402/ # HTTP micropayment wrapper
+โ โโโ new/ # Alternate frontend (WIP)
+โ โโโ web-3d/ # Standalone 3D experiment
+โโโ packages/
+โ โโโ contracts/ # Foundry project
+โ โ โโโ src/
+โ โ โโโ CouncilFeeHook.sol # Dynamic fee hook
+โ โ โโโ SentimentOracleHook.sol # Market sentiment oracle
+โ โ โโโ SwapGuardHook.sol # Swap size limiter
+โ โโโ shared/ # Shared TypeScript types
+โ โโโ src/types.ts # All domain interfaces
+โโโ turbo.json # Turborepo config
+โโโ package.json # Root workspace config
+```
+
+---
+
+## Deep-Dive: Key Subsystems
+
+### 1. ๐ง AI Council System โ [council.ts](file:///Users/utkarshraj/Documents/Summer_of_bitcoin/Agentropolis/apps/web/lib/agents/council.ts)
+
+The **core differentiator** โ a multi-agent deliberation engine using **Groq LLM** (`llama-3.3-70b-versatile`).
+
+**5 AI Agent Personas:**
+
+| Agent | Role | Behavior |
+|-------|------|----------|
+| ๐ฏ Alpha Hunter | Seeks yield | Optimistic, supports high APY opportunities |
+| ๐ก๏ธ Risk Sentinel | Risk assessor | Conservative, **can VETO** dangerous proposals |
+| ๐ฎ Macro Oracle | Market context | Neutral, provides sentiment and timing analysis |
+| ๐ Devil's Advocate | Challenges | Skeptical, presents worst-case scenarios |
+| ๐ Council Clerk | Synthesizer | Creates the final proposal from all opinions |
+
+**Flow:**
+1. User enters a prompt (e.g., "I want passive income from my 0.1 ETH")
+2. Each agent receives the prompt + previous agents' opinions (sequential context passing)
+3. Each outputs structured JSON: `{ opinion, reasoning, confidence, suggestedStrategy }`
+4. Clerk synthesizes into a `TradeProposal` with: strategy type, token pair, amounts, risk level
+5. Consensus is computed: `unanimous | majority | contested | vetoed`
+
+**Strategy Types:** `swap`, `dca`, `lp_full_range`, `lp_concentrated`, `token_launch`
+
+**BYOA (Bring Your Own Agent):** Users can plug in external AI agent endpoints. Calls are made via x402 micropayments with SSRF protection and 10s timeout.
+
+---
+
+### 2. ๐ฆ Uniswap v4 Executor โ [executor.ts](file:///Users/utkarshraj/Documents/Summer_of_bitcoin/Agentropolis/apps/web/lib/uniswap/executor.ts)
+
+Executes **real on-chain swaps** on Base Sepolia via the Universal Router.
+
+**Key technical details:**
+- Uses `V4_SWAP` command (`0x10`) with the Universal Router ABI
+- Encodes V4 actions: `SWAP_EXACT_IN_SINGLE` โ `SETTLE_ALL` โ `TAKE_ALL`
+- Handles ERC-20 approvals, balance checks, gas simulation
+- 3% default slippage protection
+- Pre-flight simulation via `eth_call` before sending transactions
+- Returns `SwapReceipt` with realized amounts and slippage vs. quote
+
+**Contract Addresses (Base Sepolia):**
+- Universal Router: `0x492E6456D9528771018DeB9E87ef7750EF184104`
+- Pool Manager: `0x05E73354cFDd6745C338b50BcFDfA3Aa6fA03408`
+- WETH: `0x4200000000000000000000000000000000000006`
+- USDC: `0x036CbD53842c5426634e7929541eC2318f3dCF7e`
+
+---
+
+### 3. โก Yellow Network Integration โ [channel.tsx](file:///Users/utkarshraj/Documents/Summer_of_bitcoin/Agentropolis/apps/web/lib/yellow/channel.tsx)
+
+Implements **state channel sessions** for gasless, instant micro-actions using `@erc7824/nitrolite`.
+
+**Lifecycle:**
+1. **Deposit** โ User deposits funds to Yellow's custody contract on-chain
+2. **Create Channel** โ Opens a state channel via WebSocket to ClearNode
+3. **Off-chain Transfers** โ Agent deployments are instant micropayments (no gas)
+4. **Close Channel** โ Settles all state deltas back on-chain
+
+Has both `createRealChannelManager` (production) and `createMockChannelManager` (demo mode).
+
+---
+
+### 4. ๐ ENS Integration โ [textRecords.ts](file:///Users/utkarshraj/Documents/Summer_of_bitcoin/Agentropolis/apps/web/lib/ens/textRecords.ts)
+
+- **Identity display**: Resolves ENS names and avatars for the connected wallet
+- **Config persistence**: Saves/loads BYOA agent endpoint URL to ENS text records
+- **Subnames**: Support for ENS subname management
+
+---
+
+### 5. ๐ค ERC-8004 Agent Registry โ [client.ts](file:///Users/utkarshraj/Documents/Summer_of_bitcoin/Agentropolis/apps/web/lib/erc8004/client.ts)
+
+Discovers AI agents from an **on-chain registry** on Base Sepolia:
+- Queries `IdentityRegistry` contract for agent metadata URIs (supports IPFS)
+- Queries `ReputationRegistry` for reputation scores (0-100)
+- Links to 8004scan.io for block explorer viewing
+- Falls back to mock agents if registry is empty
+
+---
+
+### 6. ๐ฐ x402 Micropayments โ [client.ts](file:///Users/utkarshraj/Documents/Summer_of_bitcoin/Agentropolis/apps/web/lib/x402/client.ts)
+
+HTTP-level micropayment protocol for paying external BYOA agents:
+- Wraps native `fetch` with `@x402/fetch` for automatic payment negotiation
+- Uses EVM `exact` scheme with the connected wallet's `signTypedData`
+- Transparent to the calling code โ just use the wrapped fetch
+
+---
+
+### 7. ๐ Clanker Token Launcher โ [client.ts](file:///Users/utkarshraj/Documents/Summer_of_bitcoin/Agentropolis/apps/web/lib/clanker/client.ts)
+
+Launches memecoins with Uniswap v4 hooks via the Clanker SDK:
+- Deploys ERC-20 token with metadata, reward recipients, and optional vault locking
+- Integrated into the council flow โ agents can propose token launches
+- Requires Base Mainnet (falls back to mock on testnet)
+
+---
+
+## Smart Contracts (Uniswap v4 Hooks)
+
+Three custom **Uniswap v4 hooks** written in Solidity 0.8.26 using Foundry:
+
+### [CouncilFeeHook.sol](file:///Users/utkarshraj/Documents/Summer_of_bitcoin/Agentropolis/packages/contracts/src/CouncilFeeHook.sol)
+- **Hook type:** `beforeSwap`
+- **What it does:** AI council votes on swap fees; the hook dynamically overrides the LP fee using `LPFeeLibrary.OVERRIDE_FEE_FLAG`
+- **Range:** 0.001% โ 1% (10โ10,000 bps)
+
+### [SentimentOracleHook.sol](file:///Users/utkarshraj/Documents/Summer_of_bitcoin/Agentropolis/packages/contracts/src/SentimentOracleHook.sol)
+- **Hook type:** `afterSwap`
+- **What it does:** Records council's market sentiment (-100 to +100) as an on-chain oracle after each swap
+- **API:** `getSentiment()` returns `(score, swapCount, lastUpdated, reason)`
+
+### [SwapGuardHook.sol](file:///Users/utkarshraj/Documents/Summer_of_bitcoin/Agentropolis/packages/contracts/src/SwapGuardHook.sol)
+- **Hook type:** `beforeSwap`
+- **What it does:** Risk Sentinel agent sets `maxSwapSize`; any swap exceeding it is **reverted**
+- **Safety:** Minimum 0.01 ETH threshold to prevent lockout
+
+---
+
+## Shared Type System โ [types.ts](file:///Users/utkarshraj/Documents/Summer_of_bitcoin/Agentropolis/packages/shared/src/types.ts)
+
+Key interfaces powering the entire flow:
+
+| Type | Purpose |
+|------|---------|
+| `TradeProposal` | Full swap proposal with pair, amounts, risk, deliberation, execution plan |
+| `TokenLaunchProposal` | Memecoin launch proposal with name, symbol, vault % |
+| `DeliberationResult` | Council messages + consensus + vote tally |
+| `CouncilMessage` | Individual agent opinion with role, confidence, reasoning |
+| `ExecutionPlan` | Pre-flight plan: quote + slippage + simulation result |
+| `SwapReceipt` | Post-execution: tx hash, balances, realized slippage |
+| `AgentProfile` | Agent identity from ERC-8004 with strategy & reputation |
+| `YellowSession` | State channel session metadata |
+
+---
+
+## Sponsor Integration Summary
+
+| Sponsor | Prize Track | What's Implemented |
+|---------|------------|-------------------|
+| **Yellow Network** | $15,000 | State channel sessions via Nitrolite, gasless agent deployment, on-chain settlement |
+| **Uniswap Foundation** | $10,000 | V4_SWAP command encoding, Universal Router execution, 3 custom hooks, LP + concentrated liquidity |
+| **ENS** | $5,000 | Reverse resolution, avatar display, text record storage for BYOA config, subnames |
+
+---
+
+## How to Run
+
+```bash
+# Install dependencies
+bun install
+
+# Build shared package
+cd packages/shared && bun run build && cd ../..
+
+# Run dev server
+cd apps/web && bun run dev
+# โ Open http://localhost:3000
+```
+
+**Environment Variables** (`apps/web/.env.local`):
+```
+GROQ_API_KEY=your_key # AI deliberation (or use GROQ_MOCK=true)
+NEXT_PUBLIC_UNISWAP_MOCK=true # Mock swaps for demo
+ERC8004_MOCK=true # Mock agent registry
+```
diff --git a/apps/web/components/AppPageContent.tsx b/apps/web/components/AppPageContent.tsx
index 7423c4a..6719e98 100644
--- a/apps/web/components/AppPageContent.tsx
+++ b/apps/web/components/AppPageContent.tsx
@@ -5,6 +5,7 @@ import dynamic from 'next/dynamic'
import { ConnectButton } from '@/components/ConnectButton'
import { SessionStatus } from '@/components/SessionProvider'
import { SwapHandler } from '@/components/SwapHandler'
+import { SessionEconomics } from '@/components/SessionEconomics'
import { GuestMode } from '@/components/GuestMode'
import { useGame } from '@/contexts/GameContext'
@@ -55,7 +56,7 @@ export function AppPageContent() {
{/* Yellow Session Status */}
-
+
{/* Live Status */}
Status
@@ -148,6 +149,7 @@ export function AppPageContent() {
{/* Functional Components */}
+
)
diff --git a/apps/web/components/LimitOrderManager.tsx b/apps/web/components/LimitOrderManager.tsx
index 035a257..4182930 100644
--- a/apps/web/components/LimitOrderManager.tsx
+++ b/apps/web/components/LimitOrderManager.tsx
@@ -1,85 +1,85 @@
-'use client'
+// 'use client'
-import { useState, useEffect } from 'react'
-import { PlaceOrderModal, type LimitOrder } from './PlaceOrderModal'
-import { placeLimitOrder, claimLimitOrder } from '../lib/uniswap/limit-orders'
-import { toast } from 'sonner'
+// import { useState, useEffect } from 'react'
+// import { PlaceOrderModal, type LimitOrder } from './PlaceOrderModal'
+// import { placeLimitOrder, claimLimitOrder } from '../lib/uniswap/limit-orders'
+// import { toast } from 'sonner'
-export function LimitOrderManager() {
- const [isPlaceModalOpen, setIsPlaceModalOpen] = useState(false)
+// export function LimitOrderManager() {
+// const [isPlaceModalOpen, setIsPlaceModalOpen] = useState(false)
- useEffect(() =\u003e {
- // Listen for game events
- if(typeof window === 'undefined') return
+// useEffect(() =\u003e {
+// // Listen for game events
+// if(typeof window === 'undefined') return
- const handleClaim = async (event: Event) =\u003e {
- const customEvent = event as CustomEvent
- const orderId = customEvent.detail || (event as any).detail
+// const handleClaim = async (event: Event) =\u003e {
+// const customEvent = event as CustomEvent
+// const orderId = customEvent.detail || (event as any).detail
- console.log('[LimitOrderManager] Claiming order:', orderId)
+// console.log('[LimitOrderManager] Claiming order:', orderId)
- const result = await claimLimitOrder(orderId)
+// const result = await claimLimitOrder(orderId)
- if (result.success) {
- toast.success('Order claimed successfully!', {
- description: `TxID: ${result.txHash?.slice(0, 10)}...`,
- })
- } else {
- toast.error('Failed to claim order', {
- description: result.error,
- })
- }
-}
+// if (result.success) {
+// toast.success('Order claimed successfully!', {
+// description: `TxID: ${result.txHash?.slice(0, 10)}...`,
+// })
+// } else {
+// toast.error('Failed to claim order', {
+// description: result.error,
+// })
+// }
+// }
-const handleShowDetails = (event: Event) =\u003e {
- const customEvent = event as CustomEvent
- const order = customEvent.detail as LimitOrder
+// const handleShowDetails = (event: Event) =\u003e {
+// const customEvent = event as CustomEvent
+// const order = customEvent.detail as LimitOrder
- toast.info(`Order ${order.direction === 'buy' ? 'Buy' : 'Sell'} @ $${order.targetPrice}`, {
- description: `Status: ${order.status}`,
-})
- }
+// toast.info(`Order ${order.direction === 'buy' ? 'Buy' : 'Sell'} @ $${order.targetPrice}`, {
+// description: `Status: ${order.status}`,
+// })
+// }
-window.addEventListener('claimLimitOrder' as any, handleClaim)
-window.addEventListener('showLimitOrderDetails' as any, handleShowDetails)
+// window.addEventListener('claimLimitOrder' as any, handleClaim)
+// window.addEventListener('showLimitOrderDetails' as any, handleShowDetails)
-return () =\u003e {
- window.removeEventListener('claimLimitOrder' as any, handleClaim)
- window.removeEventListener('showLimitOrderDetails' as any, handleShowDetails)
-}
- }, [])
+// return () =\u003e {
+// window.removeEventListener('claimLimitOrder' as any, handleClaim)
+// window.removeEventListener('showLimitOrderDetails' as any, handleShowDetails)
+// }
+// }, [])
-const handlePlaceOrder = async (order: LimitOrder) =\u003e {
- console.log('[LimitOrderManager] Placing order:', order)
+// const handlePlaceOrder = async (order: LimitOrder) =\u003e {
+// console.log('[LimitOrderManager] Placing order:', order)
-const result = await placeLimitOrder(order)
+// const result = await placeLimitOrder(order)
-if (result.success) {
- toast.success('Trade Tower constructed!', {
- description: 'Your limit order is now active in the city.',
- })
-} else {
- toast.error('Failed to place order', {
- description: result.error || 'Unknown error',
- })
-}
- }
+// if (result.success) {
+// toast.success('Trade Tower constructed!', {
+// description: 'Your limit order is now active in the city.',
+// })
+// } else {
+// toast.error('Failed to place order', {
+// description: result.error || 'Unknown error',
+// })
+// }
+// }
-return (
-\u003c\u003e
-{/* Button to open modal - can be placed in header or elsewhere */ }
-\u003cbutton
-onClick = {() =\u003e setIsPlaceModalOpen(true)}
-className = "fixed bottom-6 right-6 z-40 px-6 py-3 bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-500 hover:to-pink-500 text-white font-bold rounded-full shadow-lg transition-all flex items-center gap-2"
-\u003e
- ๐๏ธ Place Limit Order
-\u003c / button\u003e
+// return (
+// \u003c\u003e
+// {/* Button to open modal - can be placed in header or elsewhere */ }
+// \u003cbutton
+// onClick = {() =\u003e setIsPlaceModalOpen(true)}
+// className = "fixed bottom-6 right-6 z-40 px-6 py-3 bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-500 hover:to-pink-500 text-white font-bold rounded-full shadow-lg transition-all flex items-center gap-2"
+// \u003e
+// ๐๏ธ Place Limit Order
+// \u003c / button\u003e
-\u003cPlaceOrderModal
-isOpen = { isPlaceModalOpen }
-onClose = {() =\u003e setIsPlaceModalOpen(false)}
-onPlaceOrder = { handlePlaceOrder }
- /\u003e
-\u003c /\u003e
- )
-}
+// \u003cPlaceOrderModal
+// isOpen = { isPlaceModalOpen }
+// onClose = {() =\u003e setIsPlaceModalOpen(false)}
+// onPlaceOrder = { handlePlaceOrder }
+// /\u003e
+// \u003c /\u003e
+// )
+// }
diff --git a/apps/web/components/PlaceOrderModal.tsx b/apps/web/components/PlaceOrderModal.tsx
index b2fa5f0..8643a34 100644
--- a/apps/web/components/PlaceOrderModal.tsx
+++ b/apps/web/components/PlaceOrderModal.tsx
@@ -44,6 +44,17 @@ export function PlaceOrderModal({ isOpen, onClose, onPlaceOrder }: PlaceOrderMod
if (!targetPrice || !amount) return
setIsPlacing(true)
+
+ // Charge Yellow fee for limit order (soft โ don't block on failure)
+ if (typeof window !== 'undefined' && window.agentropolis?.isSessionActive?.()) {
+ try {
+ await window.agentropolis.chargeAction('limit_order', '0.005')
+ console.log('[PlaceOrderModal] Limit order fee charged: 0.005 ytest.USD')
+ } catch (err) {
+ console.warn('[PlaceOrderModal] Limit order fee charge failed (proceeding anyway):', err)
+ }
+ }
+
try {
const order: LimitOrder = {
id: `order-${Date.now()}`,
@@ -144,8 +155,8 @@ export function PlaceOrderModal({ isOpen, onClose, onPlaceOrder }: PlaceOrderMod