Commit 7cc54758 authored by Kelvin Fichter's avatar Kelvin Fichter

fix(ctp): remove reinitialization from ERC721 fact

Removes reinitialization from the ERC721 factory.
parent 91f40f82
...@@ -10,6 +10,7 @@ import { ...@@ -10,6 +10,7 @@ import {
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol"; import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { L2ERC721Bridge } from "../../L2/messaging/L2ERC721Bridge.sol"; import { L2ERC721Bridge } from "../../L2/messaging/L2ERC721Bridge.sol";
import { Semver } from "../../universal/Semver.sol";
/** /**
* @title L1ERC721Bridge * @title L1ERC721Bridge
...@@ -17,12 +18,7 @@ import { L2ERC721Bridge } from "../../L2/messaging/L2ERC721Bridge.sol"; ...@@ -17,12 +18,7 @@ import { L2ERC721Bridge } from "../../L2/messaging/L2ERC721Bridge.sol";
* make it possible to transfer ERC721 tokens between Optimism and Ethereum. This contract * make it possible to transfer ERC721 tokens between Optimism and Ethereum. This contract
* acts as an escrow for ERC721 tokens deposted into L2. * acts as an escrow for ERC721 tokens deposted into L2.
*/ */
contract L1ERC721Bridge is CrossDomainEnabled, OwnableUpgradeable { contract L1ERC721Bridge is Semver, CrossDomainEnabled, OwnableUpgradeable {
/**
* @notice Contract version number.
*/
uint256 public constant VERSION = 2;
/** /**
* @notice Emitted when an ERC721 bridge to the other network is initiated. * @notice Emitted when an ERC721 bridge to the other network is initiated.
* *
...@@ -77,7 +73,10 @@ contract L1ERC721Bridge is CrossDomainEnabled, OwnableUpgradeable { ...@@ -77,7 +73,10 @@ contract L1ERC721Bridge is CrossDomainEnabled, OwnableUpgradeable {
* @param _messenger Address of the CrossDomainMessenger on this network. * @param _messenger Address of the CrossDomainMessenger on this network.
* @param _otherBridge Address of the ERC721 bridge on the other network. * @param _otherBridge Address of the ERC721 bridge on the other network.
*/ */
constructor(address _messenger, address _otherBridge) CrossDomainEnabled(address(0)) { constructor(address _messenger, address _otherBridge)
Semver(0, 0, 1)
CrossDomainEnabled(address(0))
{
initialize(_messenger, _otherBridge); initialize(_messenger, _otherBridge);
} }
......
...@@ -11,6 +11,7 @@ import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC16 ...@@ -11,6 +11,7 @@ import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC16
import { Address } from "@openzeppelin/contracts/utils/Address.sol"; import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { L1ERC721Bridge } from "../../L1/messaging/L1ERC721Bridge.sol"; import { L1ERC721Bridge } from "../../L1/messaging/L1ERC721Bridge.sol";
import { IOptimismMintableERC721 } from "../../universal/op-erc721/IOptimismMintableERC721.sol"; import { IOptimismMintableERC721 } from "../../universal/op-erc721/IOptimismMintableERC721.sol";
import { Semver } from "../../universal/Semver.sol";
/** /**
* @title L2ERC721Bridge * @title L2ERC721Bridge
...@@ -19,12 +20,7 @@ import { IOptimismMintableERC721 } from "../../universal/op-erc721/IOptimismMint ...@@ -19,12 +20,7 @@ import { IOptimismMintableERC721 } from "../../universal/op-erc721/IOptimismMint
* acts as a minter for new tokens when it hears about deposits into the L1 ERC721 bridge. * acts as a minter for new tokens when it hears about deposits into the L1 ERC721 bridge.
* This contract also acts as a burner for tokens being withdrawn. * This contract also acts as a burner for tokens being withdrawn.
*/ */
contract L2ERC721Bridge is CrossDomainEnabled, OwnableUpgradeable { contract L2ERC721Bridge is Semver, CrossDomainEnabled, OwnableUpgradeable {
/**
* @notice Contract version number.
*/
uint256 public constant VERSION = 2;
/** /**
* @notice Emitted when an ERC721 bridge to the other network is initiated. * @notice Emitted when an ERC721 bridge to the other network is initiated.
* *
...@@ -91,7 +87,10 @@ contract L2ERC721Bridge is CrossDomainEnabled, OwnableUpgradeable { ...@@ -91,7 +87,10 @@ contract L2ERC721Bridge is CrossDomainEnabled, OwnableUpgradeable {
* @param _messenger Address of the CrossDomainMessenger on this network. * @param _messenger Address of the CrossDomainMessenger on this network.
* @param _otherBridge Address of the ERC721 bridge on the other network. * @param _otherBridge Address of the ERC721 bridge on the other network.
*/ */
constructor(address _messenger, address _otherBridge) CrossDomainEnabled(address(0)) { constructor(address _messenger, address _otherBridge)
Semver(0, 0, 1)
CrossDomainEnabled(address(0))
{
initialize(_messenger, _otherBridge); initialize(_messenger, _otherBridge);
} }
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/**
* @title Semver
* @notice Semver is a simple contract for managing contract versions.
*/
contract Semver {
/**
* @notice Contract version number (major).
*/
uint256 public immutable MAJOR_VERSION;
/**
* @notice Contract version number (minor).
*/
uint256 public immutable MINOR_VERSION;
/**
* @notice Contract version number (patch).
*/
uint256 public immutable PATCH_VERSION;
/**
* @param _major Version number (major).
* @param _minor Version number (minor).
* @param _patch Version number (patch).
*/
constructor(
uint256 _major,
uint256 _minor,
uint256 _patch
) {
MAJOR_VERSION = _major;
MINOR_VERSION = _minor;
PATCH_VERSION = _patch;
}
}
...@@ -5,17 +5,13 @@ import { ...@@ -5,17 +5,13 @@ import {
OwnableUpgradeable OwnableUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { OptimismMintableERC721 } from "./OptimismMintableERC721.sol"; import { OptimismMintableERC721 } from "./OptimismMintableERC721.sol";
import { Semver } from "../Semver.sol";
/** /**
* @title OptimismMintableERC721Factory * @title OptimismMintableERC721Factory
* @notice Factory contract for creating OptimismMintableERC721 contracts. * @notice Factory contract for creating OptimismMintableERC721 contracts.
*/ */
contract OptimismMintableERC721Factory is OwnableUpgradeable { contract OptimismMintableERC721Factory is Semver, OwnableUpgradeable {
/**
* @notice Contract version number.
*/
uint8 public constant VERSION = 2;
/** /**
* @notice Emitted whenever a new OptimismMintableERC721 contract is created. * @notice Emitted whenever a new OptimismMintableERC721 contract is created.
* *
...@@ -42,7 +38,7 @@ contract OptimismMintableERC721Factory is OwnableUpgradeable { ...@@ -42,7 +38,7 @@ contract OptimismMintableERC721Factory is OwnableUpgradeable {
/** /**
* @param _bridge Address of the ERC721 bridge on this network. * @param _bridge Address of the ERC721 bridge on this network.
*/ */
constructor(address _bridge, uint256 _remoteChainId) { constructor(address _bridge, uint256 _remoteChainId) Semver(0, 0, 1) {
initialize(_bridge, _remoteChainId); initialize(_bridge, _remoteChainId);
} }
...@@ -51,7 +47,7 @@ contract OptimismMintableERC721Factory is OwnableUpgradeable { ...@@ -51,7 +47,7 @@ contract OptimismMintableERC721Factory is OwnableUpgradeable {
* *
* @param _bridge Address of the ERC721 bridge on this network. * @param _bridge Address of the ERC721 bridge on this network.
*/ */
function initialize(address _bridge, uint256 _remoteChainId) public reinitializer(VERSION) { function initialize(address _bridge, uint256 _remoteChainId) public initializer {
bridge = _bridge; bridge = _bridge;
remoteChainId = _remoteChainId; remoteChainId = _remoteChainId;
......
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