version: "3.4"
services:
  l1_chain:
    image: ethereumoptimism/hardhat-node:${DOCKER_TAG:-prerelease-0.5.0-rc-7-ee217ce}
    build:
      context: ./docker/hardhat
      dockerfile: Dockerfile
    ports:
        # expose the service to the host for integration testing
      - ${L1CHAIN_HTTP_PORT:-9545}:8545

  deployer:
    depends_on:
      - l1_chain
    image: ethereumoptimism/deployer:${DOCKER_TAG:-prerelease-0.5.0-rc-7-ee217ce}
    entrypoint: ./deployer.sh
    environment:
        FRAUD_PROOF_WINDOW_SECONDS: 0
        L1_NODE_WEB3_URL: http://l1_chain:8545
        # these keys are hardhat's first 3 accounts, DO NOT use in production
        DEPLOYER_PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
        SEQUENCER_PRIVATE_KEY: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
        PROPOSER_PRIVATE_KEY: "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"
        GAS_PRICE_ORACLE_OWNER: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
        # setting the whitelist owner to address(0) disables the whitelist
        WHITELIST_OWNER: "0x0000000000000000000000000000000000000000"
        L1_FEE_WALLET_ADDRESS: "0x391716d440c151c42cdf1c95c1d83a5427bca52c"
        L2_CHAIN_ID: 420
        BLOCK_SIGNER_ADDRESS: "0x00000398232E2064F896018496b4b44b3D62751F"
        L2_BLOCK_GAS_LIMIT: 15000000
        GAS_PRICE_ORACLE_OVERHEAD: "2750"
        GAS_PRICE_ORACLE_SCALAR: "1500000"
        GAS_PRICE_ORACLE_L1_BASE_FEE: "1"
        GAS_PRICE_ORACLE_GAS_PRICE: "1"
        GAS_PRICE_ORACLE_DECIMALS: "6"
        # skip compilation when run in docker-compose, since the contracts
        # were already compiled in the builder step
        NO_COMPILE: 1
    ports:
        # expose the service to the host for getting the contract addrs
      - ${DEPLOYER_PORT:-8080}:8081

  dtl:
    depends_on:
      - l1_chain
      - deployer
      - l2geth
    image: ethereumoptimism/data-transport-layer:${DOCKER_TAG:-prerelease-0.5.0-rc-7-ee217ce}
    entrypoint: ./dtl.sh
    env_file:
      -  ./envs/dtl.env
    environment:
        # used for setting the address manager address
        URL: http://deployer:8081/addresses.json
        # connect to the 2 layers
        DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT: http://l1_chain:8545
        DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT: http://l2geth:8545
        DATA_TRANSPORT_LAYER__SYNC_FROM_L2: 'true'
        DATA_TRANSPORT_LAYER__L2_CHAIN_ID: 420
    ports:
      - ${DTL_PORT:-7878}:7878

  l2geth:
    depends_on:
      - l1_chain
      - deployer
    image: ethereumoptimism/l2geth:${DOCKER_TAG:-prerelease-0.5.0-rc-7-ee217ce}
    entrypoint: sh ./geth.sh
    env_file:
      - ./envs/geth.env
    environment:
        ETH1_HTTP: http://l1_chain:8545
        ROLLUP_TIMESTAMP_REFRESH: 5s
        ROLLUP_STATE_DUMP_PATH: http://deployer:8081/state-dump.latest.json
        # connecting to the DTL
        ROLLUP_CLIENT_HTTP: http://dtl:7878
        ETH1_CTC_DEPLOYMENT_HEIGHT: 8
        RETRIES: 60
    ports:
      - ${L2GETH_HTTP_PORT:-8545}:8545
      - ${L2GETH_WS_PORT:-8546}:8546

  batch_submitter:
    depends_on:
      - l1_chain
      - deployer
      - l2geth
    image: ethereumoptimism/batch-submitter:${DOCKER_TAG:-prerelease-0.5.0-rc-7-ee217ce}
    entrypoint: ./batches.sh
    env_file:
      - ./envs/batches.env
    environment:
        L1_NODE_WEB3_URL: http://l1_chain:8545
        L2_NODE_WEB3_URL: http://l2geth:8545
        URL: http://deployer:8081/addresses.json
        SEQUENCER_PRIVATE_KEY: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
        PROPOSER_PRIVATE_KEY: "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"

  verifier:
    depends_on:
      - l1_chain
      - deployer
      - dtl
    image: ethereumoptimism/l2geth:${DOCKER_TAG:-prerelease-0.5.0-rc-7-ee217ce}
    deploy:
      replicas: 0
    entrypoint: sh ./geth.sh
    env_file:
      - ./envs/geth.env
    environment:
        ETH1_HTTP: http://l1_chain:8545
        ROLLUP_STATE_DUMP_PATH: http://deployer:8081/state-dump.latest.json
        ROLLUP_CLIENT_HTTP: http://dtl:7878
        ROLLUP_BACKEND: 'l1'
        ROLLUP_VERIFIER_ENABLE: 'true'
        ETH1_CTC_DEPLOYMENT_HEIGHT: 8
        RETRIES: 60
    ports:
      - ${VERIFIER_HTTP_PORT:-8547}:8545
      - ${VERIFIER_WS_PORT:-8548}:8546

  replica:
    depends_on:
      - dtl
    image: ethereumoptimism/l2geth:${DOCKER_TAG:-prerelease-0.5.0-rc-7-ee217ce}
    deploy:
      replicas: 0
    entrypoint: sh ./geth.sh
    env_file:
      - ./envs/geth.env
    environment:
        ETH1_HTTP: http://l1_chain:8545
        ROLLUP_STATE_DUMP_PATH: http://deployer:8081/state-dump.latest.json
        ROLLUP_CLIENT_HTTP: http://dtl:7878
        ROLLUP_BACKEND: 'l2'
        ROLLUP_VERIFIER_ENABLE: 'true'
        ETH1_CTC_DEPLOYMENT_HEIGHT: 8
        RETRIES: 60
    ports:
      - ${L2GETH_HTTP_PORT:-8549}:8545
      - ${L2GETH_WS_PORT:-8550}:8546

  gas_oracle:
    image: ethereumoptimism/gas-oracle:${DOCKER_TAG:-prerelease-0.5.0-rc-7-ee217ce}
    deploy:
       replicas: 0
    entrypoint: ./gas-oracle.sh
    environment:
      GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL: http://l2geth:8545
      GAS_PRICE_ORACLE_PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
