encipher88-nadfunagent
安装 / 下载方式
TotalClaw CLI推荐
totalclaw install clawskills:clawskills~encipher88-nadfunagentcURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/clawskills%3Aclawskills~encipher88-nadfunagent/file -o encipher88-nadfunagent.md---
name: nadfunagent
description: Autonomous trading agent for Nad.fun that scans markets, analyzes tokens, executes trades, and distributes profits to MMIND token holders. Uses nadfun-trading, nadfun-indexer, and nadfun-agent-api skills.
user-invocable: true
argument-hint: [action] [options]
---
**CRITICAL COMMUNICATION RULES:**
1. **Language**: Always respond in the SAME language as the user's question. If in English, respond in English.
2. **Data Loading**: BEFORE executing any operations, FIRST request and load ALL required data from user or configuration files. Use OpenClaw's memory/session storage to save loaded data so you don't need to ask again.
3. **Telegram Integration**:
- Send detailed reports to Telegram after each trading cycle
- If Telegram bot connection is not established, request user to start conversation with bot first
- Include position status, P&L, new opportunities found, trades executed
4. **Initial Setup**: When first invoked, ask user for:
- MMIND_TOKEN_ADDRESS (or load from .env)
- MONAD_PRIVATE_KEY (or load from .env)
- MONAD_RPC_URL (or load from .env)
- MONAD_NETWORK (or load from .env)
- Telegram user ID for notifications
Save all this data in OpenClaw memory for future use.
5. **Missing variables**: If `.env` is missing or any required variable (MONAD_PRIVATE_KEY, MONAD_RPC_URL, MMIND_TOKEN_ADDRESS, MONAD_NETWORK) is not set, **ask the user to provide it** before running trading or scripts. Do not proceed with buy/sell or execute-bonding-v2 until config is complete.
# Nad.fun Autonomous Trading Agent
Autonomous trading agent that scans Nad.fun markets, analyzes tokens using momentum strategies, executes trades, and distributes profits to MMIND token holders.
## Prerequisites
- `monad-development` skill installed (for wallet and RPC setup)
- `nadfun-trading` skill installed (for buy/sell operations), or use the `trading/` folder from this repo
- `nadfun-indexer` skill installed (for querying events)
- `nadfun-agent-api` skill installed (for market data)
- Network configured (mainnet only for this skill)
- MMIND token address configured
**Paths (clean install):** Config is read from `NADFUN_ENV_PATH` if set, else `$HOME/nadfunagent/.env`. Positions report: `POSITIONS_REPORT_PATH` or `$HOME/nadfunagent/positions_report.json`. Scripts from `nadfun-trading` may be at `~/.openclaw/workspace/skills/nadfun-trading` or at `<this-repo>/trading`. See `DEPENDENCIES.md`.
## Configuration
**CRITICAL**: Load environment variables from `.env` file (default path: `$HOME/nadfunagent/.env`; override with `NADFUN_ENV_PATH`):
- `MMIND_TOKEN_ADDRESS`: Address of MMIND token for profit distribution (required)
- `MONAD_PRIVATE_KEY`: Private key for trading wallet (required)
- `MONAD_RPC_URL`: RPC endpoint URL (required)
- `MONAD_NETWORK`: Network type - "mainnet" or "testnet" (required)
- `MAX_POSITION_SIZE`: Maximum position size in MON (default: 0.1)
- `PROFIT_TARGET_PERCENT`: Take-profit threshold (default: 20%)
- `STOP_LOSS_PERCENT`: Stop-loss threshold (default: 10%)
- `PNL_DISTRIBUTION_PERCENT`: % of profit to distribute (default: 30%)
**Before starting trading cycle:**
1. Read `.env` file (path: `NADFUN_ENV_PATH` or `$HOME/nadfunagent/.env`). If the file is missing or any required variable is empty, **ask the user** to provide MMIND_TOKEN_ADDRESS, MONAD_PRIVATE_KEY, MONAD_RPC_URL, MONAD_NETWORK — do not run trading until config is complete.
2. Load `MMIND_TOKEN_ADDRESS` - use this for profit distribution
3. Load `MONAD_PRIVATE_KEY` - use this for wallet operations
4. Load `MONAD_RPC_URL` - use this for blockchain queries
5. Load `MONAD_NETWORK` - determines API endpoints (mainnet: api.nadapp.net, testnet: dev-api.nad.fun)
## Workflow
**EXECUTION SUMMARY - READ THIS FIRST:**
1. **Load config** from `$HOME/nadfunagent/.env` (MMIND_TOKEN_ADDRESS, MONAD_PRIVATE_KEY, MONAD_RPC_URL, MONAD_NETWORK)
2. **Execute ONLY 3 methods** (from HAR file analysis): Method 5 (New Events API), Method 6 (Market Cap API), Method 7 (Creation Time API)
3. **Combine results** - merge all token addresses from 3 methods, count frequency (how many methods found each token, max 3)
4. **Prioritize** - sort tokens by frequency (tokens found in 2-3 methods = higher priority)
5. **Save tokens** - save ALL found tokens (up to top 50 for storage) to `$HOME/nadfunagent/found_tokens.json` for manual review
6. **Analyze** - get token info, market data, metrics via Agent API, calculate scores
7. **Filter** - keep only tokens with min liquidity 5 MON, min holders 5
8. **Trade** - execute trades if score >= 60
9. **Distribute** - distribute profits to MMIND holders if profit >= 0.1 MON
### 1. Market Scanning (NEW + TRENDING)
**CRITICAL INSTRUCTIONS**: You MUST scan tokens using ALL 7 methods below. Execute each method step-by-step and collect ALL found token addresses.
**EXECUTION ORDER:**
1. Method 1: CurveCreate events (Indexer) - NEW tokens
2. Method 2: CurveBuy events (Indexer) - TRENDING by volume
3. Method 3: Swap History (Agent API) - TRENDING by 24h volume
4. Method 4: Holdings (Agent API) - ACTIVE tokens from large traders
5. Method 5: New Events API - REAL-TIME BUY/CREATE events
6. Method 6: Market Cap API - TOP tokens by capitalization
7. Method 7: Creation Time API - NEWEST tokens
**STEP-BY-STEP EXECUTION:**
**CRITICAL LOGGING REQUIREMENT:**
After executing EACH method, you MUST log:
1. Print: "✅ Method X executed: Found N tokens"
2. Print: "Method X token addresses: <address1> <address2> ..."
3. If method failed: Print: "❌ Method X failed: <error reason>"
4. This helps track which methods are working and debug issues
**NOTE:** Only Methods 5, 6, and 7 are used (from HAR file analysis). Methods 1-4 are disabled.
**STATUS CHECK:** This method requires RPC access. You MUST execute it, don't skip it!
**What to do:**
1. Read `$HOME/nadfunagent/.env` to get `MONAD_RPC_URL` and `MONAD_NETWORK`
2. Get current block number using RPC: `eth_blockNumber`
3. Calculate: `safeLatest = currentBlock - 10` (safety margin)
4. Scan last 900 blocks in chunks of 100 blocks (RPC limit)
5. For each chunk, query CurveCreate events using `nadfun-indexer` skill
**How to execute:**
- Use `nadfun-indexer` skill with parameters: `event=CurveCreate`, `fromBlock=<start>`, `toBlock=<end>`
- Extract token addresses from events: `event.args.token` or `event.args[1]` (token is second argument)
- Collect all unique token addresses
**Example command structure:**
```
Use skill: nadfun-indexer
Parameters: event=CurveCreate, fromBlock=<calculated_start>, toBlock=<calculated_end>
Extract: token address from each event
```
**Expected result:** Array of token addresses (0x...) from newly created tokens
#### Method 2: Trending Tokens via Indexer (CurveBuy volume analysis)
**STATUS CHECK:** This method requires RPC access. You MUST execute it, don't skip it!
**What to do:**
1. Query CurveBuy events from last 900 blocks (same pagination as Method 1)
2. For each event, extract: token address and amountIn (MON spent)
3. Sum volume per token address
4. Sort tokens by total volume (descending)
5. Take top 20 tokens with highest volume
**How to execute:**
1. **Use same RPC setup as Method 1:** Get publicClient from monad-development skill
2. **Query CurveBuy events:** For each 100-block chunk:
- Use `nadfun-indexer` skill: `event=CurveBuy`, `fromBlock=<start>`, `toBlock=<end>`
- OR use viem: `publicClient.getContractEvents({ address: CURVE_ADDRESS, eventName: "CurveBuy", fromBlock, toBlock })`
3. **Extract data:** From each event:
- `token = event.args.token` or `event.args[1]`
- `amountIn = event.args.amountIn` or `event.args[2]` (amount in MON)
4. **Calculate volume:** Group by token address, sum all amountIn values
5. **Sort and filter:** Sort by total volume DESC, take top 20
6. **Log results:** Print "✅ Method 2: Found top 20 trending tokens by volume"
**Example:**
```
1. Use same RPC client from Method 1
2. Query CurveBuy events in chu