Skip to content

Instantly share code, notes, and snippets.

@NoahMarconi
Created January 30, 2024 17:03
Show Gist options
  • Save NoahMarconi/b51d0732abadba33dc2bf7de779f3f4a to your computer and use it in GitHub Desktop.
Save NoahMarconi/b51d0732abadba33dc2bf7de779f3f4a to your computer and use it in GitHub Desktop.
Bast Out of Scope Findings
# Report
## Gas Optimizations
| |Issue|Instances|
|-|:-|:-:|
| [GAS-1](#GAS-1) | Use `selfbalance()` instead of `address(this).balance` | 10 |
| [GAS-2](#GAS-2) | Use assembly to check for `address(0)` | 44 |
| [GAS-3](#GAS-3) | `array[index] += amount` is cheaper than `array[index] = array[index] + amount` (or related variants) | 2 |
| [GAS-4](#GAS-4) | Using bools for storage incurs overhead | 19 |
| [GAS-5](#GAS-5) | Cache array length outside of loop | 16 |
| [GAS-6](#GAS-6) | State variables should be cached in stack variables rather than re-reading them from storage | 1 |
| [GAS-7](#GAS-7) | Use calldata instead of memory for function arguments that do not get mutated | 53 |
| [GAS-8](#GAS-8) | For Operations that will not overflow, you could use unchecked | 1706 |
| [GAS-9](#GAS-9) | Use Custom Errors | 216 |
| [GAS-10](#GAS-10) | Don't initialize variables with default value | 59 |
| [GAS-11](#GAS-11) | Long revert strings | 156 |
| [GAS-12](#GAS-12) | Functions guaranteed to revert when called by normal users can be marked `payable` | 94 |
| [GAS-13](#GAS-13) | `++i` costs less gas than `i++`, especially when it's used in `for`-loops (`--i`/`i--` too) | 26 |
| [GAS-14](#GAS-14) | Using `private` rather than `public` for constants, saves gas | 72 |
| [GAS-15](#GAS-15) | Use shift Right/Left instead of division/multiplication if possible | 26 |
| [GAS-16](#GAS-16) | Splitting require() statements that use && saves gas | 3 |
| [GAS-17](#GAS-17) | Use != 0 instead of > 0 for unsigned integer comparison | 41 |
| [GAS-18](#GAS-18) | `internal` functions not called by the contract should be removed | 28 |
### <a name="GAS-1"></a>[GAS-1] Use `selfbalance()` instead of `address(this).balance`
Use assembly when getting a contract's balance of ETH.
You can use `selfbalance()` instead of `address(this).balance` when getting your contract's balance of ETH to save gas.
Additionally, you can use `balance(address)` instead of `address.balance()` when getting an external contract's balance of ETH.
*Saves 15 gas when checking internal balance, 6 for external*
*Instances (10)*:
```solidity
File: src/L1/OptimismPortal.sol
370: uint256 etherBalance = address(this).balance;
372: txValueWithDiscount = address(this).balance - etherBalance;
```
```solidity
File: src/L2/L2ToL1MessagePasser.sol
64: uint256 balance = address(this).balance;
```
```solidity
File: src/L2/WETHRebasing.sol
97: uint256 pending = address(this).balance - yieldBearingEth - _totalVoidAndRemainders;
```
```solidity
File: src/legacy/LegacyERC20ETH.sol
25: return address(_who).balance;
```
```solidity
File: src/mainnet-bridge/ETHYieldManager.sol
31: return address(this).balance;
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
209: uint256 balanceBefore = address(YIELD_MANAGER).balance;
226: claimed = address(YIELD_MANAGER).balance - balanceBefore;
```
```solidity
File: src/universal/FeeVault.sol
63: address(this).balance >= MIN_WITHDRAWAL_AMOUNT,
67: uint256 value = address(this).balance;
```
### <a name="GAS-2"></a>[GAS-2] Use assembly to check for `address(0)`
*Saves 6 gas per instance*
*Instances (44)*:
```solidity
File: src/L1/DelayedVetoable.sol
68: if (msg.sender == address(0)) {
```
```solidity
File: src/L1/L1ERC721Bridge.sol
90: require(_remoteToken != address(0), "L1ERC721Bridge: remote token cannot be address(0)");
```
```solidity
File: src/L1/L2OutputOracle.sol
197: require(_outputRoot != bytes32(0), "L2OutputOracle: L2 output proposal cannot be the zero hash");
199: if (_l1BlockHash != bytes32(0)) {
```
```solidity
File: src/L1/OptimismPortal.sol
422: require(_to == address(0), "OptimismPortal: must send to address(0) when creating a contract");
451: if (msg.sender != yieldManager.blastBridge() || yieldManager.blastBridge() == address(0)) {
```
```solidity
File: src/L2/Blast.sol
77: return governorMap[contractAddress] == address(0);
```
```solidity
File: src/L2/ERC20Rebasing.sol
191: if (recipient == address(0)) {
237: if (from == address(0)) revert TransferFromZeroAddress();
238: if (to == address(0)) revert TransferToZeroAddress();
255: if (owner == address(0)) revert ApproveFromZeroAddress();
256: if (spender == address(0)) revert ApproveToZeroAddress();
```
```solidity
File: src/L2/L2ERC721Bridge.sol
93: require(_remoteToken != address(0), "L2ERC721Bridge: remote token cannot be address(0)");
```
```solidity
File: src/L2/L2StandardBridge.sol
153: if (_l1Token == address(0) && _l2Token == Predeploys.LEGACY_ERC20_ETH) {
```
```solidity
File: src/L2/USDB.sol
103: if (_to == address(0)) {
119: if (_from == address(0)) {
```
```solidity
File: src/governance/MintManager.sol
59: require(_newMintManager != address(0), "MintManager: mint manager cannot be the zero address");
```
```solidity
File: src/legacy/DeployerWhitelist.sol
61: require(_owner != address(0), "DeployerWhitelist: can only be disabled via enableArbitraryContractDeployment");
77: return (owner == address(0) || whitelist[_deployer]);
```
```solidity
File: src/legacy/L1ChugSplashProxy.sol
65: if (msg.sender == _getOwner() || msg.sender == address(0)) {
178: require(implementation != address(0), "L1ChugSplashProxy: implementation is not set yet");
```
```solidity
File: src/legacy/ResolvedDelegateProxy.sol
37: require(target != address(0), "ResolvedDelegateProxy: target address must be initialized");
```
```solidity
File: src/mainnet-bridge/Insurance.sol
52: if (_admin == address(0)) {
```
```solidity
File: src/mainnet-bridge/L1BlastBridge.sol
126: require(token != address(0));
244: require(usdYieldToken.provider != address(0));
266: require(_remoteToken == address(0), "L1BlastBridge: this token can only be bridged to ETH");
271: require(ethYieldToken.provider != address(0));
```
```solidity
File: src/mainnet-bridge/YieldManager.sol
143: require(_admin != address(0));
152: require(_insurance != address(0));
162: require(_blastBridge != address(0));
244: insurance != address(0)
270: insurance != address(0)
315: require(insurance != address(0));
```
```solidity
File: src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol
393: if (TOKEN == address(0)) {
```
```solidity
File: src/mainnet-bridge/yield-providers/DSRYieldProvider.sol
87: return YIELD_MANAGER.insurance() != address(0);
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
100: return YIELD_MANAGER.insurance() != address(0);
```
```solidity
File: src/universal/ERC721Bridge.sol
66: require(_otherBridge != address(0), "ERC721Bridge: other bridge cannot be address(0)");
148: require(_to != address(0), "ERC721Bridge: nft recipient cannot be address(0)");
```
```solidity
File: src/universal/OptimismMintableERC20Factory.sol
107: require(_remoteToken != address(0), "OptimismMintableERC20Factory: must provide remote token address");
```
```solidity
File: src/universal/OptimismMintableERC721.sol
52: require(_bridge != address(0), "OptimismMintableERC721: bridge cannot be address(0)");
54: require(_remoteToken != address(0), "OptimismMintableERC721: remote token cannot be address(0)");
```
```solidity
File: src/universal/OptimismMintableERC721Factory.sol
51: require(_remoteToken != address(0), "OptimismMintableERC721Factory: L1 token address cannot be address(0)");
```
```solidity
File: src/universal/Proxy.sol
27: if (msg.sender == _getAdmin() || msg.sender == address(0)) {
125: require(impl != address(0), "Proxy: implementation not initialized");
```
### <a name="GAS-3"></a>[GAS-3] `array[index] += amount` is cheaper than `array[index] = array[index] + amount` (or related variants)
When updating a value in an array with arithmetic, using `array[index] += amount` is cheaper than `array[index] = array[index] + amount`.
This is because you avoid an additonal `mload` when the array is stored in memory, and an `sload` when the array is stored in storage.
This can be applied for any arithmetic operation including `+=`, `-=`,`/=`,`*=`,`^=`,`&=`, `%=`, `<<=`,`>>=`, and `>>>=`.
This optimization can be particularly significant if the pattern occurs during a loop.
*Saves 28 gas for a storage array, 38 for a memory array*
*Instances (2)*:
```solidity
File: src/universal/StandardBridge.sol
286: deposits[_localToken][_remoteToken] = deposits[_localToken][_remoteToken] - _amount;
355: deposits[_localToken][_remoteToken] = deposits[_localToken][_remoteToken] + _amount;
```
### <a name="GAS-4"></a>[GAS-4] Using bools for storage incurs overhead
Use uint256(1) and uint256(2) for true/false to avoid a Gwarmaccess (100 gas), and to avoid Gsset (20000 gas) when changing from ‘false’ to ‘true’, after having been ‘true’ in the past. See [source](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/58f635312aa21f947cae5f8578638a85aa2519f5/contracts/security/ReentrancyGuard.sol#L23-L27).
*Instances (19)*:
```solidity
File: src/L1/L1ERC721Bridge.sol
19: mapping(address => mapping(address => mapping(uint256 => bool))) public deposits;
```
```solidity
File: src/L1/OptimismPortal.sol
50: mapping(bytes32 => bool) public finalizedWithdrawals;
58: bool public paused;
```
```solidity
File: src/L2/CrossDomainOwnable3.sol
16: bool public isLocal = true;
```
```solidity
File: src/L2/L2ToL1MessagePasser.sol
24: mapping(bytes32 => bool) public sentMessages;
```
```solidity
File: src/cannon/PreimageOracle.sol
16: mapping(bytes32 => mapping(uint256 => bool)) public preimagePartOk;
```
```solidity
File: src/dispute/FaultDisputeGame.sol
76: mapping(ClaimHash => bool) internal claims;
82: bool internal subgameAtRootResolved;
```
```solidity
File: src/legacy/DeployerWhitelist.sol
21: mapping(address => bool) public whitelist;
```
```solidity
File: src/legacy/LegacyMessagePasser.sol
14: mapping(bytes32 => bool) public sentMessages;
```
```solidity
File: src/periphery/faucet/Faucet.sol
56: mapping(bytes32 => mapping(bytes32 => bool)) public nonces;
```
```solidity
File: src/periphery/op-nft/OptimistInviter.sol
85: mapping(address => mapping(bytes32 => bool)) public usedNonces;
```
```solidity
File: src/universal/CrossDomainMessenger.sol
50: bool private spacer_101_0_1;
71: mapping(bytes32 => bool) private spacer_201_0_32;
76: mapping(bytes32 => bool) private spacer_202_0_32;
123: mapping(bytes32 => bool) public successfulMessages;
139: mapping(bytes32 => bool) public failedMessages;
```
```solidity
File: src/universal/OptimismMintableERC721Factory.sol
17: mapping(address => bool) public isOptimismMintableERC721;
```
```solidity
File: src/universal/ProxyAdmin.sol
54: bool internal upgrading;
```
### <a name="GAS-5"></a>[GAS-5] Cache array length outside of loop
If not cached, the solidity compiler will always read the length of the array during each iteration. That is, if it is a storage array, this is an extra sload operation (100 additional extra gas for each iteration except for the first) and if it is a memory array, this is an extra mload operation (3 additional gas for each iteration except for the first).
*Instances (16)*:
```solidity
File: src/Safe/LivenessGuard.sol
49: for (uint256 i = 0; i < owners.length; i++) {
90: for (uint256 i = 0; i < owners.length; i++) {
113: for (uint256 i = 0; i < signers.length; i++) {
131: for (uint256 i = 0; i < ownersAfter.length; i++) {
144: for (uint256 i = 0; i < ownersBeforeCache.length; i++) {
```
```solidity
File: src/Safe/LivenessModule.sol
121: for (uint256 i = 0; i < _previousOwners.length; i++) {
```
```solidity
File: src/dispute/FaultDisputeGame.sol
399: for (uint256 i = 0; i < challengeIndices.length; ++i) {
```
```solidity
File: src/libraries/rlp/RLPWriter.sol
96: for (uint256 j = 0; j < out_.length; j++) {
141: for (; i < _list.length; i++) {
151: for (i = 0; i < _list.length; i++) {
```
```solidity
File: src/libraries/trie/MerkleTrie.sol
77: for (uint256 i = 0; i < proof.length; i++) {
```
```solidity
File: src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol
132: for (uint256 i = 0; i < _requestIds.length; ++i) {
147: for (uint256 i = 0; i < _requestIds.length; ++i) {
259: for (uint256 i = 0; i < _requestIds.length; ++i) {
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
196: for (i = 0; i < statuses.length; i++) {
```
```solidity
File: src/periphery/drippie/Drippie.sol
111: for (uint256 i = 0; i < _config.actions.length; i++) {
```
### <a name="GAS-6"></a>[GAS-6] State variables should be cached in stack variables rather than re-reading them from storage
The instances below point to the second+ access of a state variable within a function. Caching of a state variable replaces each Gwarmaccess (100 gas) with a much cheaper stack read. Other less obvious fixes/optimizations include having local memory caches of state variable structs, or having local caches of state variable contracts/addresses.
*Saves 100 gas per instance*
*Instances (1)*:
```solidity
File: src/mainnet-bridge/YieldManager.sol
283: totalYield -= int256(accumulatedNegativeYields);
```
### <a name="GAS-7"></a>[GAS-7] Use calldata instead of memory for function arguments that do not get mutated
Mark data types as `calldata` instead of `memory` where possible. This makes it so that the data is not automatically loaded into memory. If the data passed into the function does not need to be changed (like updating values in an array), it can be passed in as `calldata`. The one exception to this is if the argument must later be passed into another function that takes an argument that specifies `memory` storage.
*Instances (53)*:
```solidity
File: src/L1/OptimismPortal.sol
217: Types.WithdrawalTransaction memory _tx,
306: function finalizeWithdrawalTransaction(uint256 hintId, Types.WithdrawalTransaction memory _tx) external whenNotPaused {
413: bytes memory _data
```
```solidity
File: src/L1/SystemConfig.sol
162: ResourceMetering.ResourceConfig memory _config,
165: SystemConfig.Addresses memory _addresses
343: function setResourceConfig(ResourceMetering.ResourceConfig memory _config) external onlyOwner {
```
```solidity
File: src/L2/GasPriceOracle.sol
34: function getL1Fee(bytes memory _data) external view returns (uint256) {
86: function getL1GasUsed(bytes memory _data) public view returns (uint256) {
```
```solidity
File: src/L2/L2ToL1MessagePasser.sol
73: function initiateWithdrawal(address _target, uint256 _gasLimit, bytes memory _data) public payable {
```
```solidity
File: src/Safe/LivenessGuard.sol
72: bytes memory data,
79: bytes memory signatures,
```
```solidity
File: src/Safe/LivenessModule.sol
114: function removeOwners(address[] memory _previousOwners, address[] memory _ownersToRemove) external {
114: function removeOwners(address[] memory _previousOwners, address[] memory _ownersToRemove) external {
```
```solidity
File: src/legacy/AddressManager.sol
25: function setAddress(string memory _name, address _address) external onlyOwner {
36: function getAddress(string memory _name) external view returns (address) {
```
```solidity
File: src/legacy/L1ChugSplashProxy.sol
96: function setCode(bytes memory _code) external proxyCallIfNotOwner {
```
```solidity
File: src/legacy/LegacyMessagePasser.sol
22: function passMessageToL1(bytes memory _message) external {
```
```solidity
File: src/legacy/LegacyMintableERC20.sol
30: string memory _name,
31: string memory _symbol
```
```solidity
File: src/legacy/ResolvedDelegateProxy.sol
27: constructor(AddressManager _addressManager, string memory _implementationName) {
```
```solidity
File: src/mainnet-bridge/USDYieldManager.sol
49: bytes memory _extraData
```
```solidity
File: src/periphery/TransferOnion.sol
44: function peel(Layer[] memory _layers) public nonReentrant {
```
```solidity
File: src/periphery/drippie/dripchecks/CheckBalanceHigh.sol
19: function check(bytes memory _params) external view returns (bool execute_) {
```
```solidity
File: src/periphery/drippie/dripchecks/CheckBalanceLow.sol
19: function check(bytes memory _params) external view returns (bool execute_) {
```
```solidity
File: src/periphery/drippie/dripchecks/CheckGelatoLow.sol
24: function check(bytes memory _params) external view returns (bool execute_) {
```
```solidity
File: src/periphery/drippie/dripchecks/CheckTrue.sol
10: function check(bytes memory) external pure returns (bool execute_) {
```
```solidity
File: src/periphery/faucet/Faucet.sol
84: function configure(IFaucetAuthModule _module, ModuleConfig memory _config) public priviledged {
91: function drip(DripParameters memory _params, AuthParameters memory _auth) public {
91: function drip(DripParameters memory _params, AuthParameters memory _auth) public {
```
```solidity
File: src/periphery/faucet/authmodules/AdminFaucetAuthModule.sol
32: constructor(address _admin, string memory _name, string memory _version) EIP712(_name, _version) {
32: constructor(address _admin, string memory _name, string memory _version) EIP712(_name, _version) {
38: Faucet.DripParameters memory _params,
40: bytes memory _proof
```
```solidity
File: src/periphery/faucet/authmodules/IFaucetAuthModule.sol
15: Faucet.DripParameters memory _params,
17: bytes memory _proof
```
```solidity
File: src/periphery/op-nft/AttestationStation.sol
38: function attest(address _about, bytes32 _key, bytes memory _val) public {
```
```solidity
File: src/periphery/op-nft/OptimistInviter.sol
104: function initialize(string memory _name) public initializer {
175: function claimInvite(address _claimer, ClaimableInvite calldata _claimableInvite, bytes memory _signature) public {
```
```solidity
File: src/universal/OptimismMintableERC20.sol
49: string memory _name,
50: string memory _symbol,
```
```solidity
File: src/universal/OptimismMintableERC20Factory.sol
67: string memory _name,
68: string memory _symbol
83: string memory _name,
84: string memory _symbol
100: string memory _name,
101: string memory _symbol,
```
```solidity
File: src/universal/OptimismMintableERC721.sol
47: string memory _name,
48: string memory _symbol
```
```solidity
File: src/universal/OptimismMintableERC721Factory.sol
45: string memory _name,
46: string memory _symbol
```
```solidity
File: src/universal/ProxyAdmin.sol
73: function setImplementationName(address _address, string memory _name) external onlyOwner {
90: function setAddress(string memory _name, address _address) external onlyOwner {
187: bytes memory _data
```
### <a name="GAS-8"></a>[GAS-8] For Operations that will not overflow, you could use unchecked
*Instances (1706)*:
```solidity
File: src/EAS/Common.sol
19: uint8 v; // The recovery ID.
19: uint8 v; // The recovery ID.
20: bytes32 r; // The x-coordinate of the nonce R.
20: bytes32 r; // The x-coordinate of the nonce R.
20: bytes32 r; // The x-coordinate of the nonce R.
21: bytes32 s; // The signature data.
21: bytes32 s; // The signature data.
26: bytes32 uid; // A unique identifier of the attestation.
26: bytes32 uid; // A unique identifier of the attestation.
27: bytes32 schema; // The unique identifier of the schema.
27: bytes32 schema; // The unique identifier of the schema.
28: uint64 time; // The time when the attestation was created (Unix timestamp).
28: uint64 time; // The time when the attestation was created (Unix timestamp).
29: uint64 expirationTime; // The time when the attestation expires (Unix timestamp).
29: uint64 expirationTime; // The time when the attestation expires (Unix timestamp).
30: uint64 revocationTime; // The time when the attestation was revoked (Unix timestamp).
30: uint64 revocationTime; // The time when the attestation was revoked (Unix timestamp).
31: bytes32 refUID; // The UID of the related attestation.
31: bytes32 refUID; // The UID of the related attestation.
32: address recipient; // The recipient of the attestation.
32: address recipient; // The recipient of the attestation.
33: address attester; // The attester/sender of the attestation.
33: address attester; // The attester/sender of the attestation.
33: address attester; // The attester/sender of the attestation.
34: bool revocable; // Whether the attestation is revocable.
34: bool revocable; // Whether the attestation is revocable.
35: bytes data; // Custom attestation data.
35: bytes data; // Custom attestation data.
46: j = i + 1;
```
```solidity
File: src/EAS/EAS.sol
4: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
4: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
4: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
5: import { ISemver } from "src/universal/ISemver.sol";
5: import { ISemver } from "src/universal/ISemver.sol";
6: import { Predeploys } from "src/libraries/Predeploys.sol";
6: import { Predeploys } from "src/libraries/Predeploys.sol";
7: import { EIP1271Verifier } from "src/EAS/eip1271/EIP1271Verifier.sol";
7: import { EIP1271Verifier } from "src/EAS/eip1271/EIP1271Verifier.sol";
7: import { EIP1271Verifier } from "src/EAS/eip1271/EIP1271Verifier.sol";
8: import { ISchemaResolver } from "src/EAS/resolver/ISchemaResolver.sol";
8: import { ISchemaResolver } from "src/EAS/resolver/ISchemaResolver.sol";
8: import { ISchemaResolver } from "src/EAS/resolver/ISchemaResolver.sol";
19: } from "./Common.sol";
34: } from "./IEAS.sol";
36: import { ISchemaRegistry, SchemaRecord } from "./ISchemaRegistry.sol";
39: uint256 usedValue; // Total ETH amount that was sent to resolvers.
39: uint256 usedValue; // Total ETH amount that was sent to resolvers.
40: bytes32[] uids; // UIDs of the new attestations.
40: bytes32[] uids; // UIDs of the new attestations.
80: uint256[MAX_GAP - 3] private __gap;
139: last = i == length - 1;
154: availableValue -= res.usedValue;
159: totalUidsCount += res.uids.length;
191: last = i == length - 1;
221: availableValue -= res.usedValue;
226: totalUidsCount += res.uids.length;
267: last = i == length - 1;
273: availableValue -= _revoke(multiRequest.schema, multiRequest.data, msg.sender, availableValue, last);
295: last = i == length - 1;
321: availableValue -=
451: ++bump;
451: ++bump;
593: availableValue -= value;
674: availableValue -= value;
675: totalUsedValue += value;
770: ++currentIndex;
770: ++currentIndex;
```
```solidity
File: src/EAS/IEAS.sol
4: import { ISchemaRegistry } from "src/EAS/ISchemaRegistry.sol";
4: import { ISchemaRegistry } from "src/EAS/ISchemaRegistry.sol";
5: import { Attestation, Signature } from "src/EAS/Common.sol";
5: import { Attestation, Signature } from "src/EAS/Common.sol";
9: address recipient; // The recipient of the attestation.
9: address recipient; // The recipient of the attestation.
10: uint64 expirationTime; // The time when the attestation expires (Unix timestamp).
10: uint64 expirationTime; // The time when the attestation expires (Unix timestamp).
11: bool revocable; // Whether the attestation is revocable.
11: bool revocable; // Whether the attestation is revocable.
12: bytes32 refUID; // The UID of the related attestation.
12: bytes32 refUID; // The UID of the related attestation.
13: bytes data; // Custom attestation data.
13: bytes data; // Custom attestation data.
14: uint256 value; // An explicit ETH amount to send to the resolver. This is important to prevent accidental user
14: uint256 value; // An explicit ETH amount to send to the resolver. This is important to prevent accidental user
20: bytes32 schema; // The unique identifier of the schema.
20: bytes32 schema; // The unique identifier of the schema.
21: AttestationRequestData data; // The arguments of the attestation request.
21: AttestationRequestData data; // The arguments of the attestation request.
26: bytes32 schema; // The unique identifier of the schema.
26: bytes32 schema; // The unique identifier of the schema.
27: AttestationRequestData data; // The arguments of the attestation request.
27: AttestationRequestData data; // The arguments of the attestation request.
28: Signature signature; // The ECDSA signature data.
28: Signature signature; // The ECDSA signature data.
29: address attester; // The attesting account.
29: address attester; // The attesting account.
30: uint64 deadline; // The deadline of the signature/request.
30: uint64 deadline; // The deadline of the signature/request.
30: uint64 deadline; // The deadline of the signature/request.
35: bytes32 schema; // The unique identifier of the schema.
35: bytes32 schema; // The unique identifier of the schema.
36: AttestationRequestData[] data; // The arguments of the attestation request.
36: AttestationRequestData[] data; // The arguments of the attestation request.
41: bytes32 schema; // The unique identifier of the schema.
41: bytes32 schema; // The unique identifier of the schema.
42: AttestationRequestData[] data; // The arguments of the attestation requests.
42: AttestationRequestData[] data; // The arguments of the attestation requests.
43: Signature[] signatures; // The ECDSA signatures data. Please note that the signatures are assumed to be signed with
43: Signature[] signatures; // The ECDSA signatures data. Please note that the signatures are assumed to be signed with
45: address attester; // The attesting account.
45: address attester; // The attesting account.
46: uint64 deadline; // The deadline of the signature/request.
46: uint64 deadline; // The deadline of the signature/request.
46: uint64 deadline; // The deadline of the signature/request.
51: bytes32 uid; // The UID of the attestation to revoke.
51: bytes32 uid; // The UID of the attestation to revoke.
52: uint256 value; // An explicit ETH amount to send to the resolver. This is important to prevent accidental user
52: uint256 value; // An explicit ETH amount to send to the resolver. This is important to prevent accidental user
58: bytes32 schema; // The unique identifier of the schema.
58: bytes32 schema; // The unique identifier of the schema.
59: RevocationRequestData data; // The arguments of the revocation request.
59: RevocationRequestData data; // The arguments of the revocation request.
64: bytes32 schema; // The unique identifier of the schema.
64: bytes32 schema; // The unique identifier of the schema.
65: RevocationRequestData data; // The arguments of the revocation request.
65: RevocationRequestData data; // The arguments of the revocation request.
66: Signature signature; // The ECDSA signature data.
66: Signature signature; // The ECDSA signature data.
67: address revoker; // The revoking account.
67: address revoker; // The revoking account.
68: uint64 deadline; // The deadline of the signature/request.
68: uint64 deadline; // The deadline of the signature/request.
68: uint64 deadline; // The deadline of the signature/request.
73: bytes32 schema; // The unique identifier of the schema.
73: bytes32 schema; // The unique identifier of the schema.
74: RevocationRequestData[] data; // The arguments of the revocation request.
74: RevocationRequestData[] data; // The arguments of the revocation request.
79: bytes32 schema; // The unique identifier of the schema.
79: bytes32 schema; // The unique identifier of the schema.
80: RevocationRequestData[] data; // The arguments of the revocation requests.
80: RevocationRequestData[] data; // The arguments of the revocation requests.
81: Signature[] signatures; // The ECDSA signatures data. Please note that the signatures are assumed to be signed with
81: Signature[] signatures; // The ECDSA signatures data. Please note that the signatures are assumed to be signed with
83: address revoker; // The revoking account.
83: address revoker; // The revoking account.
84: uint64 deadline; // The deadline of the signature/request.
84: uint64 deadline; // The deadline of the signature/request.
84: uint64 deadline; // The deadline of the signature/request.
```
```solidity
File: src/EAS/ISchemaRegistry.sol
4: import { ISchemaResolver } from "src/EAS/resolver/ISchemaResolver.sol";
4: import { ISchemaResolver } from "src/EAS/resolver/ISchemaResolver.sol";
4: import { ISchemaResolver } from "src/EAS/resolver/ISchemaResolver.sol";
8: bytes32 uid; // The unique identifier of the schema.
8: bytes32 uid; // The unique identifier of the schema.
9: ISchemaResolver resolver; // Optional schema resolver.
9: ISchemaResolver resolver; // Optional schema resolver.
10: bool revocable; // Whether the schema allows revocations explicitly.
10: bool revocable; // Whether the schema allows revocations explicitly.
11: string schema; // Custom specification of the schema (e.g., an ABI).
11: string schema; // Custom specification of the schema (e.g., an ABI).
```
```solidity
File: src/EAS/SchemaRegistry.sol
4: import { ISemver } from "src/universal/ISemver.sol";
4: import { ISemver } from "src/universal/ISemver.sol";
5: import { ISchemaResolver } from "src/EAS/resolver/ISchemaResolver.sol";
5: import { ISchemaResolver } from "src/EAS/resolver/ISchemaResolver.sol";
5: import { ISchemaResolver } from "src/EAS/resolver/ISchemaResolver.sol";
6: import { EMPTY_UID, MAX_GAP } from "src/EAS/Common.sol";
6: import { EMPTY_UID, MAX_GAP } from "src/EAS/Common.sol";
7: import { ISchemaRegistry, SchemaRecord } from "src/EAS/ISchemaRegistry.sol";
7: import { ISchemaRegistry, SchemaRecord } from "src/EAS/ISchemaRegistry.sol";
20: uint256[MAX_GAP - 1] private __gap;
```
```solidity
File: src/EAS/eip1271/EIP1271Verifier.sol
4: import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
4: import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
4: import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
4: import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
4: import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
5: import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
5: import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
5: import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
5: import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
6: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
6: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
6: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
13: } from "../IEAS.sol";
23: } from "../Common.sol";
48: uint256[MAX_GAP - 1] private __gap;
126: _nonces[request.attester]++,
126: _nonces[request.attester]++,
153: REVOKE_TYPEHASH, request.schema, data.uid, data.value, _nonces[request.revoker]++, request.deadline
153: REVOKE_TYPEHASH, request.schema, data.uid, data.value, _nonces[request.revoker]++, request.deadline
```
```solidity
File: src/EAS/resolver/ISchemaResolver.sol
4: import { Attestation } from "../Common.sol";
```
```solidity
File: src/EAS/resolver/SchemaResolver.sol
4: import { Semver } from "../../universal/Semver.sol";
4: import { Semver } from "../../universal/Semver.sol";
4: import { Semver } from "../../universal/Semver.sol";
6: import { IEAS, Attestation } from "../IEAS.sol";
7: import { AccessDenied, InvalidEAS, InvalidLength, uncheckedInc } from "../Common.sol";
9: import { ISchemaResolver } from "./ISchemaResolver.sol";
89: remainingValue -= value;
136: remainingValue -= value;
```
```solidity
File: src/L1/DelayedVetoable.sol
4: import { ISemver } from "src/universal/ISemver.sol";
4: import { ISemver } from "src/universal/ISemver.sol";
173: if (_queuedAt[callHash] + _delay < block.timestamp) {
```
```solidity
File: src/L1/L1CrossDomainMessenger.sol
4: import { Predeploys } from "src/libraries/Predeploys.sol";
4: import { Predeploys } from "src/libraries/Predeploys.sol";
5: import { SafeCall } from "src/libraries/SafeCall.sol";
5: import { SafeCall } from "src/libraries/SafeCall.sol";
6: import { Hashing } from "src/libraries/Hashing.sol";
6: import { Hashing } from "src/libraries/Hashing.sol";
7: import { Encoding } from "src/libraries/Encoding.sol";
7: import { Encoding } from "src/libraries/Encoding.sol";
8: import { OptimismPortal } from "src/L1/OptimismPortal.sol";
8: import { OptimismPortal } from "src/L1/OptimismPortal.sol";
9: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
9: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
10: import { ISemver } from "src/universal/ISemver.sol";
10: import { ISemver } from "src/universal/ISemver.sol";
11: import { Constants } from "src/libraries/Constants.sol";
11: import { Constants } from "src/libraries/Constants.sol";
126: !SafeCall.hasMinGas(_minGasLimit, RELAY_RESERVED_GAS + RELAY_GAS_CHECK_BUFFER)
148: bool success = SafeCall.call(_target, gasleft() - RELAY_RESERVED_GAS, _valueWithDiscount, _message);
```
```solidity
File: src/L1/L1ERC721Bridge.sol
4: import { ERC721Bridge } from "src/universal/ERC721Bridge.sol";
4: import { ERC721Bridge } from "src/universal/ERC721Bridge.sol";
5: import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
5: import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
5: import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
5: import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
6: import { L2ERC721Bridge } from "src/L2/L2ERC721Bridge.sol";
6: import { L2ERC721Bridge } from "src/L2/L2ERC721Bridge.sol";
7: import { ISemver } from "src/universal/ISemver.sol";
7: import { ISemver } from "src/universal/ISemver.sol";
8: import { Predeploys } from "src/libraries/Predeploys.sol";
8: import { Predeploys } from "src/libraries/Predeploys.sol";
9: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
9: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
10: import { Constants } from "src/libraries/Constants.sol";
10: import { Constants } from "src/libraries/Constants.sol";
```
```solidity
File: src/L1/L1StandardBridge.sol
4: import { Predeploys } from "src/libraries/Predeploys.sol";
4: import { Predeploys } from "src/libraries/Predeploys.sol";
5: import { SafeCall } from "src/libraries/SafeCall.sol";
5: import { SafeCall } from "src/libraries/SafeCall.sol";
6: import { StandardBridge } from "src/universal/StandardBridge.sol";
6: import { StandardBridge } from "src/universal/StandardBridge.sol";
7: import { ISemver } from "src/universal/ISemver.sol";
7: import { ISemver } from "src/universal/ISemver.sol";
8: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
8: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
9: import { Constants } from "src/libraries/Constants.sol";
9: import { Constants } from "src/libraries/Constants.sol";
```
```solidity
File: src/L1/L2OutputOracle.sol
4: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
5: import { ISemver } from "src/universal/ISemver.sol";
5: import { ISemver } from "src/universal/ISemver.sol";
6: import { Types } from "src/libraries/Types.sol";
6: import { Types } from "src/libraries/Types.sol";
7: import { Constants } from "src/libraries/Constants.sol";
7: import { Constants } from "src/libraries/Constants.sol";
155: block.timestamp - l2Outputs[_l2OutputIndex].timestamp < FINALIZATION_PERIOD_SECONDS,
251: uint256 mid = (lo + hi) / 2;
251: uint256 mid = (lo + hi) / 2;
253: lo = mid + 1;
275: return l2Outputs.length - 1;
289: return l2Outputs.length == 0 ? startingBlockNumber : l2Outputs[l2Outputs.length - 1].l2BlockNumber;
295: return latestBlockNumber() + SUBMISSION_INTERVAL;
302: return startingTimestamp + ((_l2BlockNumber - startingBlockNumber) * L2_BLOCK_TIME);
302: return startingTimestamp + ((_l2BlockNumber - startingBlockNumber) * L2_BLOCK_TIME);
302: return startingTimestamp + ((_l2BlockNumber - startingBlockNumber) * L2_BLOCK_TIME);
```
```solidity
File: src/L1/OptimismPortal.sol
4: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
5: import { SafeCall } from "src/libraries/SafeCall.sol";
5: import { SafeCall } from "src/libraries/SafeCall.sol";
6: import { L2OutputOracle } from "src/L1/L2OutputOracle.sol";
6: import { L2OutputOracle } from "src/L1/L2OutputOracle.sol";
7: import { SystemConfig } from "src/L1/SystemConfig.sol";
7: import { SystemConfig } from "src/L1/SystemConfig.sol";
8: import { Constants } from "src/libraries/Constants.sol";
8: import { Constants } from "src/libraries/Constants.sol";
9: import { Types } from "src/libraries/Types.sol";
9: import { Types } from "src/libraries/Types.sol";
10: import { Hashing } from "src/libraries/Hashing.sol";
10: import { Hashing } from "src/libraries/Hashing.sol";
11: import { SecureMerkleTrie } from "src/libraries/trie/SecureMerkleTrie.sol";
11: import { SecureMerkleTrie } from "src/libraries/trie/SecureMerkleTrie.sol";
11: import { SecureMerkleTrie } from "src/libraries/trie/SecureMerkleTrie.sol";
12: import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
12: import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
13: import { ResourceMetering } from "src/L1/ResourceMetering.sol";
13: import { ResourceMetering } from "src/L1/ResourceMetering.sol";
14: import { ISemver } from "src/universal/ISemver.sol";
14: import { ISemver } from "src/universal/ISemver.sol";
15: import { ETHYieldManager } from "src/mainnet-bridge/ETHYieldManager.sol";
15: import { ETHYieldManager } from "src/mainnet-bridge/ETHYieldManager.sol";
15: import { ETHYieldManager } from "src/mainnet-bridge/ETHYieldManager.sol";
16: import { Predeploys } from "src/libraries/Predeploys.sol";
16: import { Predeploys } from "src/libraries/Predeploys.sol";
189: return _byteCount * 16 + 21000;
189: return _byteCount * 16 + 21000;
261: uint256(0) // The withdrawals mapping is at the first slot in the layout.
261: uint256(0) // The withdrawals mapping is at the first slot in the layout.
372: txValueWithDiscount = address(this).balance - etherBalance;
485: return block.timestamp > _timestamp + l2Oracle.FINALIZATION_PERIOD_SECONDS();
```
```solidity
File: src/L1/ProtocolVersions.sol
4: import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
4: import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
4: import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
4: import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
5: import { ISemver } from "src/universal/ISemver.sol";
5: import { ISemver } from "src/universal/ISemver.sol";
6: import { Storage } from "src/libraries/Storage.sol";
6: import { Storage } from "src/libraries/Storage.sol";
7: import { Constants } from "src/libraries/Constants.sol";
7: import { Constants } from "src/libraries/Constants.sol";
27: bytes32 public constant REQUIRED_SLOT = bytes32(uint256(keccak256("protocolversion.required")) - 1);
30: bytes32 public constant RECOMMENDED_SLOT = bytes32(uint256(keccak256("protocolversion.recommended")) - 1);
```
```solidity
File: src/L1/ResourceMetering.sol
4: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
5: import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
5: import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
5: import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
5: import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
6: import { Burn } from "src/libraries/Burn.sol";
6: import { Burn } from "src/libraries/Burn.sol";
7: import { Arithmetic } from "src/libraries/Arithmetic.sol";
7: import { Arithmetic } from "src/libraries/Arithmetic.sol";
76: uint256 blockDiff = block.number - params.prevBlockNum;
80: int256(uint256(config.maxResourceLimit)) / int256(uint256(config.elasticityMultiplier));
86: int256 gasUsedDelta = int256(uint256(params.prevBoughtGas)) - targetResourceLimit;
87: int256 baseFeeDelta = (int256(uint256(params.prevBaseFee)) * gasUsedDelta)
88: / (targetResourceLimit * int256(uint256(config.baseFeeMaxChangeDenominator)));
88: / (targetResourceLimit * int256(uint256(config.baseFeeMaxChangeDenominator)));
93: _value: int256(uint256(params.prevBaseFee)) + baseFeeDelta,
109: _exponent: int256(blockDiff - 1)
123: params.prevBoughtGas += _amount;
130: uint256 resourceCost = uint256(_amount) * uint256(params.prevBaseFee);
137: uint256 gasCost = resourceCost / Math.max(block.basefee, 1 gwei);
142: uint256 usedGas = _initialGas - gasleft();
144: Burn.gas(gasCost - usedGas);
```
```solidity
File: src/L1/SystemConfig.sol
4: import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
4: import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
4: import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
4: import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
5: import { ISemver } from "src/universal/ISemver.sol";
5: import { ISemver } from "src/universal/ISemver.sol";
6: import { ResourceMetering } from "src/L1/ResourceMetering.sol";
6: import { ResourceMetering } from "src/L1/ResourceMetering.sol";
7: import { Storage } from "src/libraries/Storage.sol";
7: import { Storage } from "src/libraries/Storage.sol";
8: import { Constants } from "src/libraries/Constants.sol";
8: import { Constants } from "src/libraries/Constants.sol";
54: bytes32(uint256(keccak256("systemconfig.l1crossdomainmessenger")) - 1);
57: bytes32 public constant L1_ERC_721_BRIDGE_SLOT = bytes32(uint256(keccak256("systemconfig.l1erc721bridge")) - 1);
60: bytes32 public constant L1_STANDARD_BRIDGE_SLOT = bytes32(uint256(keccak256("systemconfig.l1standardbridge")) - 1);
63: bytes32 public constant L2_OUTPUT_ORACLE_SLOT = bytes32(uint256(keccak256("systemconfig.l2outputoracle")) - 1);
66: bytes32 public constant OPTIMISM_PORTAL_SLOT = bytes32(uint256(keccak256("systemconfig.optimismportal")) - 1);
70: bytes32(uint256(keccak256("systemconfig.optimismmintableerc20factory")) - 1);
73: bytes32 public constant BATCH_INBOX_SLOT = bytes32(uint256(keccak256("systemconfig.batchinbox")) - 1);
200: return uint64(_resourceConfig.maxResourceLimit) + uint64(_resourceConfig.systemTxMaxGas);
359: require(_config.maxResourceLimit + _config.systemTxMaxGas <= gasLimit, "SystemConfig: gas limit too low");
364: ((_config.maxResourceLimit / _config.elasticityMultiplier) * _config.elasticityMultiplier)
364: ((_config.maxResourceLimit / _config.elasticityMultiplier) * _config.elasticityMultiplier)
```
```solidity
File: src/L2/BaseFeeVault.sol
4: import { ISemver } from "src/universal/ISemver.sol";
4: import { ISemver } from "src/universal/ISemver.sol";
5: import { FeeVault } from "src/universal/FeeVault.sol";
5: import { FeeVault } from "src/universal/FeeVault.sol";
```
```solidity
File: src/L2/Blast.sol
3: import { GasMode, IGas } from "src/L2/Gas.sol";
3: import { GasMode, IGas } from "src/L2/Gas.sol";
```
```solidity
File: src/L2/CrossDomainOwnable.sol
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
5: import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
5: import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
```
```solidity
File: src/L2/CrossDomainOwnable2.sol
4: import { Predeploys } from "src/libraries/Predeploys.sol";
4: import { Predeploys } from "src/libraries/Predeploys.sol";
5: import { L2CrossDomainMessenger } from "src/L2/L2CrossDomainMessenger.sol";
5: import { L2CrossDomainMessenger } from "src/L2/L2CrossDomainMessenger.sol";
6: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
6: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
6: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
```
```solidity
File: src/L2/CrossDomainOwnable3.sol
4: import { Predeploys } from "src/libraries/Predeploys.sol";
4: import { Predeploys } from "src/libraries/Predeploys.sol";
5: import { L2CrossDomainMessenger } from "src/L2/L2CrossDomainMessenger.sol";
5: import { L2CrossDomainMessenger } from "src/L2/L2CrossDomainMessenger.sol";
6: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
6: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
6: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
```
```solidity
File: src/L2/ERC20PermitUpgradeable.sol
6: import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol";
6: import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol";
6: import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol";
6: import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol";
6: import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol";
6: import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol";
7: import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
7: import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
7: import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
7: import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
7: import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
8: import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
8: import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
8: import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
8: import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
8: import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
9: import "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
9: import "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
9: import "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
9: import "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
9: import "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
10: import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
10: import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
10: import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
10: import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
11: import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
11: import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
11: import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
11: import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
11: import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
```
```solidity
File: src/L2/ERC20Rebasing.sol
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
7: import { SharesBase } from "src/L2/Shares.sol";
7: import { SharesBase } from "src/L2/Shares.sol";
8: import { YieldMode } from "src/L2/Blast.sol";
8: import { YieldMode } from "src/L2/Blast.sol";
9: import { ERC20PermitUpgradeable } from "src/L2/ERC20PermitUpgradeable.sol";
9: import { ERC20PermitUpgradeable } from "src/L2/ERC20PermitUpgradeable.sol";
103: return price * _totalShares + _totalVoidAndRemainders;
103: return price * _totalShares + _totalVoidAndRemainders;
181: return shareValue - _fixed[account];
201: uint256 claimableAmount = shareValue - _fixed[account];
206: (uint256 newShares, uint256 newRemainder) = _computeSharesAndRemainder(shareValue - amount);
275: _approve(owner, spender, currentAllowance - amount);
284: uint256 balanceAfter = balanceOf(account) + amount;
291: _totalVoidAndRemainders += amount;
305: _setBalance(account, balance - amount, false);
312: _totalVoidAndRemainders -= amount;
341: _totalVoidAndRemainders -= prevFixed;
347: _totalVoidAndRemainders += balance;
373: shareValue = shareValue + amount - _fixed[account];
373: shareValue = shareValue + amount - _fixed[account];
388: _totalShares = _totalShares + newShares - _shares[account];
388: _totalShares = _totalShares + newShares - _shares[account];
389: _totalVoidAndRemainders = _totalVoidAndRemainders + newRemainder - _remainders[account];
389: _totalVoidAndRemainders = _totalVoidAndRemainders + newRemainder - _remainders[account];
403: shares = value / price;
413: return price * shares + remainders;
413: return price * shares + remainders;
```
```solidity
File: src/L2/Gas.sol
3: import { SafeTransferLib } from "solmate/utils/SafeTransferLib.sol";
3: import { SafeTransferLib } from "solmate/utils/SafeTransferLib.sol";
4: import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
4: import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
4: import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
4: import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
31: uint256 public zeroClaimRate; // bps
31: uint256 public zeroClaimRate; // bps
36: uint256 public baseClaimRate; // bps
36: uint256 public baseClaimRate; // bps
41: uint256 public ceilClaimRate; // bps
41: uint256 public ceilClaimRate; // bps
165: uint256 bipsDiff = minClaimRateBips - baseClaimRate;
166: uint256 secondsDiff = ceilGasSeconds - baseGasSeconds;
167: uint256 rateDiff = ceilClaimRate - baseClaimRate;
168: uint256 minSecondsStaked = baseGasSeconds + Math.ceilDiv(bipsDiff * secondsDiff, rateDiff);
168: uint256 minSecondsStaked = baseGasSeconds + Math.ceilDiv(bipsDiff * secondsDiff, rateDiff);
169: uint256 maxEtherClaimable = etherSeconds / minSecondsStaked;
173: uint256 secondsToConsume = maxEtherClaimable * minSecondsStaked;
211: require(gasToClaim > 0, "must withdraw non-zero amount");
219: uint256 userEther = gasToClaim * claimRate / 10_000;
219: uint256 userEther = gasToClaim * claimRate / 10_000;
220: uint256 penalty = gasToClaim - userEther;
222: _updateGasParams(contractAddress, etherSeconds - gasSecondsToConsumeNormalized, etherBalance - gasToClaim, mode);
222: _updateGasParams(contractAddress, etherSeconds - gasSecondsToConsumeNormalized, etherBalance - gasToClaim, mode);
239: uint256 secondsStaked = gasSecondsToConsume / gasToClaim;
244: uint256 gasToConsumeNormalized = gasToClaim * ceilGasSeconds;
248: uint256 rateDiff = ceilClaimRate - baseClaimRate;
249: uint256 secondsDiff = ceilGasSeconds - baseGasSeconds;
250: uint256 secondsStakedDiff = secondsStaked - baseGasSeconds;
251: uint256 additionalClaimRate = rateDiff * secondsStakedDiff / secondsDiff;
251: uint256 additionalClaimRate = rateDiff * secondsStakedDiff / secondsDiff;
252: uint256 claimRate = baseClaimRate + additionalClaimRate;
278: etherBalance = uint256((packedParams << (1 * 8)) >> ((32 - 12) * 8));
278: etherBalance = uint256((packedParams << (1 * 8)) >> ((32 - 12) * 8));
278: etherBalance = uint256((packedParams << (1 * 8)) >> ((32 - 12) * 8));
279: etherSeconds = uint256((packedParams << ((1 + 12) * 8)) >> ((32 - 15) * 8));
279: etherSeconds = uint256((packedParams << ((1 + 12) * 8)) >> ((32 - 15) * 8));
279: etherSeconds = uint256((packedParams << ((1 + 12) * 8)) >> ((32 - 15) * 8));
279: etherSeconds = uint256((packedParams << ((1 + 12) * 8)) >> ((32 - 15) * 8));
280: lastUpdated = uint256((packedParams << ((1 + 12 + 15) * 8)) >> ((32 - 4) * 8));
280: lastUpdated = uint256((packedParams << ((1 + 12 + 15) * 8)) >> ((32 - 4) * 8));
280: lastUpdated = uint256((packedParams << ((1 + 12 + 15) * 8)) >> ((32 - 4) * 8));
280: lastUpdated = uint256((packedParams << ((1 + 12 + 15) * 8)) >> ((32 - 4) * 8));
280: lastUpdated = uint256((packedParams << ((1 + 12 + 15) * 8)) >> ((32 - 4) * 8));
283: etherSeconds = etherSeconds + etherBalance * (block.timestamp - lastUpdated);
283: etherSeconds = etherSeconds + etherBalance * (block.timestamp - lastUpdated);
283: etherSeconds = etherSeconds + etherBalance * (block.timestamp - lastUpdated);
294: etherBalance >= 1 << (12 * 8) ||
295: etherSeconds >= 1 << (15 * 8)
300: uint256 updatedTimestamp = block.timestamp; // Known to fit in 4 bytes
300: uint256 updatedTimestamp = block.timestamp; // Known to fit in 4 bytes
305: (bytes32(uint256(mode)) << ((12 + 15 + 4) * 8)) | // Shift mode to the most significant byte
305: (bytes32(uint256(mode)) << ((12 + 15 + 4) * 8)) | // Shift mode to the most significant byte
305: (bytes32(uint256(mode)) << ((12 + 15 + 4) * 8)) | // Shift mode to the most significant byte
305: (bytes32(uint256(mode)) << ((12 + 15 + 4) * 8)) | // Shift mode to the most significant byte
305: (bytes32(uint256(mode)) << ((12 + 15 + 4) * 8)) | // Shift mode to the most significant byte
306: (bytes32(etherBalance) << ((15 + 4) * 8)) | // Shift etherBalance to start after 1 byte of mode
306: (bytes32(etherBalance) << ((15 + 4) * 8)) | // Shift etherBalance to start after 1 byte of mode
306: (bytes32(etherBalance) << ((15 + 4) * 8)) | // Shift etherBalance to start after 1 byte of mode
306: (bytes32(etherBalance) << ((15 + 4) * 8)) | // Shift etherBalance to start after 1 byte of mode
307: (bytes32(etherSeconds) << (4 * 8)) | // Shift etherSeconds to start after mode and etherBalance
307: (bytes32(etherSeconds) << (4 * 8)) | // Shift etherSeconds to start after mode and etherBalance
307: (bytes32(etherSeconds) << (4 * 8)) | // Shift etherSeconds to start after mode and etherBalance
308: bytes32(updatedTimestamp) // Keep updatedTimestamp in the least significant bytes
308: bytes32(updatedTimestamp) // Keep updatedTimestamp in the least significant bytes
```
```solidity
File: src/L2/GasPriceOracle.sol
4: import { ISemver } from "src/universal/ISemver.sol";
4: import { ISemver } from "src/universal/ISemver.sol";
5: import { Predeploys } from "src/libraries/Predeploys.sol";
5: import { Predeploys } from "src/libraries/Predeploys.sol";
6: import { L1Block } from "src/L2/L1Block.sol";
6: import { L1Block } from "src/L2/L1Block.sol";
36: uint256 l1Fee = l1GasUsed * l1BaseFee();
37: uint256 divisor = 10 ** DECIMALS;
37: uint256 divisor = 10 ** DECIMALS;
38: uint256 unscaled = l1Fee * scalar();
39: uint256 scaled = unscaled / divisor;
89: for (uint256 i = 0; i < length; i++) {
89: for (uint256 i = 0; i < length; i++) {
91: total += 4;
93: total += 16;
96: uint256 unsigned = total + overhead();
97: return unsigned + (68 * 16);
97: return unsigned + (68 * 16);
```
```solidity
File: src/L2/L1Block.sol
4: import { ISemver } from "src/universal/ISemver.sol";
4: import { ISemver } from "src/universal/ISemver.sol";
```
```solidity
File: src/L2/L1FeeVault.sol
4: import { ISemver } from "src/universal/ISemver.sol";
4: import { ISemver } from "src/universal/ISemver.sol";
5: import { FeeVault } from "src/universal/FeeVault.sol";
5: import { FeeVault } from "src/universal/FeeVault.sol";
```
```solidity
File: src/L2/L2CrossDomainMessenger.sol
4: import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
4: import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
5: import { Predeploys } from "src/libraries/Predeploys.sol";
5: import { Predeploys } from "src/libraries/Predeploys.sol";
6: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
6: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
7: import { ISemver } from "src/universal/ISemver.sol";
7: import { ISemver } from "src/universal/ISemver.sol";
8: import { L2ToL1MessagePasser } from "src/L2/L2ToL1MessagePasser.sol";
8: import { L2ToL1MessagePasser } from "src/L2/L2ToL1MessagePasser.sol";
9: import { Constants } from "src/libraries/Constants.sol";
9: import { Constants } from "src/libraries/Constants.sol";
10: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
10: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
35: address(0xdead) /// don't set a governor
35: address(0xdead) /// don't set a governor
35: address(0xdead) /// don't set a governor
```
```solidity
File: src/L2/L2ERC721Bridge.sol
4: import { ERC721Bridge } from "src/universal/ERC721Bridge.sol";
4: import { ERC721Bridge } from "src/universal/ERC721Bridge.sol";
5: import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
5: import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
5: import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
5: import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
6: import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol";
6: import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol";
7: import { IOptimismMintableERC721 } from "src/universal/IOptimismMintableERC721.sol";
7: import { IOptimismMintableERC721 } from "src/universal/IOptimismMintableERC721.sol";
8: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
8: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
9: import { ISemver } from "src/universal/ISemver.sol";
9: import { ISemver } from "src/universal/ISemver.sol";
10: import { Constants } from "src/libraries/Constants.sol";
10: import { Constants } from "src/libraries/Constants.sol";
11: import { Predeploys } from "src/libraries/Predeploys.sol";
11: import { Predeploys } from "src/libraries/Predeploys.sol";
```
```solidity
File: src/L2/L2StandardBridge.sol
4: import { Predeploys } from "src/libraries/Predeploys.sol";
4: import { Predeploys } from "src/libraries/Predeploys.sol";
5: import { StandardBridge } from "src/universal/StandardBridge.sol";
5: import { StandardBridge } from "src/universal/StandardBridge.sol";
6: import { ISemver } from "src/universal/ISemver.sol";
6: import { ISemver } from "src/universal/ISemver.sol";
7: import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
7: import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
8: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
8: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
9: import { Constants } from "src/libraries/Constants.sol";
9: import { Constants } from "src/libraries/Constants.sol";
10: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
10: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
72: address(0xdead) /// don't set a governor
72: address(0xdead) /// don't set a governor
72: address(0xdead) /// don't set a governor
```
```solidity
File: src/L2/L2ToL1MessagePasser.sol
4: import { Types } from "src/libraries/Types.sol";
4: import { Types } from "src/libraries/Types.sol";
5: import { Hashing } from "src/libraries/Hashing.sol";
5: import { Hashing } from "src/libraries/Hashing.sol";
6: import { Encoding } from "src/libraries/Encoding.sol";
6: import { Encoding } from "src/libraries/Encoding.sol";
7: import { Burn } from "src/libraries/Burn.sol";
7: import { Burn } from "src/libraries/Burn.sol";
8: import { ISemver } from "src/universal/ISemver.sol";
8: import { ISemver } from "src/universal/ISemver.sol";
90: ++msgNonce;
90: ++msgNonce;
```
```solidity
File: src/L2/SequencerFeeVault.sol
4: import { ISemver } from "src/universal/ISemver.sol";
4: import { ISemver } from "src/universal/ISemver.sol";
5: import { FeeVault } from "src/universal/FeeVault.sol";
5: import { FeeVault } from "src/universal/FeeVault.sol";
```
```solidity
File: src/L2/Shares.sol
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
6: import { Semver } from "src/universal/Semver.sol";
6: import { Semver } from "src/universal/Semver.sol";
7: import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
7: import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
8: import { Predeploys } from "src/libraries/Predeploys.sol";
8: import { Predeploys } from "src/libraries/Predeploys.sol";
9: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
9: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
69: pending += value;
92: price += pending / count();
92: price += pending / count();
122: address(0xdead) /// don't set a governor
122: address(0xdead) /// don't set a governor
122: address(0xdead) /// don't set a governor
```
```solidity
File: src/L2/USDB.sol
4: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
4: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
4: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
5: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
7: import { ERC20Rebasing } from "src/L2/ERC20Rebasing.sol";
7: import { ERC20Rebasing } from "src/L2/ERC20Rebasing.sol";
8: import { SharesBase } from "src/L2/Shares.sol";
8: import { SharesBase } from "src/L2/Shares.sol";
9: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
9: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
10: import { StandardBridge } from "src/universal/StandardBridge.sol";
10: import { StandardBridge } from "src/universal/StandardBridge.sol";
11: import { IOptimismMintableERC20 } from "src/universal/IOptimismMintableERC20.sol";
11: import { IOptimismMintableERC20 } from "src/universal/IOptimismMintableERC20.sol";
12: import { Semver } from "src/universal/Semver.sol";
12: import { Semver } from "src/universal/Semver.sol";
13: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
13: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
14: import { Predeploys } from "src/libraries/Predeploys.sol";
14: import { Predeploys } from "src/libraries/Predeploys.sol";
69: address(0xdead) /// don't set a governor
69: address(0xdead) /// don't set a governor
69: address(0xdead) /// don't set a governor
```
```solidity
File: src/L2/WETHRebasing.sol
4: import { FixedPointMathLib } from "solmate/utils/FixedPointMathLib.sol";
4: import { FixedPointMathLib } from "solmate/utils/FixedPointMathLib.sol";
6: import { Blast, YieldMode } from "src/L2/Blast.sol";
6: import { Blast, YieldMode } from "src/L2/Blast.sol";
7: import { GasMode } from "src/L2/Gas.sol";
7: import { GasMode } from "src/L2/Gas.sol";
8: import { ERC20Rebasing } from "src/L2/ERC20Rebasing.sol";
8: import { ERC20Rebasing } from "src/L2/ERC20Rebasing.sol";
9: import { SharesBase } from "src/L2/Shares.sol";
9: import { SharesBase } from "src/L2/Shares.sol";
10: import { Predeploys } from "src/libraries/Predeploys.sol";
10: import { Predeploys } from "src/libraries/Predeploys.sol";
11: import { Semver } from "src/universal/Semver.sol";
11: import { Semver } from "src/universal/Semver.sol";
60: address(0xdead) /// don't set a governor
60: address(0xdead) /// don't set a governor
60: address(0xdead) /// don't set a governor
96: uint256 yieldBearingEth = price * _totalShares;
97: uint256 pending = address(this).balance - yieldBearingEth - _totalVoidAndRemainders;
97: uint256 pending = address(this).balance - yieldBearingEth - _totalVoidAndRemainders;
102: price += (pending / _totalShares);
102: price += (pending / _totalShares);
```
```solidity
File: src/Safe/LivenessGuard.sol
4: import { Safe } from "safe-contracts/Safe.sol";
4: import { Safe } from "safe-contracts/Safe.sol";
5: import { BaseGuard, GuardManager } from "safe-contracts/base/GuardManager.sol";
5: import { BaseGuard, GuardManager } from "safe-contracts/base/GuardManager.sol";
5: import { BaseGuard, GuardManager } from "safe-contracts/base/GuardManager.sol";
6: import { ModuleManager } from "safe-contracts/base/ModuleManager.sol";
6: import { ModuleManager } from "safe-contracts/base/ModuleManager.sol";
6: import { ModuleManager } from "safe-contracts/base/ModuleManager.sol";
7: import { SafeSigners } from "src/Safe/SafeSigners.sol";
7: import { SafeSigners } from "src/Safe/SafeSigners.sol";
8: import { Enum } from "safe-contracts/common/Enum.sol";
8: import { Enum } from "safe-contracts/common/Enum.sol";
8: import { Enum } from "safe-contracts/common/Enum.sol";
9: import { ISemver } from "src/universal/ISemver.sol";
9: import { ISemver } from "src/universal/ISemver.sol";
10: import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
10: import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
10: import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
10: import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
49: for (uint256 i = 0; i < owners.length; i++) {
49: for (uint256 i = 0; i < owners.length; i++) {
84: msgSender; // silence unused variable warning
84: msgSender; // silence unused variable warning
90: for (uint256 i = 0; i < owners.length; i++) {
90: for (uint256 i = 0; i < owners.length; i++) {
106: _nonce: SAFE.nonce() - 1
113: for (uint256 i = 0; i < signers.length; i++) {
113: for (uint256 i = 0; i < signers.length; i++) {
131: for (uint256 i = 0; i < ownersAfter.length; i++) {
131: for (uint256 i = 0; i < ownersAfter.length; i++) {
144: for (uint256 i = 0; i < ownersBeforeCache.length; i++) {
144: for (uint256 i = 0; i < ownersBeforeCache.length; i++) {
```
```solidity
File: src/Safe/LivenessModule.sol
4: import { Safe, OwnerManager } from "safe-contracts/Safe.sol";
4: import { Safe, OwnerManager } from "safe-contracts/Safe.sol";
5: import { Enum } from "safe-contracts/common/Enum.sol";
5: import { Enum } from "safe-contracts/common/Enum.sol";
5: import { Enum } from "safe-contracts/common/Enum.sol";
6: import { OwnerManager } from "safe-contracts/base/OwnerManager.sol";
6: import { OwnerManager } from "safe-contracts/base/OwnerManager.sol";
6: import { OwnerManager } from "safe-contracts/base/OwnerManager.sol";
7: import { LivenessGuard } from "src/Safe/LivenessGuard.sol";
7: import { LivenessGuard } from "src/Safe/LivenessGuard.sol";
8: import { ISemver } from "src/universal/ISemver.sol";
8: import { ISemver } from "src/universal/ISemver.sol";
68: threshold_ = (_numOwners * 75 + 99) / 100;
68: threshold_ = (_numOwners * 75 + 99) / 100;
68: threshold_ = (_numOwners * 75 + 99) / 100;
106: canRemove_ = LIVENESS_GUARD.lastLive(_owner) + LIVENESS_INTERVAL < block.timestamp;
121: for (uint256 i = 0; i < _previousOwners.length; i++) {
121: for (uint256 i = 0; i < _previousOwners.length; i++) {
132: ownersCount--;
132: ownersCount--;
```
```solidity
File: src/Safe/SafeSigners.sol
62: for (i = 0; i < requiredSignatures; i++) {
62: for (i = 0; i < requiredSignatures; i++) {
77: ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", dataHash)), v - 4, r, s);
```
```solidity
File: src/cannon/PreimageOracle.sol
4: import { IPreimageOracle } from "./interfaces/IPreimageOracle.sol";
4: import { IPreimageOracle } from "./interfaces/IPreimageOracle.sol";
5: import { PreimageKeyLib } from "./PreimageKeyLib.sol";
6: import "./libraries/CannonErrors.sol";
6: import "./libraries/CannonErrors.sol";
20: require(preimagePartOk[_key][_offset], "pre-image must exist");
26: if (_offset + 32 >= length + 8) {
26: if (_offset + 32 >= length + 8) {
27: datLen_ = length + 8 - _offset;
27: datLen_ = length + 8 - _offset;
49: if (_partOffset > _size + 8 || _size > 32) {
101: let h := keccak256(ptr, size) // compute preimage keccak256 hash
101: let h := keccak256(ptr, size) // compute preimage keccak256 hash
```
```solidity
File: src/dispute/BlockOracle.sol
4: import "src/libraries/DisputeTypes.sol";
4: import "src/libraries/DisputeTypes.sol";
5: import "src/libraries/DisputeErrors.sol";
5: import "src/libraries/DisputeErrors.sol";
6: import { ISemver } from "src/universal/ISemver.sol";
6: import { ISemver } from "src/universal/ISemver.sol";
43: blockNumber_ = block.number - 1;
```
```solidity
File: src/dispute/DisputeGameFactory.sol
4: import { ClonesWithImmutableArgs } from "@cwia/ClonesWithImmutableArgs.sol";
5: import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
5: import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
5: import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
5: import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
6: import { ISemver } from "src/universal/ISemver.sol";
6: import { ISemver } from "src/universal/ISemver.sol";
8: import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
8: import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
8: import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
9: import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
9: import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
9: import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
11: import { LibGameId } from "src/dispute/lib/LibGameId.sol";
11: import { LibGameId } from "src/dispute/lib/LibGameId.sol";
11: import { LibGameId } from "src/dispute/lib/LibGameId.sol";
13: import "src/libraries/DisputeTypes.sol";
13: import "src/libraries/DisputeTypes.sol";
14: import "src/libraries/DisputeErrors.sol";
14: import "src/libraries/DisputeErrors.sol";
```
```solidity
File: src/dispute/FaultDisputeGame.sol
4: import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
4: import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
4: import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
5: import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
5: import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
5: import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
6: import { IInitializable } from "src/dispute/interfaces/IInitializable.sol";
6: import { IInitializable } from "src/dispute/interfaces/IInitializable.sol";
6: import { IInitializable } from "src/dispute/interfaces/IInitializable.sol";
7: import { IBondManager } from "src/dispute/interfaces/IBondManager.sol";
7: import { IBondManager } from "src/dispute/interfaces/IBondManager.sol";
7: import { IBondManager } from "src/dispute/interfaces/IBondManager.sol";
8: import { IBigStepper, IPreimageOracle } from "src/dispute/interfaces/IBigStepper.sol";
8: import { IBigStepper, IPreimageOracle } from "src/dispute/interfaces/IBigStepper.sol";
8: import { IBigStepper, IPreimageOracle } from "src/dispute/interfaces/IBigStepper.sol";
9: import { L2OutputOracle } from "src/L1/L2OutputOracle.sol";
9: import { L2OutputOracle } from "src/L1/L2OutputOracle.sol";
10: import { BlockOracle } from "src/dispute/BlockOracle.sol";
10: import { BlockOracle } from "src/dispute/BlockOracle.sol";
12: import { Clone } from "src/libraries/Clone.sol";
12: import { Clone } from "src/libraries/Clone.sol";
13: import { Types } from "src/libraries/Types.sol";
13: import { Types } from "src/libraries/Types.sol";
14: import { ISemver } from "src/universal/ISemver.sol";
14: import { ISemver } from "src/universal/ISemver.sol";
15: import { LibHashing } from "src/dispute/lib/LibHashing.sol";
15: import { LibHashing } from "src/dispute/lib/LibHashing.sol";
15: import { LibHashing } from "src/dispute/lib/LibHashing.sol";
16: import { LibPosition } from "src/dispute/lib/LibPosition.sol";
16: import { LibPosition } from "src/dispute/lib/LibPosition.sol";
16: import { LibPosition } from "src/dispute/lib/LibPosition.sol";
17: import { LibClock } from "src/dispute/lib/LibClock.sol";
17: import { LibClock } from "src/dispute/lib/LibClock.sol";
17: import { LibClock } from "src/dispute/lib/LibClock.sol";
19: import "src/libraries/DisputeTypes.sol";
19: import "src/libraries/DisputeTypes.sol";
20: import "src/libraries/DisputeErrors.sol";
20: import "src/libraries/DisputeErrors.sol";
134: if (stepPos.depth() != MAX_GAME_DEPTH + 1) revert InvalidParent();
146: : findTraceAncestor(Position.wrap(Position.unwrap(parentPos) - 1), parent.parentIndex).claim;
154: postState = findTraceAncestor(Position.wrap(Position.unwrap(parentPos) + 1), parent.parentIndex);
181: bool parentPostAgree = (parentPos.depth() - postState.position.depth()) % 2 == 0;
232: + block.timestamp - Timestamp.unwrap(parent.clock.timestamp())
232: + block.timestamp - Timestamp.unwrap(parent.clock.timestamp())
267: subgames[_challengeIndex].push(claimData.length - 1);
383: Duration.unwrap(parent.clock.duration()) + (block.timestamp - Timestamp.unwrap(parent.clock.timestamp()))
383: Duration.unwrap(parent.clock.duration()) + (block.timestamp - Timestamp.unwrap(parent.clock.timestamp()))
399: for (uint256 i = 0; i < challengeIndices.length; ++i) {
399: for (uint256 i = 0; i < challengeIndices.length; ++i) {
489: Types.OutputProposal memory starting = L2_OUTPUT_ORACLE.getL2Output(proposalIdx - 1);
519: index: uint128(proposalIdx - 1),
```
```solidity
File: src/dispute/lib/LibClock.sol
4: import "src/libraries/DisputeTypes.sol";
4: import "src/libraries/DisputeTypes.sol";
```
```solidity
File: src/dispute/lib/LibGameId.sol
4: import "src/libraries/DisputeTypes.sol";
4: import "src/libraries/DisputeTypes.sol";
5: import "src/dispute/interfaces/IDisputeGame.sol";
5: import "src/dispute/interfaces/IDisputeGame.sol";
5: import "src/dispute/interfaces/IDisputeGame.sol";
```
```solidity
File: src/dispute/lib/LibHashing.sol
4: import "src/libraries/DisputeTypes.sol";
4: import "src/libraries/DisputeTypes.sol";
```
```solidity
File: src/dispute/lib/LibPosition.sol
4: import "src/libraries/DisputeTypes.sol";
4: import "src/libraries/DisputeTypes.sol";
```
```solidity
File: src/governance/GovernanceToken.sol
4: import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
4: import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
4: import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
4: import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
5: import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
5: import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
5: import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
5: import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
5: import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
6: import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
6: import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
6: import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
6: import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
6: import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
7: import "@openzeppelin/contracts/access/Ownable.sol";
7: import "@openzeppelin/contracts/access/Ownable.sol";
7: import "@openzeppelin/contracts/access/Ownable.sol";
```
```solidity
File: src/governance/MintManager.sol
4: import "@openzeppelin/contracts/access/Ownable.sol";
4: import "@openzeppelin/contracts/access/Ownable.sol";
4: import "@openzeppelin/contracts/access/Ownable.sol";
5: import "./GovernanceToken.sol";
18: uint256 public constant MINT_CAP = 20; // 2%
18: uint256 public constant MINT_CAP = 20; // 2%
47: _amount <= (governanceToken.totalSupply() * MINT_CAP) / DENOMINATOR,
47: _amount <= (governanceToken.totalSupply() * MINT_CAP) / DENOMINATOR,
52: mintPermittedAfter = block.timestamp + MINT_PERIOD;
```
```solidity
File: src/legacy/AddressManager.sol
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
```
```solidity
File: src/legacy/DeployerWhitelist.sol
4: import { ISemver } from "src/universal/ISemver.sol";
4: import { ISemver } from "src/universal/ISemver.sol";
```
```solidity
File: src/legacy/L1BlockNumber.sol
4: import { L1Block } from "src/L2/L1Block.sol";
4: import { L1Block } from "src/L2/L1Block.sol";
5: import { Predeploys } from "src/libraries/Predeploys.sol";
5: import { Predeploys } from "src/libraries/Predeploys.sol";
6: import { ISemver } from "src/universal/ISemver.sol";
6: import { ISemver } from "src/universal/ISemver.sol";
```
```solidity
File: src/legacy/L1ChugSplashProxy.sol
4: import { Constants } from "src/libraries/Constants.sol";
4: import { Constants } from "src/libraries/Constants.sol";
```
```solidity
File: src/legacy/LegacyERC20ETH.sol
4: import { Predeploys } from "src/libraries/Predeploys.sol";
4: import { Predeploys } from "src/libraries/Predeploys.sol";
5: import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
5: import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
```
```solidity
File: src/legacy/LegacyMessagePasser.sol
4: import { ISemver } from "src/universal/ISemver.sol";
4: import { ISemver } from "src/universal/ISemver.sol";
```
```solidity
File: src/legacy/LegacyMintableERC20.sol
4: import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
4: import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
4: import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
4: import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
5: import { ILegacyMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
5: import { ILegacyMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
47: bytes4 firstSupportedInterface = bytes4(keccak256("supportsInterface(bytes4)")); // ERC165
47: bytes4 firstSupportedInterface = bytes4(keccak256("supportsInterface(bytes4)")); // ERC165
```
```solidity
File: src/legacy/ResolvedDelegateProxy.sol
4: import { AddressManager } from "src/legacy/AddressManager.sol";
4: import { AddressManager } from "src/legacy/AddressManager.sol";
```
```solidity
File: src/libraries/Arithmetic.sol
4: import { SignedMath } from "@openzeppelin/contracts/utils/math/SignedMath.sol";
4: import { SignedMath } from "@openzeppelin/contracts/utils/math/SignedMath.sol";
4: import { SignedMath } from "@openzeppelin/contracts/utils/math/SignedMath.sol";
4: import { SignedMath } from "@openzeppelin/contracts/utils/math/SignedMath.sol";
5: import { FixedPointMathLib } from "@rari-capital/solmate/src/utils/FixedPointMathLib.sol";
5: import { FixedPointMathLib } from "@rari-capital/solmate/src/utils/FixedPointMathLib.sol";
5: import { FixedPointMathLib } from "@rari-capital/solmate/src/utils/FixedPointMathLib.sol";
5: import { FixedPointMathLib } from "@rari-capital/solmate/src/utils/FixedPointMathLib.sol";
5: import { FixedPointMathLib } from "@rari-capital/solmate/src/utils/FixedPointMathLib.sol";
26: return (_coefficient * (FixedPointMathLib.powWad(1e18 - (1e18 / _denominator), _exponent * 1e18))) / 1e18;
26: return (_coefficient * (FixedPointMathLib.powWad(1e18 - (1e18 / _denominator), _exponent * 1e18))) / 1e18;
26: return (_coefficient * (FixedPointMathLib.powWad(1e18 - (1e18 / _denominator), _exponent * 1e18))) / 1e18;
26: return (_coefficient * (FixedPointMathLib.powWad(1e18 - (1e18 / _denominator), _exponent * 1e18))) / 1e18;
26: return (_coefficient * (FixedPointMathLib.powWad(1e18 - (1e18 / _denominator), _exponent * 1e18))) / 1e18;
```
```solidity
File: src/libraries/Burn.sol
18: while (initialGas - gasleft() < _amount) {
19: ++i;
19: ++i;
```
```solidity
File: src/libraries/Bytes.sol
17: require(_length + 31 >= _length, "slice_overflow");
18: require(_start + _length >= _start, "slice_overflow");
19: require(_bytes.length >= _start + _length, "slice_outOfBounds");
87: return slice(_bytes, _start, _bytes.length - _start);
```
```solidity
File: src/libraries/Clone.sol
50: uint256 offset = _getImmutableArgsOffset() + argOffset;
63: uint256 offset = _getImmutableArgsOffset() + argOffset;
```
```solidity
File: src/libraries/Constants.sol
4: import { ResourceMetering } from "../L1/ResourceMetering.sol";
4: import { ResourceMetering } from "../L1/ResourceMetering.sol";
```
```solidity
File: src/libraries/DisputeErrors.sol
4: import "./DisputeTypes.sol";
```
```solidity
File: src/libraries/DisputeTypes.sol
4: import { LibHashing } from "../dispute/lib/LibHashing.sol";
4: import { LibHashing } from "../dispute/lib/LibHashing.sol";
4: import { LibHashing } from "../dispute/lib/LibHashing.sol";
5: import { LibPosition } from "../dispute/lib/LibPosition.sol";
5: import { LibPosition } from "../dispute/lib/LibPosition.sol";
5: import { LibPosition } from "../dispute/lib/LibPosition.sol";
6: import { LibClock } from "../dispute/lib/LibClock.sol";
6: import { LibClock } from "../dispute/lib/LibClock.sol";
6: import { LibClock } from "../dispute/lib/LibClock.sol";
7: import { LibGameId } from "../dispute/lib/LibGameId.sol";
7: import { LibGameId } from "../dispute/lib/LibGameId.sol";
7: import { LibGameId } from "../dispute/lib/LibGameId.sol";
```
```solidity
File: src/libraries/Encoding.sol
4: import { Types } from "./Types.sol";
5: import { Hashing } from "./Hashing.sol";
6: import { RLPWriter } from "./rlp/RLPWriter.sol";
6: import { RLPWriter } from "./rlp/RLPWriter.sol";
```
```solidity
File: src/libraries/Hashing.sol
4: import { Types } from "./Types.sol";
5: import { Encoding } from "./Encoding.sol";
```
```solidity
File: src/libraries/SafeCall.sol
17: _gas, // gas
17: _gas, // gas
18: _target, // recipient
18: _target, // recipient
19: _value, // ether value
19: _value, // ether value
20: 0, // inloc
20: 0, // inloc
21: 0, // inlen
21: 0, // inlen
22: 0, // outloc
22: 0, // outloc
23: 0 // outlen
23: 0 // outlen
39: _gas, // gas
39: _gas, // gas
40: _target, // recipient
40: _target, // recipient
41: _value, // ether value
41: _value, // ether value
42: add(_calldata, 32), // inloc
42: add(_calldata, 32), // inloc
43: mload(_calldata), // inlen
43: mload(_calldata), // inlen
44: 0, // outloc
44: 0, // outloc
45: 0 // outlen
45: 0 // outlen
131: gas(), // gas
131: gas(), // gas
132: _target, // recipient
132: _target, // recipient
133: _value, // ether value
133: _value, // ether value
134: add(_calldata, 32), // inloc
134: add(_calldata, 32), // inloc
135: mload(_calldata), // inlen
135: mload(_calldata), // inlen
136: 0x00, // outloc
136: 0x00, // outloc
137: 0x00 // outlen
137: 0x00 // outlen
```
```solidity
File: src/libraries/rlp/RLPReader.sol
55: require(listOffset + listLength == _in.length, "RLPReader: list item has an invalid data remainder");
67: RLPItem({ length: _in.length - offset, ptr: MemoryPointer.wrap(MemoryPointer.unwrap(_in.ptr) + offset) })
67: RLPItem({ length: _in.length - offset, ptr: MemoryPointer.wrap(MemoryPointer.unwrap(_in.ptr) + offset) })
73: length: itemLength + itemOffset,
74: ptr: MemoryPointer.wrap(MemoryPointer.unwrap(_in.ptr) + offset)
77: itemCount += 1;
78: offset += itemOffset + itemLength;
78: offset += itemOffset + itemLength;
102: require(_in.length == itemOffset + itemLength, "RLPReader: bytes value contains an invalid remainder");
149: uint256 strLen = prefix - 0x80;
168: uint256 lenOfStrLen = prefix - 0xb7;
192: _in.length > lenOfStrLen + strLen,
196: return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);
200: uint256 listLen = prefix - 0xc0;
207: uint256 lenOfListLen = prefix - 0xf7;
231: _in.length > lenOfListLen + listLen,
235: return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);
253: uint256 src = MemoryPointer.unwrap(_src) + _offset;
```
```solidity
File: src/libraries/rlp/RLPWriter.sol
65: out_[0] = bytes1(uint8(_len) + uint8(_offset));
69: while (_len / i != 0) {
70: lenLen++;
70: lenLen++;
71: i *= 256;
74: out_ = new bytes(lenLen + 1);
75: out_[0] = bytes1(uint8(lenLen) + uint8(_offset) + 55);
75: out_[0] = bytes1(uint8(lenLen) + uint8(_offset) + 55);
76: for (i = 1; i <= lenLen; i++) {
76: for (i = 1; i <= lenLen; i++) {
77: out_[i] = bytes1(uint8((_len / (256 ** (lenLen - i))) % 256));
77: out_[i] = bytes1(uint8((_len / (256 ** (lenLen - i))) % 256));
77: out_[i] = bytes1(uint8((_len / (256 ** (lenLen - i))) % 256));
77: out_[i] = bytes1(uint8((_len / (256 ** (lenLen - i))) % 256));
89: for (; i < 32; i++) {
89: for (; i < 32; i++) {
95: out_ = new bytes(32 - i);
96: for (uint256 j = 0; j < out_.length; j++) {
96: for (uint256 j = 0; j < out_.length; j++) {
97: out_[j] = b[i++];
97: out_[j] = b[i++];
111: for (; len >= 32; len -= 32) {
115: dest += 32;
116: src += 32;
121: mask = 256 ** (32 - len) - 1;
121: mask = 256 ** (32 - len) - 1;
121: mask = 256 ** (32 - len) - 1;
121: mask = 256 ** (32 - len) - 1;
141: for (; i < _list.length; i++) {
141: for (; i < _list.length; i++) {
142: len += _list[i].length;
151: for (i = 0; i < _list.length; i++) {
151: for (i = 0; i < _list.length; i++) {
160: flattenedPtr += _list[i].length;
```
```solidity
File: src/libraries/trie/MerkleTrie.sol
4: import { Bytes } from "../Bytes.sol";
5: import { RLPReader } from "../rlp/RLPReader.sol";
5: import { RLPReader } from "../rlp/RLPReader.sol";
24: uint256 internal constant BRANCH_NODE_LENGTH = TREE_RADIX + 1;
77: for (uint256 i = 0; i < proof.length; i++) {
77: for (uint256 i = 0; i < proof.length; i++) {
111: require(i == proof.length - 1, "MerkleTrie: value node must be last node in proof (branch)");
120: currentKeyIndex += 1;
125: uint8 offset = 2 - (prefix % 2);
158: require(i == proof.length - 1, "MerkleTrie: value node must be last node in proof (leaf)");
166: currentKeyIndex += sharedNibbleLength;
188: ++i;
188: ++i;
216: ++shared_;
216: ++shared_;
```
```solidity
File: src/libraries/trie/SecureMerkleTrie.sol
4: import { MerkleTrie } from "./MerkleTrie.sol";
```
```solidity
File: src/mainnet-bridge/ETHYieldManager.sol
4: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
4: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
4: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
5: import { OptimismPortal } from "src/L1/OptimismPortal.sol";
5: import { OptimismPortal } from "src/L1/OptimismPortal.sol";
6: import { Semver } from "src/universal/Semver.sol";
6: import { Semver } from "src/universal/Semver.sol";
7: import { Predeploys } from "src/libraries/Predeploys.sol";
7: import { Predeploys } from "src/libraries/Predeploys.sol";
```
```solidity
File: src/mainnet-bridge/Insurance.sol
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
5: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
5: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
5: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
5: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
5: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
6: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
6: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
6: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
8: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
8: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
8: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
9: import { Semver } from "src/mainnet-bridge/YieldManager.sol";
9: import { Semver } from "src/mainnet-bridge/YieldManager.sol";
9: import { Semver } from "src/mainnet-bridge/YieldManager.sol";
```
```solidity
File: src/mainnet-bridge/L1BlastBridge.sol
4: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
4: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
4: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
6: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
6: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
6: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
6: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
6: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
8: import { Predeploys } from "src/libraries/Predeploys.sol";
8: import { Predeploys } from "src/libraries/Predeploys.sol";
9: import { SafeCall } from "src/libraries/SafeCall.sol";
9: import { SafeCall } from "src/libraries/SafeCall.sol";
10: import { StandardBridge } from "src/universal/StandardBridge.sol";
10: import { StandardBridge } from "src/universal/StandardBridge.sol";
11: import { L2BlastBridge } from "src/mainnet-bridge/L2BlastBridge.sol";
11: import { L2BlastBridge } from "src/mainnet-bridge/L2BlastBridge.sol";
11: import { L2BlastBridge } from "src/mainnet-bridge/L2BlastBridge.sol";
12: import { ISemver } from "src/universal/ISemver.sol";
12: import { ISemver } from "src/universal/ISemver.sol";
13: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
13: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
14: import { OptimismPortal } from "src/L1/OptimismPortal.sol";
14: import { OptimismPortal } from "src/L1/OptimismPortal.sol";
15: import { Predeploys } from "src/libraries/Predeploys.sol";
15: import { Predeploys } from "src/libraries/Predeploys.sol";
16: import { USDYieldManager } from "src/mainnet-bridge/USDYieldManager.sol";
16: import { USDYieldManager } from "src/mainnet-bridge/USDYieldManager.sol";
16: import { USDYieldManager } from "src/mainnet-bridge/USDYieldManager.sol";
17: import { ETHYieldManager } from "src/mainnet-bridge/ETHYieldManager.sol";
17: import { ETHYieldManager } from "src/mainnet-bridge/ETHYieldManager.sol";
17: import { ETHYieldManager } from "src/mainnet-bridge/ETHYieldManager.sol";
18: import { USDB } from "src/L2/USDB.sol";
18: import { USDB } from "src/L2/USDB.sol";
19: import { USDConversions } from "src/mainnet-bridge/USDConversions.sol";
19: import { USDConversions } from "src/mainnet-bridge/USDConversions.sol";
19: import { USDConversions } from "src/mainnet-bridge/USDConversions.sol";
```
```solidity
File: src/mainnet-bridge/L2BlastBridge.sol
4: import { Predeploys } from "src/libraries/Predeploys.sol";
4: import { Predeploys } from "src/libraries/Predeploys.sol";
5: import { StandardBridge } from "src/universal/StandardBridge.sol";
5: import { StandardBridge } from "src/universal/StandardBridge.sol";
6: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
6: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
7: import { ISemver } from "src/universal/ISemver.sol";
7: import { ISemver } from "src/universal/ISemver.sol";
8: import { SafeCall } from "src/libraries/SafeCall.sol";
8: import { SafeCall } from "src/libraries/SafeCall.sol";
9: import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
9: import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
10: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
10: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
35: address(0xdead) /// don't set a governor
35: address(0xdead) /// don't set a governor
35: address(0xdead) /// don't set a governor
```
```solidity
File: src/mainnet-bridge/USDConversions.sol
4: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
4: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
4: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
6: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
6: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
6: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
83: PSM.buyGem(address(this), _wadToUSD(minOutputAmountWad)); // buyGem expects the input amount in USDC
83: PSM.buyGem(address(this), _wadToUSD(minOutputAmountWad)); // buyGem expects the input amount in USDC
84: uint256 amountSent = beforeInputBalance - _tokenBalance(inputToken);
96: amountReceived = _tokenBalance(outputToken) - beforeBalance;
213: return input / (10 ** (inputDecimals - outputDecimals));
213: return input / (10 ** (inputDecimals - outputDecimals));
213: return input / (10 ** (inputDecimals - outputDecimals));
213: return input / (10 ** (inputDecimals - outputDecimals));
215: return input * (10 ** (outputDecimals - inputDecimals));
215: return input * (10 ** (outputDecimals - inputDecimals));
215: return input * (10 ** (outputDecimals - inputDecimals));
215: return input * (10 ** (outputDecimals - inputDecimals));
```
```solidity
File: src/mainnet-bridge/USDYieldManager.sol
4: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
4: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
4: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
6: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
6: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
6: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
7: import { OptimismPortal } from "src/L1/OptimismPortal.sol";
7: import { OptimismPortal } from "src/L1/OptimismPortal.sol";
8: import { USDConversions } from "src/mainnet-bridge/USDConversions.sol";
8: import { USDConversions } from "src/mainnet-bridge/USDConversions.sol";
8: import { USDConversions } from "src/mainnet-bridge/USDConversions.sol";
9: import { Semver } from "src/universal/Semver.sol";
9: import { Semver } from "src/universal/Semver.sol";
10: import { Predeploys } from "src/libraries/Predeploys.sol";
10: import { Predeploys } from "src/libraries/Predeploys.sol";
```
```solidity
File: src/mainnet-bridge/YieldManager.sol
4: import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
4: import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
4: import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
4: import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
5: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
5: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
5: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
5: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
5: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
6: import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
6: import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
6: import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
6: import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
7: import { SignedMath } from "@openzeppelin/contracts/utils/math/SignedMath.sol";
7: import { SignedMath } from "@openzeppelin/contracts/utils/math/SignedMath.sol";
7: import { SignedMath } from "@openzeppelin/contracts/utils/math/SignedMath.sol";
7: import { SignedMath } from "@openzeppelin/contracts/utils/math/SignedMath.sol";
9: import { WithdrawalQueue } from "src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol";
9: import { WithdrawalQueue } from "src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol";
9: import { WithdrawalQueue } from "src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol";
9: import { WithdrawalQueue } from "src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol";
9: import { WithdrawalQueue } from "src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol";
10: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
10: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
10: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
10: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
10: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
11: import { Types } from "src/libraries/Types.sol";
11: import { Types } from "src/libraries/Types.sol";
12: import { SafeCall } from "src/libraries/SafeCall.sol";
12: import { SafeCall } from "src/libraries/SafeCall.sol";
13: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
13: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
14: import { SharesBase } from "src/L2/Shares.sol";
14: import { SharesBase } from "src/L2/Shares.sol";
15: import { DelegateCalls } from "src/mainnet-bridge/DelegateCalls.sol";
15: import { DelegateCalls } from "src/mainnet-bridge/DelegateCalls.sol";
15: import { DelegateCalls } from "src/mainnet-bridge/DelegateCalls.sol";
16: import { USDConversions } from "src/mainnet-bridge/USDConversions.sol";
16: import { USDConversions } from "src/mainnet-bridge/USDConversions.sol";
16: import { USDConversions } from "src/mainnet-bridge/USDConversions.sol";
17: import { Semver } from "src/universal/Semver.sol";
17: import { Semver } from "src/universal/Semver.sol";
18: import { OptimismPortal } from "src/L1/OptimismPortal.sol";
18: import { OptimismPortal } from "src/L1/OptimismPortal.sol";
19: import { Predeploys } from "src/libraries/Predeploys.sol";
19: import { Predeploys } from "src/libraries/Predeploys.sol";
35: uint256 public constant MAX_INSURANCE_FEE_BIPS = 10_000; // 100%
35: uint256 public constant MAX_INSURANCE_FEE_BIPS = 10_000; // 100%
232: for (uint256 i; i < providersLength; i++) {
232: for (uint256 i; i < providersLength; i++) {
248: insurancePayment = uint256(yield) * insuranceFeeBips / BASIS_POINTS;
248: insurancePayment = uint256(yield) * insuranceFeeBips / BASIS_POINTS;
250: totalInsurancePremiumPaid += insurancePayment;
253: uint256 insuranceWithdrawal = SignedMath.abs(yield) + insuranceWithdrawalBuffer;
259: totalInsuranceWithdrawal += insuranceWithdrawal;
278: totalYield += committedYield;
283: totalYield -= int256(accumulatedNegativeYields);
289: accumulatedNegativeYields = uint256(-1 * totalYield);
289: accumulatedNegativeYields = uint256(-1 * totalYield);
324: accumulatedNegativeYields += amount;
335: accumulatedNegativeYields = _subClamped(accumulatedNegativeYields, nominalAmount - realAmount);
353: return tokenBalance() - getLockedBalance();
359: for (uint256 i; i < providersLength; i++) {
359: for (uint256 i; i < providersLength; i++) {
360: sum += YieldProvider(_providers.at(i)).totalValue();
366: return availableBalance() + totalProviderValue();
377: return value * E27_PRECISION_BASE / (value + accumulatedNegativeYields);
377: return value * E27_PRECISION_BASE / (value + accumulatedNegativeYields);
377: return value * E27_PRECISION_BASE / (value + accumulatedNegativeYields);
412: z = x > y ? x - y : 0;
```
```solidity
File: src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol
6: import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
6: import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
6: import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
6: import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
7: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
7: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
7: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
7: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
7: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
8: import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
8: import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
8: import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
8: import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
9: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
9: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
9: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
10: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
10: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
10: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
10: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
10: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
12: import { SafeCall } from "src/libraries/SafeCall.sol";
12: import { SafeCall } from "src/libraries/SafeCall.sol";
132: for (uint256 i = 0; i < _requestIds.length; ++i) {
132: for (uint256 i = 0; i < _requestIds.length; ++i) {
147: for (uint256 i = 0; i < _requestIds.length; ++i) {
147: for (uint256 i = 0; i < _requestIds.length; ++i) {
188: return lastRequestId - lastFinalizedRequestId;
195: _requests[lastRequestId].cumulativeAmount - _requests[lastFinalizedRequestId].cumulativeAmount;
219: nominalAmountToFinalize = requestToFinalize.cumulativeAmount - lastFinalizedRequest.cumulativeAmount;
220: realAmountToFinalize = (nominalAmountToFinalize * sharePrice) / E27_PRECISION_BASE;
220: realAmountToFinalize = (nominalAmountToFinalize * sharePrice) / E27_PRECISION_BASE;
225: uint256 firstRequestIdToFinalize = _lastFinalizedRequestId + 1;
227: lockedBalance += realAmountToFinalize;
259: for (uint256 i = 0; i < _requestIds.length; ++i) {
259: for (uint256 i = 0; i < _requestIds.length; ++i) {
299: if (_requestId < _checkpoints[_end + 1].fromRequestId) {
312: uint256 max = _end - 1;
315: uint256 mid = (max + min + 1) / 2;
315: uint256 mid = (max + min + 1) / 2;
315: uint256 mid = (max + min + 1) / 2;
319: max = mid - 1;
330: WithdrawalRequest memory previousRequest = _requests[_requestId - 1];
333: request.cumulativeAmount - previousRequest.cumulativeAmount,
350: uint128 cumulativeAmount = lastRequest.cumulativeAmount + SafeCast.toUint128(amount);
352: requestId = _lastRequestId + 1;
371: lastCheckpointId += 1;
391: lockedBalance -= realAmount;
430: Checkpoint memory nextCheckpoint = _checkpoints[_hintId + 1];
436: WithdrawalRequest storage prevRequest = _requests[_requestId - 1];
439: uint256 nominalAmount = request.cumulativeAmount - prevRequest.cumulativeAmount;
440: return (nominalAmount * checkpoint.sharePrice) / E27_PRECISION_BASE;
440: return (nominalAmount * checkpoint.sharePrice) / E27_PRECISION_BASE;
```
```solidity
File: src/mainnet-bridge/yield-providers/DSRYieldProvider.sol
4: import { FixedPointMathLib } from "solmate/utils/FixedPointMathLib.sol";
4: import { FixedPointMathLib } from "solmate/utils/FixedPointMathLib.sol";
5: import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
5: import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
5: import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
5: import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
6: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
6: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
6: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
9: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
9: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
9: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
39: uint256 constant RAY = 10 ** 27;
39: uint256 constant RAY = 10 ** 27;
67: block.timestamp - pot.rho(),
82: return SafeCast.toInt256(stakedBalance()) - SafeCast.toInt256(stakedPrincipal);
```
```solidity
File: src/mainnet-bridge/yield-providers/ETHTestnetYieldProvider.sol
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
7: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
7: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
7: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
9: import { TestnetYieldProvider } from "src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol";
9: import { TestnetYieldProvider } from "src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol";
9: import { TestnetYieldProvider } from "src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol";
9: import { TestnetYieldProvider } from "src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol";
9: import { TestnetYieldProvider } from "src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol";
25: return uint256(int256(stakedPrincipal) + yield());
37: (bool success,) = owner().call{value: uint256(-1 * amount)}("");
37: (bool success,) = owner().call{value: uint256(-1 * amount)}("");
40: _reportedYield += amount;
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
4: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
4: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
4: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
5: import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
5: import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
5: import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
5: import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
7: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
7: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
7: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
9: import { WithdrawalQueue } from "src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol";
9: import { WithdrawalQueue } from "src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol";
9: import { WithdrawalQueue } from "src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol";
9: import { WithdrawalQueue } from "src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol";
9: import { WithdrawalQueue } from "src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol";
95: return SafeCast.toInt256(stakedBalance()) - SafeCast.toInt256(stakedPrincipal);
122: return unstakeRequests.length - 1;
183: uint256 firstIndex = lastClaimedIndex + 1;
184: uint256 lastIndex = (lastRequestIndex - lastClaimedIndex) > claimBatchSize
185: ? firstIndex + claimBatchSize - 1
185: ? firstIndex + claimBatchSize - 1
188: uint256[] memory requestIds = new uint256[](lastIndex - firstIndex + 1);
188: uint256[] memory requestIds = new uint256[](lastIndex - firstIndex + 1);
190: for (i = firstIndex; i <= lastIndex; i++) {
190: for (i = firstIndex; i <= lastIndex; i++) {
191: requestIds[i - firstIndex] = yp.unstakeRequests(i);
196: for (i = 0; i < statuses.length; i++) {
196: for (i = 0; i < statuses.length; i++) {
201: expected += statuses[i].amountOfStETH;
203: uint256 lastClaimableIndex = i + lastClaimedIndex;
212: for (uint256 j = 0; j < i; j++) {
212: for (uint256 j = 0; j < i; j++) {
226: claimed = address(YIELD_MANAGER).balance - balanceBefore;
228: uint256 negativeYield = expected - claimed;
```
```solidity
File: src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
7: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
7: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
7: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
```
```solidity
File: src/mainnet-bridge/yield-providers/USDTestnetYieldProvider.sol
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
5: import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol";
7: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
7: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
7: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
8: import { YieldProvider } from "src/mainnet-bridge/yield-providers/YieldProvider.sol";
9: import { TestnetYieldProvider } from "src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol";
9: import { TestnetYieldProvider } from "src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol";
9: import { TestnetYieldProvider } from "src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol";
9: import { TestnetYieldProvider } from "src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol";
9: import { TestnetYieldProvider } from "src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol";
31: TOKEN.transfer(owner(), uint256(-1 * amount));
31: TOKEN.transfer(owner(), uint256(-1 * amount));
33: _reportedYield += amount;
```
```solidity
File: src/mainnet-bridge/yield-providers/YieldProvider.sol
4: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
4: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
4: import { YieldManager } from "src/mainnet-bridge/YieldManager.sol";
5: import { Semver } from "src/universal/Semver.sol";
5: import { Semver } from "src/universal/Semver.sol";
67: return stakedBalance() + pendingBalance;
128: stakedPrincipal += amount;
157: stakedPrincipal -= amount;
164: pendingBalance += amount;
177: pendingBalance -= expected;
```
```solidity
File: src/periphery/AssetReceiver.sol
4: import { ERC20 } from "@rari-capital/solmate/src/tokens/ERC20.sol";
4: import { ERC20 } from "@rari-capital/solmate/src/tokens/ERC20.sol";
4: import { ERC20 } from "@rari-capital/solmate/src/tokens/ERC20.sol";
4: import { ERC20 } from "@rari-capital/solmate/src/tokens/ERC20.sol";
4: import { ERC20 } from "@rari-capital/solmate/src/tokens/ERC20.sol";
5: import { ERC721 } from "@rari-capital/solmate/src/tokens/ERC721.sol";
5: import { ERC721 } from "@rari-capital/solmate/src/tokens/ERC721.sol";
5: import { ERC721 } from "@rari-capital/solmate/src/tokens/ERC721.sol";
5: import { ERC721 } from "@rari-capital/solmate/src/tokens/ERC721.sol";
5: import { ERC721 } from "@rari-capital/solmate/src/tokens/ERC721.sol";
6: import { Transactor } from "./Transactor.sol";
57: success; // Suppress warning; We ignore the low-level call result.
57: success; // Suppress warning; We ignore the low-level call result.
57: success; // Suppress warning; We ignore the low-level call result.
```
```solidity
File: src/periphery/Transactor.sol
4: import { Owned } from "@rari-capital/solmate/src/auth/Owned.sol";
4: import { Owned } from "@rari-capital/solmate/src/auth/Owned.sol";
4: import { Owned } from "@rari-capital/solmate/src/auth/Owned.sol";
4: import { Owned } from "@rari-capital/solmate/src/auth/Owned.sol";
4: import { Owned } from "@rari-capital/solmate/src/auth/Owned.sol";
```
```solidity
File: src/periphery/TransferOnion.sol
4: import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
4: import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
4: import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
5: import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
5: import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
5: import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
5: import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
6: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
6: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
6: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
6: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
6: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
65: ++i;
65: ++i;
```
```solidity
File: src/periphery/drippie/Drippie.sol
4: import { AssetReceiver } from "../AssetReceiver.sol";
5: import { IDripCheck } from "./IDripCheck.sol";
111: for (uint256 i = 0; i < _config.actions.length; i++) {
111: for (uint256 i = 0; i < _config.actions.length; i++) {
174: state.last + state.config.interval <= block.timestamp,
214: state.count++;
214: state.count++;
221: for (uint256 i = 0; i < len; i++) {
221: for (uint256 i = 0; i < len; i++) {
```
```solidity
File: src/periphery/drippie/dripchecks/CheckBalanceHigh.sol
4: import { IDripCheck } from "../IDripCheck.sol";
```
```solidity
File: src/periphery/drippie/dripchecks/CheckBalanceLow.sol
4: import { IDripCheck } from "../IDripCheck.sol";
```
```solidity
File: src/periphery/drippie/dripchecks/CheckGelatoLow.sol
4: import { IDripCheck } from "../IDripCheck.sol";
```
```solidity
File: src/periphery/drippie/dripchecks/CheckTrue.sol
4: import { IDripCheck } from "../IDripCheck.sol";
```
```solidity
File: src/periphery/faucet/Faucet.sol
4: import { IFaucetAuthModule } from "./authmodules/IFaucetAuthModule.sol";
4: import { IFaucetAuthModule } from "./authmodules/IFaucetAuthModule.sol";
117: timeouts[_auth.module][_auth.id] = block.timestamp + config.ttl;
```
```solidity
File: src/periphery/faucet/authmodules/AdminFaucetAuthModule.sol
4: import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
4: import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
4: import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
4: import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
4: import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
5: import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
5: import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
5: import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
5: import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
6: import { IFaucetAuthModule } from "./IFaucetAuthModule.sol";
7: import { Faucet } from "../Faucet.sol";
```
```solidity
File: src/periphery/faucet/authmodules/IFaucetAuthModule.sol
4: import { Faucet } from "../Faucet.sol";
```
```solidity
File: src/periphery/op-nft/AttestationStation.sol
4: import { Semver } from "../../universal/Semver.sol";
4: import { Semver } from "../../universal/Semver.sol";
4: import { Semver } from "../../universal/Semver.sol";
54: ++i;
54: ++i;
```
```solidity
File: src/periphery/op-nft/OptimistAllowlist.sol
4: import { Semver } from "../../universal/Semver.sol";
4: import { Semver } from "../../universal/Semver.sol";
4: import { Semver } from "../../universal/Semver.sol";
5: import { AttestationStation } from "./AttestationStation.sol";
6: import { OptimistConstants } from "./libraries/OptimistConstants.sol";
6: import { OptimistConstants } from "./libraries/OptimistConstants.sol";
15: bytes32 public constant OPTIMIST_CAN_MINT_ATTESTATION_KEY = bytes32("optimist.can-mint");
18: bytes32 public constant COINBASE_QUEST_ELIGIBLE_ATTESTATION_KEY = bytes32("coinbase.quest-eligible");
```
```solidity
File: src/periphery/op-nft/OptimistInviter.sol
4: import { OptimistConstants } from "./libraries/OptimistConstants.sol";
4: import { OptimistConstants } from "./libraries/OptimistConstants.sol";
5: import { Semver } from "../../universal/Semver.sol";
5: import { Semver } from "../../universal/Semver.sol";
5: import { Semver } from "../../universal/Semver.sol";
6: import { AttestationStation } from "./AttestationStation.sol";
7: import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
7: import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
7: import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
7: import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
8: import { EIP712Upgradeable } from "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol";
8: import { EIP712Upgradeable } from "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol";
8: import { EIP712Upgradeable } from "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol";
8: import { EIP712Upgradeable } from "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol";
8: import { EIP712Upgradeable } from "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol";
8: import { EIP712Upgradeable } from "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol";
51: bytes32 public constant CAN_INVITE_ATTESTATION_KEY = bytes32("optimist.can-invite");
131: ++i;
131: ++i;
183: commitmentTimestamp + MIN_COMMITMENT_PERIOD <= block.timestamp,
219: --inviteCounts[_claimableInvite.issuer];
219: --inviteCounts[_claimableInvite.issuer];
```
```solidity
File: src/universal/CrossDomainMessenger.sol
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
4: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
5: import { SafeCall } from "src/libraries/SafeCall.sol";
5: import { SafeCall } from "src/libraries/SafeCall.sol";
6: import { Hashing } from "src/libraries/Hashing.sol";
6: import { Hashing } from "src/libraries/Hashing.sol";
7: import { Encoding } from "src/libraries/Encoding.sol";
7: import { Encoding } from "src/libraries/Encoding.sol";
8: import { Constants } from "src/libraries/Constants.sol";
8: import { Constants } from "src/libraries/Constants.sol";
198: ++msgNonce;
198: ++msgNonce;
265: !SafeCall.hasMinGas(_minGasLimit, RELAY_RESERVED_GAS + RELAY_GAS_CHECK_BUFFER)
284: bool success = SafeCall.call(_target, gasleft() - RELAY_RESERVED_GAS, _value, _message);
337: + (uint64(_message.length) * MIN_GAS_CALLDATA_OVERHEAD)
337: + (uint64(_message.length) * MIN_GAS_CALLDATA_OVERHEAD)
339: + ((_minGasLimit * MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR) / MIN_GAS_DYNAMIC_OVERHEAD_DENOMINATOR)
339: + ((_minGasLimit * MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR) / MIN_GAS_DYNAMIC_OVERHEAD_DENOMINATOR)
339: + ((_minGasLimit * MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR) / MIN_GAS_DYNAMIC_OVERHEAD_DENOMINATOR)
342: + RELAY_CALL_OVERHEAD
345: + RELAY_RESERVED_GAS
348: + RELAY_GAS_CHECK_BUFFER;
```
```solidity
File: src/universal/ERC721Bridge.sol
4: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
4: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
5: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
5: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
5: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
6: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
6: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
6: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
6: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
```
```solidity
File: src/universal/FeeVault.sol
4: import { L2StandardBridge } from "src/L2/L2StandardBridge.sol";
4: import { L2StandardBridge } from "src/L2/L2StandardBridge.sol";
5: import { Predeploys } from "src/libraries/Predeploys.sol";
5: import { Predeploys } from "src/libraries/Predeploys.sol";
68: totalProcessed += value;
```
```solidity
File: src/universal/IOptimismMintableERC20.sol
4: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
4: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
4: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
4: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
```
```solidity
File: src/universal/IOptimismMintableERC721.sol
4: import { IERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
4: import { IERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
4: import { IERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
4: import { IERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
4: import { IERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
```
```solidity
File: src/universal/OptimismMintableERC20.sol
4: import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
4: import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
4: import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
4: import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
5: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
6: import { ILegacyMintableERC20, IOptimismMintableERC20 } from "src/universal/IOptimismMintableERC20.sol";
6: import { ILegacyMintableERC20, IOptimismMintableERC20 } from "src/universal/IOptimismMintableERC20.sol";
7: import { Semver } from "src/universal/Semver.sol";
7: import { Semver } from "src/universal/Semver.sol";
```
```solidity
File: src/universal/OptimismMintableERC20Factory.sol
4: import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
4: import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
5: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
5: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
5: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
5: import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
6: import { ISemver } from "src/universal/ISemver.sol";
6: import { ISemver } from "src/universal/ISemver.sol";
7: import { Constants } from "src/libraries/Constants.sol";
7: import { Constants } from "src/libraries/Constants.sol";
```
```solidity
File: src/universal/OptimismMintableERC721.sol
4: import { ERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
4: import { ERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
4: import { ERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
4: import { ERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
4: import { ERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
5: import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
5: import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
5: import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
5: import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
6: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
6: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
6: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
6: import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
7: import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
7: import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
7: import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
8: import { IOptimismMintableERC721 } from "src/universal/IOptimismMintableERC721.sol";
8: import { IOptimismMintableERC721 } from "src/universal/IOptimismMintableERC721.sol";
9: import { ISemver } from "src/universal/ISemver.sol";
9: import { ISemver } from "src/universal/ISemver.sol";
68: "/tokenURI?uint256="
```
```solidity
File: src/universal/OptimismMintableERC721Factory.sol
4: import { OptimismMintableERC721 } from "src/universal/OptimismMintableERC721.sol";
4: import { OptimismMintableERC721 } from "src/universal/OptimismMintableERC721.sol";
5: import { ISemver } from "src/universal/ISemver.sol";
5: import { ISemver } from "src/universal/ISemver.sol";
```
```solidity
File: src/universal/Proxy.sol
4: import { Constants } from "src/libraries/Constants.sol";
4: import { Constants } from "src/libraries/Constants.sol";
```
```solidity
File: src/universal/ProxyAdmin.sol
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
5: import { Proxy } from "src/universal/Proxy.sol";
5: import { Proxy } from "src/universal/Proxy.sol";
6: import { AddressManager } from "src/legacy/AddressManager.sol";
6: import { AddressManager } from "src/legacy/AddressManager.sol";
7: import { L1ChugSplashProxy } from "src/legacy/L1ChugSplashProxy.sol";
7: import { L1ChugSplashProxy } from "src/legacy/L1ChugSplashProxy.sol";
8: import { Constants } from "src/libraries/Constants.sol";
8: import { Constants } from "src/libraries/Constants.sol";
```
```solidity
File: src/universal/Semver.sol
4: import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
4: import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
4: import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
```
```solidity
File: src/universal/StandardBridge.sol
4: import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
4: import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
4: import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
4: import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
5: import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
5: import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
5: import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
5: import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
6: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
6: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
6: import { Address } from "@openzeppelin/contracts/utils/Address.sol";
7: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
7: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
7: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
7: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
7: import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
8: import { SafeCall } from "src/libraries/SafeCall.sol";
8: import { SafeCall } from "src/libraries/SafeCall.sol";
9: import { IOptimismMintableERC20, ILegacyMintableERC20 } from "src/universal/IOptimismMintableERC20.sol";
9: import { IOptimismMintableERC20, ILegacyMintableERC20 } from "src/universal/IOptimismMintableERC20.sol";
10: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
10: import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
11: import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
11: import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
12: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
12: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
12: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
12: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
12: import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
286: deposits[_localToken][_remoteToken] = deposits[_localToken][_remoteToken] - _amount;
355: deposits[_localToken][_remoteToken] = deposits[_localToken][_remoteToken] + _amount;
```
```solidity
File: src/universal/StorageSetter.sol
4: import { ISemver } from "src/universal/ISemver.sol";
4: import { ISemver } from "src/universal/ISemver.sol";
5: import { Storage } from "src/libraries/Storage.sol";
5: import { Storage } from "src/libraries/Storage.sol";
```
```solidity
File: src/vendor/AddressAliasHelper.sol
30: l2Address = address(uint160(l1Address) + offset);
40: l1Address = address(uint160(l2Address) - offset);
```
```solidity
File: src/vendor/WETH9.sol
35: balanceOf[msg.sender] += msg.value;
40: balanceOf[msg.sender] -= wad;
65: if (src != msg.sender && allowance[src][msg.sender] != uint(-1)) {
67: allowance[src][msg.sender] -= wad;
70: balanceOf[src] -= wad;
71: balanceOf[dst] += wad;
84: Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
84: Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
84: Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
96: share and change all versions of a program--to make sure it remains free
96: share and change all versions of a program--to make sure it remains free
122: giving you legal permission to copy, distribute and/or modify it.
143: software on general-purpose computers, but in those that do, we wish to
146: patents cannot be used to render the program non-free.
157: "Copyright" also means copyright-like laws that apply to other kinds of
195: for making modifications to it. "Object code" means any non-source
218: System Libraries, or general-purpose tools or generally available free
259: 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
281: non-permissive terms added in accord with section 7 apply to the code;
325: 6. Conveying Non-Source Forms.
329: machine-readable Corresponding Source under the terms of this License,
368: e) Convey the object code using peer-to-peer transmission, provided
368: e) Convey the object code using peer-to-peer transmission, provided
387: commercial, industrial or non-consumer uses, unless such uses represent
468: All other non-permissive additional terms are considered "further
483: Additional terms, permissive or non-permissive, may be stated in the
519: occurring solely as a consequence of using peer-to-peer transmission
519: occurring solely as a consequence of using peer-to-peer transmission
547: (including a cross-claim or counterclaim in a lawsuit) alleging that
567: Each contributor grants you a non-exclusive, worldwide, royalty-free
567: Each contributor grants you a non-exclusive, worldwide, royalty-free
603: conditioned on the non-exercise of one or more of the rights that are
645: The Free Software Foundation may publish revised and/or new versions of
673: HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
683: WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
717: This program is free software: you can redistribute it and/or modify
728: along with this program. If not, see <http://www.gnu.org/licenses/>.
728: along with this program. If not, see <http://www.gnu.org/licenses/>.
728: along with this program. If not, see <http://www.gnu.org/licenses/>.
728: along with this program. If not, see <http://www.gnu.org/licenses/>.
747: <http://www.gnu.org/licenses/>.
747: <http://www.gnu.org/licenses/>.
747: <http://www.gnu.org/licenses/>.
747: <http://www.gnu.org/licenses/>.
754: <http://www.gnu.org/philosophy/why-not-lgpl.html>.
754: <http://www.gnu.org/philosophy/why-not-lgpl.html>.
754: <http://www.gnu.org/philosophy/why-not-lgpl.html>.
754: <http://www.gnu.org/philosophy/why-not-lgpl.html>.
754: <http://www.gnu.org/philosophy/why-not-lgpl.html>.
754: <http://www.gnu.org/philosophy/why-not-lgpl.html>.
```
### <a name="GAS-9"></a>[GAS-9] Use Custom Errors
[Source](https://blog.soliditylang.org/2021/04/21/custom-errors/)
Instead of using error strings, to reduce deployment and runtime cost, you should use Custom Errors. This would save both deployment and runtime cost.
*Instances (216)*:
```solidity
File: src/L1/L1CrossDomainMessenger.sol
73: require(version < 2, "CrossDomainMessenger: only version 0 or 1 messages are supported at this time");
79: require(successfulMessages[oldHash] == false, "CrossDomainMessenger: legacy withdrawal already relayed");
101: require(msg.value == 0, "CrossDomainMessenger: value must be zero unless message is from a system address");
103: require(failedMessages[versionedHash], "CrossDomainMessenger: message cannot be replayed");
114: require(successfulMessages[versionedHash] == false, "CrossDomainMessenger: message has already been relayed");
141: revert("CrossDomainMessenger: failed to relay message");
167: revert("CrossDomainMessenger: failed to relay message");
```
```solidity
File: src/L1/L1ERC721Bridge.sol
57: require(_localToken != address(this), "L1ERC721Bridge: local token cannot be self");
90: require(_remoteToken != address(0), "L1ERC721Bridge: remote token cannot be address(0)");
```
```solidity
File: src/L1/L1StandardBridge.sol
180: require(msg.value <= _amount, "L1StandardBridge: amount sent exceeds amount required");
181: require(_to != address(this), "L1StandardBridge: cannot send to self");
182: require(_to != address(messenger), "L1StandardBridge: cannot send to messenger");
191: require(success, "L1StandardBridge: ETH transfer failed");
```
```solidity
File: src/L1/L2OutputOracle.sol
76: require(_l2BlockTime > 0, "L2OutputOracle: L2 block time must be greater than 0");
77: require(_submissionInterval > 0, "L2OutputOracle: submission interval must be greater than 0");
146: require(msg.sender == challenger, "L2OutputOracle: only the challenger address can delete outputs");
185: require(msg.sender == proposer, "L2OutputOracle: only the proposer address can propose new outputs");
197: require(_outputRoot != bytes32(0), "L2OutputOracle: L2 output proposal cannot be the zero hash");
245: require(l2Outputs.length > 0, "L2OutputOracle: cannot get output as no outputs have been proposed yet");
```
```solidity
File: src/L1/OptimismPortal.sol
106: require(paused == false, "OptimismPortal: paused");
169: require(msg.sender == guardian, "OptimismPortal: only guardian can pause");
176: require(msg.sender == guardian, "OptimismPortal: only guardian can unpause");
228: require(_tx.target != address(this), "OptimismPortal: you cannot send messages to the portal contract");
286: require(_tx.target != address(yieldManager), "OptimismPortal: unauthorized call to yield manager");
321: require(provenWithdrawal.timestamp != 0, "OptimismPortal: withdrawal has not been proven yet");
359: require(finalizedWithdrawals[withdrawalHash] == false, "OptimismPortal: withdrawal has already been finalized");
395: revert("OptimismPortal: withdrawal failed");
422: require(_to == address(0), "OptimismPortal: must send to address(0) when creating a contract");
427: require(_gasLimit >= minimumGasLimit(uint64(_data.length)), "OptimismPortal: gas limit too small");
433: require(_data.length <= 120_000, "OptimismPortal: data too large");
453: revert("OptimismPortal: only the BlastBridge can deposit");
463: require(success, "OptimismPortal: ETH transfer to YieldManager failed");
```
```solidity
File: src/L1/SystemConfig.sol
190: require(_gasLimit >= minimumGasLimit(), "SystemConfig: gas limit too low");
325: require(_gasLimit >= minimumGasLimit(), "SystemConfig: gas limit too low");
356: require(_config.baseFeeMaxChangeDenominator > 1, "SystemConfig: denominator must be larger than 1");
359: require(_config.maxResourceLimit + _config.systemTxMaxGas <= gasLimit, "SystemConfig: gas limit too low");
361: require(_config.elasticityMultiplier > 0, "SystemConfig: elasticity multiplier cannot be 0");
```
```solidity
File: src/L2/Blast.sol
96: require(isAuthorized(msg.sender), "not authorized to configure contract");
114: require(isAuthorized(contractAddress), "not authorized to configure contract");
127: require(isAuthorized(msg.sender), "not authorized to configure contract");
136: require(isAuthorized(contractAddress), "not authorized to configure contract");
144: require(isAuthorized(msg.sender), "not authorized to configure contract");
153: require(isAuthorized(contractAddress), "not authorized to configure contract");
161: require(isAuthorized(msg.sender), "not authorized to configure contract");
170: require(isAuthorized(contractAddress), "not authorized to configure contract");
178: require(isAuthorized(msg.sender), "not authorized to configure contract");
187: require(isAuthorized(contractAddress), "not authorized to configure contract");
195: require(isAuthorized(msg.sender), "not authorized to configure contract");
204: require(isAuthorized(contractAddress), "not authorized to configure contract");
212: require(isAuthorized(msg.sender), "not authorized to configure contract");
221: require(isAuthorized(contractAddress), "not authorized to configure contract");
236: require(isAuthorized(contractAddress), "Not authorized to claim yield");
246: require(isAuthorized(contractAddress), "Not authorized to claim yield");
258: require(isAuthorized(contractAddress), "Not allowed to claim all gas");
270: require(isAuthorized(contractAddress), "Not allowed to claim gas at min claim rate");
281: require(isAuthorized(contractAddress), "Not allowed to claim max gas");
293: require(isAuthorized(contractAddress), "Not allowed to claim gas");
```
```solidity
File: src/L2/CrossDomainOwnable2.sol
20: require(msg.sender == address(messenger), "CrossDomainOwnable2: caller is not the messenger");
22: require(owner() == messenger.xDomainMessageSender(), "CrossDomainOwnable2: caller is not the owner");
```
```solidity
File: src/L2/CrossDomainOwnable3.sol
29: require(_owner != address(0), "CrossDomainOwnable3: new owner is the zero address");
43: require(owner() == msg.sender, "CrossDomainOwnable3: caller is not the owner");
47: require(msg.sender == address(messenger), "CrossDomainOwnable3: caller is not the messenger");
49: require(owner() == messenger.xDomainMessageSender(), "CrossDomainOwnable3: caller is not the owner");
```
```solidity
File: src/L2/ERC20PermitUpgradeable.sol
65: require(block.timestamp <= deadline, "ERC20Permit: expired deadline");
72: require(signer == owner, "ERC20Permit: invalid signature");
```
```solidity
File: src/L2/Gas.sol
64: require(_zeroClaimRate < _baseClaimRate, "zero claim rate must be < base claim rate");
65: require(_baseClaimRate < _ceilClaimRate, "base claim rate must be < ceil claim rate");
66: require(_baseGasSeconds < _ceilGasSeconds, "base gas seconds must be < ceil gas seconds");
67: require(_baseGasSeconds > 0, "base gas seconds must be > 0");
68: require(_ceilClaimRate <= 10000, "ceil claim rate must be less than or equal to 10_000 bips");
84: require(msg.sender == admin, "Caller is not the admin");
91: require(msg.sender == blastConfigurationContract, "Caller must be blast configuration contract");
110: require(_zeroClaimRate < _baseClaimRate, "zero claim rate must be < base claim rate");
111: require(_baseClaimRate < _ceilClaimRate, "base claim rate must be < ceil claim rate");
112: require(_baseGasSeconds < _ceilGasSeconds, "base gas seconds must be < ceil gas seconds");
113: require(_baseGasSeconds > 0, "base gas seconds must be > 0");
114: require(_ceilClaimRate <= 10000, "ceil claim rate must be less than or equal to 10_000 bips");
153: require(minClaimRateBips <= ceilClaimRate, "desired claim rate exceeds maximum");
211: require(gasToClaim > 0, "must withdraw non-zero amount");
212: require(gasToClaim <= etherBalance, "too much to withdraw");
213: require(gasSecondsToConsume <= etherSeconds, "not enough gas seconds");
297: revert("Unexpected packing issue due to overflow");
```
```solidity
File: src/L2/L1Block.sol
65: require(msg.sender == DEPOSITOR_ACCOUNT, "L1Block: only the depositor account can set L1 block values");
```
```solidity
File: src/L2/L2ERC721Bridge.sol
58: require(_localToken != address(this), "L2ERC721Bridge: local token cannot be self");
93: require(_remoteToken != address(0), "L2ERC721Bridge: remote token cannot be address(0)");
104: require(remoteToken == _remoteToken, "L2ERC721Bridge: remote token does not match given value");
```
```solidity
File: src/Safe/LivenessGuard.sol
64: require(msg.sender == address(SAFE), "LivenessGuard: only Safe can call this function");
154: require(SAFE.isOwner(msg.sender), "LivenessGuard: only Safe owners may demonstrate liveness");
```
```solidity
File: src/Safe/LivenessModule.sol
58: require(_minOwners <= owners.length, "LivenessModule: minOwners must be less than the number of owners");
105: require(SAFE.isOwner(_owner), "LivenessModule: the owner to remove must be an owner of the Safe");
115: require(_previousOwners.length == _ownersToRemove.length, "LivenessModule: arrays must be the same length");
127: require(canRemove(_ownersToRemove[i]), "LivenessModule: the owner to remove has signed recently");
208: require(owners[0] == FALLBACK_OWNER, "LivenessModule: must transfer ownership to fallback owner");
```
```solidity
File: src/cannon/PreimageOracle.sol
20: require(preimagePartOk[_key][_offset], "pre-image must exist");
```
```solidity
File: src/governance/MintManager.sol
44: require(mintPermittedAfter <= block.timestamp, "MintManager: minting not permitted yet");
59: require(_newMintManager != address(0), "MintManager: mint manager cannot be the zero address");
```
```solidity
File: src/legacy/DeployerWhitelist.sol
39: require(msg.sender == owner, "DeployerWhitelist: function can only be called by the owner of this contract");
61: require(_owner != address(0), "DeployerWhitelist: can only be disabled via enableArbitraryContractDeployment");
```
```solidity
File: src/legacy/L1ChugSplashProxy.sol
45: require(ret == 0, "L1ChugSplashProxy: system is currently being upgraded");
178: require(implementation != address(0), "L1ChugSplashProxy: implementation is not set yet");
```
```solidity
File: src/legacy/LegacyERC20ETH.sol
31: revert("LegacyERC20ETH: mint is disabled");
37: revert("LegacyERC20ETH: burn is disabled");
43: revert("LegacyERC20ETH: transfer is disabled");
49: revert("LegacyERC20ETH: approve is disabled");
55: revert("LegacyERC20ETH: transferFrom is disabled");
61: revert("LegacyERC20ETH: increaseAllowance is disabled");
67: revert("LegacyERC20ETH: decreaseAllowance is disabled");
```
```solidity
File: src/legacy/LegacyMintableERC20.sol
41: require(msg.sender == l2Bridge, "Only L2 Bridge can mint and burn");
```
```solidity
File: src/legacy/ResolvedDelegateProxy.sol
37: require(target != address(0), "ResolvedDelegateProxy: target address must be initialized");
```
```solidity
File: src/libraries/Bytes.sol
17: require(_length + 31 >= _length, "slice_overflow");
18: require(_start + _length >= _start, "slice_overflow");
19: require(_bytes.length >= _start + _length, "slice_outOfBounds");
```
```solidity
File: src/libraries/Encoding.sol
57: revert("Encoding: unknown cross domain message version");
```
```solidity
File: src/libraries/Hashing.sol
57: revert("Hashing: unknown cross domain message version");
```
```solidity
File: src/libraries/rlp/RLPReader.sol
37: require(_in.length > 0, "RLPReader: length of an RLP item must be greater than zero to be decodable");
53: require(itemType == RLPItemType.LIST_ITEM, "RLPReader: decoded item type for list is not a list item");
55: require(listOffset + listLength == _in.length, "RLPReader: list item has an invalid data remainder");
100: require(itemType == RLPItemType.DATA_ITEM, "RLPReader: decoded item type for bytes is not a data item");
102: require(_in.length == itemOffset + itemLength, "RLPReader: bytes value contains an invalid remainder");
134: require(_in.length > 0, "RLPReader: length of an RLP item must be greater than zero to be decodable");
189: require(strLen > 55, "RLPReader: length of content must be greater than 55 bytes (long string)");
202: require(_in.length > listLen, "RLPReader: length of content must be greater than list length (short list)");
228: require(listLen > 55, "RLPReader: length of content must be greater than 55 bytes (long list)");
```
```solidity
File: src/libraries/trie/MerkleTrie.sol
69: require(_key.length > 0, "MerkleTrie: empty key");
81: require(currentKeyIndex <= key.length, "MerkleTrie: key index exceeds total key length");
97: require(Bytes.equal(currentNode.encoded, currentNodeID), "MerkleTrie: invalid internal node hash");
108: require(value_.length > 0, "MerkleTrie: value length must be greater than zero (branch)");
111: require(i == proof.length - 1, "MerkleTrie: value node must be last node in proof (branch)");
155: require(value_.length > 0, "MerkleTrie: value length must be greater than zero (leaf)");
158: require(i == proof.length - 1, "MerkleTrie: value node must be last node in proof (leaf)");
168: revert("MerkleTrie: received a node with an unknown prefix");
171: revert("MerkleTrie: received an unparseable node");
175: revert("MerkleTrie: ran out of proof elements");
```
```solidity
File: src/mainnet-bridge/DelegateCalls.sol
17: require(success, "delegatecall failed");
24: require(success, "delegatecall failed");
31: require(success, "delegatecall failed");
38: require(success, "delegatecall failed");
46: require(success, "delegatecall failed");
```
```solidity
File: src/mainnet-bridge/L1BlastBridge.sol
103: require(msg.sender == usdYieldManager.owner(), "L1BlastBridge: only USDYieldManager owner can call");
125: require(msg.sender == ethYieldManager.owner(), "L1BlastBridge: only ETHYieldManager owner can call");
157: require(msg.value <= _amount, "L1BlastBridge: amount sent exceeds amount required");
158: require(_to != address(this), "L1BlastBridge: cannot send to self");
159: require(_to != address(messenger), "L1BlastBridge: cannot send to messenger");
168: require(success, "L2BlastBridge: ETH transfer failed");
193: require(_to != address(this), "StandardBridge: cannot send to self");
194: require(_to != address(messenger), "StandardBridge: cannot send to messenger");
196: require(_localToken == usdYieldManager.TOKEN(), "L1BlastBridge: unsupported local token");
197: require(_remoteToken == Predeploys.USDB, "L1BlastBridge: only USDB can be withdrawn through this bridge");
236: require(_remoteToken == Predeploys.USDB, "L1BlastBridge: this token can only be bridged to USDB");
266: require(_remoteToken == address(0), "L1BlastBridge: this token can only be bridged to ETH");
295: revert("L1BlastBridge: bridge token is not supported");
```
```solidity
File: src/mainnet-bridge/L2BlastBridge.sol
56: require(AddressAliasHelper.undoL1ToL2Alias(msg.sender) == address(OTHER_BRIDGE), "L2BlastBridge: function can only be called from the other bridge");
57: require(msg.value == _amount, "L2BlastBridge: amount sent does not match amount required");
58: require(_to != address(this), "L2BlastBridge: cannot send to self");
59: require(_to != address(messenger), "L2BlastBridge: cannot send to messenger");
66: require(success, "L2BlastBridge: ETH transfer failed");
83: require(_localToken == Predeploys.USDB, "L2BlastBridge: only USDB can be withdrawn from this bridge.");
84: require(_isCorrectTokenPair(Predeploys.USDB, _remoteToken), "L2BlastBridge: wrong remote token for USDB.");
```
```solidity
File: src/mainnet-bridge/YieldManager.sol
323: require(msg.sender == address(this), "Caller is not this contract");
```
```solidity
File: src/mainnet-bridge/yield-providers/DSRYieldProvider.sol
110: revert("DSRYieldProvider: recordPending not supported");
119: require(supportsInsurancePayment(), "insurance not supported");
130: require(supportsInsurancePayment(), "insurance not supported");
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
143: require(supportsInsurancePayment(), "insurance not supported");
155: require(supportsInsurancePayment(), "insurance not supported");
180: require(lastClaimedIndex < lastRequestIndex, "invalid claim index");
```
```solidity
File: src/mainnet-bridge/yield-providers/YieldProvider.sol
80: revert("not supported");
140: require(claimed == 0 && pending == expected, "invalid yield provider implementation");
145: require(pending == 0 && claimed == expected, "invalid yield provider implementation");
172: require(claimed <= expected, "invalid yield provider implementation");
```
```solidity
File: src/periphery/drippie/Drippie.sol
91: require(drips[_name].status == DripStatus.NONE, "Drippie: drip with that name already exists");
97: require(_config.interval == 0, "Drippie: if allowing reentrant drip, must set interval to zero");
99: require(_config.interval > 0, "Drippie: interval must be greater than zero if drip is not reentrant");
128: require(_status != DripStatus.NONE, "Drippie: drip status can never be set back to NONE after creation");
136: require(curr != DripStatus.NONE, "Drippie: drip with that name does not exist and cannot be updated");
140: require(curr != DripStatus.ARCHIVED, "Drippie: drip with that name has been archived and cannot be updated");
145: require(curr != _status, "Drippie: cannot set drip status to the same status as its current status");
151: require(curr == DripStatus.PAUSED, "Drippie: drip must first be paused before being archived");
166: require(state.status == DripStatus.ACTIVE, "Drippie: selected drip does not exist or is not currently active");
242: require(success, "Drippie: drip was unsuccessful, please check your configuration for mistakes");
```
```solidity
File: src/periphery/faucet/Faucet.sol
60: require(msg.sender == ADMIN, "Faucet: function can only be called by admin");
96: require(config.enabled, "Faucet: provided auth module is not supported by this faucet");
102: require(nonces[_auth.id][_params.nonce] == false, "Faucet: nonce has already been used");
```
```solidity
File: src/periphery/op-nft/OptimistInviter.sol
113: require(msg.sender == INVITE_GRANTER, "OptimistInviter: only invite granter can grant invites");
157: require(commitmentTimestamps[_commitment] == 0, "OptimistInviter: commitment already made");
179: require(commitmentTimestamp > 0, "OptimistInviter: claimer and signature have not been committed yet");
214: require(inviteCounts[_claimableInvite.issuer] > 0, "OptimistInviter: issuer has no invites");
```
```solidity
File: src/universal/CrossDomainMessenger.sol
224: require(version < 2, "CrossDomainMessenger: only version 0 or 1 messages are supported at this time");
230: require(successfulMessages[oldHash] == false, "CrossDomainMessenger: legacy withdrawal already relayed");
244: require(msg.value == 0, "CrossDomainMessenger: value must be zero unless message is from a system address");
246: require(failedMessages[versionedHash], "CrossDomainMessenger: message cannot be replayed");
253: require(successfulMessages[versionedHash] == false, "CrossDomainMessenger: message has already been relayed");
277: revert("CrossDomainMessenger: failed to relay message");
300: revert("CrossDomainMessenger: failed to relay message");
```
```solidity
File: src/universal/ERC721Bridge.sol
66: require(_otherBridge != address(0), "ERC721Bridge: other bridge cannot be address(0)");
118: require(!Address.isContract(msg.sender), "ERC721Bridge: account is not externally owned");
148: require(_to != address(0), "ERC721Bridge: nft recipient cannot be address(0)");
```
```solidity
File: src/universal/FeeVault.sol
75: require(success, "FeeVault: failed to send ETH to L2 fee recipient");
```
```solidity
File: src/universal/OptimismMintableERC20.sol
37: require(msg.sender == BRIDGE, "OptimismMintableERC20: only bridge can mint and burn");
```
```solidity
File: src/universal/OptimismMintableERC20Factory.sol
107: require(_remoteToken != address(0), "OptimismMintableERC20Factory: must provide remote token address");
```
```solidity
File: src/universal/OptimismMintableERC721.sol
30: require(msg.sender == BRIDGE, "OptimismMintableERC721: only bridge can call this function");
52: require(_bridge != address(0), "OptimismMintableERC721: bridge cannot be address(0)");
53: require(_remoteChainId != 0, "OptimismMintableERC721: remote chain id cannot be zero");
54: require(_remoteToken != address(0), "OptimismMintableERC721: remote token cannot be address(0)");
```
```solidity
File: src/universal/OptimismMintableERC721Factory.sol
51: require(_remoteToken != address(0), "OptimismMintableERC721Factory: L1 token address cannot be address(0)");
```
```solidity
File: src/universal/Proxy.sol
79: require(success, "Proxy: delegatecall to new implementation contract failed");
125: require(impl != address(0), "Proxy: implementation not initialized");
```
```solidity
File: src/universal/ProxyAdmin.sol
122: revert("ProxyAdmin: unknown proxy type");
138: revert("ProxyAdmin: unknown proxy type");
154: revert("ProxyAdmin: unknown proxy type");
200: require(success, "ProxyAdmin: call to proxy after upgrade failed");
```
```solidity
File: src/universal/StandardBridge.sol
108: require(!Address.isContract(msg.sender), "StandardBridge: function can only be called from an EOA");
244: require(msg.value == _amount, "StandardBridge: amount sent does not match amount required");
245: require(_to != address(this), "StandardBridge: cannot send to self");
246: require(_to != address(messenger), "StandardBridge: cannot send to messenger");
253: require(success, "StandardBridge: ETH transfer failed");
312: require(msg.value == _amount, "StandardBridge: bridging ETH must include sufficient ETH value");
```
### <a name="GAS-10"></a>[GAS-10] Don't initialize variables with default value
*Instances (59)*:
```solidity
File: src/EAS/Common.sol
8: uint64 constant NO_EXPIRATION_TIME = 0;
69: uint256 length = 0;
70: for (uint256 i = 0; i < 32; i = uncheckedInc(i)) {
81: for (uint256 j = 0; j < length; j = uncheckedInc(j)) {
```
```solidity
File: src/EAS/EAS.sol
125: uint256 totalUidsCount = 0;
133: for (uint256 i = 0; i < length; i = uncheckedInc(i)) {
177: uint256 totalUidsCount = 0;
185: for (uint256 i = 0; i < length; i = uncheckedInc(i)) {
204: for (uint256 j = 0; j < dataLength; j = uncheckedInc(j)) {
261: for (uint256 i = 0; i < length; i = uncheckedInc(i)) {
289: for (uint256 i = 0; i < length; i = uncheckedInc(i)) {
308: for (uint256 j = 0; j < dataLength; j = uncheckedInc(j)) {
345: for (uint256 i = 0; i < length; i = uncheckedInc(i)) {
357: for (uint256 i = 0; i < length; i = uncheckedInc(i)) {
415: for (uint256 i = 0; i < length; i = uncheckedInc(i)) {
443: uint32 bump = 0;
505: for (uint256 i = 0; i < length; i = uncheckedInc(i)) {
639: for (uint256 i = 0; i < length; i = uncheckedInc(i)) {
652: uint256 totalUsedValue = 0;
655: for (uint256 i = 0; i < length; i = uncheckedInc(i)) {
761: uint256 currentIndex = 0;
763: for (uint256 i = 0; i < uidListLength; i = uncheckedInc(i)) {
766: for (uint256 j = 0; j < currentUidsLength; j = uncheckedInc(j)) {
```
```solidity
File: src/EAS/resolver/SchemaResolver.sol
75: for (uint256 i = 0; i < length; i = uncheckedInc(i)) {
122: for (uint256 i = 0; i < length; i = uncheckedInc(i)) {
```
```solidity
File: src/L1/L2OutputOracle.sol
248: uint256 lo = 0;
```
```solidity
File: src/L1/OptimismPortal.sol
36: uint256 internal constant DEPOSIT_VERSION = 0;
```
```solidity
File: src/L1/ProtocolVersions.sol
24: uint256 public constant VERSION = 0;
```
```solidity
File: src/L1/SystemConfig.sol
40: uint256 public constant VERSION = 0;
```
```solidity
File: src/L2/GasPriceOracle.sol
87: uint256 total = 0;
89: for (uint256 i = 0; i < length; i++) {
```
```solidity
File: src/Safe/LivenessGuard.sol
49: for (uint256 i = 0; i < owners.length; i++) {
90: for (uint256 i = 0; i < owners.length; i++) {
113: for (uint256 i = 0; i < signers.length; i++) {
131: for (uint256 i = 0; i < ownersAfter.length; i++) {
144: for (uint256 i = 0; i < ownersBeforeCache.length; i++) {
```
```solidity
File: src/Safe/LivenessModule.sol
121: for (uint256 i = 0; i < _previousOwners.length; i++) {
```
```solidity
File: src/dispute/FaultDisputeGame.sol
397: bool countered = false;
399: for (uint256 i = 0; i < challengeIndices.length; ++i) {
```
```solidity
File: src/libraries/Burn.sol
16: uint256 i = 0;
```
```solidity
File: src/libraries/rlp/RLPReader.sol
63: uint256 itemCount = 0;
```
```solidity
File: src/libraries/rlp/RLPWriter.sol
88: uint256 i = 0;
96: for (uint256 j = 0; j < out_.length; j++) {
140: uint256 i = 0;
```
```solidity
File: src/libraries/trie/MerkleTrie.sol
30: uint8 internal constant PREFIX_EXTENSION_EVEN = 0;
74: uint256 currentKeyIndex = 0;
77: for (uint256 i = 0; i < proof.length; i++) {
185: for (uint256 i = 0; i < length;) {
```
```solidity
File: src/mainnet-bridge/USDConversions.sol
31: int128 constant DAI_INDEX = 0;
```
```solidity
File: src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol
29: uint256 internal constant NOT_FOUND = 0;
132: for (uint256 i = 0; i < _requestIds.length; ++i) {
147: for (uint256 i = 0; i < _requestIds.length; ++i) {
258: uint256 prevRequestId = 0;
259: for (uint256 i = 0; i < _requestIds.length; ++i) {
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
212: for (uint256 j = 0; j < i; j++) {
```
```solidity
File: src/periphery/TransferOnion.sol
47: for (uint256 i = 0; i < length;) {
```
```solidity
File: src/periphery/drippie/Drippie.sol
111: for (uint256 i = 0; i < _config.actions.length; i++) {
221: for (uint256 i = 0; i < len; i++) {
```
```solidity
File: src/periphery/op-nft/AttestationStation.sol
48: for (uint256 i = 0; i < length;) {
```
### <a name="GAS-11"></a>[GAS-11] Long revert strings
*Instances (156)*:
```solidity
File: src/L1/L1CrossDomainMessenger.sol
73: require(version < 2, "CrossDomainMessenger: only version 0 or 1 messages are supported at this time");
79: require(successfulMessages[oldHash] == false, "CrossDomainMessenger: legacy withdrawal already relayed");
101: require(msg.value == 0, "CrossDomainMessenger: value must be zero unless message is from a system address");
103: require(failedMessages[versionedHash], "CrossDomainMessenger: message cannot be replayed");
114: require(successfulMessages[versionedHash] == false, "CrossDomainMessenger: message has already been relayed");
```
```solidity
File: src/L1/L1ERC721Bridge.sol
57: require(_localToken != address(this), "L1ERC721Bridge: local token cannot be self");
90: require(_remoteToken != address(0), "L1ERC721Bridge: remote token cannot be address(0)");
```
```solidity
File: src/L1/L1StandardBridge.sol
180: require(msg.value <= _amount, "L1StandardBridge: amount sent exceeds amount required");
181: require(_to != address(this), "L1StandardBridge: cannot send to self");
182: require(_to != address(messenger), "L1StandardBridge: cannot send to messenger");
191: require(success, "L1StandardBridge: ETH transfer failed");
```
```solidity
File: src/L1/L2OutputOracle.sol
76: require(_l2BlockTime > 0, "L2OutputOracle: L2 block time must be greater than 0");
77: require(_submissionInterval > 0, "L2OutputOracle: submission interval must be greater than 0");
146: require(msg.sender == challenger, "L2OutputOracle: only the challenger address can delete outputs");
185: require(msg.sender == proposer, "L2OutputOracle: only the proposer address can propose new outputs");
197: require(_outputRoot != bytes32(0), "L2OutputOracle: L2 output proposal cannot be the zero hash");
245: require(l2Outputs.length > 0, "L2OutputOracle: cannot get output as no outputs have been proposed yet");
```
```solidity
File: src/L1/OptimismPortal.sol
169: require(msg.sender == guardian, "OptimismPortal: only guardian can pause");
176: require(msg.sender == guardian, "OptimismPortal: only guardian can unpause");
228: require(_tx.target != address(this), "OptimismPortal: you cannot send messages to the portal contract");
286: require(_tx.target != address(yieldManager), "OptimismPortal: unauthorized call to yield manager");
321: require(provenWithdrawal.timestamp != 0, "OptimismPortal: withdrawal has not been proven yet");
359: require(finalizedWithdrawals[withdrawalHash] == false, "OptimismPortal: withdrawal has already been finalized");
422: require(_to == address(0), "OptimismPortal: must send to address(0) when creating a contract");
427: require(_gasLimit >= minimumGasLimit(uint64(_data.length)), "OptimismPortal: gas limit too small");
463: require(success, "OptimismPortal: ETH transfer to YieldManager failed");
```
```solidity
File: src/L1/SystemConfig.sol
356: require(_config.baseFeeMaxChangeDenominator > 1, "SystemConfig: denominator must be larger than 1");
361: require(_config.elasticityMultiplier > 0, "SystemConfig: elasticity multiplier cannot be 0");
```
```solidity
File: src/L2/Blast.sol
96: require(isAuthorized(msg.sender), "not authorized to configure contract");
114: require(isAuthorized(contractAddress), "not authorized to configure contract");
127: require(isAuthorized(msg.sender), "not authorized to configure contract");
136: require(isAuthorized(contractAddress), "not authorized to configure contract");
144: require(isAuthorized(msg.sender), "not authorized to configure contract");
153: require(isAuthorized(contractAddress), "not authorized to configure contract");
161: require(isAuthorized(msg.sender), "not authorized to configure contract");
170: require(isAuthorized(contractAddress), "not authorized to configure contract");
178: require(isAuthorized(msg.sender), "not authorized to configure contract");
187: require(isAuthorized(contractAddress), "not authorized to configure contract");
195: require(isAuthorized(msg.sender), "not authorized to configure contract");
204: require(isAuthorized(contractAddress), "not authorized to configure contract");
212: require(isAuthorized(msg.sender), "not authorized to configure contract");
221: require(isAuthorized(contractAddress), "not authorized to configure contract");
270: require(isAuthorized(contractAddress), "Not allowed to claim gas at min claim rate");
```
```solidity
File: src/L2/CrossDomainOwnable2.sol
20: require(msg.sender == address(messenger), "CrossDomainOwnable2: caller is not the messenger");
22: require(owner() == messenger.xDomainMessageSender(), "CrossDomainOwnable2: caller is not the owner");
```
```solidity
File: src/L2/CrossDomainOwnable3.sol
29: require(_owner != address(0), "CrossDomainOwnable3: new owner is the zero address");
43: require(owner() == msg.sender, "CrossDomainOwnable3: caller is not the owner");
47: require(msg.sender == address(messenger), "CrossDomainOwnable3: caller is not the messenger");
49: require(owner() == messenger.xDomainMessageSender(), "CrossDomainOwnable3: caller is not the owner");
```
```solidity
File: src/L2/Gas.sol
64: require(_zeroClaimRate < _baseClaimRate, "zero claim rate must be < base claim rate");
65: require(_baseClaimRate < _ceilClaimRate, "base claim rate must be < ceil claim rate");
66: require(_baseGasSeconds < _ceilGasSeconds, "base gas seconds must be < ceil gas seconds");
68: require(_ceilClaimRate <= 10000, "ceil claim rate must be less than or equal to 10_000 bips");
91: require(msg.sender == blastConfigurationContract, "Caller must be blast configuration contract");
110: require(_zeroClaimRate < _baseClaimRate, "zero claim rate must be < base claim rate");
111: require(_baseClaimRate < _ceilClaimRate, "base claim rate must be < ceil claim rate");
112: require(_baseGasSeconds < _ceilGasSeconds, "base gas seconds must be < ceil gas seconds");
114: require(_ceilClaimRate <= 10000, "ceil claim rate must be less than or equal to 10_000 bips");
153: require(minClaimRateBips <= ceilClaimRate, "desired claim rate exceeds maximum");
```
```solidity
File: src/L2/L1Block.sol
65: require(msg.sender == DEPOSITOR_ACCOUNT, "L1Block: only the depositor account can set L1 block values");
```
```solidity
File: src/L2/L2ERC721Bridge.sol
58: require(_localToken != address(this), "L2ERC721Bridge: local token cannot be self");
93: require(_remoteToken != address(0), "L2ERC721Bridge: remote token cannot be address(0)");
104: require(remoteToken == _remoteToken, "L2ERC721Bridge: remote token does not match given value");
```
```solidity
File: src/Safe/LivenessGuard.sol
64: require(msg.sender == address(SAFE), "LivenessGuard: only Safe can call this function");
154: require(SAFE.isOwner(msg.sender), "LivenessGuard: only Safe owners may demonstrate liveness");
```
```solidity
File: src/Safe/LivenessModule.sol
58: require(_minOwners <= owners.length, "LivenessModule: minOwners must be less than the number of owners");
105: require(SAFE.isOwner(_owner), "LivenessModule: the owner to remove must be an owner of the Safe");
115: require(_previousOwners.length == _ownersToRemove.length, "LivenessModule: arrays must be the same length");
127: require(canRemove(_ownersToRemove[i]), "LivenessModule: the owner to remove has signed recently");
208: require(owners[0] == FALLBACK_OWNER, "LivenessModule: must transfer ownership to fallback owner");
```
```solidity
File: src/governance/MintManager.sol
44: require(mintPermittedAfter <= block.timestamp, "MintManager: minting not permitted yet");
59: require(_newMintManager != address(0), "MintManager: mint manager cannot be the zero address");
```
```solidity
File: src/legacy/DeployerWhitelist.sol
39: require(msg.sender == owner, "DeployerWhitelist: function can only be called by the owner of this contract");
61: require(_owner != address(0), "DeployerWhitelist: can only be disabled via enableArbitraryContractDeployment");
```
```solidity
File: src/legacy/L1ChugSplashProxy.sol
45: require(ret == 0, "L1ChugSplashProxy: system is currently being upgraded");
178: require(implementation != address(0), "L1ChugSplashProxy: implementation is not set yet");
```
```solidity
File: src/legacy/ResolvedDelegateProxy.sol
37: require(target != address(0), "ResolvedDelegateProxy: target address must be initialized");
```
```solidity
File: src/libraries/rlp/RLPReader.sol
37: require(_in.length > 0, "RLPReader: length of an RLP item must be greater than zero to be decodable");
53: require(itemType == RLPItemType.LIST_ITEM, "RLPReader: decoded item type for list is not a list item");
55: require(listOffset + listLength == _in.length, "RLPReader: list item has an invalid data remainder");
100: require(itemType == RLPItemType.DATA_ITEM, "RLPReader: decoded item type for bytes is not a data item");
102: require(_in.length == itemOffset + itemLength, "RLPReader: bytes value contains an invalid remainder");
134: require(_in.length > 0, "RLPReader: length of an RLP item must be greater than zero to be decodable");
189: require(strLen > 55, "RLPReader: length of content must be greater than 55 bytes (long string)");
202: require(_in.length > listLen, "RLPReader: length of content must be greater than list length (short list)");
228: require(listLen > 55, "RLPReader: length of content must be greater than 55 bytes (long list)");
```
```solidity
File: src/libraries/trie/MerkleTrie.sol
81: require(currentKeyIndex <= key.length, "MerkleTrie: key index exceeds total key length");
97: require(Bytes.equal(currentNode.encoded, currentNodeID), "MerkleTrie: invalid internal node hash");
108: require(value_.length > 0, "MerkleTrie: value length must be greater than zero (branch)");
111: require(i == proof.length - 1, "MerkleTrie: value node must be last node in proof (branch)");
155: require(value_.length > 0, "MerkleTrie: value length must be greater than zero (leaf)");
158: require(i == proof.length - 1, "MerkleTrie: value node must be last node in proof (leaf)");
```
```solidity
File: src/mainnet-bridge/L1BlastBridge.sol
103: require(msg.sender == usdYieldManager.owner(), "L1BlastBridge: only USDYieldManager owner can call");
125: require(msg.sender == ethYieldManager.owner(), "L1BlastBridge: only ETHYieldManager owner can call");
157: require(msg.value <= _amount, "L1BlastBridge: amount sent exceeds amount required");
158: require(_to != address(this), "L1BlastBridge: cannot send to self");
159: require(_to != address(messenger), "L1BlastBridge: cannot send to messenger");
168: require(success, "L2BlastBridge: ETH transfer failed");
193: require(_to != address(this), "StandardBridge: cannot send to self");
194: require(_to != address(messenger), "StandardBridge: cannot send to messenger");
196: require(_localToken == usdYieldManager.TOKEN(), "L1BlastBridge: unsupported local token");
197: require(_remoteToken == Predeploys.USDB, "L1BlastBridge: only USDB can be withdrawn through this bridge");
236: require(_remoteToken == Predeploys.USDB, "L1BlastBridge: this token can only be bridged to USDB");
266: require(_remoteToken == address(0), "L1BlastBridge: this token can only be bridged to ETH");
```
```solidity
File: src/mainnet-bridge/L2BlastBridge.sol
56: require(AddressAliasHelper.undoL1ToL2Alias(msg.sender) == address(OTHER_BRIDGE), "L2BlastBridge: function can only be called from the other bridge");
57: require(msg.value == _amount, "L2BlastBridge: amount sent does not match amount required");
58: require(_to != address(this), "L2BlastBridge: cannot send to self");
59: require(_to != address(messenger), "L2BlastBridge: cannot send to messenger");
66: require(success, "L2BlastBridge: ETH transfer failed");
83: require(_localToken == Predeploys.USDB, "L2BlastBridge: only USDB can be withdrawn from this bridge.");
84: require(_isCorrectTokenPair(Predeploys.USDB, _remoteToken), "L2BlastBridge: wrong remote token for USDB.");
```
```solidity
File: src/mainnet-bridge/yield-providers/YieldProvider.sol
140: require(claimed == 0 && pending == expected, "invalid yield provider implementation");
145: require(pending == 0 && claimed == expected, "invalid yield provider implementation");
172: require(claimed <= expected, "invalid yield provider implementation");
```
```solidity
File: src/periphery/drippie/Drippie.sol
91: require(drips[_name].status == DripStatus.NONE, "Drippie: drip with that name already exists");
97: require(_config.interval == 0, "Drippie: if allowing reentrant drip, must set interval to zero");
99: require(_config.interval > 0, "Drippie: interval must be greater than zero if drip is not reentrant");
128: require(_status != DripStatus.NONE, "Drippie: drip status can never be set back to NONE after creation");
136: require(curr != DripStatus.NONE, "Drippie: drip with that name does not exist and cannot be updated");
140: require(curr != DripStatus.ARCHIVED, "Drippie: drip with that name has been archived and cannot be updated");
145: require(curr != _status, "Drippie: cannot set drip status to the same status as its current status");
151: require(curr == DripStatus.PAUSED, "Drippie: drip must first be paused before being archived");
166: require(state.status == DripStatus.ACTIVE, "Drippie: selected drip does not exist or is not currently active");
242: require(success, "Drippie: drip was unsuccessful, please check your configuration for mistakes");
```
```solidity
File: src/periphery/faucet/Faucet.sol
60: require(msg.sender == ADMIN, "Faucet: function can only be called by admin");
96: require(config.enabled, "Faucet: provided auth module is not supported by this faucet");
102: require(nonces[_auth.id][_params.nonce] == false, "Faucet: nonce has already been used");
```
```solidity
File: src/periphery/op-nft/OptimistInviter.sol
113: require(msg.sender == INVITE_GRANTER, "OptimistInviter: only invite granter can grant invites");
157: require(commitmentTimestamps[_commitment] == 0, "OptimistInviter: commitment already made");
179: require(commitmentTimestamp > 0, "OptimistInviter: claimer and signature have not been committed yet");
214: require(inviteCounts[_claimableInvite.issuer] > 0, "OptimistInviter: issuer has no invites");
```
```solidity
File: src/universal/CrossDomainMessenger.sol
224: require(version < 2, "CrossDomainMessenger: only version 0 or 1 messages are supported at this time");
230: require(successfulMessages[oldHash] == false, "CrossDomainMessenger: legacy withdrawal already relayed");
244: require(msg.value == 0, "CrossDomainMessenger: value must be zero unless message is from a system address");
246: require(failedMessages[versionedHash], "CrossDomainMessenger: message cannot be replayed");
253: require(successfulMessages[versionedHash] == false, "CrossDomainMessenger: message has already been relayed");
```
```solidity
File: src/universal/ERC721Bridge.sol
66: require(_otherBridge != address(0), "ERC721Bridge: other bridge cannot be address(0)");
118: require(!Address.isContract(msg.sender), "ERC721Bridge: account is not externally owned");
148: require(_to != address(0), "ERC721Bridge: nft recipient cannot be address(0)");
```
```solidity
File: src/universal/FeeVault.sol
75: require(success, "FeeVault: failed to send ETH to L2 fee recipient");
```
```solidity
File: src/universal/OptimismMintableERC20.sol
37: require(msg.sender == BRIDGE, "OptimismMintableERC20: only bridge can mint and burn");
```
```solidity
File: src/universal/OptimismMintableERC20Factory.sol
107: require(_remoteToken != address(0), "OptimismMintableERC20Factory: must provide remote token address");
```
```solidity
File: src/universal/OptimismMintableERC721.sol
30: require(msg.sender == BRIDGE, "OptimismMintableERC721: only bridge can call this function");
52: require(_bridge != address(0), "OptimismMintableERC721: bridge cannot be address(0)");
53: require(_remoteChainId != 0, "OptimismMintableERC721: remote chain id cannot be zero");
54: require(_remoteToken != address(0), "OptimismMintableERC721: remote token cannot be address(0)");
```
```solidity
File: src/universal/OptimismMintableERC721Factory.sol
51: require(_remoteToken != address(0), "OptimismMintableERC721Factory: L1 token address cannot be address(0)");
```
```solidity
File: src/universal/Proxy.sol
79: require(success, "Proxy: delegatecall to new implementation contract failed");
125: require(impl != address(0), "Proxy: implementation not initialized");
```
```solidity
File: src/universal/ProxyAdmin.sol
200: require(success, "ProxyAdmin: call to proxy after upgrade failed");
```
```solidity
File: src/universal/StandardBridge.sol
108: require(!Address.isContract(msg.sender), "StandardBridge: function can only be called from an EOA");
244: require(msg.value == _amount, "StandardBridge: amount sent does not match amount required");
245: require(_to != address(this), "StandardBridge: cannot send to self");
246: require(_to != address(messenger), "StandardBridge: cannot send to messenger");
253: require(success, "StandardBridge: ETH transfer failed");
312: require(msg.value == _amount, "StandardBridge: bridging ETH must include sufficient ETH value");
```
### <a name="GAS-12"></a>[GAS-12] Functions guaranteed to revert when called by normal users can be marked `payable`
If a function modifier such as `onlyOwner` is used, the function will revert if a normal user tries to pay the function. Marking the function as `payable` will lower the gas cost for legitimate callers because the compiler will not include checks for whether a payment was provided.
*Instances (94)*:
```solidity
File: src/EAS/resolver/SchemaResolver.sol
162: function _onlyEAS() private view {
```
```solidity
File: src/L1/ProtocolVersions.sol
80: function setRequired(ProtocolVersion _required) external onlyOwner {
101: function setRecommended(ProtocolVersion _recommended) external onlyOwner {
```
```solidity
File: src/L1/ResourceMetering.sol
157: function __ResourceMetering_init() internal onlyInitializing {
```
```solidity
File: src/L1/SystemConfig.sol
270: function setUnsafeBlockSigner(address _unsafeBlockSigner) external onlyOwner {
285: function setBatcherHash(bytes32 _batcherHash) external onlyOwner {
301: function setGasConfig(uint256 _overhead, uint256 _scalar) external onlyOwner {
318: function setGasLimit(uint64 _gasLimit) external onlyOwner {
343: function setResourceConfig(ResourceMetering.ResourceConfig memory _config) external onlyOwner {
```
```solidity
File: src/L2/CrossDomainOwnable3.sol
28: function transferOwnership(address _owner, bool _isLocal) external onlyOwner {
```
```solidity
File: src/L2/ERC20PermitUpgradeable.sol
47: function __ERC20Permit_init(string memory name) internal onlyInitializing {
51: function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}
```
```solidity
File: src/L2/ERC20Rebasing.sol
87: function __ERC20Rebasing_init(string memory _name, string memory _symbol, uint256 _price) internal onlyInitializing {
```
```solidity
File: src/L2/Gas.sol
128: function adminClaimGas(address contractAddress) external onlyAdmin returns (uint256) {
139: function setGasMode(address contractAddress, GasMode mode) external onlyBlastConfigurationContract {
206: function claim(address contractAddress, address recipientOfGas, uint256 gasToClaim, uint256 gasSecondsToConsume) public onlyBlastConfigurationContract() returns (uint256) {
```
```solidity
File: src/L2/Shares.sol
45: function __SharesBase_init(uint256 _price) internal onlyInitializing {
```
```solidity
File: src/dispute/DisputeGameFactory.sol
158: function setImplementation(GameType _gameType, IDisputeGame _impl) external onlyOwner {
```
```solidity
File: src/governance/GovernanceToken.sol
22: function mint(address _account, uint256 _amount) public onlyOwner {
```
```solidity
File: src/governance/MintManager.sol
42: function mint(address _account, uint256 _amount) public onlyOwner {
58: function upgrade(address _newMintManager) public onlyOwner {
```
```solidity
File: src/legacy/AddressManager.sol
25: function setAddress(string memory _name, address _address) external onlyOwner {
```
```solidity
File: src/legacy/DeployerWhitelist.sol
39: require(msg.sender == owner, "DeployerWhitelist: function can only be called by the owner of this contract");
50: function setWhitelistedDeployer(address _deployer, bool _isWhitelisted) external onlyOwner {
57: function setOwner(address _owner) external onlyOwner {
68: function enableArbitraryContractDeployment() external onlyOwner {
```
```solidity
File: src/legacy/L1ChugSplashProxy.sol
175: function _doProxyCall() internal onlyWhenNotPaused {
```
```solidity
File: src/legacy/LegacyMintableERC20.sol
56: function mint(address _to, uint256 _amount) public virtual onlyL2Bridge {
65: function burn(address _from, uint256 _amount) public virtual onlyL2Bridge {
```
```solidity
File: src/mainnet-bridge/Insurance.sol
51: function setAdmin(address _admin) external onlyAdmin {
58: function coverLoss(address token, uint256 amount) external onlyAdminOrYieldManager {
```
```solidity
File: src/mainnet-bridge/L2BlastBridge.sol
56: require(AddressAliasHelper.undoL1ToL2Alias(msg.sender) == address(OTHER_BRIDGE), "L2BlastBridge: function can only be called from the other bridge");
```
```solidity
File: src/mainnet-bridge/YieldManager.sol
129: function __YieldManager_init(OptimismPortal _portal, address _owner) internal onlyInitializing {
142: function setAdmin(address _admin) external onlyOwner {
151: function setInsurance(address _insurance, uint256 _insuranceFeeBips, uint256 _withdrawalBuffer) external onlyOwner {
161: function setBlastBridge(address _blastBridge) external onlyOwner {
168: function addProvider(address provider) external onlyOwner {
181: function removeProvider(address provider) external onlyOwner {
194: function stake(uint256 idx, address providerAddress, uint256 amount) external onlyAdmin {
209: function unstake(uint256 idx, address providerAddress, uint256 amount) external onlyAdmin {
224: function commitYieldReport(bool enableInsurance) public onlyAdmin {
329: function finalize(uint256 requestId) external onlyAdmin returns (uint256 checkpointId) {
402: function recordStakedDeposit(address providerAddress, uint256 amount) external onlyBlastBridge {
```
```solidity
File: src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol
121: function __WithdrawalQueue_init() internal onlyInitializing {
```
```solidity
File: src/mainnet-bridge/yield-providers/DSRYieldProvider.sol
46: function initialize() external override onlyDelegateCall {
91: function stake(uint256 amount) external override onlyDelegateCall {
101: function unstake(uint256 amount) external override onlyDelegateCall returns (uint256 pending, uint256 claimed) {
118: function payInsurancePremium(uint256 amount) external override onlyDelegateCall {
129: function withdrawFromInsurance(uint256 amount) external override onlyDelegateCall {
```
```solidity
File: src/mainnet-bridge/yield-providers/ETHTestnetYieldProvider.sol
19: function stake(uint256 amount) external override onlyDelegateCall {
28: function sendAsset(uint256 amount) external override onlyYieldManager {
44: function payInsurancePremium(uint256 amount) external override onlyDelegateCall {
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
73: function initialize() external override onlyDelegateCall {
104: function stake(uint256 amount) external override onlyDelegateCall {
112: function unstake(uint256 amount) external override onlyDelegateCall returns (uint256 pending, uint256 claimed) {
125: function enqueueUnstakeRequest(uint256 lidoRequestId) external onlyYieldManager {
129: function setLastClaimedIndex(uint256 index) external onlyYieldManager {
133: function recordClaimed(uint256 claimed, uint256 expected) external onlyYieldManager {
137: function preCommitYieldReportDelegateCallHook() external override onlyDelegateCall {
142: function payInsurancePremium(uint256 amount) external override onlyDelegateCall {
154: function withdrawFromInsurance(uint256 amount) external override onlyDelegateCall {
170: function _claim() internal onlyDelegateCall returns (uint256 claimed, uint256 expected) {
```
```solidity
File: src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol
27: function initialize() external override onlyDelegateCall {}
55: function unstake(uint256 amount) external override onlyDelegateCall returns (uint256, uint256) {
```
```solidity
File: src/mainnet-bridge/yield-providers/USDTestnetYieldProvider.sol
19: function stake(uint256 amount) external override onlyDelegateCall {
23: function sendAsset(uint256 amount) external override onlyYieldManager {
27: function recordYield(int256 amount) external onlyOwner {
37: function payInsurancePremium(uint256 amount) external override onlyDelegateCall {
```
```solidity
File: src/mainnet-bridge/yield-providers/YieldProvider.sol
51: function initialize() external onlyDelegateCall virtual {}
86: function commitYield() external onlyYieldManager returns (int256) {
114: function payInsurancePremium(uint256) external virtual onlyDelegateCall {
120: function withdrawFromInsurance(uint256) external virtual onlyDelegateCall {
127: function recordStakedDeposit(uint256 amount) external virtual onlyYieldManager {
136: function recordUnstaked(uint256 pending, uint256 claimed, uint256 expected) external virtual onlyYieldManager {
152: function preCommitYieldReportDelegateCallHook() external virtual onlyDelegateCall {}
```
```solidity
File: src/periphery/AssetReceiver.sol
64: function withdrawERC20(ERC20 _asset, address _to) external onlyOwner {
72: function withdrawERC20(ERC20 _asset, address _to, uint256 _amount) public onlyOwner {
83: function withdrawERC721(ERC721 _asset, address _to, uint256 _id) external onlyOwner {
```
```solidity
File: src/periphery/drippie/Drippie.sol
87: function create(string calldata _name, DripConfig calldata _config) external onlyOwner {
125: function status(string calldata _name, DripStatus _status) external onlyOwner {
```
```solidity
File: src/periphery/faucet/Faucet.sol
60: require(msg.sender == ADMIN, "Faucet: function can only be called by admin");
```
```solidity
File: src/universal/CrossDomainMessenger.sol
353: function __CrossDomainMessenger_init() internal onlyInitializing {
```
```solidity
File: src/universal/ERC721Bridge.sol
58: "ERC721Bridge: function can only be called from the other bridge"
72: function __ERC721Bridge_init(CrossDomainMessenger _messenger) internal onlyInitializing {
```
```solidity
File: src/universal/OptimismMintableERC721.sol
89: function safeMint(address _to, uint256 _tokenId) external virtual onlyBridge {
96: function burn(address _from, uint256 _tokenId) external virtual onlyBridge {
```
```solidity
File: src/universal/ProxyAdmin.sol
65: function setProxyType(address _address, ProxyType _type) external onlyOwner {
73: function setImplementationName(address _address, string memory _name) external onlyOwner {
80: function setAddressManager(AddressManager _address) external onlyOwner {
90: function setAddress(string memory _name, address _address) external onlyOwner {
97: function setUpgrading(bool _upgrading) external onlyOwner {
```
```solidity
File: src/universal/StandardBridge.sol
108: require(!Address.isContract(msg.sender), "StandardBridge: function can only be called from an EOA");
116: "StandardBridge: function can only be called from the other bridge"
129: function __StandardBridge_init(CrossDomainMessenger _messenger) internal onlyInitializing {
```
### <a name="GAS-13"></a>[GAS-13] `++i` costs less gas than `i++`, especially when it's used in `for`-loops (`--i`/`i--` too)
*Saves 5 gas per loop*
*Instances (26)*:
```solidity
File: src/EAS/eip1271/EIP1271Verifier.sol
126: _nonces[request.attester]++,
153: REVOKE_TYPEHASH, request.schema, data.uid, data.value, _nonces[request.revoker]++, request.deadline
```
```solidity
File: src/L2/GasPriceOracle.sol
89: for (uint256 i = 0; i < length; i++) {
```
```solidity
File: src/Safe/LivenessGuard.sol
49: for (uint256 i = 0; i < owners.length; i++) {
90: for (uint256 i = 0; i < owners.length; i++) {
113: for (uint256 i = 0; i < signers.length; i++) {
131: for (uint256 i = 0; i < ownersAfter.length; i++) {
144: for (uint256 i = 0; i < ownersBeforeCache.length; i++) {
```
```solidity
File: src/Safe/LivenessModule.sol
121: for (uint256 i = 0; i < _previousOwners.length; i++) {
```
```solidity
File: src/Safe/SafeSigners.sol
62: for (i = 0; i < requiredSignatures; i++) {
```
```solidity
File: src/libraries/rlp/RLPWriter.sol
70: lenLen++;
76: for (i = 1; i <= lenLen; i++) {
89: for (; i < 32; i++) {
96: for (uint256 j = 0; j < out_.length; j++) {
97: out_[j] = b[i++];
141: for (; i < _list.length; i++) {
151: for (i = 0; i < _list.length; i++) {
```
```solidity
File: src/libraries/trie/MerkleTrie.sol
77: for (uint256 i = 0; i < proof.length; i++) {
```
```solidity
File: src/mainnet-bridge/YieldManager.sol
232: for (uint256 i; i < providersLength; i++) {
359: for (uint256 i; i < providersLength; i++) {
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
190: for (i = firstIndex; i <= lastIndex; i++) {
196: for (i = 0; i < statuses.length; i++) {
212: for (uint256 j = 0; j < i; j++) {
```
```solidity
File: src/periphery/drippie/Drippie.sol
111: for (uint256 i = 0; i < _config.actions.length; i++) {
214: state.count++;
221: for (uint256 i = 0; i < len; i++) {
```
### <a name="GAS-14"></a>[GAS-14] Using `private` rather than `public` for constants, saves gas
If needed, the values can be read from the verified contract source code, or if there are multiple values there can be a single getter function that [returns a tuple](https://github.com/code-423n4/2022-08-frax/blob/90f55a9ce4e25bceed3a74290b854341d8de6afa/src/contracts/FraxlendPair.sol#L156-L178) of the values of all currently-public constants. Saves **3406-3606 gas** in deployment gas due to the compiler not having to create non-payable getter functions for deployment calldata, not having to store the bytes of the value outside of where it's used, and not adding another entry to the method ID table
*Instances (72)*:
```solidity
File: src/EAS/EAS.sol
84: string public constant version = "1.3.0";
```
```solidity
File: src/EAS/SchemaRegistry.sol
24: string public constant version = "1.3.0";
```
```solidity
File: src/L1/DelayedVetoable.sol
78: string public constant version = "1.0.0";
```
```solidity
File: src/L1/L1CrossDomainMessenger.sol
34: string public constant version = "1.7.1";
```
```solidity
File: src/L1/L1ERC721Bridge.sol
23: string public constant version = "1.4.1";
```
```solidity
File: src/L1/L1StandardBridge.sol
74: string public constant version = "1.4.1";
```
```solidity
File: src/L1/L2OutputOracle.sol
68: string public constant version = "1.6.0";
```
```solidity
File: src/L1/OptimismPortal.sol
112: string public constant version = "1.10.0";
```
```solidity
File: src/L1/ProtocolVersions.sol
24: uint256 public constant VERSION = 0;
27: bytes32 public constant REQUIRED_SLOT = bytes32(uint256(keccak256("protocolversion.required")) - 1);
30: bytes32 public constant RECOMMENDED_SLOT = bytes32(uint256(keccak256("protocolversion.recommended")) - 1);
40: string public constant version = "1.0.0";
```
```solidity
File: src/L1/SystemConfig.sol
40: uint256 public constant VERSION = 0;
50: bytes32 public constant UNSAFE_BLOCK_SIGNER_SLOT = keccak256("systemconfig.unsafeblocksigner");
53: bytes32 public constant L1_CROSS_DOMAIN_MESSENGER_SLOT =
57: bytes32 public constant L1_ERC_721_BRIDGE_SLOT = bytes32(uint256(keccak256("systemconfig.l1erc721bridge")) - 1);
60: bytes32 public constant L1_STANDARD_BRIDGE_SLOT = bytes32(uint256(keccak256("systemconfig.l1standardbridge")) - 1);
63: bytes32 public constant L2_OUTPUT_ORACLE_SLOT = bytes32(uint256(keccak256("systemconfig.l2outputoracle")) - 1);
66: bytes32 public constant OPTIMISM_PORTAL_SLOT = bytes32(uint256(keccak256("systemconfig.optimismportal")) - 1);
69: bytes32 public constant OPTIMISM_MINTABLE_ERC20_FACTORY_SLOT =
73: bytes32 public constant BATCH_INBOX_SLOT = bytes32(uint256(keccak256("systemconfig.batchinbox")) - 1);
105: string public constant version = "1.10.0";
```
```solidity
File: src/L2/BaseFeeVault.sol
14: string public constant version = "1.4.1";
```
```solidity
File: src/L2/ERC20PermitUpgradeable.sol
31: bytes32 public constant PERMIT_TYPEHASH =
```
```solidity
File: src/L2/GasPriceOracle.sol
24: uint256 public constant DECIMALS = 6;
28: string public constant version = "1.1.0";
```
```solidity
File: src/L2/L1Block.sol
15: address public constant DEPOSITOR_ACCOUNT = 0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001;
42: string public constant version = "1.1.0";
```
```solidity
File: src/L2/L1FeeVault.sol
14: string public constant version = "1.4.1";
```
```solidity
File: src/L2/L2CrossDomainMessenger.sol
20: string public constant version = "1.7.0";
```
```solidity
File: src/L2/L2ERC721Bridge.sol
24: string public constant version = "1.4.0";
```
```solidity
File: src/L2/L2StandardBridge.sol
57: string public constant version = "1.4.0";
```
```solidity
File: src/L2/L2ToL1MessagePasser.sol
21: uint16 public constant MESSAGE_VERSION = 1;
52: string public constant version = "1.1.0";
```
```solidity
File: src/L2/SequencerFeeVault.sol
14: string public constant version = "1.4.1";
```
```solidity
File: src/Safe/LivenessGuard.sol
30: string public constant version = "1.0.0";
```
```solidity
File: src/Safe/LivenessModule.sol
42: string public constant version = "1.0.0";
```
```solidity
File: src/dispute/BlockOracle.sol
25: string public constant version = "0.0.1";
```
```solidity
File: src/dispute/DisputeGameFactory.sol
41: string public constant version = "0.0.6";
```
```solidity
File: src/dispute/FaultDisputeGame.sol
86: string public constant version = "0.0.11";
```
```solidity
File: src/governance/MintManager.sol
18: uint256 public constant MINT_CAP = 20; // 2%
21: uint256 public constant DENOMINATOR = 1000;
25: uint256 public constant MINT_PERIOD = 365 days;
```
```solidity
File: src/legacy/DeployerWhitelist.sol
45: string public constant version = "1.1.0";
```
```solidity
File: src/legacy/L1BlockNumber.sol
19: string public constant version = "1.1.0";
```
```solidity
File: src/legacy/LegacyMessagePasser.sol
18: string public constant version = "1.1.0";
```
```solidity
File: src/mainnet-bridge/L1BlastBridge.sol
60: string public constant version = "1.0.0";
```
```solidity
File: src/mainnet-bridge/L2BlastBridge.sol
20: string public constant version = "1.0.0";
```
```solidity
File: src/mainnet-bridge/YieldManager.sol
35: uint256 public constant MAX_INSURANCE_FEE_BIPS = 10_000; // 100%
```
```solidity
File: src/mainnet-bridge/yield-providers/DSRYieldProvider.sol
36: IERC20 public constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
37: IDsrManager public constant DSR_MANAGER = IDsrManager(0x373238337Bfe1146fb49989fc222523f83081dDb);
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
50: ILido public constant LIDO = ILido(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);
51: IWithdrawalQueue public constant WITHDRAWAL_QUEUE = IWithdrawalQueue(0x889edC2eDab5f40e902b864aD4d7AdE8E412F9B1);
```
```solidity
File: src/periphery/faucet/authmodules/AdminFaucetAuthModule.sol
17: bytes32 public constant PROOF_TYPEHASH = keccak256("Proof(address recipient,bytes32 nonce,bytes32 id)");
```
```solidity
File: src/periphery/op-nft/OptimistAllowlist.sol
15: bytes32 public constant OPTIMIST_CAN_MINT_ATTESTATION_KEY = bytes32("optimist.can-mint");
18: bytes32 public constant COINBASE_QUEST_ELIGIBLE_ATTESTATION_KEY = bytes32("coinbase.quest-eligible");
```
```solidity
File: src/periphery/op-nft/OptimistInviter.sol
45: string public constant EIP712_VERSION = "1.0.0";
48: bytes32 public constant CLAIMABLE_INVITE_TYPEHASH = keccak256("ClaimableInvite(address issuer,bytes32 nonce)");
51: bytes32 public constant CAN_INVITE_ATTESTATION_KEY = bytes32("optimist.can-invite");
67: uint256 public constant MIN_COMMITMENT_PERIOD = 60;
```
```solidity
File: src/universal/CrossDomainMessenger.sol
93: uint16 public constant MESSAGE_VERSION = 1;
96: uint64 public constant RELAY_CONSTANT_OVERHEAD = 200_000;
99: uint64 public constant MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR = 64;
102: uint64 public constant MIN_GAS_DYNAMIC_OVERHEAD_DENOMINATOR = 63;
105: uint64 public constant MIN_GAS_CALLDATA_OVERHEAD = 16;
108: uint64 public constant RELAY_CALL_OVERHEAD = 40_000;
111: uint64 public constant RELAY_RESERVED_GAS = 40_000;
115: uint64 public constant RELAY_GAS_CHECK_BUFFER = 5_000;
```
```solidity
File: src/universal/OptimismMintableERC20Factory.sol
36: string public constant version = "1.6.1";
```
```solidity
File: src/universal/OptimismMintableERC721.sol
36: string public constant version = "1.3.0";
```
```solidity
File: src/universal/OptimismMintableERC721Factory.sol
27: string public constant version = "1.4.0";
```
```solidity
File: src/universal/StorageSetter.sol
14: string public constant version = "1.0.0";
```
### <a name="GAS-15"></a>[GAS-15] Use shift Right/Left instead of division/multiplication if possible
*Instances (26)*:
```solidity
File: src/L1/L1ERC721Bridge.sol
6: import { L2ERC721Bridge } from "src/L2/L2ERC721Bridge.sol";
```
```solidity
File: src/L1/L2OutputOracle.sol
251: uint256 mid = (lo + hi) / 2;
```
```solidity
File: src/L2/Blast.sol
3: import { GasMode, IGas } from "src/L2/Gas.sol";
```
```solidity
File: src/L2/CrossDomainOwnable2.sol
5: import { L2CrossDomainMessenger } from "src/L2/L2CrossDomainMessenger.sol";
```
```solidity
File: src/L2/CrossDomainOwnable3.sol
5: import { L2CrossDomainMessenger } from "src/L2/L2CrossDomainMessenger.sol";
```
```solidity
File: src/L2/ERC20Rebasing.sol
7: import { SharesBase } from "src/L2/Shares.sol";
8: import { YieldMode } from "src/L2/Blast.sol";
9: import { ERC20PermitUpgradeable } from "src/L2/ERC20PermitUpgradeable.sol";
```
```solidity
File: src/L2/GasPriceOracle.sol
6: import { L1Block } from "src/L2/L1Block.sol";
```
```solidity
File: src/L2/L2CrossDomainMessenger.sol
8: import { L2ToL1MessagePasser } from "src/L2/L2ToL1MessagePasser.sol";
10: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
```
```solidity
File: src/L2/L2StandardBridge.sol
10: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
```
```solidity
File: src/L2/Shares.sol
9: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
```
```solidity
File: src/L2/USDB.sol
7: import { ERC20Rebasing } from "src/L2/ERC20Rebasing.sol";
8: import { SharesBase } from "src/L2/Shares.sol";
13: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
```
```solidity
File: src/L2/WETHRebasing.sol
6: import { Blast, YieldMode } from "src/L2/Blast.sol";
7: import { GasMode } from "src/L2/Gas.sol";
8: import { ERC20Rebasing } from "src/L2/ERC20Rebasing.sol";
9: import { SharesBase } from "src/L2/Shares.sol";
```
```solidity
File: src/legacy/L1BlockNumber.sol
4: import { L1Block } from "src/L2/L1Block.sol";
```
```solidity
File: src/mainnet-bridge/L1BlastBridge.sol
18: import { USDB } from "src/L2/USDB.sol";
```
```solidity
File: src/mainnet-bridge/L2BlastBridge.sol
10: import { Blast, YieldMode, GasMode } from "src/L2/Blast.sol";
```
```solidity
File: src/mainnet-bridge/YieldManager.sol
14: import { SharesBase } from "src/L2/Shares.sol";
```
```solidity
File: src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol
315: uint256 mid = (max + min + 1) / 2;
```
```solidity
File: src/universal/FeeVault.sol
4: import { L2StandardBridge } from "src/L2/L2StandardBridge.sol";
```
### <a name="GAS-16"></a>[GAS-16] Splitting require() statements that use && saves gas
*Instances (3)*:
```solidity
File: src/mainnet-bridge/USDConversions.sol
70: require(inputToken >= 0 && inputToken < 3 && outputToken >= 0 && outputToken < 3);
```
```solidity
File: src/mainnet-bridge/yield-providers/YieldProvider.sol
140: require(claimed == 0 && pending == expected, "invalid yield provider implementation");
145: require(pending == 0 && claimed == expected, "invalid yield provider implementation");
```
### <a name="GAS-17"></a>[GAS-17] Use != 0 instead of > 0 for unsigned integer comparison
*Instances (41)*:
```solidity
File: src/EAS/EAS.sol
717: if (remainingValue > 0) {
```
```solidity
File: src/L1/L1CrossDomainMessenger.sol
93: assert(msg.value <= _value && (_value == 0 || msg.value > 0));
```
```solidity
File: src/L1/L2OutputOracle.sol
76: require(_l2BlockTime > 0, "L2OutputOracle: L2 block time must be greater than 0");
77: require(_submissionInterval > 0, "L2OutputOracle: submission interval must be greater than 0");
245: require(l2Outputs.length > 0, "L2OutputOracle: cannot get output as no outputs have been proposed yet");
```
```solidity
File: src/L1/OptimismPortal.sol
279: if (_tx.value > 0 && provenWithdrawal.timestamp == 0) {
369: if (_tx.value > 0) {
461: if (msg.value > 0) {
```
```solidity
File: src/L1/ResourceMetering.sol
82: if (blockDiff > 0) {
```
```solidity
File: src/L1/SystemConfig.sol
361: require(_config.elasticityMultiplier > 0, "SystemConfig: elasticity multiplier cannot be 0");
```
```solidity
File: src/L2/Gas.sol
67: require(_baseGasSeconds > 0, "base gas seconds must be > 0");
67: require(_baseGasSeconds > 0, "base gas seconds must be > 0");
113: require(_baseGasSeconds > 0, "base gas seconds must be > 0");
113: require(_baseGasSeconds > 0, "base gas seconds must be > 0");
211: require(gasToClaim > 0, "must withdraw non-zero amount");
225: if (penalty > 0) {
```
```solidity
File: src/L2/Shares.sol
68: if (value > 0) {
```
```solidity
File: src/Safe/LivenessModule.sol
157: if (_newOwnersCount > 0) {
```
```solidity
File: src/governance/MintManager.sol
43: if (mintPermittedAfter > 0) {
```
```solidity
File: src/libraries/rlp/RLPReader.sol
37: require(_in.length > 0, "RLPReader: length of an RLP item must be greater than zero to be decodable");
134: require(_in.length > 0, "RLPReader: length of an RLP item must be greater than zero to be decodable");
```
```solidity
File: src/libraries/trie/MerkleTrie.sol
69: require(_key.length > 0, "MerkleTrie: empty key");
108: require(value_.length > 0, "MerkleTrie: value length must be greater than zero (branch)");
155: require(value_.length > 0, "MerkleTrie: value length must be greater than zero (leaf)");
```
```solidity
File: src/mainnet-bridge/USDConversions.sol
72: if (inputAmountWad > 0) {
```
```solidity
File: src/mainnet-bridge/YieldManager.sol
246: if (yield > 0) {
282: if (accumulatedNegativeYields > 0) {
292: if (totalYield > 0) {
```
```solidity
File: src/mainnet-bridge/yield-providers/DSRYieldProvider.sol
95: if (amount > 0) {
102: if (amount > 0) {
120: if (amount > 0) {
```
```solidity
File: src/mainnet-bridge/yield-providers/ETHTestnetYieldProvider.sol
34: if (amount > 0) {
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
229: if (negativeYield > 0) {
```
```solidity
File: src/mainnet-bridge/yield-providers/USDTestnetYieldProvider.sol
28: if (amount > 0) {
```
```solidity
File: src/mainnet-bridge/yield-providers/YieldProvider.sol
139: if (pending > 0) {
144: if (claimed > 0) {
```
```solidity
File: src/periphery/drippie/Drippie.sol
99: require(_config.interval > 0, "Drippie: interval must be greater than zero if drip is not reentrant");
```
```solidity
File: src/periphery/op-nft/OptimistAllowlist.sol
101: valid_ = ATTESTATION_STATION.attestations(_creator, _about, _key).length > 0;
```
```solidity
File: src/periphery/op-nft/OptimistInviter.sol
179: require(commitmentTimestamp > 0, "OptimistInviter: claimer and signature have not been committed yet");
214: require(inviteCounts[_claimableInvite.issuer] > 0, "OptimistInviter: issuer has no invites");
```
```solidity
File: src/vendor/WETH9.sol
16: pragma solidity >=0.4.22 <0.6;
```
### <a name="GAS-18"></a>[GAS-18] `internal` functions not called by the contract should be removed
If the functions are required by an interface, the contract should inherit from that interface and use the `override` keyword
*Instances (28)*:
```solidity
File: src/L1/ResourceMetering.sol
157: function __ResourceMetering_init() internal onlyInitializing {
```
```solidity
File: src/L2/ERC20Rebasing.sol
87: function __ERC20Rebasing_init(string memory _name, string memory _symbol, uint256 _price) internal onlyInitializing {
```
```solidity
File: src/cannon/PreimageKeyLib.sol
12: function localizeIdent(uint256 _ident, uint256 _localContext) internal view returns (bytes32 key_) {
47: function keccak256PreimageKey(bytes memory _preimage) internal pure returns (bytes32 key_) {
```
```solidity
File: src/libraries/Arithmetic.sol
15: function clamp(int256 _value, int256 _min, int256 _max) internal pure returns (int256) {
25: function cdexp(int256 _coefficient, int256 _denominator, int256 _exponent) internal pure returns (int256) {
```
```solidity
File: src/libraries/Burn.sol
9: function eth(uint256 _amount) internal {
15: function gas(uint256 _amount) internal view {
```
```solidity
File: src/libraries/SafeCall.sol
12: function send(address _target, uint256 _gas, uint256 _value) internal returns (bool) {
34: function call(address _target, uint256 _gas, uint256 _value, bytes memory _calldata) internal returns (bool) {
90: function callWithMinGas(
```
```solidity
File: src/mainnet-bridge/DelegateCalls.sol
13: function _delegatecall_payInsurancePremium(address provider, uint256 arg) internal {
20: function _delegatecall_withdrawFromInsurance(address provider, uint256 arg) internal {
27: function _delegatecall_stake(address provider, uint256 arg) internal {
34: function _delegatecall_unstake(address provider, uint256 arg) internal returns (uint256, uint256) {
42: function _delegatecall_preCommitYieldReportDelegateCallHook(address provider) internal {
```
```solidity
File: src/mainnet-bridge/USDConversions.sol
52: function _init() internal {
69: function _convert(int128 inputToken, int128 outputToken, uint256 inputAmountWad, uint256 minOutputAmountWad) internal returns (uint256 amountReceived) {
109: function _convertTo(
202: function _usdToWad(uint256 usd) internal pure returns (uint256) {
```
```solidity
File: src/mainnet-bridge/YieldManager.sol
129: function __YieldManager_init(OptimismPortal _portal, address _owner) internal onlyInitializing {
```
```solidity
File: src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol
121: function __WithdrawalQueue_init() internal onlyInitializing {
193: function unfinalizedAmount() internal view returns (uint256) {
201: function _finalize(
343: function _requestWithdrawal(address recipient, uint256 amount)
```
```solidity
File: src/universal/CrossDomainMessenger.sol
353: function __CrossDomainMessenger_init() internal onlyInitializing {
```
```solidity
File: src/universal/ERC721Bridge.sol
72: function __ERC721Bridge_init(CrossDomainMessenger _messenger) internal onlyInitializing {
```
```solidity
File: src/universal/StandardBridge.sol
129: function __StandardBridge_init(CrossDomainMessenger _messenger) internal onlyInitializing {
```
## Non Critical Issues
| |Issue|Instances|
|-|:-|:-:|
| [NC-1](#NC-1) | Missing checks for `address(0)` when assigning values to address state variables | 7 |
| [NC-2](#NC-2) | Array indices should be referenced via `enum`s rather than via numeric literals | 4 |
| [NC-3](#NC-3) | `require()` / `revert()` statements should have descriptive reason strings | 15 |
| [NC-4](#NC-4) | Return values of `approve()` not checked | 12 |
| [NC-5](#NC-5) | Event is missing `indexed` fields | 52 |
| [NC-6](#NC-6) | Constants should be defined rather than using magic numbers | 25 |
| [NC-7](#NC-7) | Functions not used internally could be marked external | 75 |
### <a name="NC-1"></a>[NC-1] Missing checks for `address(0)` when assigning values to address state variables
*Instances (7)*:
```solidity
File: src/L1/L2OutputOracle.sol
107: proposer = _proposer;
108: challenger = _challenger;
```
```solidity
File: src/L1/OptimismPortal.sol
143: guardian = _guardian;
```
```solidity
File: src/legacy/LegacyMintableERC20.sol
35: l1Token = _l1Token;
36: l2Bridge = _l2Bridge;
```
```solidity
File: src/universal/CrossDomainMessenger.sol
283: xDomainMsgSender = _sender;
```
```solidity
File: src/universal/OptimismMintableERC20Factory.sol
48: bridge = _bridge;
```
### <a name="NC-2"></a>[NC-2] Array indices should be referenced via `enum`s rather than via numeric literals
*Instances (4)*:
```solidity
File: src/L2/Gas.sol
277: mode = GasMode(uint8(packedParams[0]));
```
```solidity
File: src/Safe/LivenessModule.sol
208: require(owners[0] == FALLBACK_OWNER, "LivenessModule: must transfer ownership to fallback owner");
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
114: amounts[0] = amount;
115: uint256 requestId = WITHDRAWAL_QUEUE.requestWithdrawals(amounts, address(YIELD_MANAGER))[0];
```
### <a name="NC-3"></a>[NC-3] `require()` / `revert()` statements should have descriptive reason strings
*Instances (15)*:
```solidity
File: src/mainnet-bridge/L1BlastBridge.sol
126: require(token != address(0));
244: require(usdYieldToken.provider != address(0));
271: require(ethYieldToken.provider != address(0));
```
```solidity
File: src/mainnet-bridge/USDConversions.sol
70: require(inputToken >= 0 && inputToken < 3 && outputToken >= 0 && outputToken < 3);
71: require(inputToken != outputToken);
```
```solidity
File: src/mainnet-bridge/YieldManager.sol
143: require(_admin != address(0));
152: require(_insurance != address(0));
153: require(_insuranceFeeBips <= MAX_INSURANCE_FEE_BIPS);
162: require(_blastBridge != address(0));
315: require(insurance != address(0));
```
```solidity
File: src/mainnet-bridge/yield-providers/ETHTestnetYieldProvider.sol
21: require(success);
30: require(success);
35: require(msg.value == uint256(amount));
38: require(success);
```
```solidity
File: src/mainnet-bridge/yield-providers/YieldProvider.sol
46: require(address(_yieldManager) != address(this));
```
### <a name="NC-4"></a>[NC-4] Return values of `approve()` not checked
Not all IERC20 implementations `revert()` when there's a failure in `approve()`. The function signature has a boolean return value and they indicate errors that way instead. By not checking the return value, operations that should have marked as failed, may potentially go through without actually approving anything
*Instances (12)*:
```solidity
File: src/L2/ERC20PermitUpgradeable.sol
74: _approve(owner, spender, value);
```
```solidity
File: src/L2/ERC20Rebasing.sol
148: _approve(owner, spender, amount);
275: _approve(owner, spender, currentAllowance - amount);
```
```solidity
File: src/mainnet-bridge/USDConversions.sol
53: USDC.approve(address(CURVE_3POOL), type(uint256).max);
54: USDC.approve(GEM_JOIN, type(uint256).max);
55: USDT.approve(address(CURVE_3POOL), type(uint256).max);
56: DAI.approve(address(CURVE_3POOL), type(uint256).max);
57: DAI.approve(GEM_JOIN, type(uint256).max);
58: DAI.approve(address(PSM), type(uint256).max);
```
```solidity
File: src/mainnet-bridge/yield-providers/DSRYieldProvider.sol
47: DAI.approve(address(DSR_MANAGER), type(uint256).max);
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
74: LIDO.approve(address(WITHDRAWAL_QUEUE), type(uint256).max);
75: LIDO.approve(address(YIELD_MANAGER), type(uint256).max);
```
### <a name="NC-5"></a>[NC-5] Event is missing `indexed` fields
Index event fields make the field more quickly accessible to off-chain tools that parse events. However, note that each index field costs extra gas during emission, so it's not necessarily best to index the maximum allowed per event (three fields). Each event should use three indexed fields if there are three or more fields, and gas usage is not particularly of concern for the events in question. If there are fewer than three fields, all of the fields should be indexed.
*Instances (52)*:
```solidity
File: src/L1/DelayedVetoable.sol
28: event DelayActivated(uint256 delay);
33: event Initiated(bytes32 indexed callHash, bytes data);
38: event Forwarded(bytes32 indexed callHash, bytes data);
43: event Vetoed(bytes32 indexed callHash, bytes data);
```
```solidity
File: src/L1/L1StandardBridge.sol
28: event ETHDepositInitiated(address indexed from, address indexed to, uint256 amount, bytes extraData);
36: event ETHWithdrawalFinalized(address indexed from, address indexed to, uint256 amount, bytes extraData);
```
```solidity
File: src/L1/OptimismPortal.sol
94: event WithdrawalFinalized(bytes32 indexed withdrawalHash, bool success);
98: event Paused(address account);
102: event Unpaused(address account);
```
```solidity
File: src/L1/ProtocolVersions.sol
36: event ConfigUpdate(uint256 indexed version, UpdateType indexed updateType, bytes data);
```
```solidity
File: src/L1/SystemConfig.sol
98: event ConfigUpdate(uint256 indexed version, UpdateType indexed updateType, bytes data);
```
```solidity
File: src/L2/ERC20Rebasing.sol
62: event Configure(address indexed account, YieldMode yieldMode);
68: event Claim(address indexed account, address indexed recipient, uint256 amount);
```
```solidity
File: src/L2/Shares.sol
31: event NewPrice(uint256 price);
```
```solidity
File: src/L2/USDB.sol
32: event Mint(address indexed account, uint256 amount);
37: event Burn(address indexed account, uint256 amount);
```
```solidity
File: src/L2/WETHRebasing.sol
32: event Deposit(address indexed account, uint amount);
37: event Withdrawal(address indexed account, uint amount);
```
```solidity
File: src/Safe/LivenessGuard.sol
26: event OwnerRecorded(address owner);
```
```solidity
File: src/legacy/AddressManager.sol
20: event AddressSet(string indexed name, address newAddress, address oldAddress);
```
```solidity
File: src/legacy/DeployerWhitelist.sol
26: event OwnerChanged(address oldOwner, address newOwner);
31: event WhitelistStatusChanged(address deployer, bool whitelisted);
35: event WhitelistDisabled(address oldOwner);
```
```solidity
File: src/legacy/LegacyMintableERC20.sol
12: event Mint(address indexed _account, uint256 _amount);
15: event Burn(address indexed _account, uint256 _amount);
```
```solidity
File: src/mainnet-bridge/YieldManager.sol
91: event YieldReport(
```
```solidity
File: src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol
99: event WithdrawalClaimed(
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
62: event LidoUnstakeInitiated(uint256 indexed requestId, uint256 amount);
```
```solidity
File: src/mainnet-bridge/yield-providers/YieldProvider.sol
16: event YieldCommit(bytes32 indexed provider, int256 yield);
17: event Staked(bytes32 indexed provider, uint256 amount);
18: event Unstaked(bytes32 indexed provider, uint256 amount);
19: event Pending(bytes32 indexed provider, uint256 amount);
20: event Claimed(bytes32 indexed provider, uint256 claimedAmount, uint256 expectedAmount);
21: event InsurancePremiumPaid(bytes32 indexed provider, uint256 amount);
22: event InsuranceWithdrawn(bytes32 indexed provider, uint256 amount);
```
```solidity
File: src/periphery/drippie/Drippie.sol
59: event DripCreated(string indexed nameref, string name, DripConfig config);
66: event DripStatusUpdated(string indexed nameref, string name, DripStatus status);
74: event DripExecuted(string indexed nameref, string name, address executor, uint256 timestamp);
```
```solidity
File: src/periphery/drippie/dripchecks/CheckBalanceHigh.sol
16: event _EventToExposeStructInABI__Params(Params params);
```
```solidity
File: src/periphery/drippie/dripchecks/CheckBalanceLow.sol
16: event _EventToExposeStructInABI__Params(Params params);
```
```solidity
File: src/periphery/drippie/dripchecks/CheckGelatoLow.sol
21: event _EventToExposeStructInABI__Params(Params params);
```
```solidity
File: src/universal/CrossDomainMessenger.sol
152: event SentMessage(address indexed target, address sender, bytes message, uint256 messageNonce, uint256 gasLimit);
158: event SentMessageExtension1(address indexed sender, uint256 value);
```
```solidity
File: src/universal/FeeVault.sol
39: event Withdrawal(uint256 value, address to, address from);
46: event Withdrawal(uint256 value, address to, address from, WithdrawalNetwork withdrawalNetwork);
```
```solidity
File: src/universal/OptimismMintableERC20.sol
28: event Mint(address indexed account, uint256 amount);
33: event Burn(address indexed account, uint256 amount);
```
```solidity
File: src/universal/OptimismMintableERC20Factory.sol
32: event OptimismMintableERC20Created(address indexed localToken, address indexed remoteToken, address deployer);
```
```solidity
File: src/universal/OptimismMintableERC721Factory.sol
23: event OptimismMintableERC721Created(address indexed localToken, address indexed remoteToken, address deployer);
```
```solidity
File: src/universal/Proxy.sol
20: event AdminChanged(address previousAdmin, address newAdmin);
```
```solidity
File: src/universal/StandardBridge.sol
63: event ETHBridgeInitiated(address indexed from, address indexed to, uint256 amount, bytes extraData);
70: event ETHBridgeFinalized(address indexed from, address indexed to, uint256 amount, bytes extraData);
```
### <a name="NC-6"></a>[NC-6] Constants should be defined rather than using magic numbers
*Instances (25)*:
```solidity
File: src/L2/Gas.sol
294: etherBalance >= 1 << (12 * 8) ||
295: etherSeconds >= 1 << (15 * 8)
305: (bytes32(uint256(mode)) << ((12 + 15 + 4) * 8)) | // Shift mode to the most significant byte
306: (bytes32(etherBalance) << ((15 + 4) * 8)) | // Shift etherBalance to start after 1 byte of mode
```
```solidity
File: src/L2/GasPriceOracle.sol
97: return unsigned + (68 * 16);
```
```solidity
File: src/cannon/PreimageKeyLib.sol
16: key_ := or(shl(248, 1), and(_ident, not(shl(248, 0xFF))))
38: localizedKey_ := or(and(keccak256(0, 0x60), not(shl(248, 0xFF))), shl(248, 1))
56: key_ := or(and(h, not(shl(248, 0xFF))), shl(248, 2))
```
```solidity
File: src/cannon/PreimageOracle.sol
60: mstore(0x00, shl(192, _size))
94: mstore(ptr, shl(192, size))
103: key := or(and(h, not(shl(248, 0xFF))), shl(248, 2))
```
```solidity
File: src/dispute/lib/LibGameId.sol
25: gameId_ := or(or(shl(248, _gameType), shl(184, _timestamp)), _gameProxy)
40: gameType_ := shr(248, _gameId)
41: timestamp_ := shr(184, and(_gameId, not(shl(248, 0xff))))
```
```solidity
File: src/dispute/lib/LibPosition.sol
36: _position := or(_position, shr(16, _position))
42: shr(251, mul(_position, shl(224, 0x07c4acdd))),
```
```solidity
File: src/libraries/Bytes.sol
61: mstore(0x40, and(add(mc, 31), not(31)))
```
```solidity
File: src/libraries/Encoding.sol
118: nonce := or(shl(240, _version), _nonce)
132: version := shr(240, _nonce)
```
```solidity
File: src/libraries/SafeCall.sol
78: _hasMinGas := iszero(lt(mul(gas(), 63), add(mul(_minGas, 64), mul(add(40000, _reservedGas), 63))))
118: mstore(88, 0x0000185361666543616c6c3a204e6f7420656e6f75676820676173)
121: revert(28, 100)
```
```solidity
File: src/libraries/rlp/RLPReader.sol
157: firstByteOfContent := and(mload(add(ptr, 1)), shl(248, 0xff))
177: firstByteOfContent := and(mload(add(ptr, 1)), shl(248, 0xff))
216: firstByteOfContent := and(mload(add(ptr, 1)), shl(248, 0xff))
```
### <a name="NC-7"></a>[NC-7] Functions not used internally could be marked external
*Instances (75)*:
```solidity
File: src/L1/SystemConfig.sol
208: function unsafeBlockSigner() public view returns (address addr_) {
```
```solidity
File: src/L2/Blast.sol
302: function readClaimableYield(address contractAddress) public view returns (uint256) {
311: function readYieldConfiguration(address contractAddress) public view returns (uint8) {
322: function readGasParams(address contractAddress) public view returns (uint256, uint256, uint256, GasMode) {
```
```solidity
File: src/L2/ERC20Rebasing.sol
95: function count() public view override returns (uint256) {
175: function getClaimableAmount(address account) public view returns (uint256) {
```
```solidity
File: src/L2/Gas.sol
194: function claimMax(address contractAddress, address recipientOfGas) public returns (uint256) {
```
```solidity
File: src/L2/GasPriceOracle.sol
45: function gasPrice() public view returns (uint256) {
51: function baseFee() public view returns (uint256) {
76: function decimals() public pure returns (uint256) {
```
```solidity
File: src/L2/L2CrossDomainMessenger.sol
29: function initialize() public reinitializer(Constants.INITIALIZER) {
43: function l1CrossDomainMessenger() public view returns (address) {
```
```solidity
File: src/L2/L2StandardBridge.sol
66: function initialize() public reinitializer(Constants.INITIALIZER) {
```
```solidity
File: src/L2/SequencerFeeVault.sol
31: function l1FeeWallet() public view returns (address) {
```
```solidity
File: src/L2/Shares.sol
116: function initialize(uint256 _price) public initializer {
```
```solidity
File: src/L2/USDB.sol
63: function initialize() public initializer {
85: function remoteToken() public view returns (address) {
91: function bridge() public view returns (address) {
```
```solidity
File: src/L2/WETHRebasing.sol
80: function withdraw(uint256 wad) public {
```
```solidity
File: src/Safe/LivenessGuard.sol
58: function safe() public view returns (Safe safe_) {
```
```solidity
File: src/Safe/LivenessModule.sol
73: function safe() public view returns (Safe safe_) {
79: function livenessGuard() public view returns (LivenessGuard livenessGuard_) {
85: function livenessInterval() public view returns (uint256 livenessInterval_) {
91: function minOwners() public view returns (uint256 minOwners_) {
97: function fallbackOwner() public view returns (address fallbackOwner_) {
```
```solidity
File: src/governance/GovernanceToken.sol
22: function mint(address _account, uint256 _amount) public onlyOwner {
```
```solidity
File: src/governance/MintManager.sol
42: function mint(address _account, uint256 _amount) public onlyOwner {
58: function upgrade(address _newMintManager) public onlyOwner {
```
```solidity
File: src/legacy/LegacyMintableERC20.sol
46: function supportsInterface(bytes4 _interfaceId) public pure returns (bool) {
```
```solidity
File: src/mainnet-bridge/ETHYieldManager.sol
30: function tokenBalance() public view override returns (uint256) {
```
```solidity
File: src/mainnet-bridge/L1BlastBridge.sol
145: function finalizeBridgeETH(
181: function finalizeBridgeERC20(
```
```solidity
File: src/mainnet-bridge/L2BlastBridge.sol
29: function initialize() public initializer {
47: function finalizeBridgeETHDirect(
```
```solidity
File: src/mainnet-bridge/USDYieldManager.sol
24: function initialize(OptimismPortal _portal, address _owner) public initializer {
32: function tokenBalance() public view override returns (uint256) {
```
```solidity
File: src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol
177: function getLockedBalance() public view returns (uint256) {
187: function unfinalizedRequestNumber() public view returns (uint256) {
```
```solidity
File: src/mainnet-bridge/yield-providers/DSRYieldProvider.sol
50: function name() public pure override returns (string memory) {
55: function isStakingEnabled(address token) public view override returns (bool) {
81: function yield() public view override returns (int256) {
137: function insuranceBalance() public view override returns (uint256) {
```
```solidity
File: src/mainnet-bridge/yield-providers/ETHTestnetYieldProvider.sol
24: function stakedBalance() public view override returns (uint256) {
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
79: function name() public pure override returns (string memory) {
84: function isStakingEnabled(address token) public view override returns (bool) {
94: function yield() public view override returns (int256) {
121: function lastUnstakeRequestIndex() public view returns (uint256) {
162: function insuranceBalance() public view override returns (uint256) {
```
```solidity
File: src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol
30: function name() public pure override returns (string memory) {
35: function isStakingEnabled(address token) public view override returns (bool) {
45: function yield() public view override returns (int256) {
50: function supportsInsurancePayment() public pure override returns (bool) {
```
```solidity
File: src/mainnet-bridge/yield-providers/YieldProvider.sol
66: function totalValue() public view returns (uint256) {
```
```solidity
File: src/periphery/TransferOnion.sol
44: function peel(Layer[] memory _layers) public nonReentrant {
```
```solidity
File: src/periphery/drippie/Drippie.sol
251: function getDripStatus(string calldata _name) public view returns (DripStatus) {
```
```solidity
File: src/periphery/faucet/Faucet.sol
77: function withdraw(address payable _recipient, uint256 _amount) public priviledged {
84: function configure(IFaucetAuthModule _module, ModuleConfig memory _config) public priviledged {
91: function drip(DripParameters memory _params, AuthParameters memory _auth) public {
131: function isModuleEnabled(IFaucetAuthModule _module) public view returns (bool) {
```
```solidity
File: src/periphery/op-nft/OptimistAllowlist.sol
62: function isAllowedToMint(address _claimer) public view returns (bool allowed_) {
```
```solidity
File: src/periphery/op-nft/OptimistInviter.sol
104: function initialize(string memory _name) public initializer {
111: function setInviteCounts(address[] calldata _accounts, uint256 _inviteCount) public {
153: function commitInvite(bytes32 _commitment) public {
175: function claimInvite(address _claimer, ClaimableInvite calldata _claimableInvite, bytes memory _signature) public {
```
```solidity
File: src/universal/OptimismMintableERC20.sol
107: function l1Token() public view returns (address) {
113: function l2Bridge() public view returns (address) {
119: function remoteToken() public view returns (address) {
125: function bridge() public view returns (address) {
135: function decimals() public view override returns (uint8) {
```
```solidity
File: src/universal/OptimismMintableERC721.sol
105: function supportsInterface(bytes4 _interfaceId) public view override(ERC721Enumerable, IERC165) returns (bool) {
```
```solidity
File: src/universal/StandardBridge.sol
154: function bridgeETH(uint32 _minGasLimit, bytes calldata _extraData) public payable onlyEOA {
170: function bridgeETHTo(address _to, uint32 _minGasLimit, bytes calldata _extraData) public payable {
```
```solidity
File: src/universal/StorageSetter.sol
18: function setBytes32(bytes32 _slot, bytes32 _value) public {
28: function setUint(bytes32 _slot, uint256 _value) public {
38: function setAddress(bytes32 _slot, address _address) public {
```
## Low Issues
| |Issue|Instances|
|-|:-|:-:|
| [L-1](#L-1) | `abi.encodePacked()` should not be used with dynamic types when passing the result to a hash function such as `keccak256()` | 7 |
| [L-2](#L-2) | Use of `tx.origin` is unsafe in almost every context | 6 |
| [L-3](#L-3) | Empty Function Body - Consider commenting why | 25 |
| [L-4](#L-4) | Initializers could be front-run | 95 |
| [L-5](#L-5) | Unsafe ERC20 operation(s) | 20 |
| [L-6](#L-6) | Unspecific compiler version pragma | 1 |
| [L-7](#L-7) | Use of ecrecover is susceptible to signature malleability | 2 |
### <a name="L-1"></a>[L-1] `abi.encodePacked()` should not be used with dynamic types when passing the result to a hash function such as `keccak256()`
Use `abi.encode()` instead which will pad items to 32 bytes, which will [prevent hash collisions](https://docs.soliditylang.org/en/v0.8.13/abi-spec.html#non-standard-packed-mode) (e.g. `abi.encodePacked(0x123,0x456)` => `0x123456` => `abi.encodePacked(0x1,0x23456)`, but `abi.encode(0x123,0x456)` => `0x0...1230...456`). "Unless there is a compelling reason, `abi.encode` should be preferred". If there is only one argument to `abi.encodePacked()` it can often be cast to `bytes()` or `bytes32()` [instead](https://ethereum.stackexchange.com/questions/30912/how-to-compare-strings-in-solidity#answer-82739).
If all arguments are strings and or bytes, `bytes.concat()` should be used instead
*Instances (7)*:
```solidity
File: src/EAS/SchemaRegistry.sol
53: return keccak256(abi.encodePacked(schemaRecord.schema, schemaRecord.resolver, schemaRecord.revocable));
```
```solidity
File: src/L2/Gas.sol
265: bytes32 paramsHash = keccak256(abi.encodePacked(user, "parameters"));
302: bytes32 paramsHash = keccak256(abi.encodePacked(contractAddress, "parameters"));
```
```solidity
File: src/Safe/SafeSigners.sol
77: ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", dataHash)), v - 4, r, s);
```
```solidity
File: src/legacy/AddressManager.sol
44: return keccak256(abi.encodePacked(_name));
```
```solidity
File: src/legacy/LegacyMessagePasser.sol
23: sentMessages[keccak256(abi.encodePacked(_message, msg.sender))] = true;
```
```solidity
File: src/mainnet-bridge/yield-providers/YieldProvider.sol
56: return keccak256(abi.encodePacked(name(), version()));
```
### <a name="L-2"></a>[L-2] Use of `tx.origin` is unsafe in almost every context
According to [Vitalik Buterin](https://ethereum.stackexchange.com/questions/196/how-do-i-make-my-dapp-serenity-proof), contracts should _not_ `assume that tx.origin will continue to be usable or meaningful`. An example of this is [EIP-3074](https://eips.ethereum.org/EIPS/eip-3074#allowing-txorigin-as-signer-1) which explicitly mentions the intention to change its semantics when it's used with new op codes. There have also been calls to [remove](https://github.com/ethereum/solidity/issues/683) `tx.origin`, and there are [security issues](solidity.readthedocs.io/en/v0.4.24/security-considerations.html#tx-origin) associated with using it for authorization. For these reasons, it's best to completely avoid the feature.
*Instances (6)*:
```solidity
File: src/L1/L1CrossDomainMessenger.sol
140: if (tx.origin == Constants.ESTIMATION_ADDRESS) {
166: if (tx.origin == Constants.ESTIMATION_ADDRESS) {
```
```solidity
File: src/L1/OptimismPortal.sol
394: if (success == false && tx.origin == Constants.ESTIMATION_ADDRESS) {
437: if (msg.sender != tx.origin) {
```
```solidity
File: src/universal/CrossDomainMessenger.sol
276: if (tx.origin == Constants.ESTIMATION_ADDRESS) {
299: if (tx.origin == Constants.ESTIMATION_ADDRESS) {
```
### <a name="L-3"></a>[L-3] Empty Function Body - Consider commenting why
*Instances (25)*:
```solidity
File: src/EAS/EAS.sol
87: constructor() EIP1271Verifier("EAS", "1.2.0") { }
```
```solidity
File: src/L2/BaseFeeVault.sol
26: { }
```
```solidity
File: src/L2/ERC20PermitUpgradeable.sol
51: function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}
```
```solidity
File: src/L2/L1FeeVault.sol
26: { }
```
```solidity
File: src/L2/SequencerFeeVault.sol
26: { }
```
```solidity
File: src/governance/GovernanceToken.sol
17: constructor() ERC20("Optimism", "OP") ERC20Permit("Optimism") { }
```
```solidity
File: src/legacy/LegacyERC20ETH.sol
17: constructor() OptimismMintableERC20(Predeploys.L2_STANDARD_BRIDGE, address(0), "Ether", "ETH", 18) { }
```
```solidity
File: src/libraries/rlp/RLPReader.sol
257: for { } lt(i, _length) { i := add(i, 32) } { mstore(add(dest, i), mload(add(src, i))) }
```
```solidity
File: src/mainnet-bridge/ETHYieldManager.sol
20: receive() external payable {}
```
```solidity
File: src/mainnet-bridge/Insurance.sol
45: receive() external payable {}
```
```solidity
File: src/mainnet-bridge/USDYieldManager.sol
19: constructor(address _token) YieldManager(_token) Semver(1, 0, 0) {}
```
```solidity
File: src/mainnet-bridge/YieldManager.sol
124: constructor(address _token) WithdrawalQueue(_token) {}
```
```solidity
File: src/mainnet-bridge/yield-providers/DSRYieldProvider.sol
43: constructor(YieldManager _yieldManager) YieldProvider(_yieldManager) {}
```
```solidity
File: src/mainnet-bridge/yield-providers/ETHTestnetYieldProvider.sol
16: ) TestnetYieldProvider(_yieldManager, _owner, _token) {}
```
```solidity
File: src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol
27: function initialize() external override onlyDelegateCall {}
```
```solidity
File: src/mainnet-bridge/yield-providers/USDTestnetYieldProvider.sol
16: ) TestnetYieldProvider(_yieldManager, _owner, _token) {}
```
```solidity
File: src/mainnet-bridge/yield-providers/YieldProvider.sol
51: function initialize() external onlyDelegateCall virtual {}
152: function preCommitYieldReportDelegateCallHook() external virtual onlyDelegateCall {}
181: function _beforeCommitYield() internal virtual {}
182: function _afterCommitYield() internal virtual {}
```
```solidity
File: src/periphery/AssetReceiver.sol
38: constructor(address _owner) Transactor(_owner) { }
```
```solidity
File: src/periphery/Transactor.sol
10: constructor(address _owner) Owned(_owner) { }
```
```solidity
File: src/periphery/drippie/Drippie.sol
80: constructor(address _owner) AssetReceiver(_owner) { }
```
```solidity
File: src/periphery/op-nft/AttestationStation.sol
32: constructor() Semver(1, 1, 2) { }
```
```solidity
File: src/universal/FeeVault.sol
58: receive() external payable { }
```
### <a name="L-4"></a>[L-4] Initializers could be front-run
Initializers could be front-run, allowing an attacker to either set their own values, take ownership of the contract, and in the best case forcing a re-deployment
*Instances (95)*:
```solidity
File: src/L1/L1CrossDomainMessenger.sol
38: initialize({ _portal: OptimismPortal(payable(0)) });
43: function initialize(OptimismPortal _portal) public reinitializer(Constants.INITIALIZER) {
43: function initialize(OptimismPortal _portal) public reinitializer(Constants.INITIALIZER) {
45: __CrossDomainMessenger_init();
```
```solidity
File: src/L1/L1ERC721Bridge.sol
27: initialize({ _messenger: CrossDomainMessenger(address(0)) });
32: function initialize(CrossDomainMessenger _messenger) public reinitializer(Constants.INITIALIZER) {
32: function initialize(CrossDomainMessenger _messenger) public reinitializer(Constants.INITIALIZER) {
33: __ERC721Bridge_init({ _messenger: _messenger });
```
```solidity
File: src/L1/L1StandardBridge.sol
78: initialize({ _messenger: CrossDomainMessenger(address(0)) });
82: function initialize(CrossDomainMessenger _messenger) public reinitializer(Constants.INITIALIZER) {
82: function initialize(CrossDomainMessenger _messenger) public reinitializer(Constants.INITIALIZER) {
83: __StandardBridge_init({ _messenger: _messenger });
```
```solidity
File: src/L1/L2OutputOracle.sol
83: initialize({ _startingBlockNumber: 0, _startingTimestamp: 0, _proposer: address(0), _challenger: address(0) });
91: function initialize(
98: reinitializer(Constants.INITIALIZER)
```
```solidity
File: src/L1/OptimismPortal.sol
116: initialize({
130: function initialize(
138: reinitializer(Constants.INITIALIZER)
146: __ResourceMetering_init();
```
```solidity
File: src/L1/ProtocolVersions.sol
47: initialize({
58: function initialize(
64: reinitializer(Constants.INITIALIZER)
66: __Ownable_init();
```
```solidity
File: src/L1/ResourceMetering.sol
157: function __ResourceMetering_init() internal onlyInitializing {
```
```solidity
File: src/L1/SystemConfig.sol
111: initialize({
155: function initialize(
168: reinitializer(Constants.INITIALIZER)
170: __Ownable_init();
```
```solidity
File: src/L2/ERC20PermitUpgradeable.sol
47: function __ERC20Permit_init(string memory name) internal onlyInitializing {
```
```solidity
File: src/L2/ERC20Rebasing.sol
87: function __ERC20Rebasing_init(string memory _name, string memory _symbol, uint256 _price) internal onlyInitializing {
88: __ERC20Permit_init(_name);
89: __SharesBase_init({ _price: _price });
```
```solidity
File: src/L2/L2CrossDomainMessenger.sol
29: function initialize() public reinitializer(Constants.INITIALIZER) {
29: function initialize() public reinitializer(Constants.INITIALIZER) {
30: __CrossDomainMessenger_init();
```
```solidity
File: src/L2/L2ERC721Bridge.sol
29: initialize();
33: function initialize() public reinitializer(Constants.INITIALIZER) {
33: function initialize() public reinitializer(Constants.INITIALIZER) {
34: __ERC721Bridge_init({ _messenger: CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER) });
```
```solidity
File: src/L2/L2StandardBridge.sol
66: function initialize() public reinitializer(Constants.INITIALIZER) {
66: function initialize() public reinitializer(Constants.INITIALIZER) {
67: __StandardBridge_init({ _messenger: CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER) });
```
```solidity
File: src/L2/Shares.sol
45: function __SharesBase_init(uint256 _price) internal onlyInitializing {
116: function initialize(uint256 _price) public initializer {
116: function initialize(uint256 _price) public initializer {
117: __SharesBase_init({ _price: _price });
```
```solidity
File: src/L2/USDB.sol
63: function initialize() public initializer {
63: function initialize() public initializer {
64: __ERC20Rebasing_init("Rebasing USD", "USDB", 1e9);
```
```solidity
File: src/L2/WETHRebasing.sol
50: function initialize() external initializer {
50: function initialize() external initializer {
51: __ERC20Rebasing_init(
```
```solidity
File: src/dispute/DisputeGameFactory.sol
45: initialize(address(0));
50: function initialize(address _owner) public initializer {
50: function initialize(address _owner) public initializer {
51: __Ownable_init();
100: proxy_.initialize();
```
```solidity
File: src/dispute/FaultDisputeGame.sol
451: function initialize() external {
```
```solidity
File: src/mainnet-bridge/ETHYieldManager.sol
17: initialize(OptimismPortal(payable(address(0))), address(0));
25: function initialize(OptimismPortal _portal, address _owner) public initializer {
25: function initialize(OptimismPortal _portal, address _owner) public initializer {
26: __YieldManager_init(_portal, _owner);
```
```solidity
File: src/mainnet-bridge/Insurance.sol
42: initialize();
47: function initialize() public initializer {
47: function initialize() public initializer {
```
```solidity
File: src/mainnet-bridge/L1BlastBridge.sol
65: initialize({
78: function initialize(
83: ) public initializer {
85: __StandardBridge_init(_messenger);
```
```solidity
File: src/mainnet-bridge/L2BlastBridge.sol
29: function initialize() public initializer {
29: function initialize() public initializer {
30: __StandardBridge_init({ _messenger: CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER) });
```
```solidity
File: src/mainnet-bridge/USDConversions.sol
52: function _init() internal {
```
```solidity
File: src/mainnet-bridge/USDYieldManager.sol
24: function initialize(OptimismPortal _portal, address _owner) public initializer {
24: function initialize(OptimismPortal _portal, address _owner) public initializer {
25: __YieldManager_init(_portal, _owner);
27: USDConversions._init();
```
```solidity
File: src/mainnet-bridge/YieldManager.sol
129: function __YieldManager_init(OptimismPortal _portal, address _owner) internal onlyInitializing {
130: __Ownable2Step_init();
131: __WithdrawalQueue_init();
173: (bool success,) = provider.delegatecall(abi.encodeWithSignature("initialize()"));
```
```solidity
File: src/mainnet-bridge/withdrawal-queue/WithdrawalQueue.sol
121: function __WithdrawalQueue_init() internal onlyInitializing {
```
```solidity
File: src/mainnet-bridge/yield-providers/DSRYieldProvider.sol
46: function initialize() external override onlyDelegateCall {
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
73: function initialize() external override onlyDelegateCall {
```
```solidity
File: src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol
27: function initialize() external override onlyDelegateCall {}
```
```solidity
File: src/mainnet-bridge/yield-providers/YieldProvider.sol
51: function initialize() external onlyDelegateCall virtual {}
```
```solidity
File: src/periphery/op-nft/OptimistInviter.sol
104: function initialize(string memory _name) public initializer {
104: function initialize(string memory _name) public initializer {
105: __EIP712_init(_name, EIP712_VERSION);
```
```solidity
File: src/universal/CrossDomainMessenger.sol
353: function __CrossDomainMessenger_init() internal onlyInitializing {
```
```solidity
File: src/universal/ERC721Bridge.sol
72: function __ERC721Bridge_init(CrossDomainMessenger _messenger) internal onlyInitializing {
```
```solidity
File: src/universal/OptimismMintableERC20Factory.sol
42: initialize({ _bridge: address(0) });
47: function initialize(address _bridge) public reinitializer(Constants.INITIALIZER) {
47: function initialize(address _bridge) public reinitializer(Constants.INITIALIZER) {
```
```solidity
File: src/universal/StandardBridge.sol
129: function __StandardBridge_init(CrossDomainMessenger _messenger) internal onlyInitializing {
```
### <a name="L-5"></a>[L-5] Unsafe ERC20 operation(s)
*Instances (20)*:
```solidity
File: src/L1/L1ERC721Bridge.sol
99: IERC721(_localToken).transferFrom(_from, address(this), _tokenId);
```
```solidity
File: src/mainnet-bridge/USDConversions.sol
53: USDC.approve(address(CURVE_3POOL), type(uint256).max);
54: USDC.approve(GEM_JOIN, type(uint256).max);
55: USDT.approve(address(CURVE_3POOL), type(uint256).max);
56: DAI.approve(address(CURVE_3POOL), type(uint256).max);
57: DAI.approve(GEM_JOIN, type(uint256).max);
58: DAI.approve(address(PSM), type(uint256).max);
```
```solidity
File: src/mainnet-bridge/yield-providers/DSRYieldProvider.sol
47: DAI.approve(address(DSR_MANAGER), type(uint256).max);
122: DAI.transfer(YIELD_MANAGER.insurance(), amount);
```
```solidity
File: src/mainnet-bridge/yield-providers/LidoYieldProvider.sol
74: LIDO.approve(address(WITHDRAWAL_QUEUE), type(uint256).max);
75: LIDO.approve(address(YIELD_MANAGER), type(uint256).max);
146: LIDO.transfer(YIELD_MANAGER.insurance(), amount);
```
```solidity
File: src/mainnet-bridge/yield-providers/USDTestnetYieldProvider.sol
20: TOKEN.transfer(THIS, amount);
24: TOKEN.transfer(address(YIELD_MANAGER), amount);
29: TOKEN.transferFrom(owner(), THIS, uint256(amount));
31: TOKEN.transfer(owner(), uint256(-1 * amount));
38: TOKEN.transfer(YIELD_MANAGER.insurance(), amount);
```
```solidity
File: src/periphery/AssetReceiver.sol
74: _asset.transfer(_to, _amount);
84: _asset.transferFrom(address(this), _to, _id);
```
```solidity
File: src/vendor/WETH9.sol
41: msg.sender.transfer(wad);
```
### <a name="L-6"></a>[L-6] Unspecific compiler version pragma
*Instances (1)*:
```solidity
File: src/vendor/WETH9.sol
16: pragma solidity >=0.4.22 <0.6;
```
### <a name="L-7"></a>[L-7] Use of ecrecover is susceptible to signature malleability
The built-in EVM precompile ecrecover is susceptible to signature malleability, which could lead to replay attacks.Consider using OpenZeppelin’s ECDSA library instead of the built-in function.
*Instances (2)*:
```solidity
File: src/Safe/SafeSigners.sol
77: ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", dataHash)), v - 4, r, s);
81: currentOwner = ecrecover(dataHash, v, r, s);
```
## Medium Issues
| |Issue|Instances|
|-|:-|:-:|
| [M-1](#M-1) | Centralization Risk for trusted owners | 58 |
### <a name="M-1"></a>[M-1] Centralization Risk for trusted owners
#### Impact:
Contracts have owners with privileged rights to perform admin tasks and need to be trusted to not perform malicious updates or drain funds.
*Instances (58)*:
```solidity
File: src/L1/ProtocolVersions.sol
80: function setRequired(ProtocolVersion _required) external onlyOwner {
101: function setRecommended(ProtocolVersion _recommended) external onlyOwner {
```
```solidity
File: src/L1/SystemConfig.sol
270: function setUnsafeBlockSigner(address _unsafeBlockSigner) external onlyOwner {
285: function setBatcherHash(bytes32 _batcherHash) external onlyOwner {
301: function setGasConfig(uint256 _overhead, uint256 _scalar) external onlyOwner {
318: function setGasLimit(uint64 _gasLimit) external onlyOwner {
343: function setResourceConfig(ResourceMetering.ResourceConfig memory _config) external onlyOwner {
```
```solidity
File: src/L2/CrossDomainOwnable.sol
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
12: abstract contract CrossDomainOwnable is Ownable {
12: abstract contract CrossDomainOwnable is Ownable {
```
```solidity
File: src/L2/CrossDomainOwnable2.sol
6: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
13: abstract contract CrossDomainOwnable2 is Ownable {
```
```solidity
File: src/L2/CrossDomainOwnable3.sol
6: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
13: abstract contract CrossDomainOwnable3 is Ownable {
28: function transferOwnership(address _owner, bool _isLocal) external onlyOwner {
```
```solidity
File: src/dispute/DisputeGameFactory.sol
158: function setImplementation(GameType _gameType, IDisputeGame _impl) external onlyOwner {
```
```solidity
File: src/governance/GovernanceToken.sol
15: contract GovernanceToken is ERC20Burnable, ERC20Votes, Ownable {
22: function mint(address _account, uint256 _amount) public onlyOwner {
```
```solidity
File: src/governance/MintManager.sol
12: contract MintManager is Ownable {
42: function mint(address _account, uint256 _amount) public onlyOwner {
58: function upgrade(address _newMintManager) public onlyOwner {
```
```solidity
File: src/legacy/AddressManager.sol
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
12: contract AddressManager is Ownable {
25: function setAddress(string memory _name, address _address) external onlyOwner {
```
```solidity
File: src/legacy/DeployerWhitelist.sol
50: function setWhitelistedDeployer(address _deployer, bool _isWhitelisted) external onlyOwner {
57: function setOwner(address _owner) external onlyOwner {
68: function enableArbitraryContractDeployment() external onlyOwner {
```
```solidity
File: src/mainnet-bridge/YieldManager.sol
142: function setAdmin(address _admin) external onlyOwner {
151: function setInsurance(address _insurance, uint256 _insuranceFeeBips, uint256 _withdrawalBuffer) external onlyOwner {
161: function setBlastBridge(address _blastBridge) external onlyOwner {
168: function addProvider(address provider) external onlyOwner {
181: function removeProvider(address provider) external onlyOwner {
```
```solidity
File: src/mainnet-bridge/yield-providers/ETHTestnetYieldProvider.sol
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
33: function recordYield(int256 amount) external payable onlyOwner {
```
```solidity
File: src/mainnet-bridge/yield-providers/TestnetYieldProvider.sol
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
12: abstract contract TestnetYieldProvider is YieldProvider, Ownable {
```
```solidity
File: src/mainnet-bridge/yield-providers/USDTestnetYieldProvider.sol
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
27: function recordYield(int256 amount) external onlyOwner {
```
```solidity
File: src/periphery/AssetReceiver.sol
47: function withdrawETH(address payable _to) external onlyOwner {
54: function withdrawETH(address payable _to, uint256 _amount) public onlyOwner {
64: function withdrawERC20(ERC20 _asset, address _to) external onlyOwner {
72: function withdrawERC20(ERC20 _asset, address _to, uint256 _amount) public onlyOwner {
83: function withdrawERC721(ERC721 _asset, address _to, uint256 _id) external onlyOwner {
```
```solidity
File: src/periphery/Transactor.sol
4: import { Owned } from "@rari-capital/solmate/src/auth/Owned.sol";
8: contract Transactor is Owned {
10: constructor(address _owner) Owned(_owner) { }
```
```solidity
File: src/periphery/drippie/Drippie.sol
87: function create(string calldata _name, DripConfig calldata _config) external onlyOwner {
125: function status(string calldata _name, DripStatus _status) external onlyOwner {
```
```solidity
File: src/universal/ProxyAdmin.sol
4: import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
30: contract ProxyAdmin is Ownable {
57: constructor(address _owner) Ownable() {
65: function setProxyType(address _address, ProxyType _type) external onlyOwner {
73: function setImplementationName(address _address, string memory _name) external onlyOwner {
80: function setAddressManager(AddressManager _address) external onlyOwner {
90: function setAddress(string memory _name, address _address) external onlyOwner {
97: function setUpgrading(bool _upgrading) external onlyOwner {
145: function changeProxyAdmin(address payable _proxy, address _newAdmin) external onlyOwner {
161: function upgrade(address payable _proxy, address _implementation) public onlyOwner {
```
## High Issues
| |Issue|Instances|
|-|:-|:-:|
| [H-1](#H-1) | Using `delegatecall` inside a loop | 1 |
### <a name="H-1"></a>[H-1] Using `delegatecall` inside a loop
#### Impact:
When calling `delegatecall` the same `msg.value` amount will be accredited multiple times.
*Instances (1)*:
```solidity
File: src/mainnet-bridge/YieldManager.sol
232: for (uint256 i; i < providersLength; i++) {
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment