# Integration Tests

This directory contains comprehensive integration tests for the bridge system.

## Test Suites

### BridgeReserveCoordinatorTest
Tests the integration between bridge and reserve system:
- Reserve verification
- Peg status checking
- Rebalancing triggers

### StablecoinPegManagerTest
Tests USD and ETH peg maintenance:
- USD stablecoin pegging (USDT, USDC)
- WETH pegging to ETH
- Deviation calculation
- Threshold configuration

### CommodityPegManagerTest
Tests commodity pegging via XAU:
- XAU as base anchor
- Commodity registration
- XAU triangulation
- Price calculation

### ISOCurrencyManagerTest
Tests ISO-4217 currency support:
- Currency registration
- XAU triangulation conversion
- Exchange rate calculation
- Batch registration

### EnhancedSwapRouterTest
Tests multi-protocol routing:
- Provider enable/disable
- Routing configuration
- Quote aggregation
- Balancer pool configuration

### FullIntegrationTest
End-to-end integration test:
- Complete bridge flow with reserve verification
- Peg management integration
- ISO currency conversion
- Enhanced routing

### LiquidityEngineIntegrationTest
Tests liquidity engine features:
- Routing configuration by size
- Provider toggling
- Pool ID configuration
- Quote aggregation

### PegManagementIntegrationTest
Tests comprehensive peg management:
- Multiple stablecoin pegs
- Commodity pegs
- ISO currency triangulation
- Threshold configuration

## Running Tests

```bash
# Run all integration tests
forge test --match-path "test/bridge/trustless/integration/*" --via-ir

# Run specific test suite
forge test --match-contract "FullIntegrationTest" --via-ir

# Run with verbose output
forge test --match-path "test/bridge/trustless/integration/*" --via-ir -vv
```

## Test Coverage

- ✅ Bridge → Reserve integration
- ✅ Peg maintenance mechanisms
- ✅ Multi-protocol routing
- ✅ ISO-4217 currency support
- ✅ Commodity pegging
- ✅ Decision logic
- ✅ End-to-end flows

