Skip to content

Commit

Permalink
contracts-bedrock: use errors, events contracts in L1Block, L1BlockIn…
Browse files Browse the repository at this point in the history
…terop
  • Loading branch information
0xfuturistic committed May 20, 2024
1 parent e46a001 commit fb141dc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
8 changes: 2 additions & 6 deletions packages/contracts-bedrock/src/L2/L1Block.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ pragma solidity 0.8.15;
import { ISemver } from "src/universal/ISemver.sol";
import { Constants } from "src/libraries/Constants.sol";
import { GasPayingToken, IGasToken } from "src/libraries/GasPayingToken.sol";
import "src/libraries/L1BlockErrors.sol";
import "src/libraries/L1BlockEvents.sol";

/// @custom:proxied
/// @custom:predeploy 0x4200000000000000000000000000000000000015
Expand All @@ -13,12 +15,6 @@ import { GasPayingToken, IGasToken } from "src/libraries/GasPayingToken.sol";
/// set by the "depositor" account, a special system address. Depositor account transactions
/// are created by the protocol whenever we move to a new epoch.
contract L1Block is ISemver, IGasToken {
/// @notice Error returns when a non-depositor account tries to set L1 block values.
error NotDepositor();

/// @notice Event emitted when the gas paying token is set.
event GasPayingTokenSet(address indexed token, uint8 indexed decimals, bytes32 name, bytes32 symbol);

/// @notice Address of the special depositor account.
function DEPOSITOR_ACCOUNT() public pure returns (address addr_) {
addr_ = Constants.DEPOSITOR_ACCOUNT;
Expand Down
15 changes: 0 additions & 15 deletions packages/contracts-bedrock/src/L2/L1BlockInterop.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,6 @@ enum ConfigType {
contract L1BlockInterop is L1Block {
using EnumerableSet for EnumerableSet.UintSet;

/// @notice Error when a chain ID is not in the interop dependency set.
error NotDependency();

/// @notice Error when the interop dependency set size is too large.
error DependencySetSizeTooLarge();

/// @notice Error when the chain's chain ID is attempted to be removed from the interop dependency set.
error CantRemovedChainId();

/// @notice Event emitted when a new dependency is added to the interop dependency set.
event DependencyAdded(uint256 indexed chainId);

/// @notice Event emitted when a dependency is removed from the interop dependency set.
event DependencyRemoved(uint256 indexed chainId);

/// @notice The interop dependency set, containing the chain IDs in it.
EnumerableSet.UintSet public dependencySet;

Expand Down
14 changes: 14 additions & 0 deletions packages/contracts-bedrock/src/libraries/L1BlockErrors.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

/// @notice Error returns when a non-depositor account tries to set L1 block values.
error NotDepositor();

/// @notice Error when a chain ID is not in the interop dependency set.
error NotDependency();

/// @notice Error when the interop dependency set size is too large.
error DependencySetSizeTooLarge();

/// @notice Error when the chain's chain ID is attempted to be removed from the interop dependency set.
error CantRemovedChainId();
11 changes: 11 additions & 0 deletions packages/contracts-bedrock/src/libraries/L1BlockEvents.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

/// @notice Event emitted when the gas paying token is set.
event GasPayingTokenSet(address indexed token, uint8 indexed decimals, bytes32 name, bytes32 symbol);

/// @notice Event emitted when a new dependency is added to the interop dependency set.
event DependencyAdded(uint256 indexed chainId);

/// @notice Event emitted when a dependency is removed from the interop dependency set.
event DependencyRemoved(uint256 indexed chainId);

0 comments on commit fb141dc

Please sign in to comment.