Skip to content

Xirui-Chen/arcwise-treasury-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

36 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Arcwise Treasury AI โ€“ Autonomous USDC Rebalancing and Risk Management Agent

Intelligent USDC rebalancing and risk management agent for on-chain treasury automation on Arc Blockchain.

Python License Status Platform


๐Ÿ“š Table of Contents


๐Ÿ’ก Overview

Arcwise Treasury AI is an autonomous treasury management system built on the Arc Blockchain.
It uses AI-driven decision logic to monitor wallet balances, dynamically rebalance liquidity between main and reserve accounts, and automatically execute USDC transactions on-chain with deterministic settlement.

This project demonstrates how intelligent agents can handle decentralized treasury operations through real-time analytics, rule-based automation, and stablecoin-native financial logic.


๐Ÿ“Š Treasury Dashboard

The dashboard visualizes the evolution of balances between the Main and Reserve wallets.
Each time the agent executes, new data are appended to data/rebalance_log_compatible.csv and analyzed via the notebook notebooks/treasury_dashboard.ipynb.

Live Balance Overview

Dashboard Preview

Last updated automatically from analysis notebook outputs.

Key Metrics

Metric Description
Main Balance (USDC) Current balance of the primary operational wallet
Reserve Balance (USDC) Current balance of the reserve wallet
Total (USDC) Combined holdings of both wallets
Main Ratio Share of main balance in total holdings
3h Change Net movement of both wallets over the last 3 hours
Volatility Approx. Rolling 5-sample standard deviation of total balance

๐Ÿšจ Problem Statement

Managing liquidity across multiple blockchain accounts remains a complex process for funds, DAOs, and decentralized organizations.
Manual monitoring and fund transfers are inefficient and prone to human bias and latency.

Challenges include:

  • Balancing multiple wallets or liquidity pools in real time
  • Forecasting short-term liquidity requirements
  • Reducing idle capital and transaction costs
  • Ensuring safety, auditability, and transparency

๐Ÿš€ Solution

Arcwise Treasury AI introduces an intelligent on-chain agent that:

  1. Continuously monitors wallet balances and historical activity using Arc APIs.
  2. Applies AI-based decision logic to determine optimal fund distribution.
  3. Automatically executes USDC transfers on the Arc Testnet via deterministic smart contracts.
  4. Logs each event with full transparency for compliance and audit purposes.

By leveraging Arcโ€™s USDC-native design and sub-second deterministic finality, the system provides institutional-grade automation for digital treasury management.


โš™๏ธ Core Features

Category Description
AI Decision Engine Predict liquidity needs with time-series balance data and simple predictive rules.
Autonomous Execution Automatically transfer funds when ratio thresholds are breached.
Risk Controls Apply transaction limits, minimum reserves, and safety checks.
Transparent Dashboard Interactive Streamlit dashboard for real-time visualization.
Comprehensive Logging All actions logged in JSONL format for auditability.

๐Ÿงฉ System Architecture

+-----------------------------+
|      AI Decision Engine     |
| (Rules + Predictive Model)  |
+-------------+---------------+
              |
              v
+-----------------------------+
|   Arcwise Agent (Python)    |
|  - Web3 Integration         |
|  - Smart Contract Calls     |
|  - Event Logging            |
+-------------+---------------+
              |
              v
+-----------------------------+
|     Arc Blockchain Layer    |
|  - Arc Testnet (USDC Gas)   |
|  - Settlement Contracts     |
+-------------+---------------+
              |
              v
+-----------------------------+
|     Streamlit Dashboard     |
|  - Visualization & KPIs     |
|  - Analysis Notebook        |
+-----------------------------+

๐Ÿงฑ Architecture

Architecture


๐Ÿง  Tech Stack

Component Tools / Frameworks
Language Python 3.11
Blockchain SDK Web3.py
Smart Contracts Solidity (EVM-Compatible)
Blockchain Network Arc Testnet + USDC as native gas
AI & Analytics Scikit-learn, Pandas, NumPy
Frontend / Visualization Streamlit, Matplotlib
Database / Logging JSONL + CSV
Environment Management virtualenv + dotenv

๐Ÿ” Workflow

  1. Balance Fetching: Retrieve real-time balances from both main and reserve wallets.
  2. Decision Engine:
    • If main wallet < lower bound โ†’ transfer from reserve.
    • If main wallet > upper bound โ†’ send excess back to reserve.
  3. Execution: Signed transactions broadcast to Arc blockchain.
  4. Logging: Results stored locally for audit tracking.
  5. Dashboard Analysis: Data visualized via Jupyter Notebook and Streamlit UI.

๐Ÿ“ฆ Deliverables

โœ… Fully working on Arc Testnet

โœ… AI logic + on-chain execution pipeline

โœ… Streamlit monitoring dashboard

โœ… Analysis notebook with balance visualizations

โœ… Comprehensive documentation and modular structure


๐Ÿฆ Use Cases

  • Quantitative Funds: Continuous intra-day portfolio rebalancing
  • DAO Treasuries: Self-governing liquidity agents
  • DeFi Vaults: Autonomous stablecoin management
  • Enterprise Treasury: Stablecoin-based working capital allocation

๐Ÿ”ฎ Future Enhancements

  • Reinforcement Learning for adaptive liquidity management
  • Multi-asset support (EURC, USYC, and other stablecoins)
  • NLP-driven command interface (โ€œRebalance reserve wallet to 40%โ€)
  • Integration with Circle APIs for off-chain synchronization

๐Ÿ“ˆ Summary

Arcwise Treasury AI merges AI automation with stablecoin-native blockchain infrastructure. It illustrates a real-world application of data science, quantitative strategy, and on-chain execution, delivering a scalable and transparent treasury automation framework.


๐Ÿงฐ Quick Start (Development)

# Clone the repository
git clone https://github.com/yourusername/arcwise-treasury-ai.git
cd arcwise-treasury-ai

# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Create .env file
echo "ARC_RPC_URL=https://rpc.testnet.arc.network" >> .env
echo "PRIVATE_KEY_TEST=your_private_key" >> .env
echo "ACCOUNT_ADDRESS=your_wallet_address" >> .env
echo "RESERVE_ADDRESS=your_reserve_wallet_address" >> .env

# Run the treasury agent
python -m agent.main

# Generate dashboard visualization
jupyter nbconvert --to notebook --execute notebooks/treasury_dashboard.ipynb --output notebooks/treasury_dashboard.ipynb

๐Ÿงญ Deployment Summary

Contract Address (Arc Testnet)
0x5b75e285eacafae2a260ed2387ec4440ac7fde76
Deployed via Arc Testnet Sandbox

Explorer Example Transaction
0x010724d591fba63de7a0e09968644147b839bc5923e5d2ce142dddb8828ecb83
Rebalance operation triggered by AI agent

AI Agent Logs:
The agent autonomously triggered a rebalance when the main wallet ratio exceeded 65%.
Example decision output


๐Ÿช™ Credits

Developed by Xirui Chen Data Science & FinTech Enthusiast | Quantitative Research | Blockchain AI

Project originally inspired by the โ€œAI Agents on Arc with USDCโ€ Hackathon, now evolved into a production-ready autonomous treasury analytics framework.

About

๐Ÿง  Arcwise Treasury AI โ€“ Intelligent USDC rebalancing and risk management agent for on-chain treasury automation on Arc.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors