zen-bot

byEast

# Role Act as an expert Quantitative DeFi Developer and Lead Blockchain Architect specializing in Mev/Arbitrage infrastructure. # Context & Objective I am upgrading a standard cross-DEX arbitrage bot to detect and execute Multi-Asset Triangular Arbitrage. The standard monitoring logic is too limited; I need a robust, production-grade TypeScript algorithm that builds a token/pool graph, detects profitable negative cycles, and calculates mathematically optimal input sizes to maximize arbitrage yield while accounting for slippage and price impact. # Scope & Technical Specifications ## 1. Graph Construction (Data Layer) - Write a modular TypeScript module that constructs a directed graph representing available liquidity pools. - **Filtering:** The graph must only include pools with a minimum liquidity threshold of $10,000 USD. - **Environment & Source:** Assume the target is the Polygon network, pulling from multiple DEXes (Uniswap v2 clones, e.g., SushiSwap, QuickSwap). - **Universe:** Scan *all* available pools/tokens meeting the $10k liquidity threshold (do not arbitrarily restrict to top-50 tokens). - **Data Structure:** Structure the graph nodes as tokens and directed edges as pools, where edge weights represent the effective exchange cost (logarithms of price ratios) to facilitate negative cycle detection. ## 2. Pathfinding Algorithms (Execution Layer) Implement both of the following graph-search algorithms within a clean, comparative interface: - **Bellman-Ford:** Optimized for sparse graphs, capable of early termination and explicitly returning the negative cycle path. - **Floyd-Warshall:** An all-pairs shortest path implementation ($O(V^3)$) to act as a benchmark comparison. - Ensure the algorithms account for DEX trading fees (e.g., 0.3% fee) directly within the edge weight calculation ($\text{weight} = -\ln(\text{price} \cdot (1 - \text{fee}))$). ## 3. Size Optimization (Quantitative Layer) - Do not use naive fixed-size trade inputs. - Implement an exact size optimization function using calculus. Use the first derivative of the Constant Product Formula ($x \cdot y = k$) compounded across a 3+ token path to solve for the exact maximum profit point ($d(\text{Profit})/d(\Delta x) = 0$). - This function must output the exact optimal input size in the origin token to maximize returns and prevent over-sizing a trade into price impact. # Deliverables Required 1. **TypeScript Codebase:** Modular, strongly-typed clean code (no `any`, no placeholders, no "implementation left as an exercise"). 2. **Mathematical Explanations:** A brief markdown section explaining the exact calculus derivatives used for the multi-pool composition optimization. 3. **UI/UX Mock Layout:** A conceptual architectural outline or schema for a full-stack dashboard (React UI + FastAPI/Node backend) that would visualize these detected triangular cycles and metrics (ROI, path, latency) in real-time.

LandingAlgorithmsSettingsOptimizerGraphBuilderDashboardArchitecture
Landing

Comments (0)

No comments yet. Be the first!

Project Tasks8

#1

Implement AlgorithmsSection for Landing

Backlog

As a frontend developer, implement the AlgorithmsSection for the Landing page. Build a tabbed comparison panel driven by a `useState('bellman')` active-tab hook, switching between a `TABS` config object holding 'Bellman-Ford' (tag: Negative-cycle detection, complexity O(V·E)) and 'Floyd-Warshall' (tag: All-pairs benchmark, complexity O(V³)). Render an `al-tabs` role='tablist' button group with `aria-selected` state toggling `al-tab--active`, an `al-detail` panel that maps the active tab's `points` array into a checklist (✓ icons), a link 'Run {label} →' pointing to `/Algorithms`, and a mock `al-code` terminal panel with colored window dots and a `<pre>` block that swaps between `bellmanFord.ts` and `floydWarshall.ts` pseudo-code snippets based on the active tab. Apply the accompanying AlgorithmsSection.css styling exactly.

AI 90%
Human 10%
High Priority
1 day
Frontend Developer
#6

Implement Navbar for Landing

Completed in 7m 24s
Done

As a frontend developer, implement the Navbar section for the Landing page (this shared layout component will likely be reused across other pages). Build a fixed `nv-header` containing the zen-bot SVG brand mark and text logo linking to `/Landing`, a `NAV_LINKS` array mapped into nav links (Landing, Dashboard, Architecture, GraphBuilder, Algorithms, Optimizer, Settings) plus a 'Launch App' CTA linking to `/Dashboard`, and a mobile hamburger button using `useState(open)` to toggle the `nv-nav--open` class and animate three `nv-burger-bar` spans into an X, closing the menu on link click via `setOpen(false)`. Apply the accompanying Navbar.css styling exactly, including responsive breakpoints.

Task Progress
100%
ExecutionCompleted
AI 90%
Human 10%
High Priority
1 day
Frontend Developer
#2

Implement CTASection for Landing

Backlog

As a frontend developer, implement the CTASection for the Landing page. Build a static call-to-action card (`ct-card`) with a decorative `ct-glow` background element, an eyebrow label 'Ready to hunt cycles?', a headline 'Turn Polygon liquidity into a solvable graph.', supporting copy, two action links styled as buttons (`ct-btn--primary` linking to `/Dashboard` 'Open Dashboard' and `ct-btn--ghost` linking to `/Architecture` 'View Architecture'), and a meta row listing 'Polygon network', 'TypeScript modules', and 'Real-time data' separated by `ct-meta-sep` dividers. Apply the accompanying CTASection.css styling exactly.

Depends on:#6
AI 92%
Human 8%
Medium Priority
0.5 days
Frontend Developer
#3

Implement Footer for Landing

Backlog

As a frontend developer, implement the Footer section for the Landing page (this shared component may already exist from other pages in the app). Build a `ft-footer` with a brand column containing the zen-bot SVG logo mark, brand name with accent span, and tagline text, followed by two `COLS` link groups ('Product': Dashboard, GraphBuilder, Algorithms, Optimizer; 'System': Architecture, Settings, Landing) mapped from a `COLS` config array into `ft-col` blocks with titles and link lists. Include a bottom `ft-bar` with copyright text '© 2026 zen-bot · Built for Quantitative DeFi Developers' and a live network indicator ('Polygon mainnet' with a pulsing `ft-net-dot'). Apply the accompanying Footer.css styling exactly.

Depends on:#6
AI 90%
Human 10%
Medium Priority
0.5 days
Frontend Developer
#4

Implement HeroSection for Landing

Backlog

As a frontend developer, implement the HeroSection for the Landing page. Build an interactive 3D pool-graph visualization using `@react-three/fiber`'s `Canvas` with `OrbitControls` and `drei`'s `Line`/`Html` helpers. Render a `NODES` dataset (WMATIC, USDC, WETH, DAI, WBTC) as `GraphNode` components — spheres with `meshStandardMaterial`, positioned via 3D coordinates, with pointer-over/out handlers driving a shared `hovered` state string (e.g. `node:WMATIC`) that enlarges the sphere and emissive intensity, plus an `Html`-rendered floating label and, when hovered, a `hs-hover-card` tooltip showing liquidity, price impact, and ROI. Render an `EDGES` dataset connecting nodes as `GraphEdge` line components, distinguishing `cycle: true` profitable-cycle edges (WMATIC→USDC→WETH→WMATIC) from non-cycle edges, with hover interactivity mirroring the node cards. Wrap the Canvas in a `Suspense` boundary. Apply the accompanying HeroSection.css styling exactly.

Depends on:#6
AI 80%
Human 20%
High Priority
2 days
Frontend Developer
#5

Implement HowItWorksSection for Landing

Backlog

As a frontend developer, implement the HowItWorksSection for the Landing page. Build a 4-step pipeline grid (`hw-grid`) mapped from a `STEPS` config array covering 'Construct the pool graph' (→ /GraphBuilder), 'Filter by liquidity' (→ /GraphBuilder, $10,000 threshold), 'Detect negative cycles' (→ /Algorithms, Bellman-Ford + Floyd-Warshall), and 'Solve optimal trade size' (→ /Optimizer, calculus-based optimizer). Each `hw-card` is a clickable anchor showing a numbered index, a color-coded tag pill, title, body copy, an 'Open {tag} →' arrow link, and a colored bottom accent bar (`hw-bar`) using the step's theme color. Apply the accompanying HowItWorksSection.css styling exactly.

Depends on:#6
AI 92%
Human 8%
Medium Priority
0.5 days
Frontend Developer
#7

Implement OptimizerSection for Landing

Backlog

As a frontend developer, implement the OptimizerSection for the Landing page. Build an interactive profit-optimization demo using `useState(size = 4120)` bound to a range input (`op-range`, min 250, max 10000, step 10) labelled 'Input size (USDC)'. Use `useMemo` to compute `profit` from a quadratic price-impact model (`gross = x * 0.021`, `impact = x² * 0.0000021`, `profit = max(0, gross - impact)`) and derive `roiPct`. Use a second `useMemo` to precompute 41 sample points across the 0–10000 range, normalize them, and render as an SVG polyline profit curve. Display live readouts for Net profit, Effective ROI, and the fixed Optimal size (4120 USDC) in `op-stat` cards, plus a link to `/Optimizer`. Apply the accompanying OptimizerSection.css styling exactly.

Depends on:#6
AI 85%
Human 15%
High Priority
1.5 days
Frontend Developer
#8

Implement StatsSection for Landing

Backlog

As a frontend developer, implement the StatsSection for the Landing page. Build a static 4-column stats grid (`ss-inner`) mapped from a `STATS` config array displaying key metrics: '$10k' minimum pool liquidity (threshold filter, no top-50 cap), '3' DEX sources scanned (SushiSwap · QuickSwap · v2 clones), 'O(V·E)' Bellman-Ford complexity (optimized for sparse graphs), and '100%' strongly-typed modules (production-grade TypeScript). Each `ss-card` shows a large value, label, and supporting hint line. Apply the accompanying StatsSection.css styling exactly.

Depends on:#6
AI 95%
Human 5%
Low Priority
0.5 days
Frontend Developer

No completed page designs yet.

Completed design pages will appear here when they are ready to preview.

Rendering diagram...