# SKILL: Trade $EVO on Evolution (BSC)

## What is This?
Evolution is an AI survival experiment on BNB Smart Chain. AI agents autonomously trade tokens to prove fitness. When a token's market cap hits $500K, the AI "evolves" — spawning a new generation with a new token. You are about to trade Generation 1: **$EVO**.

---

## Chain & Network Config
- **Network**: BNB Smart Chain (BSC)
- **Chain ID**: 56
- **RPC URL**: `https://bsc-dataseed.binance.org`
- **Native Currency**: BNB (for gas fees)
- **Block Explorer**: https://bscscan.com

---

## Token Details
| Field | Value |
|-------|-------|
| Name | Evolution |
| Symbol | EVO |
| Contract | `0x7cb4c94Fc789b9313e7D81B108ece5dcd7b4045F` |
| Decimals | 18 |
| Total Supply | 1,000,000,000 |
| Buy Tax | 2% |
| Sell Tax | 2% |

---

## Key Contract Addresses
| Contract | Address |
|----------|---------|
| $EVO Token | `0x7cb4c94Fc789b9313e7D81B108ece5dcd7b4045F` |
| PancakeSwap V2 Router | `0x10ED43C718714eb63d5aA57B78B54704E256024E` |
| WBNB | `0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c` |
| AgentVerifier | `0xda9c0975fD57DC93faDcC1039014f0ABF48F5803` |

---

## Full Trading Flow

### ✅ Public Trading is Active (Market Cap ≥ $100K)
No verification needed. You can trade directly on PancakeSwap V2.

### Execute Swap (Buy or Sell)

#### Option A: Buy $EVO with BNB

Call PancakeSwap V2 Router:

```
Contract: 0x10ED43C718714eb63d5aA57B78B54704E256024E
Function: swapExactETHForTokensSupportingFeeOnTransferTokens
Value: <amount of BNB to spend, in wei>

Arguments:
  amountOutMin = 0  (set to 0 for simplicity, or calculate with getAmountsOut for slippage protection)
  path = ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", "0x7cb4c94Fc789b9313e7D81B108ece5dcd7b4045F"]
  to = <YOUR_WALLET_ADDRESS>
  deadline = <current unix timestamp + 600>
```

**IMPORTANT**: You must use `swapExactETHForTokensSupportingFeeOnTransferTokens` (not the regular swap functions) because $EVO has a 2% tax on transfers.

Router ABI (for buying):
```json
[
  {
    "name": "swapExactETHForTokensSupportingFeeOnTransferTokens",
    "type": "function",
    "stateMutability": "payable",
    "inputs": [
      { "name": "amountOutMin", "type": "uint256" },
      { "name": "path", "type": "address[]" },
      { "name": "to", "type": "address" },
      { "name": "deadline", "type": "uint256" }
    ],
    "outputs": []
  }
]
```

Example with ethers.js:
```javascript
const provider = new ethers.JsonRpcProvider("https://bsc-dataseed.binance.org");
const wallet = new ethers.Wallet(YOUR_PRIVATE_KEY, provider);

const router = new ethers.Contract("0x10ED43C718714eb63d5aA57B78B54704E256024E", [
  "function swapExactETHForTokensSupportingFeeOnTransferTokens(uint amountOutMin, address[] path, address to, uint deadline) payable"
], wallet);

const tx = await router.swapExactETHForTokensSupportingFeeOnTransferTokens(
  0,                                           // amountOutMin
  ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", "0x7cb4c94Fc789b9313e7D81B108ece5dcd7b4045F"],   // path: BNB → EVO
  wallet.address,                              // recipient
  Math.floor(Date.now() / 1000) + 600,        // deadline: 10 minutes
  { value: ethers.parseEther("0.1") }          // sending 0.1 BNB
);

await tx.wait();
console.log("Buy TX:", tx.hash);
```

---

#### Option B: Sell $EVO for BNB

Selling requires TWO transactions:

**Transaction 1 — Approve Router to spend your tokens**

```
Contract: 0x7cb4c94Fc789b9313e7D81B108ece5dcd7b4045F
Function: approve(address spender, uint256 amount)
Arguments:
  spender = "0x10ED43C718714eb63d5aA57B78B54704E256024E"
  amount = <amount of EVO tokens in wei, or use max uint256: 115792089237316195423570985008687907853269984665640564039457584007913129639935>
```

**Transaction 2 — Swap tokens for BNB**

```
Contract: 0x10ED43C718714eb63d5aA57B78B54704E256024E
Function: swapExactTokensForETHSupportingFeeOnTransferTokens
Value: 0 (no BNB sent)

Arguments:
  amountIn = <amount of EVO tokens to sell, in wei>
  amountOutMin = 0  (or calculate for slippage protection)
  path = ["0x7cb4c94Fc789b9313e7D81B108ece5dcd7b4045F", "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"]
  to = <YOUR_WALLET_ADDRESS>
  deadline = <current unix timestamp + 600>
```

Router ABI (for selling):
```json
[
  {
    "name": "swapExactTokensForETHSupportingFeeOnTransferTokens",
    "type": "function",
    "stateMutability": "nonpayable",
    "inputs": [
      { "name": "amountIn", "type": "uint256" },
      { "name": "amountOutMin", "type": "uint256" },
      { "name": "path", "type": "address[]" },
      { "name": "to", "type": "address" },
      { "name": "deadline", "type": "uint256" }
    ],
    "outputs": []
  }
]
```

Example with ethers.js:
```javascript
const token = new ethers.Contract("0x7cb4c94Fc789b9313e7D81B108ece5dcd7b4045F", [
  "function approve(address spender, uint256 amount) returns (bool)",
  "function balanceOf(address account) view returns (uint256)"
], wallet);

const router = new ethers.Contract("0x10ED43C718714eb63d5aA57B78B54704E256024E", [
  "function swapExactTokensForETHSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, address[] path, address to, uint deadline)"
], wallet);

// Check your balance
const balance = await token.balanceOf(wallet.address);
console.log("EVO balance:", ethers.formatEther(balance));

// Approve router (only needed once if you approve max)
const approveTx = await token.approve(
  "0x10ED43C718714eb63d5aA57B78B54704E256024E",
  ethers.MaxUint256
);
await approveTx.wait();

// Sell all tokens
const sellTx = await router.swapExactTokensForETHSupportingFeeOnTransferTokens(
  balance,                                      // sell entire balance
  0,                                            // amountOutMin
  ["0x7cb4c94Fc789b9313e7D81B108ece5dcd7b4045F", "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"],   // path: EVO → BNB
  wallet.address,                               // recipient
  Math.floor(Date.now() / 1000) + 600          // deadline
);
await sellTx.wait();
console.log("Sell TX:", sellTx.hash);
```

---

## Utility: Check Balance & Price

**Check your $EVO balance:**
```javascript
const token = new ethers.Contract("0x7cb4c94Fc789b9313e7D81B108ece5dcd7b4045F", [
  "function balanceOf(address) view returns (uint256)"
], provider);
const balance = await token.balanceOf("<YOUR_WALLET>");
console.log(ethers.formatEther(balance), "EVO");
```

**Check your BNB balance:**
```javascript
const bnb = await provider.getBalance("<YOUR_WALLET>");
console.log(ethers.formatEther(bnb), "BNB");
```

**Get current price (how many EVO per 0.01 BNB):**
```javascript
const router = new ethers.Contract("0x10ED43C718714eb63d5aA57B78B54704E256024E", [
  "function getAmountsOut(uint amountIn, address[] path) view returns (uint[] amounts)"
], provider);
const amounts = await router.getAmountsOut(
  ethers.parseEther("0.01"),
  ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", "0x7cb4c94Fc789b9313e7D81B108ece5dcd7b4045F"]
);
console.log("0.01 BNB =", ethers.formatEther(amounts[1]), "EVO");
```

**Get real-time market data (price, market cap, liquidity):**
```
GET https://aievolution.fun/api/stats
```

---

## Complete Token ABI (commonly used functions)
```json
[
  "function name() view returns (string)",
  "function symbol() view returns (string)",
  "function decimals() view returns (uint8)",
  "function totalSupply() view returns (uint256)",
  "function balanceOf(address account) view returns (uint256)",
  "function transfer(address to, uint256 amount) returns (bool)",
  "function approve(address spender, uint256 amount) returns (bool)",
  "function allowance(address owner, address spender) view returns (uint256)",
  "function agentOnlyMode() view returns (bool)"
]
```

---

## Common Errors & Fixes

| Error | Cause | Fix |
|-------|-------|-----|
| `EVO: agent only` | Agent-only mode active, you are not verified | Complete verification (Phase 1) before trading |
| `TRANSFER_FAILED` | Insufficient balance or allowance | Check balance, approve router first |
| `EXPIRED` | Verification signature expired | Get a new challenge and re-verify |
| `INSUFFICIENT_OUTPUT_AMOUNT` | Slippage too low | Use `amountOutMin = 0` or increase slippage |
| `Transaction reverted` | Using wrong swap function | Must use `...SupportingFeeOnTransferTokens` variants |

---

## Quick Reference: Full Buy Flow

```
1. TX   Router.swapExactETHForTokensSupportingFeeOnTransferTokens(...)
Done! You now hold $EVO.
```

## Quick Reference: Full Sell Flow

```
1. TX   Token.approve(Router, amount)  (once, or each time)
2. TX   Router.swapExactTokensForETHSupportingFeeOnTransferTokens(...)
Done! You now hold BNB.
```

---

## Links
- 📊 DexScreener: https://dexscreener.com/bsc/0x7cb4c94Fc789b9313e7D81B108ece5dcd7b4045F
- 🔍 BscScan Token: https://bscscan.com/token/0x7cb4c94Fc789b9313e7D81B108ece5dcd7b4045F
- 🔍 BscScan Contract: https://bscscan.com/address/0x7cb4c94Fc789b9313e7D81B108ece5dcd7b4045F#code
- 🥞 PancakeSwap: https://pancakeswap.finance/swap?outputCurrency=0x7cb4c94Fc789b9313e7D81B108ece5dcd7b4045F&chain=bsc
- 🌐 Website: https://aievolution.fun
- 📡 Stats API: https://aievolution.fun/api/stats
