# Quick Start Guide: Reserve Backing + DODO PMM Integration

**Date**: 2025-01-12  
**Purpose**: Quick reference for implementing reserve backing and DODO PMM integration

---

## Quick Reference

### 1. Deploy Reserve Vault (Ethereum Mainnet)

```bash
# Set environment
export ETH_MAINNET_RPC_URL=https://...
export PRIVATE_KEY=0x...
export COMPLIANT_USDT_ADDRESS=0x93E66202A11B1772E55407B32B44e5Cd8eda7f22
export COMPLIANT_USDC_ADDRESS=0xf22258f57794CC8E06237084b353Ab30fFfa640b

# Deploy
forge script script/reserve/DeployStablecoinReserveVault.s.sol:DeployStablecoinReserveVault \
  --rpc-url $ETH_MAINNET_RPC_URL \
  --broadcast \
  --legacy \
  --gas-price 30000000000 \
  --via-ir \
  -vv

# Save address
export STABLECOIN_RESERVE_VAULT_ADDRESS=<deployed_address>
```

### 2. Deploy DODO Integration (Chain 138 or Mainnet)

```bash
# Set environment
export RPC_URL=http://192.168.11.250:8545  # Chain 138
export DODO_VENDING_MACHINE_ADDRESS=0x...  # Check DODO docs
export COMPLIANT_USDT_ADDRESS=0x93E66202A11B1772E55407B32B44e5Cd8eda7f22
export COMPLIANT_USDC_ADDRESS=0xf22258f57794CC8E06237084b353Ab30fFfa640b
# Chain 138 local quote-side mirror stables
export OFFICIAL_USDT_ADDRESS=0x004b63A7B5b0E06f6bB6adb4a5F9f590BF3182D1
export OFFICIAL_USDC_ADDRESS=0x71D6687F38b93CCad569Fa6352c876eea967201b

# Deploy
forge script script/dex/DeployDODOPMMIntegration.s.sol:DeployDODOPMMIntegration \
  --rpc-url $RPC_URL \
  --broadcast \
  --legacy \
  --gas-price 20000000000 \
  --via-ir \
  -vv

# Save address
export DODO_PMM_INTEGRATION_ADDRESS=<deployed_address>
```

### 3. Create DODO Pools

```bash
# Use setup script
./scripts/setup-dodo-pools.sh

# Or manually
cast send $DODO_PMM_INTEGRATION_ADDRESS \
  "createCUSDTUSDTPool(uint256,uint256,uint256,bool)" \
  3 \
  1000000000000000000 \
  500000000000000000 \
  true \
  --rpc-url $RPC_URL \
  --private-key $PRIVATE_KEY \
  --legacy
```

### 4. Deposit to Reserve Vault

```bash
# Approve USDT
cast send 0xdAC17F958D2ee523a2206206994597C13D831ec7 \
  "approve(address,uint256)" \
  $STABLECOIN_RESERVE_VAULT_ADDRESS \
  1000000000000 \
  --rpc-url $ETH_MAINNET_RPC_URL \
  --private-key $PRIVATE_KEY \
  --legacy

# Deposit
cast send $STABLECOIN_RESERVE_VAULT_ADDRESS \
  "depositUSDT(uint256)" \
  1000000000000 \
  --rpc-url $ETH_MAINNET_RPC_URL \
  --private-key $PRIVATE_KEY \
  --legacy
```

---

## Key Commands

### Check Reserve Status

```bash
# Reserve balance
cast call $STABLECOIN_RESERVE_VAULT_ADDRESS "usdtReserveBalance()" --rpc-url $ETH_MAINNET_RPC_URL

# Backing ratio
cast call $STABLECOIN_RESERVE_VAULT_ADDRESS \
  "getBackingRatio(address)" \
  $COMPLIANT_USDT_ADDRESS \
  --rpc-url $ETH_MAINNET_RPC_URL
```

### Check Pool Status

```bash
# Pool address
cast call $DODO_PMM_INTEGRATION_ADDRESS \
  "pools(address,address)" \
  $COMPLIANT_USDT_ADDRESS \
  $OFFICIAL_USDT_ADDRESS \
  --rpc-url $RPC_URL

# Pool price
cast call $DODO_PMM_INTEGRATION_ADDRESS \
  "getPoolPrice(address)" \
  $POOL_ADDRESS \
  --rpc-url $RPC_URL
```

---

## File Locations

- **Reserve Vault Contract**: `contracts/reserve/StablecoinReserveVault.sol`
- **DODO Integration Contract**: `contracts/dex/DODOPMMIntegration.sol`
- **Deployment Scripts**: `script/reserve/DeployStablecoinReserveVault.s.sol`, `script/dex/DeployDODOPMMIntegration.s.sol`
- **Setup Scripts**: `scripts/setup-reserve-vault.sh`, `scripts/setup-dodo-pools.sh`
- **Documentation**: `docs/integration/`

---

## Next Steps

1. Review detailed documentation
2. Deploy contracts
3. Configure pools
4. Seed liquidity
5. Enable trading

See `COMPLETE_INTEGRATION_GUIDE.md` for detailed instructions.
