Skip to content

Commit

Permalink
Feat deployment alt gas token (#20)
Browse files Browse the repository at this point in the history
Co-authored-by: zimpha <[email protected]>
Co-authored-by: Péter Garamvölgyi <[email protected]>
  • Loading branch information
3 people authored Aug 20, 2024
1 parent 4ca3a3c commit 187563f
Show file tree
Hide file tree
Showing 20 changed files with 2,300 additions and 114 deletions.
4 changes: 4 additions & 0 deletions docker/config-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ MAX_L1_MESSAGE_GAS_LIMIT = 10000000

L1_CONTRACT_DEPLOYMENT_BLOCK = 0

ALTERNATIVE_GAS_TOKEN_ENABLED = true
# EXAMPLE_GAS_TOKEN_DECIMAL = 6

TEST_ENV_MOCK_FINALIZE_ENABLED = true
TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC = 3600

Expand Down Expand Up @@ -64,6 +67,7 @@ L1_PLONK_VERIFIER_ADDR = "0x0000000000000000000000000000000000000001"
[contracts.overrides]

# L1_WETH = "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14"
# L1_GAS_TOKEN = "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"

L2_MESSAGE_QUEUE = "0x5300000000000000000000000000000000000000"
L1_GAS_PRICE_ORACLE = "0x5300000000000000000000000000000000000002"
Expand Down
5 changes: 0 additions & 5 deletions docker/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ if [ "$L2_RPC_ENDPOINT" = "" ]; then
L2_RPC_ENDPOINT="http://host.docker.internal:8545"
fi

if [ "${L1_RPC_ENDPOINT}" = "" ]; then
echo "L1_RPC_ENDPOINT is not set"
L1_RPC_ENDPOINT="http://host.docker.internal:8543"
fi

if [ "${BATCH_SIZE}" = "" ]; then
BATCH_SIZE="100"
fi
Expand Down
19 changes: 18 additions & 1 deletion docker/scripts/gen-configs.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
#!/bin/bash

# the deployment of the L1GasTokenGateway implementation necessitates fetching the gas token decimal
# in this case it requires the context of layer 1
gen_config_contracts_toml() {
config_file="./volume/config.toml"
gas_token_addr=$(grep -E "^L1_GAS_TOKEN =" "$config_file" | sed 's/ *= */=/' | cut -d'=' -f2-)
gas_token_enabled=$(grep -E "^ALTERNATIVE_GAS_TOKEN_ENABLED =" "$config_file" | sed 's/ *= */=/' | cut -d'=' -f2-)
l1_rpc_url=$(grep -E "^L1_RPC_ENDPOINT =" "$config_file" | sed 's/ *= */=/' | cut -d'=' -f2- | sed 's/"//g')

if [[ "$gas_token_enabled" == "true" && "$gas_token_addr" != "" && "$gas_token_addr" != "0x0000000000000000000000000000000000000000" ]]; then
echo "gas token enabled and address provided"
forge script scripts/deterministic/DeployScroll.s.sol:DeployScroll --rpc-url "$l1_rpc_url" --sig "run(string,string)" "none" "write-config" || exit 1
else
echo "gas token disabled or address not provided"
forge script scripts/deterministic/DeployScroll.s.sol:DeployScroll --sig "run(string,string)" "none" "write-config" || exit 1
fi
}

echo ""
echo "generating config-contracts.toml"
forge script scripts/deterministic/DeployScroll.s.sol:DeployScroll --sig "run(string,string)" "none" "write-config" || exit 1
gen_config_contracts_toml

echo ""
echo "generating genesis.json"
Expand Down
4 changes: 3 additions & 1 deletion docker/templates/bridge-history-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"USDCGatewayAddr": "0x0000000000000000000000000000000000000000",
"LIDOGatewayAddr": "0x0000000000000000000000000000000000000000",
"DAIGatewayAddr": "0x0000000000000000000000000000000000000000",
"PufferGatewayAddr": "0x0000000000000000000000000000000000000000"
"PufferGatewayAddr": "0x0000000000000000000000000000000000000000",
"GasTokenGatewayAddr": null,
"WrappedTokenGatewayAddr": null
},
"L2": {
"confirmation": 0,
Expand Down
8 changes: 5 additions & 3 deletions docker/templates/chain-monitor-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
"dai_gateway": "0x0000000000000000000000000000000000000000",
"usdc_gateway": "0x0000000000000000000000000000000000000000",
"lido_gateway": "0x0000000000000000000000000000000000000000",
"puffer_gateway": "0x0000000000000000000000000000000000000000"
"puffer_gateway": "0x0000000000000000000000000000000000000000",
"gas_token_gateway": null
},
"scroll_messenger": null,
"message_queue": null,
"scroll_chain": null
"scroll_chain": null,
"gas_token": null
},
"start_messenger_balance": null
"start_messenger_balance": 0
},
"l2_config": {
"l2_url": null,
Expand Down
4 changes: 4 additions & 0 deletions docker/templates/config-contracts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ L1_ERC721_GATEWAY_PROXY_ADDR = ""
L1_ERC1155_GATEWAY_PROXY_ADDR = ""
L2_MESSAGE_QUEUE_ADDR = ""
L1_GAS_PRICE_ORACLE_ADDR = ""
L1_GAS_TOKEN_ADDR = ""
L1_GAS_TOKEN_GATEWAY_IMPLEMENTATION_ADDR = ""
L1_GAS_TOKEN_GATEWAY_PROXY_ADDR = ""
L1_WRAPPED_TOKEN_GATEWAY_ADDR = ""
L2_WHITELIST_ADDR = ""
L2_WETH_ADDR = ""
L2_TX_FEE_VAULT_ADDR = ""
Expand Down
2 changes: 1 addition & 1 deletion docker/templates/rollup-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"gas_price_diff": 50000
},
"chain_monitor": {
"enabled": false,
"enabled": true,
"timeout": 3,
"try_times": 5,
"base_url": "http://chain-monitor:8080"
Expand Down
4 changes: 4 additions & 0 deletions scripts/deterministic/Configuration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ abstract contract Configuration is Script {

uint256 internal L1_CONTRACT_DEPLOYMENT_BLOCK;

bool internal ALTERNATIVE_GAS_TOKEN_ENABLED;

bool internal TEST_ENV_MOCK_FINALIZE_ENABLED;
uint256 internal TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC;

Expand Down Expand Up @@ -110,6 +112,8 @@ abstract contract Configuration is Script {

L1_CONTRACT_DEPLOYMENT_BLOCK = cfg.readUint(".general.L1_CONTRACT_DEPLOYMENT_BLOCK");

ALTERNATIVE_GAS_TOKEN_ENABLED = cfg.readBool(".general.ALTERNATIVE_GAS_TOKEN_ENABLED");

TEST_ENV_MOCK_FINALIZE_ENABLED = cfg.readBool(".general.TEST_ENV_MOCK_FINALIZE_ENABLED");
TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC = cfg.readUint(".general.TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC");

Expand Down
Loading

0 comments on commit 187563f

Please sign in to comment.