UNPKG

@elizaos/plugin-avalanche

Version:

Avalanche blockchain plugin for ElizaOS - enables DeFi operations, token transfers, YAK swaps, and yield strategies

254 lines (180 loc) 5.73 kB
# @elizaos/plugin-avalanche A plugin for interacting with the Avalanche blockchain network within the ElizaOS ecosystem. ## Description The Avalanche plugin enables comprehensive DeFi operations on the Avalanche network, including token transfers, YAK swaps, yield strategy management, and token creation via Token Mill. ## Installation ```bash pnpm install @elizaos/plugin-avalanche ``` ## Configuration The plugin requires the following environment variable: ```typescript AVALANCHE_PRIVATE_KEY=<Your Avalanche private key> ``` ## Features ### 1. Token Transfers - Send native AVAX and ERC20 tokens - Support for multiple token standards - Built-in address validation ### 2. YAK Swaps - Decentralized token swaps - Automatic best path finding - Slippage protection (default: 0.2%) - Support for all major tokens ### 3. Yield Strategies - Deposit tokens into yield-generating strategies - Support for multiple strategies including: - YAK staking - USDC Benqi - gmYAK Token Mill - PRINCESS staking - JOE staking ### 4. Token Mill - Create new tokens - Configure custom tokenomics - Automatic market creation ## Supported Tokens ```typescript const TOKENS = { AVAX: "0x0000000000000000000000000000000000000000", WAVAX: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", YAK: "0x59414b3089ce2AF0010e7523Dea7E2b35d776ec7", gmYAK: "0x3A30784c1af928CdFce678eE49370220aA716DC3", USDC: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", // ... and more }; ``` ## Usage Examples ### Token Transfer ```typescript // Send AVAX "Send 10 AVAX to 0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"; // Send ERC20 "Transfer 100 USDC to [address]"; ``` ### YAK Swap ```typescript // Swap tokens "Swap 1 AVAX for USDC"; "Swap 10 USDC for gmYAK"; ``` ### Yield Strategy ```typescript // Deposit into strategies "Deposit 1 USDC into the strategy"; "Deposit 10 gmYAK to earn yield"; ``` ### Token Creation ```typescript // Create new token "Create a new memecoin called 'Test Token' with the symbol 'TEST'"; ``` ## Providers ### 1. Wallet Provider - Displays wallet balances - Shows tokens in yield strategies - Real-time balance updates ### 2. Strategies Provider - Lists available yield strategies - Shows deposit token requirements ### 3. Tokens Provider - Lists supported tokens - Shows token addresses ## Development 1. Clone the repository 2. Install dependencies: ```bash pnpm install ``` 3. Build the plugin: ```bash pnpm run build ``` 4. Run linting: ```bash pnpm run lint ``` ## Dependencies - viem: ^2.21.49 - @elizaos/core: workspace:\* ## Future Enhancements 1. **Advanced DeFi Operations** - Multi-hop yield strategies - Auto-compounding features - Yield optimization algorithms - Risk assessment tools - Portfolio rebalancing automation - Cross-chain yield farming 2. **Enhanced Token Management** - Batch token operations - Advanced token creation templates - Token migration tools - Automated token listing - Token analytics dashboard - Custom tokenomics implementation 3. **YAK Protocol Integration** - Advanced routing algorithms - MEV protection features - Gas optimization strategies - Liquidity analysis tools - Price impact predictions - Custom trading strategies 4. **Benqi Protocol Features** - Collateral optimization - Liquidation protection - Interest rate monitoring - Position management tools - Risk assessment dashboard - Auto-repayment features 5. **Token Mill Improvements** - Advanced token customization - Automated market making - Token distribution tools - Vesting schedule management - Governance token features - Token upgrade mechanisms 6. **Security Enhancements** - Transaction simulation - Smart contract auditing tools - Real-time monitoring - Automated safety checks - Emergency shutdown features - Multi-signature support 7. **Developer Tools** - Enhanced debugging capabilities - Testing framework improvements - Documentation generator - CLI tools for common operations - Integration templates - Performance monitoring 8. **Analytics and Reporting** - Portfolio tracking - Performance metrics - Gas usage optimization - Transaction history analysis - Yield comparison tools - Risk assessment reports We welcome community feedback and contributions to help prioritize these enhancements. ## Contributing Contributions are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information. ## Credits This plugin integrates with and builds upon several key technologies: - [Avalanche](https://www.avax.network/): High-performance blockchain platform - [avalanchejs](https://github.com/ava-labs/avalanchejs): Official Avalanche JavaScript library - [YAK Protocol](https://yak.exchange/): Decentralized exchange aggregator - [Benqi](https://benqi.fi/): Lending and borrowing protocol - [Token Mill](https://tokenmill.xyz/): Token creation platform Special thanks to: - The Ava Labs team for developing Avalanche - The YAK Protocol development team - The Benqi protocol developers - The Token Mill platform team - The Avalanche Developer community - The Eliza community for their contributions and feedback For more information about Avalanche capabilities: - [Avalanche Documentation](https://docs.avax.network/) - [YAK Protocol Docs](https://yak.exchange/docs) - [Benqi Documentation](https://docs.benqi.fi/) - [Token Mill Guide](https://docs.tokenmill.xyz/) ## License This plugin is part of the Eliza project. See the main project repository for license information.