Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
1912bfd
Merge pull request #1 from foundryUp/ayush
singhyash05 Feb 2, 2025
eb03d24
changes
singhyash05 Feb 2, 2025
10d40e8
intent engine : trading with quant(ai) done
singhyash05 Feb 2, 2025
3d778b5
proxy initialized
arunabha003 Feb 2, 2025
0d46ee9
changes
arunabha003 Feb 2, 2025
4e2108f
Merge pull request #3 from foundryUp/proxies
arunabha003 Feb 2, 2025
e2aa928
formatted and without proxy
singhyash05 Feb 2, 2025
b52b0fd
workflow test
arunabha003 Feb 2, 2025
e97fdbe
workflow check
arunabha003 Feb 2, 2025
882e896
workflow check
arunabha003 Feb 2, 2025
e3e06b6
workflow check
arunabha003 Feb 2, 2025
eb35a84
changes
arunabha003 Feb 2, 2025
f75bade
changes
arunabha003 Feb 2, 2025
2c89513
server added
arunabha003 Feb 2, 2025
5a765ff
algos added
arunabha003 Mar 20, 2025
bb54299
decisions added
arunabha003 Mar 20, 2025
fab80c5
updates
arunabha003 Mar 20, 2025
e3f418f
subgraphs added
arunabha003 Mar 23, 2025
1e55dc2
Buy/Sell IntentEngineCore
singhyash05 Mar 29, 2025
3bae9e8
finally working
singhyash05 Mar 29, 2025
e68cd73
Stratos
singhyash05 Mar 29, 2025
21abf17
see RSI
shorya27 Mar 29, 2025
08f6c0b
changes shorya
singhyash05 Mar 30, 2025
39ef524
lol
shorya27 Mar 30, 2025
6e3cb65
changes
singhyash05 Mar 30, 2025
e2bc730
Merge branch 'main' of github.com:foundryUp/AI-Quant-Trader
singhyash05 Mar 30, 2025
cc5178b
changes
singhyash05 Mar 30, 2025
b729b89
lol
shorya27 Mar 30, 2025
81d280b
lol
shorya27 Mar 30, 2025
7ddd76f
changes
singhyash05 Mar 30, 2025
d94550b
minor changes
singhyash05 Mar 30, 2025
5f4963a
yeasss
singhyash05 Mar 30, 2025
edf6762
Updated Readme TODO
singhyash05 Mar 30, 2025
96785f1
changed frontend for api call from flask (not tested flask yet)
singhyash05 Mar 30, 2025
0daf1b1
api name changes and added
singhyash05 Mar 30, 2025
11fc3ce
intent engine working yash contract before shorya core.sol
singhyash05 Apr 5, 2025
6ca79f6
intent engine core shorya gas efficient claude 3.7
singhyash05 Apr 5, 2025
f1d59b4
back to basics!
singhyash05 Apr 5, 2025
5fa93ad
contracts and structure folder defined and compiled
singhyash05 Apr 6, 2025
d28d5bc
do
singhyash05 Apr 6, 2025
ca09746
lib added
singhyash05 Apr 6, 2025
fcf8c13
fixed added lib n all now working
singhyash05 Apr 6, 2025
c30f328
changes
singhyash05 Apr 6, 2025
b3e3a28
aave v3 core added intent engine
singhyash05 Apr 6, 2025
24e893e
changes
singhyash05 Apr 6, 2025
dcb1579
fucking approval functions!!!
singhyash05 Apr 6, 2025
da5d9bb
changes
singhyash05 Apr 6, 2025
fb651d3
web d integration done problem with defi contract
singhyash05 Apr 6, 2025
d1ce158
working deposit
singhyash05 Apr 6, 2025
ac9adcf
Update README.md
arunabha003 Apr 28, 2025
6daab4c
Update README.md
arunabha003 Apr 28, 2025
4a5bf0a
feat : add send swap ie
arunabha003 Jun 2, 2025
d50ea6b
feat : defi assistant added
arunabha003 Jun 3, 2025
4129a9c
defi assistant added
arunabha003 Jun 3, 2025
9ea2c20
feat : Trading assistant flow added
arunabha003 Jun 3, 2025
9711a12
chore : deployment setup
arunabha003 Jun 4, 2025
bb36236
chore : add new server files for deployment
arunabha003 Jun 4, 2025
f3cb10a
fix : deployment link updated
arunabha003 Jun 4, 2025
e0c73c9
fix: fix deployment issues
arunabha003 Jun 4, 2025
3191cb7
Fix CORS configuration and Python backend URL environment variable fo…
arunabha003 Jun 4, 2025
05d3c79
fix : changes for production
arunabha003 Jun 4, 2025
2a31d5c
chore : anvil deployment setup
arunabha003 Jun 4, 2025
de7a2ae
fix : make chainid 1
arunabha003 Jun 4, 2025
347dea8
fix : chainID fix
arunabha003 Jun 4, 2025
5f64298
fix : fix chainId
arunabha003 Jun 5, 2025
3147f65
fix
arunabha003 Jun 5, 2025
6b02c65
fix
arunabha003 Jun 5, 2025
e05c238
fix : chaiId issue fixed
arunabha003 Jun 5, 2025
3210a4f
chore : dd new abis
arunabha003 Jun 5, 2025
bdeec8a
fix : deployment fixes
arunabha003 Jun 5, 2025
c286547
fix : fix contract address
arunabha003 Jun 5, 2025
092a89e
fix : change contract address
arunabha003 Jun 5, 2025
c4741f3
fix : contract address fixed
arunabha003 Jun 5, 2025
8332f67
chore : cleanup
arunabha003 Jun 5, 2025
2813b20
fix : abi fix
arunabha003 Jun 5, 2025
81d74d5
Update README.md
arunabha003 Jun 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
33 changes: 33 additions & 0 deletions .github/workflows/build-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Vercel Production Deployment

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

on:
push:
branches:
- main

jobs:
Deploy-Production:
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3

- name: Install Vercel CLI
run: npm install --global vercel

- name: Pull Vercel Environment Information
# Retrieves Vercel environment variables
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}

- name: Build Project Artifacts
# Builds the project locally, creating .vercel/output
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts
# Deploys the prebuilt output
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
out
broadcast
cache
.env
.DS_Store
__init__.py
__pycache__
myenv
venv
node_modules
cache
.vscode
.wake
cache
.env.local
.env.production
out
15 changes: 15 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/chainlink-local"]
path = lib/chainlink-local
url = https://github.com/smartcontractkit/chainlink-local
[submodule "contracts/lib/forge-std"]
path = contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "contracts/lib/openzeppelin-contracts"]
path = contracts/lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
23 changes: 23 additions & 0 deletions Dockerfile.anvil
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Use the official Foundry image
FROM ghcr.io/foundry-rs/foundry:latest

# Set environment variables for Anvil
ENV ANVIL_IP_ADDR=0.0.0.0
ENV FOUNDRY_DISABLE_NIGHTLY_WARNING=true

# Create app directory
WORKDIR /app

# Copy configuration files if any
COPY . .

# Expose the default Anvil port
EXPOSE 8545

# Health check (using a simple TCP check instead of curl)
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD timeout 5s bash -c 'echo > /dev/tcp/localhost/8545' || exit 1

# Use ENTRYPOINT to ensure the full command executes with chain ID 1
ENTRYPOINT ["anvil", "--fork-url", "https://eth-mainnet.g.alchemy.com/v2/KywLaq2zlVzePOhip0BY3U8ztfHkYDmo", "--chain-id", "1"]

284 changes: 280 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,285 @@
Intent Engine for Aave and Compound
# 🚀 Stratos

An advanced AI-powered cryptocurrency trading platform featuring three specialized assistants for seamless blockchain interactions. Built with React, Node.js, Python, and Solidity smart contracts.

**🌐 Live Demo**: [https://foundryup-frontend.vercel.app/](https://foundryup-frontend.vercel.app/)

---

## 🎯 Overview

AI Quant Trader is a comprehensive DeFi platform that combines artificial intelligence with quantitative trading strategies. Users can interact with blockchain protocols through natural language commands, execute sophisticated trading algorithms, and manage DeFi positions—all through an intuitive chat interface.

---

## ✨ Features

### 🤖 Three Specialized AI Assistants

#### 1. **General Assistant**
**Send & Swap Made Simple**
- 💸 **Send Tokens**: Transfer ETH and ERC-20 tokens to any address
- 🔄 **Token Swaps**: Swap between different cryptocurrencies via Uniswap integration
- 🎯 **Natural Language**: Use commands like "send 1 ETH to 0x..." or "swap 100 USDC for WETH"

#### 2. **DeFi Assistant**
**Aave Protocol Integration**
- 🏦 **Deposit**: Earn yield by depositing assets into Aave lending pools
- 💰 **Borrow**: Take loans against your collateral
- 📤 **Withdraw**: Remove your deposits from lending pools
- 💳 **Repay**: Pay back borrowed amounts
- 📊 **Commands**: Simple chat commands like "deposit 1000 USDC" or "borrow 0.5 WETH"

#### 3. **Trading Assistant**
**Advanced Quantitative Trading Algorithms**

| Algorithm | Risk Level | Term | Strategy |
|-----------|------------|------|----------|
| **RSI** | High | Short | Relative Strength Index momentum trading |
| **MACD** | High | Long | Moving Average Convergence Divergence |
| **Moving Average** | Low | Short | MA crossover signals |
| **DCA** | Low | Long | Dollar Cost Averaging |

**Features:**
- 📈 **Real-time Signals**: Live trading signals from Python-based algorithms
- ⚡ **Auto-execution**: One-click trade execution with slippage protection
- 🛡️ **Risk Management**: Configurable risk levels and position sizing
- 📊 **Portfolio Tracking**: Real-time balance and performance monitoring

---

## 🏗️ Architecture

```mermaid
graph TD
A[React Frontend] --> B[Node.js Backend]
B --> C[Python Trading Algorithms]
A --> D[Smart Contracts]
D --> E[Anvil Fork]
C --> F[Market Data APIs]

subgraph "Smart Contracts"
D1[TradingEngine]
D2[AaveV3Interactor]
D3[SimpleIE]
end

subgraph "Python Algorithms"
C1[RSI Strategy]
C2[MACD Strategy]
C3[MA Strategy]
C4[DCA Strategy]
end
```

---

## 🚀 Getting Started

### Prerequisites

- **Node.js** (v16 or higher)
- **Python** (v3.8 or higher)
- **Foundry** (for smart contract development)
- **MetaMask** or compatible Web3 wallet

### Local Development Setup

#### 1. Clone the Repository
```bash
git clone https://github.com/your-username/AI-Quant-Trader.git
cd AI-Quant-Trader
```

#### 2. Install Dependencies

**Frontend:**
```bash
cd frontend
npm install
```

**Backend:**
```bash
cd backend
npm install
```

**Python Environment:**
```bash
cd backend/Python
python -m venv myenv
source myenv/bin/activate # On Windows: myenv\Scripts\activate
pip install -r requirements.txt
```

#### 3. Smart Contract Setup

**Install Foundry:**
```bash
curl -L https://foundry.paradigm.xyz | bash
foundryup
```

**Compile Contracts:**
```bash
forge build
```

#### 4. Start Local Anvil Chain
```bash
anvil --fork-url https://eth-mainnet.g.alchemy.com/v2/YOUR_ALCHEMY_KEY
```

#### 5. Deploy Contracts
```bash
forge script script/DeployTradeIntent.sol:DeployTradeIntent --rpc-url http://127.0.0.1:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --broadcast
forge script script/DeployAll.sol --rpc-url http://127.0.0.1:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --broadcast
```

#### 6. Start Development Servers

**Python Trading Servers:**
```bash
anvil --fork-url https://eth-mainnet.g.alchemy.com/v2/KywLaq2zlVzePOhip0BY3U8ztfHkYDmo
```
cd backend/Python
python main.py # Starts servers on ports 5049-5052
```

**Node.js Backend:**
```bash
cd backend
npm start # Starts on port 3001
```

**React Frontend:**
```bash
cd frontend
npm start # Starts on port 3000
```

#### 7. Configure MetaMask
- Add local network: RPC URL `http://127.0.0.1:8545`, Chain ID `31337`
- Import test account with private key: `0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80`

---

## 🌐 Production Deployment

### Live Application
- **Frontend**: [https://foundryup-frontend.vercel.app/](https://foundryup-frontend.vercel.app/)
- **Anvil Instance**: [https://anvil-mainnet-fork.onrender.com](https://anvil-mainnet-fork.onrender.com)
- **Backend Servers**: Deployed on Render

### Important Notes
⚠️ **Server Limitations**: Backend servers may go down after 15 minutes of inactivity due to Render's free tier limitations. If contracts become unresponsive, they may need to be redeployed. In that case prefer building on local for testing.


---

## 🛠️ Tech Stack

### Frontend
- **React** - User interface
- **Web3.js** - Blockchain interactions
- **Tailwind CSS** - Styling
- **Spline** - 3D animations

### Backend
- **Node.js** - API server
- **Express** - Web framework
- **Python** - Trading algorithms
- **NumPy/Pandas** - Data analysis

### Blockchain
- **Solidity** - Smart contracts
- **Foundry** - Development framework
- **Anvil** - Local/Remote blockchain
- **Uniswap V2** - DEX integration
- **Aave V3** - Lending protocol

---

## 📊 Smart Contracts

| Contract | Purpose | Features |
|----------|---------|----------|
| **TradingEngine** | Automated trading | USDC-based trading, slippage protection, multi-token support |
| **AaveV3Interactor** | DeFi operations | Deposit, withdraw, borrow, repay on Aave |
| **SimpleIE** | General operations | Token transfers, swaps, intent execution |

---

## 🔍 Usage Examples

### General Assistant
```
"Send 1 ETH to 0x742d35Cc6635C0532925a3b8D31Fc3c06f6e6d1b"
"Swap 100 USDC for WETH"
```

### DeFi Assistant
```
"Deposit 1000 USDC"
"Borrow 0.5 WETH"
"Withdraw all DAI"
"Repay 100 USDC"
```

### Trading Assistant
1. Select risk level (Low/High)
2. Choose term (Short/Long)
3. Generate signals
4. Execute trades with one click

---

## 🧪 Testing

### Contract Verification
Use the built-in "🔍 Verify Contracts" button in the UI to test:
- Contract deployment status
- Function accessibility
- Network connectivity

### Manual Testing
1. Connect MetaMask to the appropriate network
2. Ensure you have test tokens (ETH, USDC, etc.)
3. Test each assistant's functionality
4. Monitor transaction confirmations

---

## 🤝 Contributing

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

---

## 📜 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

## 🆘 Support

- **Issues**: [GitHub Issues](https://github.com/your-username/AI-Quant-Trader/issues)
- **Documentation**: Check the `/docs` folder for detailed guides
- **Community**: Join our Discord for real-time support

---

## ⚡ Quick Start (TL;DR)

1. **Try Live Demo**: [https://foundryup-frontend.vercel.app/](https://foundryup-frontend.vercel.app/)
2. **Connect Wallet**: Use MetaMask with the remote Anvil network
3. **Test Features**: Use "Verify Contracts" button, then try each assistant
4. **Local Setup**: Follow the detailed setup guide above for development

---

**Built with ❤️ by the AI Quant Trader Team**

Binary file renamed lib/.DS_Store → backend/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions backend/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GROQ_API_KEY="abcd"
Loading