Skip to content

Commit 187563f

Browse files
yiweichizimphaThegaram
authored
Feat deployment alt gas token (#20)
Co-authored-by: zimpha <[email protected]> Co-authored-by: Péter Garamvölgyi <[email protected]>
1 parent 4ca3a3c commit 187563f

20 files changed

+2300
-114
lines changed

docker/config-example.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ MAX_L1_MESSAGE_GAS_LIMIT = 10000000
1313

1414
L1_CONTRACT_DEPLOYMENT_BLOCK = 0
1515

16+
ALTERNATIVE_GAS_TOKEN_ENABLED = true
17+
# EXAMPLE_GAS_TOKEN_DECIMAL = 6
18+
1619
TEST_ENV_MOCK_FINALIZE_ENABLED = true
1720
TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC = 3600
1821

@@ -64,6 +67,7 @@ L1_PLONK_VERIFIER_ADDR = "0x0000000000000000000000000000000000000001"
6467
[contracts.overrides]
6568

6669
# L1_WETH = "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14"
70+
# L1_GAS_TOKEN = "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"
6771

6872
L2_MESSAGE_QUEUE = "0x5300000000000000000000000000000000000000"
6973
L1_GAS_PRICE_ORACLE = "0x5300000000000000000000000000000000000002"

docker/scripts/deploy.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ if [ "$L2_RPC_ENDPOINT" = "" ]; then
1313
L2_RPC_ENDPOINT="http://host.docker.internal:8545"
1414
fi
1515

16-
if [ "${L1_RPC_ENDPOINT}" = "" ]; then
17-
echo "L1_RPC_ENDPOINT is not set"
18-
L1_RPC_ENDPOINT="http://host.docker.internal:8543"
19-
fi
20-
2116
if [ "${BATCH_SIZE}" = "" ]; then
2217
BATCH_SIZE="100"
2318
fi

docker/scripts/gen-configs.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
#!/bin/bash
22

3+
# the deployment of the L1GasTokenGateway implementation necessitates fetching the gas token decimal
4+
# in this case it requires the context of layer 1
5+
gen_config_contracts_toml() {
6+
config_file="./volume/config.toml"
7+
gas_token_addr=$(grep -E "^L1_GAS_TOKEN =" "$config_file" | sed 's/ *= */=/' | cut -d'=' -f2-)
8+
gas_token_enabled=$(grep -E "^ALTERNATIVE_GAS_TOKEN_ENABLED =" "$config_file" | sed 's/ *= */=/' | cut -d'=' -f2-)
9+
l1_rpc_url=$(grep -E "^L1_RPC_ENDPOINT =" "$config_file" | sed 's/ *= */=/' | cut -d'=' -f2- | sed 's/"//g')
10+
11+
if [[ "$gas_token_enabled" == "true" && "$gas_token_addr" != "" && "$gas_token_addr" != "0x0000000000000000000000000000000000000000" ]]; then
12+
echo "gas token enabled and address provided"
13+
forge script scripts/deterministic/DeployScroll.s.sol:DeployScroll --rpc-url "$l1_rpc_url" --sig "run(string,string)" "none" "write-config" || exit 1
14+
else
15+
echo "gas token disabled or address not provided"
16+
forge script scripts/deterministic/DeployScroll.s.sol:DeployScroll --sig "run(string,string)" "none" "write-config" || exit 1
17+
fi
18+
}
19+
320
echo ""
421
echo "generating config-contracts.toml"
5-
forge script scripts/deterministic/DeployScroll.s.sol:DeployScroll --sig "run(string,string)" "none" "write-config" || exit 1
22+
gen_config_contracts_toml
623

724
echo ""
825
echo "generating genesis.json"

docker/templates/bridge-history-config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"USDCGatewayAddr": "0x0000000000000000000000000000000000000000",
1919
"LIDOGatewayAddr": "0x0000000000000000000000000000000000000000",
2020
"DAIGatewayAddr": "0x0000000000000000000000000000000000000000",
21-
"PufferGatewayAddr": "0x0000000000000000000000000000000000000000"
21+
"PufferGatewayAddr": "0x0000000000000000000000000000000000000000",
22+
"GasTokenGatewayAddr": null,
23+
"WrappedTokenGatewayAddr": null
2224
},
2325
"L2": {
2426
"confirmation": 0,

docker/templates/chain-monitor-config.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@
1414
"dai_gateway": "0x0000000000000000000000000000000000000000",
1515
"usdc_gateway": "0x0000000000000000000000000000000000000000",
1616
"lido_gateway": "0x0000000000000000000000000000000000000000",
17-
"puffer_gateway": "0x0000000000000000000000000000000000000000"
17+
"puffer_gateway": "0x0000000000000000000000000000000000000000",
18+
"gas_token_gateway": null
1819
},
1920
"scroll_messenger": null,
2021
"message_queue": null,
21-
"scroll_chain": null
22+
"scroll_chain": null,
23+
"gas_token": null
2224
},
23-
"start_messenger_balance": null
25+
"start_messenger_balance": 0
2426
},
2527
"l2_config": {
2628
"l2_url": null,

docker/templates/config-contracts.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ L1_ERC721_GATEWAY_PROXY_ADDR = ""
2323
L1_ERC1155_GATEWAY_PROXY_ADDR = ""
2424
L2_MESSAGE_QUEUE_ADDR = ""
2525
L1_GAS_PRICE_ORACLE_ADDR = ""
26+
L1_GAS_TOKEN_ADDR = ""
27+
L1_GAS_TOKEN_GATEWAY_IMPLEMENTATION_ADDR = ""
28+
L1_GAS_TOKEN_GATEWAY_PROXY_ADDR = ""
29+
L1_WRAPPED_TOKEN_GATEWAY_ADDR = ""
2630
L2_WHITELIST_ADDR = ""
2731
L2_WETH_ADDR = ""
2832
L2_TX_FEE_VAULT_ADDR = ""

docker/templates/rollup-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"gas_price_diff": 50000
5050
},
5151
"chain_monitor": {
52-
"enabled": false,
52+
"enabled": true,
5353
"timeout": 3,
5454
"try_times": 5,
5555
"base_url": "http://chain-monitor:8080"

scripts/deterministic/Configuration.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ abstract contract Configuration is Script {
3636

3737
uint256 internal L1_CONTRACT_DEPLOYMENT_BLOCK;
3838

39+
bool internal ALTERNATIVE_GAS_TOKEN_ENABLED;
40+
3941
bool internal TEST_ENV_MOCK_FINALIZE_ENABLED;
4042
uint256 internal TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC;
4143

@@ -110,6 +112,8 @@ abstract contract Configuration is Script {
110112

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

115+
ALTERNATIVE_GAS_TOKEN_ENABLED = cfg.readBool(".general.ALTERNATIVE_GAS_TOKEN_ENABLED");
116+
113117
TEST_ENV_MOCK_FINALIZE_ENABLED = cfg.readBool(".general.TEST_ENV_MOCK_FINALIZE_ENABLED");
114118
TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC = cfg.readUint(".general.TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC");
115119

0 commit comments

Comments
 (0)