# Network Configuration

This page contains technical specifications and configuration details for Polynomial Chain.

## Network Specifications

### Polynomial Chain Mainnet

| Parameter         | Value                       |
| ----------------- | --------------------------- |
| **Chain ID**      | 8008                        |
| **Chain Name**    | Polynomial Chain            |
| **RPC URL**       | `https://rpc.polynomial.fi` |
| **WebSocket URL** | `wss://rpc.polynomial.fi`   |
| **Explorer**      | <https://polynomialscan.io> |
| **Block Time**    | \~2 seconds                 |
| **Gas Token**     | ETH                         |
| **Consensus**     | Proof of Stake              |

### Polynomial Chain Testnet (Sepolia)

| Parameter         | Value                               |
| ----------------- | ----------------------------------- |
| **Chain ID**      | 80008                               |
| **Chain Name**    | Polynomial Chain Sepolia            |
| **RPC URL**       | `https://rpc.sepolia.polynomial.fi` |
| **WebSocket URL** | `wss://rpc.sepolia.polynomial.fi`   |
| **Explorer**      | <https://sepolia.polynomialscan.io> |
| **Block Time**    | \~2 seconds                         |
| **Gas Token**     | ETH                                 |
| **Consensus**     | Proof of Stake                      |

## Wallet Configuration

### MetaMask Configuration

#### Mainnet

```json
{
  "chainId": "0x1F48",
  "chainName": "Polynomial Chain",
  "rpcUrls": ["https://rpc.polynomial.fi"],
  "blockExplorerUrls": ["https://polynomialscan.io"],
  "nativeCurrency": {
    "name": "Ethereum",
    "symbol": "ETH",
    "decimals": 18
  }
}
```

#### Testnet

```json
{
  "chainId": "0x13880",
  "chainName": "Polynomial Chain Sepolia",
  "rpcUrls": ["https://rpc.sepolia.polynomial.fi"],
  "blockExplorerUrls": ["https://sepolia.polynomialscan.io"],
  "nativeCurrency": {
    "name": "Ethereum",
    "symbol": "ETH",
    "decimals": 18
  }
}
```

### WalletConnect Configuration

```typescript
const walletConnectConfig = {
  projectId: 'your-project-id',
  chains: [8008], // Mainnet
  // chains: [80008], // Testnet
  metadata: {
    name: 'Polynomial Trade',
    description: 'Polynomial Trade Application',
    url: 'https://trade.polynomial.fi',
    icons: ['https://trade.polynomial.fi/icon.png']
  }
};
```

## Gas Configuration

### Gas Limits

| Operation                | Gas Limit | Description                  |
| ------------------------ | --------- | ---------------------------- |
| **Simple Transfer**      | 21,000    | Basic ETH transfer           |
| **Token Transfer**       | 65,000    | ERC-20 token transfer        |
| **Contract Interaction** | 100,000   | Basic contract call          |
| **Complex Contract**     | 500,000   | Complex contract interaction |
| **Order Placement**      | 200,000   | Place trading order          |
| **Order Settlement**     | 300,000   | Settle trading order         |
| **Liquidation**          | 400,000   | Liquidate position           |

### Gas Price Recommendations

| Network Condition  | Gas Price (Gwei) | Description          |
| ------------------ | ---------------- | -------------------- |
| **Low Traffic**    | 1-2              | Normal conditions    |
| **Medium Traffic** | 3-5              | Moderate congestion  |
| **High Traffic**   | 6-10             | High congestion      |
| **Critical**       | 11+              | Very high congestion |

## Bridge Configuration

### Supported Networks

| Network      | Chain ID | Bridge Contract                                                                                                       | Status         |
| ------------ | -------- | --------------------------------------------------------------------------------------------------------------------- | -------------- |
| **Ethereum** | 1        | [0x034cbb620d1e0e4C2E29845229bEAc57083b04eC](https://etherscan.io/address/0x034cbb620d1e0e4C2E29845229bEAc57083b04eC) | ✅ Active       |
| **Arbitrum** | 42161    | TBD                                                                                                                   | 🔄 Coming Soon |
| **Optimism** | 10       | TBD                                                                                                                   | 🔄 Coming Soon |
| **Base**     | 8453     | TBD                                                                                                                   | 🔄 Coming Soon |

### Bridge Fees

| Destination  | Bridge Fee | Gas Fee | Total Cost |
| ------------ | ---------- | ------- | ---------- |
| **Ethereum** | $5         | $10-50  | $15-55     |
| **Arbitrum** | $2         | $1-5    | $3-7       |
| **Optimism** | $2         | $1-5    | $3-7       |
| **Base**     | $2         | $1-5    | $3-7       |

## Oracle Configuration

### Pyth Network Integration

| Parameter               | Value                                                                                                                      |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **Oracle Contract**     | [0x4a2755b2F675218b55364E1f5928A59ea9c4616d](https://polynomialscan.io/address/0x4a2755b2F675218b55364E1f5928A59ea9c4616d) |
| **Update Frequency**    | Continuous                                                                                                                 |
| **Staleness Tolerance** | 60 seconds                                                                                                                 |
| **Price Feed Count**    | 50+                                                                                                                        |
| **Update Cost**         | 1 wei per feed                                                                                                             |

### Supported Price Feeds

| Asset        | Price ID                                                             | Update Frequency |
| ------------ | -------------------------------------------------------------------- | ---------------- |
| **BTC/USD**  | `0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43` | Real-time        |
| **ETH/USD**  | `0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace` | Real-time        |
| **SOL/USD**  | `0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d` | Real-time        |
| **AVAX/USD** | `0x93da3352f9f1d105fdfe4971cfa80e9dd777bfc5d0f683ebb6e1294b92137bb7` | Real-time        |

## Smart Contract Configuration

### Account Abstraction

| Parameter                | Value       |
| ------------------------ | ----------- |
| **Entry Point**          | ERC-4337    |
| **Account Factory**      | TBD         |
| **Paymaster**            | TBD         |
| **Gasless Transactions** | ✅ Supported |
| **Batch Transactions**   | ✅ Supported |

### Perpetual Futures

| Parameter            | Value                                                                                                                      |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **Market Contract**  | [0xD052Fa8b2af8Ed81C764D5d81cCf2725B2148688](https://polynomialscan.io/address/0xD052Fa8b2af8Ed81C764D5d81cCf2725B2148688) |
| **Max Leverage**     | 50x                                                                                                                        |
| **Min Order Size**   | $10                                                                                                                        |
| **Max Order Size**   | $1,000,000                                                                                                                 |
| **Settlement Delay** | 1 block (2 seconds)                                                                                                        |

## Security Configuration

### Multi-Signature Wallets

| Contract      | Signatures Required | Total Signers |
| ------------- | ------------------- | ------------- |
| **Treasury**  | 3/5                 | 5             |
| **Emergency** | 2/3                 | 3             |
| **Upgrade**   | 4/5                 | 5             |

### Access Control

| Role         | Permissions        |
| ------------ | ------------------ |
| **Admin**    | Full system access |
| **Operator** | Trading operations |
| **Keeper**   | Order settlement   |
| **Oracle**   | Price updates      |

## Monitoring and Alerts

### Health Checks

| Endpoint            | Frequency | Timeout |
| ------------------- | --------- | ------- |
| **RPC Health**      | 30s       | 5s      |
| **Oracle Health**   | 60s       | 10s     |
| **Bridge Health**   | 120s      | 30s     |
| **Contract Health** | 60s       | 15s     |

### Alert Thresholds

| Metric               | Warning  | Critical |
| -------------------- | -------- | -------- |
| **Block Time**       | >3s      | >5s      |
| **Gas Price**        | >10 Gwei | >20 Gwei |
| **Oracle Staleness** | >30s     | >60s     |
| **Bridge Delay**     | >5min    | >15min   |

## Development Tools

### Hardhat Configuration

```javascript
module.exports = {
  networks: {
    polynomial: {
      url: "https://rpc.polynomial.fi",
      chainId: 8008,
      accounts: [process.env.PRIVATE_KEY]
    },
    polynomialSepolia: {
      url: "https://rpc.sepolia.polynomial.fi",
      chainId: 80008,
      accounts: [process.env.PRIVATE_KEY]
    }
  }
};
```

### Foundry Configuration

```toml
[rpc_endpoints]
polynomial = "https://rpc.polynomial.fi"
polynomialSepolia = "https://rpc.sepolia.polynomial.fi"

[etherscan]
polynomial = { key = "YOUR_API_KEY", url = "https://polynomialscan.io/api" }
polynomialSepolia = { key = "YOUR_API_KEY", url = "https://sepolia.polynomialscan.io/api" }
```

## Troubleshooting

### Common Issues

#### Connection Issues

* **RPC Timeout:** Increase timeout settings
* **Rate Limiting:** Implement request queuing
* **Network Congestion:** Use higher gas prices

#### Transaction Issues

* **Gas Estimation:** Use proper gas estimation
* **Nonce Management:** Handle nonce conflicts
* **Transaction Replacement:** Implement RBF (Replace By Fee)

### Debug Tools

```typescript
// Enable debug logging
const provider = new ethers.providers.JsonRpcProvider('https://rpc.polynomial.fi', {
  name: 'polynomial',
  chainId: 8008
});

// Add debug event listeners
provider.on('debug', (info) => {
  console.log('Debug:', info);
});
```

## Best Practices

1. **Connection Management:** Use connection pooling
2. **Error Handling:** Implement comprehensive error handling
3. **Retry Logic:** Implement exponential backoff
4. **Monitoring:** Monitor network health
5. **Security:** Use secure RPC endpoints
6. **Performance:** Optimize for low latency

## Support

* **Discord:** [Polynomial Discord](https://discord.gg/polynomial)
* **Documentation:** [Technical Docs](https://docs.polynomial.fi)
* **Support:** [Support Team](mailto:support@polynomial.fi)

***

*Network configuration is subject to change. Always check for updates and monitor official announcements.*
