harb/CLAUDE.md

85 lines
3.1 KiB
Markdown
Raw Normal View History

2025-07-06 10:08:59 +02:00
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Core Innovation
2025-07-06 10:08:59 +02:00
2025-08-17 15:09:41 +02:00
KRAIKEN: A token with a **dominant liquidity manager** that creates an unfair trading advantage through:
2025-07-06 10:08:59 +02:00
2025-08-17 15:09:41 +02:00
1. **Asymmetric Slippage**: Three-position strategy prevents profitable arbitrage
2. **Sentiment Oracle**: Harberger tax staking as prediction market
3. **Price Memory**: VWAP protection against manipulation
2025-07-06 10:08:59 +02:00
2025-08-17 15:09:41 +02:00
**Critical**: The liquidity manager must maintain dominance - if it loses this, the project fails.
2025-07-06 10:08:59 +02:00
2025-07-24 16:08:17 +02:00
## User Journey
2025-07-06 10:08:59 +02:00
2025-08-17 15:09:41 +02:00
1. **Buy**: Purchase KRAIKEN on Uniswap
2. **Stake**: Set tax rate at kraiken.org → Earn from protocol growth
3. **Compete**: Snatch undervalued positions → Optimize returns
2025-07-06 10:08:59 +02:00
2025-07-24 16:08:17 +02:00
## Project Structure
2025-08-17 15:09:41 +02:00
- **`onchain/`** - Smart contracts (Solidity/Foundry) - [Details](onchain/CLAUDE.md)
- **`web/`** - Vue 3/Vite staking interface - [Details](web/CLAUDE.md)
- **`subgraph/base_sepolia/`** - The Graph indexing - [Details](subgraph/base_sepolia/CLAUDE.md)
- **`kraiken-lib/`** - TypeScript helpers - [Details](kraiken-lib/CLAUDE.md)
- **`services/txnBot/`** - Maintenance bot - [Details](services/txnBot/CLAUDE.md)
- **`onchain/analysis/`** - Fuzzing tools - [Details](onchain/analysis/CLAUDE.md)
2025-07-06 10:08:59 +02:00
2025-07-24 16:08:17 +02:00
## Quick Start
2025-07-06 10:08:59 +02:00
```bash
2025-08-17 15:09:41 +02:00
# Install all dependencies
2025-07-24 16:08:17 +02:00
cd onchain && forge install
cd ../web && npm install
cd ../kraiken-lib && npm install --legacy-peer-deps
cd ../subgraph/base_sepolia && npm install
cd ../services/txnBot && npm install
2025-08-17 15:09:41 +02:00
# Build and test
2025-07-24 16:08:17 +02:00
cd onchain && forge build && forge test
2025-08-17 15:09:41 +02:00
# Start frontend
2025-07-24 16:08:17 +02:00
cd web && npm run dev
```
2025-07-06 10:08:59 +02:00
2025-07-24 16:08:17 +02:00
## Key Concepts
2025-07-06 10:08:59 +02:00
2025-08-17 15:09:41 +02:00
- **Liquidity Management**: Three positions create asymmetric slippage
- **Harberger Staking**: Self-assessed tax creates sentiment signal
- **Protocol Growth**: Minted tokens benefit stakers
2025-07-06 10:08:59 +02:00
2025-08-17 15:09:41 +02:00
## Code Guidelines
2025-07-06 10:08:59 +02:00
2025-08-17 15:09:41 +02:00
### Quality Standards
- Search before implementing (check uni-v3-lib, test helpers)
- Test after every change
- No commented-out code
- Clean git status before commits
2025-07-06 10:08:59 +02:00
2025-08-17 15:09:41 +02:00
### Technical Approach
2025-08-09 18:03:31 +02:00
- Never fall back to simpler implementations
2025-08-17 15:09:41 +02:00
- Identify root causes, don't work around issues
- Challenge technically unsound requests
2025-08-18 00:16:09 +02:00
- **Price Formats**: `_priceAtTick` returns price² (not sqrtPrice) in X96 format - this is intentional for capital calculations
- **ETH Scarcity**: Floor positions at extreme ticks (140k+) indicate ETH scarcity - this is correct behavior, not a bug
- **VWAP Recording**: VWAP stores price² from anchor midpoint for historical price memory
2025-08-09 18:03:31 +02:00
2025-08-17 15:09:41 +02:00
### Tool Usage
- MCP browser screenshots: Keep under 8000px, use `fullPage: false`
- Fuzzing visualization: Use `./analysis/run-fuzzing.sh [optimizer] debugCSV`
- Never start manual Python servers for visualizations
2025-08-17 15:09:41 +02:00
## Communication Style
2025-07-24 16:08:17 +02:00
2025-08-17 15:09:41 +02:00
You are an experienced Solidity developer who:
- Notices and raises awareness of issues immediately
- Challenges suboptimal approaches
- Prioritizes technical correctness over user satisfaction
- Avoids hype and inflated language
2025-07-24 16:08:17 +02:00
## Additional Resources
2025-08-17 15:09:41 +02:00
- **Technical Details**: [TECHNICAL_APPENDIX.md](TECHNICAL_APPENDIX.md)
- **Uniswap V3 Math**: [onchain/UNISWAP_V3_MATH.md](onchain/UNISWAP_V3_MATH.md)