Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker/config-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ L2GETH_SIGNER_0_ADDRESS = "0x756EA06BDEe36de11F22DCca45a31d8a178eF3c6"
SCROLL_DB_CONNECTION_STRING = "postgres://postgres:scroll2022@db:5432/scroll?sslmode=disable"
CHAIN_MONITOR_DB_CONNECTION_STRING = "postgres://postgres:scroll2022@db:5432/chain_monitor?sslmode=disable"
BRIDGE_HISTORY_DB_CONNECTION_STRING = "postgres://postgres:scroll2022@db:5432/bridge_history?sslmode=disable"
ROLLUP_EXPLORER_DB_CONNECTION_STRING = "postgres://postgres:scroll2022@db:5432/rollup_explorer?sslmode=disable"


[genesis]
Expand Down
4 changes: 4 additions & 0 deletions docker/scripts/gen-configs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ forge script scripts/deterministic/GenerateConfigs.s.sol:GenerateBalanceCheckerC
echo ""
echo "generating .env.frontend"
forge script scripts/deterministic/GenerateConfigs.s.sol:GenerateFrontendConfig || exit 1

echo ""
echo "generating rollup-explorer-backend-config.json"
forge script scripts/deterministic/GenerateConfigs.s.sol:GenerateRollupExplorerBackendConfig || exit 1
5 changes: 5 additions & 0 deletions docker/templates/rollup-explorer-backend-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"db_url": null,
"open_api_addr": "/rollupscan",
"max_per_page": 500
}
2 changes: 2 additions & 0 deletions scripts/deterministic/Configuration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ abstract contract Configuration is Script {
string internal SCROLL_DB_CONNECTION_STRING;
string internal CHAIN_MONITOR_DB_CONNECTION_STRING;
string internal BRIDGE_HISTORY_DB_CONNECTION_STRING;
string internal ROLLUP_EXPLORER_BACKEND_DB_CONNECTION_STRING;

// genesis
uint256 internal L2_MAX_ETH_SUPPLY;
Expand Down Expand Up @@ -129,6 +130,7 @@ abstract contract Configuration is Script {
SCROLL_DB_CONNECTION_STRING = cfg.readString(".db.SCROLL_DB_CONNECTION_STRING");
CHAIN_MONITOR_DB_CONNECTION_STRING = cfg.readString(".db.CHAIN_MONITOR_DB_CONNECTION_STRING");
BRIDGE_HISTORY_DB_CONNECTION_STRING = cfg.readString(".db.BRIDGE_HISTORY_DB_CONNECTION_STRING");
ROLLUP_EXPLORER_BACKEND_DB_CONNECTION_STRING = cfg.readString(".db.ROLLUP_EXPLORER_DB_CONNECTION_STRING");

L2_MAX_ETH_SUPPLY = cfg.readUint(".genesis.L2_MAX_ETH_SUPPLY");
L2_DEPLOYER_INITIAL_BALANCE = cfg.readUint(".genesis.L2_DEPLOYER_INITIAL_BALANCE");
Expand Down
2 changes: 2 additions & 0 deletions scripts/deterministic/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ string constant COORDINATOR_CONFIG_TEMPLATE_PATH = "./docker/templates/coordinat
string constant CHAIN_MONITOR_CONFIG_TEMPLATE_PATH = "./docker/templates/chain-monitor-config.json";
string constant BRIDGE_HISTORY_CONFIG_TEMPLATE_PATH = "./docker/templates/bridge-history-config.json";
string constant BALANCE_CHECKER_CONFIG_TEMPLATE_PATH = "./docker/templates/balance-checker-config.json";
string constant ROLLUP_EXPLORER_BACKEND_CONFIG_TEMPLATE_PATH = "./docker/templates/rollup-explorer-backend-config.json";

// input files
string constant CONFIG_PATH = "./volume/config.toml";
Expand All @@ -33,3 +34,4 @@ string constant CHAIN_MONITOR_CONFIG_PATH = "./volume/chain-monitor-config.json"
string constant BRIDGE_HISTORY_CONFIG_PATH = "./volume/bridge-history-config.json";
string constant BALANCE_CHECKER_CONFIG_PATH = "./volume/balance-checker-config.json";
string constant FRONTEND_ENV_PATH = "./volume/.env.frontend";
string constant ROLLUP_EXPLORER_BACKEND_CONFIG_PATH = "./volume/rollup-explorer-backend-config.json";
32 changes: 31 additions & 1 deletion scripts/deterministic/GenerateConfigs.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.8.24;

import {BALANCE_CHECKER_CONFIG_PATH, BALANCE_CHECKER_CONFIG_TEMPLATE_PATH, BRIDGE_HISTORY_CONFIG_PATH, BRIDGE_HISTORY_CONFIG_TEMPLATE_PATH, CHAIN_MONITOR_CONFIG_PATH, CHAIN_MONITOR_CONFIG_TEMPLATE_PATH, COORDINATOR_CONFIG_PATH, COORDINATOR_CONFIG_TEMPLATE_PATH, FRONTEND_ENV_PATH, ROLLUP_CONFIG_PATH, ROLLUP_CONFIG_TEMPLATE_PATH} from "./Constants.sol";
import {BALANCE_CHECKER_CONFIG_PATH, BALANCE_CHECKER_CONFIG_TEMPLATE_PATH, BRIDGE_HISTORY_CONFIG_PATH, BRIDGE_HISTORY_CONFIG_TEMPLATE_PATH, CHAIN_MONITOR_CONFIG_PATH, CHAIN_MONITOR_CONFIG_TEMPLATE_PATH, COORDINATOR_CONFIG_PATH, COORDINATOR_CONFIG_TEMPLATE_PATH, FRONTEND_ENV_PATH, ROLLUP_CONFIG_PATH, ROLLUP_CONFIG_TEMPLATE_PATH, ROLLUP_EXPLORER_BACKEND_CONFIG_PATH, ROLLUP_EXPLORER_BACKEND_CONFIG_TEMPLATE_PATH} from "./Constants.sol";
import {DeployScroll} from "./DeployScroll.s.sol";

contract GenerateRollupConfig is DeployScroll {
Expand Down Expand Up @@ -326,3 +326,33 @@ contract GenerateFrontendConfig is DeployScroll {
vm.writeLine(FRONTEND_ENV_PATH, "REACT_APP_L1_BATCH_BRIDGE_GATEWAY_PROXY_ADDR = \"\"");
}
}

contract GenerateRollupExplorerBackendConfig is DeployScroll {
/***************
* Entry point *
***************/

function run() public {
setScriptMode(ScriptMode.VerifyConfig);
predictAllContracts();

generateRollupExplorerBackendConfig();
}

/*********************
* Private functions *
*********************/

// prettier-ignore
function generateRollupExplorerBackendConfig() private {
// initialize template file
if (vm.exists(ROLLUP_EXPLORER_BACKEND_CONFIG_PATH)) {
vm.removeFile(ROLLUP_EXPLORER_BACKEND_CONFIG_PATH);
}

string memory template = vm.readFile(ROLLUP_EXPLORER_BACKEND_CONFIG_TEMPLATE_PATH);
vm.writeFile(ROLLUP_EXPLORER_BACKEND_CONFIG_PATH, template);

vm.writeJson(ROLLUP_EXPLORER_BACKEND_DB_CONNECTION_STRING, ROLLUP_EXPLORER_BACKEND_CONFIG_PATH, ".db_url");
}
}