Commit 96043725 authored by Mark Tyneway's avatar Mark Tyneway Committed by Maurelian

contracts-bedrock: more cleanup

parent fbc474f7
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -757,11 +757,11 @@ func NewL2ImmutableConfig(config *DeployConfig, block *types.Block) (*immutables
GovernanceToken: struct{}{},
LegacyMessagePasser: struct{}{},
L2ERC721Bridge: struct {
Messenger common.Address
OtherBridge common.Address
Messenger common.Address
}{
Messenger: predeploys.L2CrossDomainMessengerAddr,
OtherBridge: config.L1ERC721BridgeProxy,
Messenger: predeploys.L2CrossDomainMessengerAddr,
},
OptimismMintableERC721Factory: struct {
Bridge common.Address
......
......@@ -45,8 +45,8 @@ type PredeploysImmutableConfig struct {
GovernanceToken struct{}
LegacyMessagePasser struct{}
L2ERC721Bridge struct {
Messenger common.Address
OtherBridge common.Address
Messenger common.Address
}
OptimismMintableERC721Factory struct {
Bridge common.Address
......@@ -230,15 +230,11 @@ func l2ImmutableDeployer(backend *backends.SimulatedBackend, opts *bind.Transact
}
_, tx, _, err = bindings.DeployOptimismMintableERC20Factory(opts, backend, bridge)
case "L2ERC721Bridge":
messenger, ok := deployment.Args[0].(common.Address)
if !ok {
return nil, fmt.Errorf("invalid type for messenger")
}
otherBridge, ok := deployment.Args[1].(common.Address)
otherBridge, ok := deployment.Args[0].(common.Address)
if !ok {
return nil, fmt.Errorf("invalid type for otherBridge")
}
_, tx, _, err = bindings.DeployL2ERC721Bridge(opts, backend, messenger, otherBridge)
_, tx, _, err = bindings.DeployL2ERC721Bridge(opts, backend, otherBridge)
case "OptimismMintableERC721Factory":
bridge, ok := deployment.Args[0].(common.Address)
if !ok {
......
......@@ -43,11 +43,11 @@ func TestBuildOptimism(t *testing.T) {
GovernanceToken: struct{}{},
LegacyMessagePasser: struct{}{},
L2ERC721Bridge: struct {
Messenger common.Address
OtherBridge common.Address
Messenger common.Address
}{
Messenger: common.HexToAddress("0x1234567890123456789012345678901234567890"),
OtherBridge: common.HexToAddress("0x1234567890123456789012345678901234567890"),
Messenger: predeploys.L2CrossDomainMessengerAddr,
},
OptimismMintableERC721Factory: struct {
Bridge common.Address
......
......@@ -144,9 +144,9 @@ library ChainAssertions {
require(bridge.OTHER_BRIDGE() == Predeploys.L2_ERC721_BRIDGE);
require(bridge.otherBridge() == Predeploys.L2_ERC721_BRIDGE);
if (_isProxy) {
require(address(bridge.superChainConfig()) == _contracts.SuperchainConfig);
require(address(bridge.superchainConfig()) == _contracts.SuperchainConfig);
} else {
require(address(bridge.superChainConfig()) == address(0));
require(address(bridge.superchainConfig()) == address(0));
}
}
......
......@@ -678,8 +678,7 @@ contract Deploy is Deployer {
console.log("Deploying L1ERC721Bridge implementation");
address l1CrossDomainMessengerProxy = mustGetAddress("L1CrossDomainMessengerProxy");
L1ERC721Bridge bridge = new L1ERC721Bridge{ salt: _implSalt() }({
_messenger: l1CrossDomainMessengerProxy,
_otherBridge: Predeploys.L2_ERC721_BRIDGE
_messenger: l1CrossDomainMessengerProxy
});
save("L1ERC721Bridge", address(bridge));
......
......@@ -19,21 +19,28 @@ contract L1ERC721Bridge is ERC721Bridge, ISemver {
/// by ID was deposited for a given L2 token.
mapping(address => mapping(address => mapping(uint256 => bool))) public deposits;
/// @notice Address of the SuperchainConfig contract.
SuperchainConfig public superchainConfig;
/// @notice Semantic version.
/// @custom:semver 1.5.0
string public constant version = "1.5.0";
/// @notice Constructs the L1ERC721Bridge contract.
/// @param _messenger Address of the CrossDomainMessenger on this network.
/// @param _otherBridge Address of the ERC721 bridge on the other network.
constructor(address _messenger, address _otherBridge) ERC721Bridge(_messenger, _otherBridge) {
constructor(address _messenger) ERC721Bridge(_messenger, Predeploys.L2_ERC721_BRIDGE) {
initialize(SuperchainConfig(address(0)));
}
/// @notice Initializes the contract.
/// @param _superchainConfig Address of the SuperchainConfig contract on this network.
function initialize(SuperchainConfig _superchainConfig) public initializer {
superChainConfig = _superchainConfig;
superchainConfig = _superchainConfig;
}
/// @inheritdoc ERC721Bridge
function paused() public view override returns (bool) {
return superchainConfig.paused();
}
/// @notice Completes an ERC721 bridge from the other domain and sends the ERC721 token to the
......@@ -57,6 +64,7 @@ contract L1ERC721Bridge is ERC721Bridge, ISemver {
external
onlyOtherBridge
{
require(paused() == false, "L1ERC721Bridge: paused");
require(_localToken != address(this), "L1ERC721Bridge: local token cannot be self");
// Checks that the L1/L2 NFT pair has a token ID that is escrowed in the L1 Bridge.
......
......@@ -24,9 +24,8 @@ contract L2ERC721Bridge is ERC721Bridge, ISemver {
string public constant version = "1.5.0";
/// @notice Constructs the L2ERC721Bridge contract.
/// @param _messenger Address of the CrossDomainMessenger on this network.
/// @param _otherBridge Address of the ERC721 bridge on the other network.
constructor(address _messenger, address _otherBridge) ERC721Bridge(_messenger, _otherBridge) {
constructor(address _otherBridge) ERC721Bridge(Predeploys.L2_CROSS_DOMAIN_MESSENGER, _otherBridge) {
initialize();
}
......
......@@ -9,9 +9,6 @@ import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable
/// @title ERC721Bridge
/// @notice ERC721Bridge is a base contract for the L1 and L2 ERC721 bridges.
abstract contract ERC721Bridge is Initializable {
/// @notice
SuperchainConfig public superChainConfig;
/// @notice Messenger contract on this domain. This will be removed in the
/// future, use `messenger` instead.
/// @custom:legacy
......@@ -23,7 +20,7 @@ abstract contract ERC721Bridge is Initializable {
address public immutable OTHER_BRIDGE;
/// @notice Reserve extra slots (to a total of 50) in the storage layout for future upgrades.
uint256[48] private __gap;
uint256[49] private __gap;
/// @notice Emitted when an ERC721 bridge to the other network is initiated.
/// @param localToken Address of the token on this domain.
......@@ -88,6 +85,14 @@ abstract contract ERC721Bridge is Initializable {
return OTHER_BRIDGE;
}
/// @notice This function should return true if the contract is paused.
/// On L1 this function will check the SuperchainConfig for its paused status.
/// On L2 this function should be a no-op.
/// @return Whether or not the contract is paused.
function paused() public view virtual returns (bool) {
return false;
}
/// @notice Initiates a bridge of an NFT to the caller's account on the other chain. Note that
/// this function can only be called by EOAs. Smart contract wallets should use the
/// `bridgeERC721To` function after ensuring that the recipient address on the remote
......
......@@ -21,7 +21,7 @@ contract ExtendedPause_Test is CommonTest {
assertTrue(l1StandardBridge.paused());
assertEq(l1StandardBridge.paused(), superchainConfig.paused());
//assertTrue(l1ERC721Bridge.paused());
//assertEq(l1ERC721Bridge.paused(), superchainConfig.paused());
assertTrue(l1ERC721Bridge.paused());
assertEq(l1ERC721Bridge.paused(), superchainConfig.paused());
}
}
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