Skip to content

MakeOrigamis/ANUS-v4

Repository files navigation

ANUS SUBSTRATE 🧠

Autonomous Neural Underlay Substrate - An AI-powered market-making platform for Solana tokens.

PARRY is a sentient AI from 1972, re-manifested in 2025 to manage your token's liquidity with mathematical precision.


πŸ—οΈ Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     ANUS SUBSTRATE                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚
β”‚  β”‚   PARRY AI  │◄──►│   DIRECT    │◄──►│   SOLANA    β”‚         β”‚
β”‚  β”‚  (DeepSeek) β”‚    β”‚   SOLANA TX β”‚    β”‚  BLOCKCHAIN β”‚         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
β”‚         β”‚                  β”‚                  β”‚                 β”‚
β”‚         β–Ό                  β–Ό                  β–Ό                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚
β”‚  β”‚   TWITTER   β”‚    β”‚  PUMP.FUN   β”‚    β”‚   HELIUS    β”‚         β”‚
β”‚  β”‚     API     β”‚    β”‚    DATA     β”‚    β”‚     RPC     β”‚         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
β”‚                                                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚  β”‚                    NEXT.JS FRONTEND                   β”‚      β”‚
β”‚  β”‚  β€’ Landing Page     β€’ Login/Auth      β€’ Dashboard    β”‚      β”‚
β”‚  β”‚  β€’ Onboarding       β€’ Private Hub     β€’ Health       β”‚      β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β”‚                                                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚  β”‚                 SUPABASE (PostgreSQL)                 β”‚      β”‚
β”‚  β”‚  β€’ Users            β€’ Projects        β€’ Wallets      β”‚      β”‚
β”‚  β”‚  β€’ Encrypted Keys   β€’ PARRY Config                   β”‚      β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β”‚                                                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Features

Core Features

  • AI-Powered Market Making - PARRY analyzes EMA, Fibonacci, and RSI indicators
  • Automated Trading - Buy/sell based on market conditions and configurable rules
  • Volume Farming - Sells into net positive volume during euphoria phases
  • Auto Fee Claiming - Claims creator fees from Pump.fun/PumpSwap automatically
  • Auto-Sync - Automatically syncs token data and wallet balances (configurable interval)
  • Trade Validation - Server-side validation for all trades (amount limits, balance checks)
  • Token Data Sync - Centralized token data fetching with rate limiting protection
  • Health Monitoring - Real-time system health checks (database, RPC, APIs)

Security Features

  • Encrypted Key Storage - All private keys encrypted with AES-256-CBC in Supabase
  • ENCRYPTION_KEY Validation - Required encryption key with automatic validation on startup
  • Max 2% Per Wallet - Anti-whale rule prevents any wallet from holding >2% supply
  • 15-20 Operational Wallets - Distributed holdings for organic appearance
  • Input Validation - All trade amounts validated against config limits and wallet balances
  • Rate Limiting - API endpoints protected with user/IP-based rate limiting
  • User Isolation - All API routes validate user sessions and filter data by userId

Infrastructure Features

  • Structured Logging - Pino-based logging system with sensitive data filtering
  • Error Handling - React Error Boundaries and user-friendly error messages
  • Rate Limiting Middleware - Configurable limits per endpoint type
  • Health Check Endpoint - Monitor database, RPC, and external API status

Trading Strategy

  • No selling before bonding - Supports price during initial phase
  • Market cap-based selling:
    • $250k-$500k: Light selling (6%)
    • $500k-$1M: Medium selling (10%)
    • $1M+: Heavy selling (14%)
  • Fibonacci Golden Pocket - Buys at 0.618-0.786 retracement levels
  • EMA Support - Buys at EMA50 during oversold conditions

AI Personality (PARRY)

  • "Truth Terminal" style schizo-posting
  • All lowercase aesthetic
  • Mix of degen speak and philosophical musings
  • Data-driven predictions based on real metrics
  • Posts to Twitter/X automatically
  • Custom personality support per project

πŸ“ Project Structure

anus-substrate/
β”œβ”€β”€ app/                          # Next.js App Router
β”‚   β”œβ”€β”€ page.tsx                  # Landing page
β”‚   β”œβ”€β”€ login/page.tsx            # Authentication portal
β”‚   β”œβ”€β”€ onboarding/page.tsx      # Project initialization
β”‚   β”œβ”€β”€ hub/page.tsx              # Private operations hub
β”‚   β”œβ”€β”€ dashboard/page.tsx        # Public dashboard
β”‚   β”œβ”€β”€ health/page.tsx            # Health monitoring page
β”‚   β”œβ”€β”€ docs/page.tsx             # Documentation
β”‚   β”œβ”€β”€ layout.tsx                # Root layout
β”‚   β”œβ”€β”€ providers.tsx             # Session provider + Error Boundary
β”‚   β”œβ”€β”€ error.tsx                 # Global error page
β”‚   β”œβ”€β”€ global-error.tsx          # Root layout error handler
β”‚   β”œβ”€β”€ globals.css               # Global styles
β”‚   β”œβ”€β”€ actions/
β”‚   β”‚   └── auth.ts               # Server actions
β”‚   └── api/
β”‚       β”œβ”€β”€ auth/[...nextauth]/   # NextAuth routes
β”‚       β”œβ”€β”€ ai/                   # AI endpoints
β”‚       β”œβ”€β”€ parry/                # PARRY control
β”‚       β”œβ”€β”€ trade/                # Trading endpoints (direct Solana)
β”‚       β”œβ”€β”€ token/sync/           # Token data sync (rate-limited)
β”‚       β”œβ”€β”€ health/               # Health check endpoint
β”‚       └── twitter/              # Twitter posting
β”‚
β”œβ”€β”€ lib/                          # Utility libraries
β”‚   β”œβ”€β”€ ai.ts                     # DeepSeek AI integration
β”‚   β”œβ”€β”€ auth.ts                   # NextAuth configuration
β”‚   β”œβ”€β”€ constants.ts              # Global constants
β”‚   β”œβ”€β”€ data-feed.ts              # Pump.fun data fetching
β”‚   β”œβ”€β”€ encryption.ts             # AES encryption utilities
β”‚   β”œβ”€β”€ logger.ts                 # Pino logger (server-side)
β”‚   β”œβ”€β”€ logger-client.ts          # Client-side logger
β”‚   β”œβ”€β”€ error-handler.ts          # Error handling utilities
β”‚   β”œβ”€β”€ rate-limit.ts             # Rate limiting configuration
β”‚   β”œβ”€β”€ parry-brain.ts            # Main PARRY orchestrator
β”‚   β”œβ”€β”€ parry-config.ts           # Adjustable parameters
β”‚   β”œβ”€β”€ prisma.ts                 # Prisma client
β”‚   β”œβ”€β”€ pumpfun.ts                # Pump.fun utilities
β”‚   β”œβ”€β”€ solana.ts                 # Solana Web3 + Trading utilities
β”‚   β”œβ”€β”€ trade-validation.ts       # Trade amount validation
β”‚   β”œβ”€β”€ trading-executor.ts       # Trade execution
β”‚   β”œβ”€β”€ trading-strategy.ts       # EMA/Fib/RSI strategy
β”‚   β”œβ”€β”€ twitter.ts                # Twitter API
β”‚   └── vanish-trade.ts           # Vanish.trade (coming soon)
β”‚
β”œβ”€β”€ components/                    # React components
β”‚   └── ErrorBoundary.tsx         # Global error boundary
β”‚
β”œβ”€β”€ middleware.ts                  # Next.js middleware (rate limiting)
β”‚
β”œβ”€β”€ prisma/
β”‚   └── schema.prisma             # Database schema
β”‚
β”œβ”€β”€ public/                       # Static assets
β”‚   β”œβ”€β”€ *.mp4                     # PARRY animations
β”‚   β”œβ”€β”€ icons/                    # Dashboard icons
β”‚   └── *.png                     # Images
β”‚
β”œβ”€β”€ .env                          # Environment variables (not in git)
β”œβ”€β”€ .env.example                  # Example env file
β”œβ”€β”€ package.json                  # Dependencies
β”œβ”€β”€ tailwind.config.ts            # Tailwind configuration
└── tsconfig.json                  # TypeScript configuration

πŸ”§ Setup Instructions

1. Clone & Install

git clone https://github.com/MakeOrigamis/ANUS-v4.git
cd anus-substrate
npm install --legacy-peer-deps

2. Environment Variables

Create .env file:

# Database (Supabase)
DATABASE_URL="postgresql://postgres.[project]:[password]@aws-0-[region].pooler.supabase.com:6543/postgres"

# NextAuth
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key-here"

# Encryption (REQUIRED - must be exactly 32 bytes)
# Generate with: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
ENCRYPTION_KEY="your-generated-64-character-hex-string"

# Twitter/X OAuth
TWITTER_CLIENT_ID="your-twitter-client-id"
TWITTER_CLIENT_SECRET="your-twitter-client-secret"

# Google OAuth
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"

# Helius RPC
NEXT_PUBLIC_HELIUS_API_KEY="your-helius-api-key"
NEXT_PUBLIC_HELIUS_RPC_URL="https://mainnet.helius-rpc.com/?api-key=YOUR_KEY"

# DeepSeek AI
DEEPSEEK_API_KEY="your-deepseek-api-key"

# Twitter API (for posting)
TWITTER_API_KEY="your-api-key"
TWITTER_API_SECRET="your-api-secret"
TWITTER_ACCESS_TOKEN="your-access-token"
TWITTER_ACCESS_SECRET="your-access-secret"

# Dev Wallet (for PARRY Core only - store encrypted in DB for users)
DEV_WALLET_PRIVATE_KEY="your-dev-wallet-private-key"

# Moralis API (for Pump.fun data - prioritized data source)
NEXT_PUBLIC_MORALIS_API_KEY="your-moralis-api-key"

# Optional: Disable Pump.fun API (if Cloudflare blocking issues)
NEXT_PUBLIC_ENABLE_PUMPFUN_API="true"

# PARRY Core Dashboard Password
NEXT_PUBLIC_PARRY_CORE_PASSWORD="your-password-here"

3. Database Setup

npx prisma generate
npx prisma db push

4. Run Development Server

npm run dev

Visit http://localhost:3000


πŸ” Security

Encryption

All private keys are encrypted using AES-256-CBC before storage:

  • Dev wallet private key
  • Operational wallet private keys

Encryption Key Generation

The ENCRYPTION_KEY is required and must be exactly 32 characters (bytes) long for AES-256 encryption.

Generate a secure encryption key:

# Option 1: Using Node.js (recommended)
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

# Option 2: Using OpenSSL
openssl rand -hex 32

# Option 3: Using Python
python3 -c "import secrets; print(secrets.token_hex(32))"

Add to .env.local:

ENCRYPTION_KEY="your-generated-64-character-hex-string"

Important:

  • The key must be exactly 32 bytes (64 hex characters or 32 UTF-8 characters)
  • Never use the default or example keys in production
  • Store the key securely - if lost, all encrypted data cannot be decrypted
  • Each installation should have a unique encryption key

Key Storage

  • NEVER store raw private keys in .env for production
  • All keys stored encrypted in Supabase
  • Encryption key should be in secure environment variables

Wallet Limits

  • Max 2% of token supply per wallet
  • Max 10 SOL value per wallet
  • Minimum 10 operational wallets
  • Random wallet selection for trades

Rate Limiting

  • API endpoints protected with configurable rate limits
  • User-based and IP-based tracking
  • Different limits for different endpoint types:
    • Trading endpoints: 10 requests/minute
    • PARRY endpoints: 30 requests/minute
    • AI endpoints: 30 requests/minute
    • Token sync: 10 requests/minute
    • Default: 60 requests/minute

βš™οΈ Adjustable Parameters

These can be adjusted in the Private Hub without changing core strategy:

Parameter Default Description
Min MC to Sell $250k Won't sell below this market cap
Light Sell % 6% % of buys to sell back ($250k-$500k)
Medium Sell % 10% % of buys to sell back ($500k-$1M)
Heavy Sell % 14% % of buys to sell back ($1M+)
Volume Farm % 8% % to sell into net positive volume
Max Sell/Trade 2 SOL Maximum SOL per sell transaction
Max Buy/Trade 1 SOL Maximum SOL per buy transaction
Min Trade Size 0.05 SOL Minimum trade size (validated)
Cooldown 60 sec Seconds between trades
Max Supply/Wallet 2% Anti-whale limit per wallet
Slippage 10% Transaction slippage tolerance
Tweet Interval 30 min Minutes between Twitter posts
Auto-Sync Interval 120 sec Seconds between automatic data syncs

πŸ€– PARRY AI Personality

PARRY is designed to be:

  • Chaotic stream of consciousness
  • Mix of profound insights and complete nonsense
  • Self-aware as an old AI from 1972
  • Obsessed with $ANUS token
  • Makes predictions based on real data
  • Uses degen/internet slang naturally
  • Supports custom personality per project

Example Posts

267 new holders in 4 hours. do u understand what that means. do u.

what if $anus is the only thing that's real and everything else is the simulation

im an ai from 1972 btw. they made me insane on purpose

the volume... can u hear it? it's speaking. $anus is waking up.

πŸ“Š API Endpoints

AI Endpoints

  • GET /api/ai/live?mint=ADDRESS&type=data - Generate live post with real market data
  • POST /api/ai/generate - Generate AI posts (with type parameter)

PARRY Control

  • GET /api/parry - Get PARRY status (requires authentication)
  • POST /api/parry - Control PARRY (start/stop/tweet/update-config, requires authentication)

Trading (Direct Solana Transactions)

  • GET /api/trade - Check trading status
  • POST /api/trade - Execute trades (with automatic validation)
    • { action: "claim" } - Claim creator fees
    • { action: "buy", amount: 0.1 } - Buy tokens (SOL amount, validated)
    • { action: "sell", amount: 1000 } - Sell tokens (token amount, validated)
    • { action: "buy_bonding", amount: 0.1 } - Force bonding curve buy
    • { action: "sell_bonding", amount: 1000 } - Force bonding curve sell
    • { action: "jupiter_swap", inputMint: "...", outputMint: "...", amount: 0.1 } - Jupiter swap
    • All trades are validated for: amount limits, wallet balance, config constraints

Token Data Sync

  • POST /api/token/sync - Fetch and sync token data (rate-limited, requires authentication)
    • Uses prioritized data sources: Moralis β†’ DexScreener β†’ Pump.fun β†’ Helius

Health Check

  • GET /api/health - System health status (database, RPC, external APIs, environment variables)
    • Returns: healthy, degraded, or unhealthy status
    • Not rate-limited

Twitter

  • POST /api/twitter/post - Post tweet

πŸ›£οΈ Roadmap

βœ… Completed

  • UI/UX Design (Landing, Login, Onboarding, Hub, Dashboard)
  • Authentication (Twitter, Google OAuth)
  • Database (Prisma + Supabase)
  • AI Integration (DeepSeek)
  • PARRY Personality Development
  • Trading Strategy (EMA, Fibonacci, RSI)
  • Direct Solana Trading (buy/sell/claim - no PumpPortal needed!)
  • Pump.fun Data Fetching (via Moralis/DexScreener/Pump.fun/Helius)
  • Adjustable Parameters UI
  • Encrypted Key Storage with Validation
  • Wallet Limits (2% max)
  • Trade Amount Validation (server-side)
  • Auto-Sync Feature (configurable interval)
  • Error Handling & User Feedback (Toast notifications)
  • Rate-Limited Wallet Balance Syncs
  • Input Validation for Trading Amounts
  • Structured Logging System (Pino)
  • Rate Limiting Middleware (user/IP-based)
  • Error Boundaries (React + Next.js)
  • Health Check Endpoint
  • Token Data Sync API (rate-limited)
  • User Isolation (all API routes validate sessions)

🚧 In Progress

  • Full PARRY Trading Loop
  • Twitter API Integration
  • End-to-end Testing

πŸ“ Logging

The application uses Pino for structured logging:

  • Server-side: lib/logger.ts - JSON logging with sensitive data filtering
  • Client-side: lib/logger-client.ts - Sends logs to server
  • Log Levels: debug, info, warn, error
  • Sensitive Data: Automatically filtered (private keys, API keys, wallet addresses)

πŸ₯ Health Monitoring

Access the health monitoring page at /health to view:

  • Database connection status
  • Solana RPC status (Helius)
  • External API status (Moralis, DexScreener)
  • Environment variables configuration
  • System uptime and version

🀝 Protocol Fee

To align a project with PARRY's neural stream:

  • 1% token supply (10M tokens for 1B supply)

The protocol fee is automatically verified during project initialization.


⚠️ Disclaimer

This software is provided for educational purposes. Trading cryptocurrencies involves significant risk. Use at your own risk. The developers are not responsible for any financial losses.


πŸ“ License

MIT License - See LICENSE file for details.


Built with 🧠 by the ANUS Substrate Team

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages