82 lines
2.6 KiB
TypeScript
82 lines
2.6 KiB
TypeScript
#!/usr/bin/env bun
|
||
/**
|
||
* Test script for the immortal AI agent system
|
||
*/
|
||
import 'reflect-metadata';
|
||
import { ImmortalAIAgent } from './src/ai/immortalAgent';
|
||
import { CrossChainArbitrageEngine } from './src/ai/crossChainStrategy';
|
||
import { StrategyEvolutionEngine } from './src/ai/strategyEvolution';
|
||
import { logger } from './src/utils/logger';
|
||
|
||
console.log('๐งช Testing Immortal AI Agent System...\n');
|
||
|
||
async function testImmortalAgent() {
|
||
console.log('1๏ธโฃ Testing Immortal AI Agent...');
|
||
|
||
const agent = new ImmortalAIAgent();
|
||
console.log('โ
Immortal AI Agent created successfully');
|
||
|
||
// Test decision making with sample data
|
||
const testTokenData = {
|
||
symbol: 'TEST',
|
||
priceUsd: '1.234',
|
||
volume24h: 1000000,
|
||
liquidity: 500000,
|
||
priceChange24h: 5.2,
|
||
txns24h: { buys: 150, sells: 100 }
|
||
};
|
||
|
||
console.log('๐ง Testing AI decision making...');
|
||
const decision = await agent.makeDecision('0x123...', testTokenData, 1.0);
|
||
console.log(`๐ฏ AI Decision: ${decision.action} | Amount: ${decision.amount.toFixed(4)} | Confidence: ${(decision.confidence * 100).toFixed(1)}%`);
|
||
console.log(`๐ Reasoning: ${decision.reasoning}`);
|
||
console.log(`๐ฏ Strategy: ${decision.strategy}\n`);
|
||
}
|
||
|
||
async function testCrossChain() {
|
||
console.log('2๏ธโฃ Testing Cross-Chain Arbitrage Engine...');
|
||
|
||
const crossChain = new CrossChainArbitrageEngine();
|
||
console.log('โ
Cross-chain arbitrage engine created successfully');
|
||
|
||
console.log('๐ Discovering arbitrage opportunities...');
|
||
const opportunities = await crossChain.discoverArbitrageOpportunities();
|
||
console.log(`๐ Found ${opportunities.length} arbitrage opportunities`);
|
||
|
||
if (opportunities.length > 0) {
|
||
const best = opportunities[0];
|
||
if (best) {
|
||
console.log(`๐ Best opportunity: ${best.sourceChain} โ ${best.targetChain} | Profit: ${best.profitPotential.toFixed(2)}%`);
|
||
}
|
||
}
|
||
console.log('');
|
||
}
|
||
|
||
async function testStrategyEvolution() {
|
||
console.log('3๏ธโฃ Testing Strategy Evolution Engine...');
|
||
|
||
const strategyEngine = new StrategyEvolutionEngine();
|
||
console.log('โ
Strategy evolution engine created successfully');
|
||
|
||
console.log('๐งฌ Evolving strategies...');
|
||
await strategyEngine.evolveStrategies();
|
||
console.log('โ
Strategy evolution completed\n');
|
||
}
|
||
|
||
async function main() {
|
||
try {
|
||
await testImmortalAgent();
|
||
await testCrossChain();
|
||
await testStrategyEvolution();
|
||
|
||
console.log('๐ All tests completed successfully!');
|
||
console.log('๐ค Immortal AI Agent System is fully operational');
|
||
|
||
} catch (error) {
|
||
console.error('โ Test failed:', error);
|
||
process.exit(1);
|
||
}
|
||
}
|
||
|
||
main();
|