forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
contract change following idea of ethereum-optimism/specs#122
- Loading branch information
1 parent
ce49d0c
commit c01c362
Showing
8 changed files
with
72 additions
and
27 deletions.
There are no files selected for viewing
Submodule clones-with-immutable-args
added at
105efe
Submodule openzeppelin-contracts-v5
added at
dbb610
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import { Storage } from "src/libraries/Storage.sol"; | ||
|
||
/// @title BatchInbox | ||
/// @notice Handles reading and writing the batch inbox address to storage. | ||
/// To be used in any place where batch inbox address is read or | ||
/// written to state. If multiple contracts use this library, the | ||
/// values in storage should be kept in sync between them. | ||
library BatchInbox { | ||
/// @notice Storage slot that the batch inbox address is stored at. | ||
bytes32 public constant BATCH_INBOX_SLOT = bytes32(uint256(keccak256("opstack.batchinbox")) - 1); | ||
|
||
/// @notice Writes the batch inbox address to the magic storage slot. | ||
function set(address _batchInbox) internal { | ||
Storage.setAddress(BATCH_INBOX_SLOT, _batchInbox); | ||
} | ||
|
||
/// @notice Reads the batch inbox address from the magic storage slot. | ||
function get() internal view returns (address) { | ||
return Storage.getAddress(BATCH_INBOX_SLOT); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,4 +57,18 @@ library StaticConfig { | |
function decodeRemoveDependency(bytes memory _data) internal pure returns (uint256) { | ||
return abi.decode(_data, (uint256)); | ||
} | ||
|
||
/// @notice Encodes the static configuration data for setting a batch inbox. | ||
/// @param _batchInbox Address of the batch inbox. | ||
/// @return Encoded static configuration data. | ||
This comment has been minimized.
Sorry, something went wrong.
tynes
|
||
function encodeSetBatchInbox(address _batchInbox) internal pure returns (bytes memory) { | ||
return abi.encode(_batchInbox); | ||
} | ||
|
||
/// @notice Decodes the static configuration data for setting a batch inbox. | ||
/// @param _data Encoded static configuration data. | ||
/// @return Decoded Address of the batch inbox. | ||
function decodeSetBatchInbox(bytes memory _data) internal pure returns (address) { | ||
return abi.decode(_data, (address)); | ||
} | ||
} |
This can just use
sstore
directly