β οΈ ARCHIVED PROJECTThis project is no longer actively maintained and is provided as-is for archival and educational purposes. No support, updates, or security patches will be provided. Use at your own risk.
Originally developed by Autonomous Finance
The Token Index Agent is an Autonomous Investment Agent (AIA) that executes dynamic token index investment strategies across liquidity pools within the AO ecosystem. It automatically manages a portfolio of tokens based on user-defined criteria and autonomously rebalances holdings using market signals from DEXI.
- π Fully Autonomous: Operates independently on the AO platform with no off-chain signals or human intervention required
- π Dynamic Rebalancing: Automatically adjusts portfolio based on price changes and token set membership
- π Permaweb-Native: Management interface hosted on Arweave's permanent web
- π Self-Custodial: Users maintain full ownership and control through their Arweave wallet
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (Next.js) β
β Hosted on Arweave Permaweb β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AO Network (Hyper-Parallel Computer) β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββββββ β
β β Agent Process β β Backend Process β β DEXI (Oracle) β β
β β (Per User) β β (Shared) β β Market Data β β
β ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ ββββββββββββ¬βββββββββββ β
β β β β β
β βΌ βΌ βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β AMM Liquidity Pools β β
β β (Bark, Permaswap, and others) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Component | Description |
|---|---|
| Agent Process | Individual Lua process per user that manages portfolio, executes trades, and maintains state |
| Backend Process | Shared registry tracking all agents and facilitating queries |
| Frontend | Next.js application for agent creation, monitoring, and management |
| DEXI Integration | Oracle providing real-time market data and token rankings |
- Index Set Updates: Automatically swaps exited tokens for newly added tokens when the index composition changes
- Price-Based Rebalancing: Rebalances portfolio when price deviations exceed configured thresholds
- Token Loading: Deposit quote tokens to fund the agent
- Liquidation: Partial or total liquidation back to quote token
- Emergency Exit: Immediate withdrawal of all assets
- Ownership Transfer: Transfer agent control to another wallet
- Token Set Size: Number of tokens in the index (e.g., "Top 3 tokens")
- Price Threshold: Maximum deviation before rebalancing triggers
- Slippage Tolerance: Acceptable slippage for swap execution
- Rebalance Interval: How frequently to check for rebalancing needs
β οΈ Note: This project is archived and may not work with current AO infrastructure.
# Clone the repository
git clone https://github.com/your-org/token-index-agent.git
cd token-index-agent
# Install dependencies
yarn install
# Copy environment configuration
cp .env.example .env.local
# Edit .env.local with your configuration# Start development server
yarn dev
# Open http://localhost:3000# Build agent source (combines Lua modules)
yarn build-lua-agent
# Build backend source
yarn build-lua-backend# Run Lua tests
yarn testtoken-index-agent/
βββ ao/ # Lua agent and backend code
β βββ agent/ # Agent process modules
β β βββ deposits.lua # Deposit handling
β β βββ holdings.lua # Portfolio management
β β βββ life-cycle.lua # Agent lifecycle
β β βββ liquidation.lua # Liquidation logic
β β βββ rebalancing.lua # Rebalancing algorithm
β β βββ ...
β βββ backend/ # Backend process modules
β βββ permissions/ # Access control
β βββ utils/ # Shared utilities
β βββ test/ # Lua tests
β βββ process.lua # Main agent entry point
β βββ backend.lua # Main backend entry point
βββ src/ # Next.js frontend
β βββ app/ # App router pages
β βββ components/ # React components
β βββ hooks/ # Custom React hooks
β βββ utils/ # Frontend utilities
β βββ lua/ # Embedded Lua source
βββ scripts/ # Build and deploy scripts
βββ public/ # Static assets
See .env.example for all available configuration options.
| Variable | Description |
|---|---|
NEXT_PUBLIC_AGENT_BACKEND |
Backend process ID for agent registration |
NEXT_PUBLIC_CRED_ADDRESS |
Quote token (CRED) process address |
NEXT_PUBLIC_DEXI_MONITOR |
DEXI oracle contract address |
NEXT_PUBLIC_AO_MODULE |
AO module ID for process spawning |
NEXT_PUBLIC_AO_SCHEDULER |
AO scheduler address |
IMPORTANT: This software is provided "as-is" without any warranties.
- Financial Risk: Autonomous investment strategies carry inherent financial risks including potential loss of funds
- Technological Risk: Blockchain technology and DeFi protocols may have bugs, vulnerabilities, or unexpected behaviors
- Regulatory Risk: The regulatory environment for digital assets varies by jurisdiction
- No Liability: The authors are not liable for any damages arising from the use of this software
Use at your own risk. Always conduct your own due diligence before using any investment software.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built on AO - The hyper-parallel computer
- Powered by Arweave - Permanent data storage
- Market data from DEXI
- Originally developed by Autonomous Finance
β‘ Built for the Permaweb β‘
This repository is archived and preserved on Arweave for posterity