-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathTaikoL2EIP1559Configurable.sol
46 lines (37 loc) · 1.4 KB
/
TaikoL2EIP1559Configurable.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import "./TaikoL2.sol";
/// @title TaikoL2EIP1559Configurable
/// @notice TaikoL2 with a setter to change EIP-1559 configurations and states.
/// @custom:security-contact security@taiko.xyz
contract TaikoL2EIP1559Configurable is TaikoL2 {
/// @notice EIP-1559 configuration.
Config public customConfig;
uint256[49] private __gap;
/// @notice Emits when the EIP-1559 configuration and gas excess are changed.
/// @param config The new EIP-1559 config.
/// @param gasExcess The new gas excess.
event ConfigAndExcessChanged(Config config, uint64 gasExcess);
error L2_INVALID_CONFIG();
/// @notice Sets EIP1559 configuration and gas excess.
/// @param _newConfig The new EIP1559 config.
/// @param _newGasExcess The new gas excess
function setConfigAndExcess(
Config memory _newConfig,
uint64 _newGasExcess
)
external
virtual
onlyOwner
{
if (_newConfig.gasTargetPerL1Block == 0) revert L2_INVALID_CONFIG();
if (_newConfig.basefeeAdjustmentQuotient == 0) revert L2_INVALID_CONFIG();
customConfig = _newConfig;
gasExcess = _newGasExcess;
emit ConfigAndExcessChanged(_newConfig, _newGasExcess);
}
/// @inheritdoc TaikoL2
function getConfig() public view override returns (Config memory) {
return customConfig;
}
}