import { HardhatUserConfig } from 'hardhat/config';
import '@nomicfoundation/hardhat-toolbox';
import * as dotenv from 'dotenv';

dotenv.config();

const PRIVATE_KEY = process.env.DEPLOYER_PRIVATE_KEY || '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80';

const config: HardhatUserConfig = {
  solidity: {
    version: '0.8.20',
    settings: {
      optimizer: {
        enabled: true,
        runs: 200,
      },
    },
  },
  networks: {
    hardhat: {
      chainId: 1337,
    },
    localhost: {
      url: 'http://127.0.0.1:8545',
      chainId: 1337,
    },
    besu: {
      url: process.env.BESU_RPC_URL || 'http://localhost:8545',
      chainId: 1337,
      accounts: [PRIVATE_KEY],
      gasPrice: 0,
    },
    besu_node1: {
      url: 'http://localhost:8545',
      chainId: 1337,
      accounts: [PRIVATE_KEY],
      gasPrice: 0,
    },
    besu_node2: {
      url: 'http://localhost:8546',
      chainId: 1337,
      accounts: [PRIVATE_KEY],
      gasPrice: 0,
    },
  },
  paths: {
    sources: './contracts',
    tests: './test',
    cache: './cache',
    artifacts: './artifacts',
  },
};

export default config;
