Commit b94c4492 authored by smartcontracts's avatar smartcontracts Committed by GitHub

style(ctb): tweaks to L2 contracts (#2886)

Minor style tweaks to a few L2 contracts.
parent f8a4084e
This diff is collapsed.
...@@ -2,47 +2,65 @@ ...@@ -2,47 +2,65 @@
pragma solidity ^0.8.9; pragma solidity ^0.8.9;
/** /**
* @title OVM_DeployerWhitelist * @custom:legacy
* @dev The Deployer Whitelist is a temporary predeploy used to provide additional safety during the * @custom:proxied
* initial phases of our mainnet roll out. It is owned by the Optimism team, and defines accounts * @custom:predeployed 0x4200000000000000000000000000000000000002
* which are allowed to deploy contracts on Layer2. The Execution Manager will only allow an * @title DeployerWhitelist
* ovmCREATE or ovmCREATE2 operation to proceed if the deployer's address whitelisted. * @notice DeployerWhitelist is a legacy contract that was originally used to act as a whitelist of
* addresses allowed to the Optimism network. The DeployerWhitelist has since been
* disabled, but the code is kept in state for the sake of full backwards compatibility.
* As of the Bedrock upgrade, the DeployerWhitelist is completely unused by the Optimism
* system and could, in theory, be removed entirely.
*/ */
contract DeployerWhitelist { contract DeployerWhitelist {
/********** /**
* Events * * @notice Emitted when the owner of this contract changes.
**********/ *
* @param oldOwner Address of the previous owner.
* @param newOwner Address of the new owner.
*/
event OwnerChanged(address oldOwner, address newOwner); event OwnerChanged(address oldOwner, address newOwner);
/**
* @notice Emitted when the whitelist status of a deployer changes.
*
* @param deployer Address of the deployer.
* @param whitelisted Boolean indicating whether the deployer is whitelisted.
*/
event WhitelistStatusChanged(address deployer, bool whitelisted); event WhitelistStatusChanged(address deployer, bool whitelisted);
event WhitelistDisabled(address oldOwner);
/********************** /**
* Contract Constants * * @notice Emitted when the whitelist is disabled.
**********************/ *
* @param oldOwner Address of the final owner of the whitelist.
*/
event WhitelistDisabled(address oldOwner);
// WARNING: When owner is set to address(0), the whitelist is disabled. /**
* @notice Address of the owner of this contract. Note that when this address is set to
* address(0), the whitelist is disabled.
*/
address public owner; address public owner;
mapping(address => bool) public whitelist;
/********************** /**
* Function Modifiers * * @notice Mapping of deployer addresses to boolean whitelist status.
**********************/ */
mapping(address => bool) public whitelist;
/** /**
* Blocks functions to anyone except the contract owner. * @notice Blocks functions to anyone except the contract owner.
*/ */
modifier onlyOwner() { modifier onlyOwner() {
require(msg.sender == owner, "Function can only be called by the owner of this contract."); require(
msg.sender == owner,
"DeployerWhitelist: function can only be called by the owner of this contract"
);
_; _;
} }
/********************
* Public Functions *
********************/
/** /**
* Adds or removes an address from the deployment whitelist. * @notice Adds or removes an address from the deployment whitelist.
*
* @param _deployer Address to update permissions for. * @param _deployer Address to update permissions for.
* @param _isWhitelisted Whether or not the address is whitelisted. * @param _isWhitelisted Whether or not the address is whitelisted.
*/ */
...@@ -52,17 +70,17 @@ contract DeployerWhitelist { ...@@ -52,17 +70,17 @@ contract DeployerWhitelist {
} }
/** /**
* Updates the owner of this contract. * @notice Updates the owner of this contract.
*
* @param _owner Address of the new owner. * @param _owner Address of the new owner.
*/ */
// slither-disable-next-line external-function function setOwner(address _owner) external onlyOwner {
function setOwner(address _owner) public onlyOwner {
// Prevent users from setting the whitelist owner to address(0) except via // Prevent users from setting the whitelist owner to address(0) except via
// enableArbitraryContractDeployment. If you want to burn the whitelist owner, send it to // enableArbitraryContractDeployment. If you want to burn the whitelist owner, send it to
// any other address that doesn't have a corresponding knowable private key. // any other address that doesn't have a corresponding knowable private key.
require( require(
_owner != address(0), _owner != address(0),
"OVM_DeployerWhitelist: can only be disabled via enableArbitraryContractDeployment" "DeployerWhitelist: can only be disabled via enableArbitraryContractDeployment"
); );
emit OwnerChanged(owner, _owner); emit OwnerChanged(owner, _owner);
...@@ -70,7 +88,7 @@ contract DeployerWhitelist { ...@@ -70,7 +88,7 @@ contract DeployerWhitelist {
} }
/** /**
* Permanently enables arbitrary contract deployment and deletes the owner. * @notice Permanently enables arbitrary contract deployment and deletes the owner.
*/ */
function enableArbitraryContractDeployment() external onlyOwner { function enableArbitraryContractDeployment() external onlyOwner {
emit WhitelistDisabled(owner); emit WhitelistDisabled(owner);
...@@ -78,9 +96,11 @@ contract DeployerWhitelist { ...@@ -78,9 +96,11 @@ contract DeployerWhitelist {
} }
/** /**
* Checks whether an address is allowed to deploy contracts. * @notice Checks whether an address is allowed to deploy contracts.
*
* @param _deployer Address to check. * @param _deployer Address to check.
* @return _allowed Whether or not the address can deploy contracts. *
* @return Whether or not the address can deploy contracts.
*/ */
function isDeployerAllowed(address _deployer) external view returns (bool) { function isDeployerAllowed(address _deployer) external view returns (bool) {
return (owner == address(0) || whitelist[_deployer]); return (owner == address(0) || whitelist[_deployer]);
......
...@@ -39,19 +39,11 @@ contract L2ToL1MessagePasser { ...@@ -39,19 +39,11 @@ contract L2ToL1MessagePasser {
*/ */
event WithdrawerBalanceBurnt(uint256 indexed amount); event WithdrawerBalanceBurnt(uint256 indexed amount);
/*************
* Constants *
*************/
/** /**
* @notice The L1 gas limit set when eth is withdrawn using the receive() function. * @notice The L1 gas limit set when eth is withdrawn using the receive() function.
*/ */
uint256 internal constant RECEIVE_DEFAULT_GAS_LIMIT = 100_000; uint256 internal constant RECEIVE_DEFAULT_GAS_LIMIT = 100_000;
/*************
* Variables *
*************/
/** /**
* @notice Includes the message hashes for all withdrawals * @notice Includes the message hashes for all withdrawals
*/ */
......
...@@ -8,10 +8,14 @@ import { Lib_PredeployAddresses } from "../libraries/Lib_PredeployAddresses.sol" ...@@ -8,10 +8,14 @@ import { Lib_PredeployAddresses } from "../libraries/Lib_PredeployAddresses.sol"
import { OptimismMintableERC20 } from "../universal/OptimismMintableERC20.sol"; import { OptimismMintableERC20 } from "../universal/OptimismMintableERC20.sol";
/** /**
* @custom:legacy
* @custom:proxied * @custom:proxied
* @custom:predeploy 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000 * @custom:predeploy 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000
* @title OVM_ETH * @title OVM_ETH
* @notice Legacy contract which used to hold ETH balances on L2. * @notice OVM_ETH is a legacy contract that held ETH balances before the Bedrock upgrade. All
* ETH balances held within this contract were migrated to the state trie as part of the
* Bedrock upgrade. Functions within this contract that mutate state were already disabled
* as part of the EVM equivalence upgrade.
*/ */
contract OVM_ETH is OptimismMintableERC20 { contract OVM_ETH is OptimismMintableERC20 {
/** /**
......
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