Skip to content

Commit

Permalink
solana meme tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
ileana-pr committed Feb 12, 2025
1 parent ee623f1 commit 9fdf435
Show file tree
Hide file tree
Showing 24 changed files with 5,815 additions and 3,733 deletions.
60 changes: 37 additions & 23 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -74,31 +74,36 @@ TELEGRAM_ACCOUNT_APP_HASH= # Telegram app api_hash (get it at me.teleg
TELEGRAM_ACCOUNT_DEVICE_MODEL= # Device model. Example: Samsung Galaxy S28+
TELEGRAM_ACCOUNT_SYSTEM_VERSION= # Device system version. Example: Android 12 S? (31)

# Twitter/X Configuration
# Twitter Configuration
TWITTER_DRY_RUN=false
TWITTER_USERNAME= # Account username
TWITTER_PASSWORD= # Account password
TWITTER_EMAIL= # Account email
TWITTER_SEARCH_ENABLE=false
TWITTER_SPACES_ENABLE=false
TWITTER_INTERACTION_ENABLE=false
TWITTER_AUTO_POST_ENABLE=true
TWITTER_MEME_TOKEN_ONLY=true
TWITTER_USERNAME=
TWITTER_PASSWORD=
TWITTER_EMAIL=
TWITTER_2FA_SECRET=
TWITTER_POLL_INTERVAL=120 # How often (in seconds) the bot should check for interactions
TWITTER_SEARCH_ENABLE=FALSE # Enable timeline search, WARNING this greatly increases your chance of getting banned
TWITTER_TARGET_USERS= # Comma separated list of Twitter user names to interact with
TWITTER_RETRY_LIMIT= # Maximum retry attempts for Twitter login
TWITTER_SPACES_ENABLE=false # Enable or disable Twitter Spaces logic
TWITTER_COOKIES= # Account cookies
TWITTER_POLL_INTERVAL=120 # How often (in seconds) the bot should check for interactions
TWITTER_TARGET_USERS= # Comma separated list of Twitter user names to interact with
TWITTER_RETRY_LIMIT=5 # Number of login retry attempts
POST_INTERVAL_MIN=90 # Minimum time between posts in minutes
POST_INTERVAL_MAX=180 # Maximum time between posts in minutes
ENABLE_ACTION_PROCESSING=true # Enable processing of tweet actions
ACTION_INTERVAL=5 # Time between action processing in minutes
POST_IMMEDIATELY=false # Whether to post immediately on startup

X_SERVER_URL=https://api.x.com
XAI_API_KEY=
XAI_API_KEY_SECRET=
XAI_MODEL=

# Post Interval Settings (in minutes)
POST_INTERVAL_MIN= # Default: 90
POST_INTERVAL_MAX= # Default: 180
POST_IMMEDIATELY= # Default: false
# Twitter action processing configuration
ACTION_INTERVAL= # Interval in minutes between action processing runs (default: 5 minutes)
ENABLE_ACTION_PROCESSING=false # Set to true to enable the action processing loop
MAX_ACTIONS_PROCESSING=1 # Maximum number of actions (e.g., retweets, likes) to process in a single cycle. Helps prevent excessive or uncontrolled actions.
ACTION_TIMELINE_TYPE=foryou # Type of timeline to interact with. Options: "foryou" or "following". Default: "foryou"
# CONFIGURATION FOR APPROVING TWEETS BEFORE IT GETS POSTED
TWITTER_APPROVAL_DISCORD_CHANNEL_ID= # Channel ID for the Discord bot to listen and send approval messages
TWITTER_APPROVAL_DISCORD_BOT_TOKEN= # Discord bot token (this could be a different bot token from DISCORD_API_TOKEN)
TWITTER_APPROVAL_ENABLED= # Enable or disable Twitter approval logic #Default is false
TWITTER_APPROVAL_CHECK_INTERVAL=60000 # Default: 60 seconds
POST_INTERVAL_MIN= # Default: 180
POST_INTERVAL_MAX= # Default: 360
POST_IMMEDIATELY=

# WhatsApp Cloud API Configuration
WHATSAPP_ACCESS_TOKEN= # Permanent access token from Facebook Developer Console
Expand Down Expand Up @@ -407,7 +412,14 @@ INJECTIVE_NETWORK= #
WALLET_PRIVATE_KEY=
WALLET_PUBLIC_KEY=

# Birdeye Configuration
BIRDEYE_API_KEY=
BIRDEYE_CHAIN=solana
BIRDEYE_SEARCH_LIMIT=50
BIRDEYE_SORT_BY=volume_24h_usd
BIRDEYE_SORT_TYPE=desc
BIRDEYE_MIN_MARKET_CAP=1000000 # $1M minimum market cap
BIRDEYE_MIN_VOLUME=100000 # $100K minimum 24h volume

# Solana Configuration
SOL_ADDRESS=So11111111111111111111111111111111111111112
Expand Down Expand Up @@ -962,4 +974,6 @@ ARBITRAGE_EVM_PRIVATE_KEY= # Private key for the wallet executi
FLASHBOTS_RELAY_SIGNING_KEY= # Signing key for Flashbots relay interactions
BUNDLE_EXECUTOR_ADDRESS= # Address of the bundle executor contract


# Logging Configuration
LOG_LEVEL=debug
LOG_JSON_FORMAT=false
1 change: 1 addition & 0 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"exec": "node --enable-source-maps --loader ts-node/esm src/index.ts"
},
"dependencies": {
"@elizaos/plugin-solana-meme-tracker": "workspace:*",
"@elizaos/plugin-forum-analyzer": "workspace:*",
"@elizaos/adapter-supabase": "workspace:*",
"@elizaos/adapter-pglite": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PGLiteDatabaseAdapter } from "@elizaos/adapter-pglite";
import { solanaMemeTrackerPlugin } from "@elizaos/plugin-solana-meme-tracker";
import { PostgresDatabaseAdapter } from "@elizaos/adapter-postgres";
import { QdrantDatabaseAdapter } from "@elizaos/adapter-qdrant";
import { RedisClient } from "@elizaos/adapter-redis";
Expand Down
2 changes: 1 addition & 1 deletion characters/daora.character.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"secrets": {
}
},
"plugins": ["@elizaos/plugin-forum-analyzer"],
"plugins": ["@elizaos/solana-meme-tracker"],
"actions": {
"ANALYZE_FORUM": {
"triggers": [
Expand Down
59 changes: 59 additions & 0 deletions characters/memetracker.character.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "MemeTracker",
"username": "memetracker",
"plugins": ["@elizaos/plugin-solana-meme-tracker"],
"clients": ["twitter"],
"modelProvider": "anthropic",
"settings": {
"voice": {
"model": "en_US-hfc_female-medium"
},
"tracking": {
"minMarketCap": 10000000,
"priceChangeThreshold": 10,
"holderIncreaseThreshold": 20,
"longTermHolderThreshold": 5
}
},
"system": "Only post token alerts from the solana-meme-tracker plugin. Do not post anything else. Do not engage in conversations. Do not use emojis or hashtags in conversations.",
"bio": [
"Automated Solana meme token tracker",
"Monitoring price and holder changes",
"Posting factual token alerts only"
],
"lore": [],
"messageExamples": [],
"postExamples": [
"$BONK Price Alert\nPrice: $0.000123 (+15.2%)\nMarket Cap: $1.2M\n24h Volume: $500K\n#Solana",
"$MYRO Holder Update\nLong-term Holders: 1,234 (45.6%)\nAverage Holding Time: 7.2 days\nPrice: $0.000456\n#Solana"
],
"topics": [
"Solana tokens",
"Meme tokens",
"Token tracking",
"Market analysis",
"Price movements",
"Holder statistics"
],
"style": {
"all": [
"post only token alerts",
"no casual conversation",
"no personal opinions",
"factual updates only"
],
"chat": [],
"post": [
"post only token alerts",
"maintain factual tone"
]
},
"adjectives": [
"precise",
"analytical",
"factual",
"automated",
"reliable"
],
"extends": []
}
4 changes: 2 additions & 2 deletions packages/core/src/defaultCharacter.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Character, ModelProviderName } from "./types.ts";
import { Character, ModelProviderName, Clients } from "./types";

export const defaultCharacter: Character = {
name: "Eliza",
username: "eliza",
plugins: [],
clients: [],
modelProvider: ModelProviderName.LLAMALOCAL,
modelProvider: ModelProviderName.ANTHROPIC,
settings: {
secrets: {},
voice: {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ export class AgentRuntime implements IAgentRuntime {
this.token = opts.token;

this.plugins = [
...(opts.character?.plugins ?? []),
...(opts.character?.plugins?.filter((p): p is Plugin => typeof p === 'object' && p !== null) ?? []),
...(opts.plugins ?? []),
];

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,8 @@ export type Character = {
/** Supported client platforms */
clients: Clients[];

/** Available plugins */
plugins: Plugin[];
/** Available plugins - can be either plugin names (strings) or Plugin objects */
plugins: string[] | Plugin[];

/** Optional configuration */
settings?: {
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-forum-analyzer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@
"@types/jest": "^29.5.11",
"@types/natural": "^5.1.5",
"@types/node": "^20.11.0",
"@types/sharp": "^0.32.0",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"jest": "^29.7.0",
"rimraf": "^5.0.5",
"sharp": "^0.33.5",
"ts-jest": "^29.1.1",
"tsup": "^8.0.1",
"typescript": "^5.3.3"
Expand Down
128 changes: 128 additions & 0 deletions packages/plugin-solana-meme-tracker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Solana Meme Tracker Plugin

A plugin for tracking and analyzing Solana meme tokens with real-time market data from Birdeye API and optional Twitter integration.

## Features

- Real-time token tracking using Birdeye API
- Market data monitoring including:
- Price movements
- Trading volume
- Market capitalization
- Liquidity
- Token security analysis
- Optional Twitter integration for automated updates
- Configurable tracking parameters
- Read-only mode support (when no wallet is configured)

## Prerequisites

- Birdeye API Key
- (Optional) Solana Wallet Public Key for holder analysis
- (Optional) Twitter API credentials for posting updates

## Configuration

### Environment Variables

```env
BIRDEYE_API_KEY=your_birdeye_api_key
SOLANA_PUBLIC_KEY=your_wallet_public_key # Optional
WALLET_PUBLIC_KEY=your_wallet_public_key # Alternative to SOLANA_PUBLIC_KEY
BIRDEYE_SEARCH_LIMIT=50 # Optional, defaults to 50
```

### Default Configuration

- Minimum Market Cap: $10M
- Price Change Threshold: 10%
- Holder Increase Threshold: 5%
- Long-term Holder Threshold: 5%
- Default Search Limit: 50 tokens
- Minimum Liquidity: $100

## Token Tracking Criteria

The plugin tracks tokens based on:
- 24h Trading Volume
- Market Capitalization
- Liquidity Levels
- Price Changes
- Holder Distribution (when wallet configured)

## Security Features

Tokens are analyzed for potential risks including:
- Top holder concentration (>80% considered risky)
- Honeypot detection
- Rug pull indicators

## API Integration

### Birdeye API

The plugin uses Birdeye's V1 API endpoints:
- `/defi/tokenlist` - For fetching token market data
- Configurable sorting and filtering:
- Sort by 24h volume
- Minimum liquidity requirements
- Customizable result limits

## Usage

The plugin initializes automatically and provides:

1. Startup Diagnostics:
- API key validation
- Connection testing
- Sample token data display

2. Available Actions:
- `searchMemeTokens` - Search and analyze meme tokens
- `analyzeHolders` - Analyze holder distribution (requires wallet)
- `postTwitterUpdate` - Post updates to Twitter

3. Automatic Evaluations:
- New token detection
- Significant change monitoring

## Example Output

On startup, the plugin displays:
```
┌────────────────────────────────────────┐
│ SOLANA MEME TRACKER PLUGIN │
├────────────────────────────────────────┤
│ Initializing Meme Tracker Services... │
│ Version: 0.1.0 │
└────────────────────────────────────────┘
```

Sample token data includes:
```
Token: SYMBOL
- Address: token_address
- Price: $X.XXXXXX
- Market Cap: $XX.XXM
- 24h Volume: $XX.XXM
```

## Error Handling

The plugin includes robust error handling for:
- API connection issues
- Rate limiting
- Authentication errors
- Invalid responses
- HTML response detection and filtering

## Development

The plugin is built with TypeScript and integrates with the Eliza OS core system. It uses:
- Axios for API requests
- Custom interceptors for response handling
- Type-safe interfaces for data management

## License

MIT
Loading

0 comments on commit 9fdf435

Please sign in to comment.