# Asetta MCP - Multi-chain RWA Tokenization Platform

Model Context Protocol (MCP) server for Asetta Protocol with USDC support and new smart contract architecture.

## 🚀 New Features

### USDC Integration
- **Mock USDC Support**: All networks include MockUSDC for testing RWA purchases
- **USDC Balance Tracking**: Wallet info now shows both native tokens and USDC
- **USDC Minting**: Easy minting of test USDC for RWA token purchases
- **USDC Shortcuts**: Quick USDC balance checks and operations

### New RWA Workflow
The new smart contract architecture introduces a multi-step RWA creation process:

1. **Create RWA Token** (`asetta_create_rwa_token`) - Deploy base token ✅
2. **Configure CCIP** (`asetta_configure_ccip`) - Setup cross-chain transfers ✅
3. **Mark CCIP Ready** (`asetta_mark_ccip_configured`) - Signal CCIP completion ✅
4. **Register Sales** (`asetta_register_primary_sales`) - Setup USDC pricing ✅
5. **Activate Sales** (`asetta_activate_primary_sales`) - Go live for purchases ✅

## 📋 Supported Networks

- **Avalanche Fuji Testnet** (avalancheFuji) ✅ Fully deployed
- **Ethereum Sepolia Testnet** (ethereumSepolia) ✅ Fully deployed  
- **Arbitrum Sepolia Testnet** (arbitrumSepolia) ✅ Fully deployed

## 🔧 Smart Contracts

### Contract Addresses

**Avalanche Fuji:**
```
MockUSDC: 0x5067e9a9154A2EA674DEf639de5e98F238824039
RWAManager: 0xD55ADE8667a99a6d89681f00E3e155A7f945CB7a
TokenFactory: 0xB82FBa76846D1aCC3e8A508deCDA74a3d191118e
PrimaryDistribution: 0x8E426864826bC3808f6b2A12aE606a14B52903cA
RFQ: 0x307992307C89216b1079C7c5Cbc4F51005b1472D
```

**Ethereum Sepolia:**
```
MockUSDC: 0xf2260B00250c772CB64606dBb88d9544F709308C
RWAManager: 0x61ad3Fe6B44Bfbbcec39c9FaD566538c894b6471
TokenFactory: 0x576430Ecadbd9729B32a4cA9Fed9F38331273924
PrimaryDistribution: 0x553588e084604a2677e10E46ea0a8A8e9D859146
RFQ: 0x42209A0A2a3D80Ad48B7D25fC6a61ad355901484
```

**Arbitrum Sepolia:**
```
MockUSDC: 0x16EE94e3C07B24EbA6067eb9394BA70178aAc4c0
RWAManager: 0x553588e084604a2677e10E46ea0a8A8e9D859146
TokenFactory: 0xFa15adECD1CC94bd17cf48DD3b41F066FE2812a7
PrimaryDistribution: 0x65e38111d8e2561aDC0E2EA1eeA856E6a43dC892
RFQ: 0x61ad3Fe6B44Bfbbcec39c9FaD566538c894b6471
```

## 🛠️ Available Tools

### Wallet & Balance Management
- `asetta_get_wallet_info` - Get wallet address, native balance, network info
- `asetta_get_account_balances` - Get native + USDC balances
- `asetta_get_transaction_history` - View recent transactions

### USDC Operations
- `asetta_get_usdc_balance` - Quick USDC balance check (shortcut)
- `asetta_mint_usdc` - Mint mock USDC for testing (any amount)

### Token Operations  
- `asetta_send_native_ip` - Send native tokens (AVAX/ETH)
- `asetta_send_token` - Send any ERC-20 tokens
- `asetta_approve_token` - Approve token spending
- `asetta_check_allowance` - Check token allowances
- `asetta_get_token_info` - Get comprehensive token details

### RWA Creation Workflow
- `asetta_create_rwa_token` - **Step 1**: Create RWA token ✅ Ready
- `asetta_configure_ccip` - **Step 2**: Configure cross-chain ✅ Instructions Available
- `asetta_mark_ccip_configured` - **Step 3**: Mark CCIP ready ✅ Ready  
- `asetta_register_primary_sales` - **Step 4**: Setup USDC pricing ✅ Ready
- `asetta_activate_primary_sales` - **Step 5**: Go live ✅ Ready

### Project Management
- `asetta_get_rwa_project` - Get project details
- `asetta_update_project_status` - Update project status

## 🚀 Quick Start

### 1. Basic Setup
```bash
# Default network (Avalanche Fuji)
node dist/index.js --agent_mode=tokenization --wallet_private_key=YOUR_KEY

# Specific network
node dist/index.js --agent_mode=tokenization --wallet_private_key=YOUR_KEY --network=ethereumSepolia
```

### 2. Check Balances (includes USDC)
```json
{
  "tool": "asetta_get_account_balances",
  "parameters": {
    "network": "avalancheFuji"
  }
}
```

### 3. Mint Test USDC
```json
{
  "tool": "asetta_mint_usdc", 
  "parameters": {
    "amount": 5000,
    "network": "avalancheFuji"
  }
}
```

### 4. Create RWA Token
```json
{
  "tool": "asetta_create_rwa_token",
  "parameters": {
    "name": "Tokyo Prime Office Tower",
    "symbol": "TPOT",
    "assetType": "real-estate",
    "description": "Premium office building in Shibuya district",
    "totalValue": "25000000",
    "url": "https://example.com/docs",
    "network": "avalancheFuji"
  }
}
```

## 🔗 CCIP Cross-Chain Workflow

The new architecture supports Chainlink CCIP for cross-chain token transfers:

1. **Deploy Token**: Use `asetta_create_rwa_token` on each desired chain
2. **Configure CCIP**: Set up burn/mint permissions and chain links
3. **Mark Ready**: Signal that CCIP configuration is complete  
4. **Register Sales**: Set USDC pricing and purchase limits
5. **Activate**: Make tokens available for public purchase

Cross-chain transfers will use a **burn and mint** approach:
- Burn tokens on source chain
- Mint equivalent tokens on destination chain  
- Secured by Chainlink's decentralized oracle network

## 💰 USDC Purchase Flow

Once RWA tokens are activated for sales:

1. **User Flow**:
   - User approves USDC spending
   - User purchases tokens with USDC
   - USDC goes to project treasury
   - RWA tokens transferred to user

2. **Pricing**: Set in USDC per token (e.g., $1.50 per token)
3. **Limits**: Min/max purchase amounts in USDC
4. **Cross-chain**: Users can transfer tokens between supported chains

## 🔧 Development

```bash
npm install
npm run build
npm start
```

## 📞 Support

For CCIP configuration assistance or questions about the new architecture, contact the development team.
