Commit 829fa195 authored by Kelvin Fichter's avatar Kelvin Fichter Committed by Kelvin Fichter

feat: add getting started config script

Adds a new script to contracts-bedrock that generates the deploy
config for the getting started network. Removes the getting started
config from the repository and avoids unnecessary work for the user
while following the guide.
parent c74a0197
...@@ -26,3 +26,6 @@ deployments/1337 ...@@ -26,3 +26,6 @@ deployments/1337
# Devnet config which changes with each 'make devnet-up' # Devnet config which changes with each 'make devnet-up'
deploy-config/devnetL1.json deploy-config/devnetL1.json
# Getting Started guide deploy config
deploy-config/getting-started.json
#!/usr/bin/env bash
# This script is used to generate the getting-started.json configuration file
# used in the Getting Started quickstart guide on the docs site. Avoids the
# need to have the getting-started.json committed to the repo since it's an
# invalid JSON file when not filled in, which is annoying.
reqenv() {
local var_name="$1"
local var_value="${!var_name}"
if [ -z "$var_value" ]; then
echo "Error: environment variable $var_name is undefined"
exit 1
fi
echo "$var_value"
}
# Load required environment variables
GS_ADMIN_ADDRESS=$(reqenv GS_ADMIN_ADDRESS)
GS_BATCHER_ADDRESS=$(reqenv GS_BATCHER_ADDRESS)
GS_PROPOSER_ADDRESS=$(reqenv GS_PROPOSER_ADDRESS)
GS_SEQUENCER_ADDRESS=$(reqenv GS_SEQUENCER_ADDRESS)
L1_RPC_URL=$(reqenv L1_RPC_URL)
# Get the finalized block timestamp and hash
block=$(cast block finalized --rpc-url $L1_RPC_URL)
timestamp=$(echo "$block" | awk '/timestamp/ { print $2 }')
blockhash=$(echo "$block" | awk '/hash/ { print $2 }')
# Generate the config file
config=$(cat << EOL
{ {
"finalSystemOwner": "ADMIN", "finalSystemOwner": "$GS_ADMIN_ADDRESS",
"portalGuardian": "ADMIN", "portalGuardian": "$GS_ADMIN_ADDRESS",
"l1StartingBlockTag": "BLOCKHASH", "l1StartingBlockTag": "$blockhash",
"l1ChainID": 5, "l1ChainID": 5,
"l2ChainID": 42069, "l2ChainID": 42069,
...@@ -13,23 +44,23 @@ ...@@ -13,23 +44,23 @@
"sequencerWindowSize": 3600, "sequencerWindowSize": 3600,
"channelTimeout": 300, "channelTimeout": 300,
"p2pSequencerAddress": "SEQUENCER", "p2pSequencerAddress": "$GS_SEQUENCER_ADDRESS",
"batchInboxAddress": "0xff00000000000000000000000000000000042069", "batchInboxAddress": "0xff00000000000000000000000000000000042069",
"batchSenderAddress": "BATCHER", "batchSenderAddress": "$GS_BATCHER_ADDRESS",
"l2OutputOracleSubmissionInterval": 120, "l2OutputOracleSubmissionInterval": 120,
"l2OutputOracleStartingBlockNumber": 0, "l2OutputOracleStartingBlockNumber": 0,
"l2OutputOracleStartingTimestamp": TIMESTAMP, "l2OutputOracleStartingTimestamp": $timestamp,
"l2OutputOracleProposer": "PROPOSER", "l2OutputOracleProposer": "$GS_PROPOSER_ADDRESS",
"l2OutputOracleChallenger": "ADMIN", "l2OutputOracleChallenger": "$GS_ADMIN_ADDRESS",
"finalizationPeriodSeconds": 12, "finalizationPeriodSeconds": 12,
"proxyAdminOwner": "ADMIN", "proxyAdminOwner": "$GS_ADMIN_ADDRESS",
"baseFeeVaultRecipient": "ADMIN", "baseFeeVaultRecipient": "$GS_ADMIN_ADDRESS",
"l1FeeVaultRecipient": "ADMIN", "l1FeeVaultRecipient": "$GS_ADMIN_ADDRESS",
"sequencerFeeVaultRecipient": "ADMIN", "sequencerFeeVaultRecipient": "$GS_ADMIN_ADDRESS",
"baseFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "baseFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
"l1FeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "l1FeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
...@@ -44,7 +75,7 @@ ...@@ -44,7 +75,7 @@
"enableGovernance": true, "enableGovernance": true,
"governanceTokenSymbol": "OP", "governanceTokenSymbol": "OP",
"governanceTokenName": "Optimism", "governanceTokenName": "Optimism",
"governanceTokenOwner": "ADMIN", "governanceTokenOwner": "$GS_ADMIN_ADDRESS",
"l2GenesisBlockGasLimit": "0x1c9c380", "l2GenesisBlockGasLimit": "0x1c9c380",
"l2GenesisBlockBaseFeePerGas": "0x3b9aca00", "l2GenesisBlockBaseFeePerGas": "0x3b9aca00",
...@@ -59,3 +90,8 @@ ...@@ -59,3 +90,8 @@
"requiredProtocolVersion": "0x0000000000000000000000000000000000000000000000000000000000000000", "requiredProtocolVersion": "0x0000000000000000000000000000000000000000000000000000000000000000",
"recommendedProtocolVersion": "0x0000000000000000000000000000000000000000000000000000000000000000" "recommendedProtocolVersion": "0x0000000000000000000000000000000000000000000000000000000000000000"
} }
EOL
)
# Write the config file
echo "$config" > deploy-config/getting-started.json
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment