Commit fc17c191 authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: cleanup

parent cc577663
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{ {
"src/L1/L1CrossDomainMessenger.sol": "0x2b276f14475869cfd81868b03dc72b91dd726a787c9568caf4849fe34830b207", "src/L1/L1CrossDomainMessenger.sol": "0x2b276f14475869cfd81868b03dc72b91dd726a787c9568caf4849fe34830b207",
"src/L1/L1ERC721Bridge.sol": "0xc9b9c88b7f46d928443c219d6c99955c6f6bc79f8cf7440d97433f13772dc441", "src/L1/L1ERC721Bridge.sol": "0x6aeb386bab56e1fa45692188ffc0dcb09c6719e17776e1fffd13278f7a5f40cc",
"src/L1/L1StandardBridge.sol": "0xa35dc0ab143043063c3bff73c8b065e401c23296a2017258ce8a87f4a4da9416", "src/L1/L1StandardBridge.sol": "0xa35dc0ab143043063c3bff73c8b065e401c23296a2017258ce8a87f4a4da9416",
"src/L1/L2OutputOracle.sol": "0x8f32ccb4c5cb63a459a0e79ee412177dc03fd279fdaaf1dac69e8c714902e857", "src/L1/L2OutputOracle.sol": "0x8f32ccb4c5cb63a459a0e79ee412177dc03fd279fdaaf1dac69e8c714902e857",
"src/L1/OptimismPortal.sol": "0xeaa47a63e8a3bcfdb7dfd3e6c8608369e34e362d9de82f3acf13cbc27c070bf7", "src/L1/OptimismPortal.sol": "0xeaa47a63e8a3bcfdb7dfd3e6c8608369e34e362d9de82f3acf13cbc27c070bf7",
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
"src/L2/L1Block.sol": "0x7fbfc8b4da630386636c665570321fdec287b0867dbe0f91c2e7cd5b7697c220", "src/L2/L1Block.sol": "0x7fbfc8b4da630386636c665570321fdec287b0867dbe0f91c2e7cd5b7697c220",
"src/L2/L1FeeVault.sol": "0x62bfe739ff939fc68f90916399ac4160936d31eb37749cb014dd9d0c5dd4183a", "src/L2/L1FeeVault.sol": "0x62bfe739ff939fc68f90916399ac4160936d31eb37749cb014dd9d0c5dd4183a",
"src/L2/L2CrossDomainMessenger.sol": "0xc9641981f7aa79f44b5925100027098d8f76c6178c65aca99fafa859289182be", "src/L2/L2CrossDomainMessenger.sol": "0xc9641981f7aa79f44b5925100027098d8f76c6178c65aca99fafa859289182be",
"src/L2/L2ERC721Bridge.sol": "0xfedd00d6bbbfe12150b6fbe31047eede706c563fa0b25f2b145c16cb1655dd8a", "src/L2/L2ERC721Bridge.sol": "0x8c43c5f631a79df9f736c6e336af285065e798151e97f11b52bb7d722759f35f",
"src/L2/L2StandardBridge.sol": "0x67e202bc6751807b20a98b88b0b65bdff30420bf1e71f2c1c7948de448cfcdc0", "src/L2/L2StandardBridge.sol": "0x67e202bc6751807b20a98b88b0b65bdff30420bf1e71f2c1c7948de448cfcdc0",
"src/L2/L2ToL1MessagePasser.sol": "0xed800b600cb3f67e18a1ab10750e3934a8b3e42178f422bcacfde770a6e8e8bd", "src/L2/L2ToL1MessagePasser.sol": "0xed800b600cb3f67e18a1ab10750e3934a8b3e42178f422bcacfde770a6e8e8bd",
"src/L2/SequencerFeeVault.sol": "0xd57c143b1f042400430b991b806bf971628e6980406c751e82d19ae80eeb4e8d", "src/L2/SequencerFeeVault.sol": "0xd57c143b1f042400430b991b806bf971628e6980406c751e82d19ae80eeb4e8d",
......
...@@ -31,7 +31,9 @@ contract L1ERC721Bridge is ERC721Bridge, Semver { ...@@ -31,7 +31,9 @@ contract L1ERC721Bridge is ERC721Bridge, Semver {
/// @notice Initializes the contract. /// @notice Initializes the contract.
/// @param _messenger Address of the CrossDomainMessenger on this network. /// @param _messenger Address of the CrossDomainMessenger on this network.
function initialize(CrossDomainMessenger _messenger) public reinitializer(1) { function initialize(CrossDomainMessenger _messenger) public reinitializer(1) {
__ERC721Bridge_init(_messenger); __ERC721Bridge_init({
_messenger: _messenger
});
} }
/// @notice Completes an ERC721 bridge from the other domain and sends the ERC721 token to the /// @notice Completes an ERC721 bridge from the other domain and sends the ERC721 token to the
...@@ -100,7 +102,7 @@ contract L1ERC721Bridge is ERC721Bridge, Semver { ...@@ -100,7 +102,7 @@ contract L1ERC721Bridge is ERC721Bridge, Semver {
IERC721(_localToken).transferFrom(_from, address(this), _tokenId); IERC721(_localToken).transferFrom(_from, address(this), _tokenId);
// Send calldata into L2 // Send calldata into L2
_MESSENGER.sendMessage(_OTHER_BRIDGE, message, _minGasLimit); messenger.sendMessage(OTHER_BRIDGE, message, _minGasLimit);
emit ERC721BridgeInitiated(_localToken, _remoteToken, _from, _to, _tokenId, _extraData); emit ERC721BridgeInitiated(_localToken, _remoteToken, _from, _to, _tokenId, _extraData);
} }
} }
...@@ -18,11 +18,11 @@ import { Semver } from "../universal/Semver.sol"; ...@@ -18,11 +18,11 @@ import { Semver } from "../universal/Semver.sol";
/// wait for the one-week challenge period to elapse before their Optimism-native NFT /// wait for the one-week challenge period to elapse before their Optimism-native NFT
/// can be refunded on L2. /// can be refunded on L2.
contract L2ERC721Bridge is ERC721Bridge, Semver { contract L2ERC721Bridge is ERC721Bridge, Semver {
/// @custom:semver 1.2.0 /// @custom:semver 1.3.0
/// @notice Constructs the L2ERC721Bridge contract. /// @notice Constructs the L2ERC721Bridge contract.
/// @param _otherBridge Address of the ERC721 bridge on the other network. /// @param _otherBridge Address of the ERC721 bridge on the other network.
constructor(address _otherBridge) constructor(address _otherBridge)
Semver(1, 2, 1) Semver(1, 3, 0)
ERC721Bridge(_otherBridge) ERC721Bridge(_otherBridge)
{ {
initialize({ initialize({
...@@ -32,8 +32,10 @@ contract L2ERC721Bridge is ERC721Bridge, Semver { ...@@ -32,8 +32,10 @@ contract L2ERC721Bridge is ERC721Bridge, Semver {
/// @notice Initializes the contract. /// @notice Initializes the contract.
/// @param _messenger Address of the CrossDomainMessenger on this network. /// @param _messenger Address of the CrossDomainMessenger on this network.
function initialize(CrossDomainMessenger _messenger) public reinitializer(1) { function initialize(CrossDomainMessenger _messenger) public reinitializer(2) {
__ERC721Bridge_init(_messenger); __ERC721Bridge_init({
_messenger: _messenger
});
} }
/// @notice Completes an ERC721 bridge from the other domain and sends the ERC721 token to the /// @notice Completes an ERC721 bridge from the other domain and sends the ERC721 token to the
...@@ -119,7 +121,7 @@ contract L2ERC721Bridge is ERC721Bridge, Semver { ...@@ -119,7 +121,7 @@ contract L2ERC721Bridge is ERC721Bridge, Semver {
// Send message to L1 bridge // Send message to L1 bridge
// slither-disable-next-line reentrancy-events // slither-disable-next-line reentrancy-events
_MESSENGER.sendMessage(_OTHER_BRIDGE, message, _minGasLimit); messenger.sendMessage(OTHER_BRIDGE, message, _minGasLimit);
// slither-disable-next-line reentrancy-events // slither-disable-next-line reentrancy-events
emit ERC721BridgeInitiated(_localToken, remoteToken, _from, _to, _tokenId, _extraData); emit ERC721BridgeInitiated(_localToken, remoteToken, _from, _to, _tokenId, _extraData);
......
...@@ -10,10 +10,11 @@ import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable ...@@ -10,10 +10,11 @@ import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable
abstract contract ERC721Bridge is Initializable { abstract contract ERC721Bridge is Initializable {
/// @notice Messenger contract on this domain. /// @notice Messenger contract on this domain.
/// @custom:network-specific /// @custom:network-specific
CrossDomainMessenger internal _MESSENGER; CrossDomainMessenger public messenger;
/// @notice Address of the bridge on the other network. /// @notice Address of the bridge on the other network.
address internal immutable _OTHER_BRIDGE; /// @custom:legacy
address public immutable OTHER_BRIDGE;
/// @notice Reserve extra slots (to a total of 50) in the storage layout for future upgrades. /// @notice Reserve extra slots (to a total of 50) in the storage layout for future upgrades.
uint256[48] private __gap; uint256[48] private __gap;
...@@ -53,7 +54,7 @@ abstract contract ERC721Bridge is Initializable { ...@@ -53,7 +54,7 @@ abstract contract ERC721Bridge is Initializable {
/// @notice Ensures that the caller is a cross-chain message from the other bridge. /// @notice Ensures that the caller is a cross-chain message from the other bridge.
modifier onlyOtherBridge() { modifier onlyOtherBridge() {
require( require(
msg.sender == address(_MESSENGER) && _MESSENGER.xDomainMessageSender() == _OTHER_BRIDGE, msg.sender == address(messenger) && messenger.xDomainMessageSender() == OTHER_BRIDGE,
"ERC721Bridge: function can only be called from the other bridge" "ERC721Bridge: function can only be called from the other bridge"
); );
_; _;
...@@ -63,38 +64,24 @@ abstract contract ERC721Bridge is Initializable { ...@@ -63,38 +64,24 @@ abstract contract ERC721Bridge is Initializable {
/// @param _otherBridge Address of the ERC721 bridge on the other network. /// @param _otherBridge Address of the ERC721 bridge on the other network.
constructor(address _otherBridge) { constructor(address _otherBridge) {
require(_otherBridge != address(0), "ERC721Bridge: other bridge cannot be address(0)"); require(_otherBridge != address(0), "ERC721Bridge: other bridge cannot be address(0)");
_OTHER_BRIDGE = _otherBridge; OTHER_BRIDGE = _otherBridge;
} }
// @notice Initializes the contract. // @notice Initializes the contract.
/// @param _messenger Address of the CrossDomainMessenger on this network. /// @param _messenger Address of the CrossDomainMessenger on this network.
function __ERC721Bridge_init(CrossDomainMessenger _messenger) internal onlyInitializing { function __ERC721Bridge_init(CrossDomainMessenger _messenger) internal onlyInitializing {
_MESSENGER = _messenger; messenger = _messenger;
} }
/// @notice Getter for messenger contract.
/// @return Messenger contract on this domain.
function messenger() external view returns (CrossDomainMessenger) {
return _MESSENGER;
}
/// @custom:legacy
/// @notice Getter for messenger contract. /// @notice Getter for messenger contract.
function MESSENGER() external view returns (CrossDomainMessenger) { function MESSENGER() external view returns (CrossDomainMessenger) {
return _MESSENGER; return messenger;
} }
/// @notice Getter for other bridge address. /// @notice Getter for other bridge address.
/// @return Address of the bridge on the other network. /// @return Address of the bridge on the other network.
function otherBridge() external view returns (address) { function otherBridge() external view returns (address) {
return _OTHER_BRIDGE; return OTHER_BRIDGE;
}
/// @custom:legacy
/// @notice Getter for other bridge address.
/// @return Address of the bridge on the other network.
function OTHER_BRIDGE() external view returns (address) {
return _OTHER_BRIDGE;
} }
/// @notice Initiates a bridge of an NFT to the caller's account on the other chain. Note that /// @notice Initiates a bridge of an NFT to the caller's account on the other chain. Note that
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment