Skip to content

Commit

Permalink
Merge pull request #7553 from ethereum-optimism/ctb/erc721-isemver
Browse files Browse the repository at this point in the history
contracts-bedrock: migrate ERC721 contracts to ISemver
  • Loading branch information
tynes committed Oct 6, 2023
2 parents 50f63bb + d5de98c commit c738508
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion op-bindings/bindings/optimismmintableerc721factory.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion op-bindings/bindings/optimismmintableerc721factory_more.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/contracts-bedrock/.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ OptimismMintableERC20_Test:test_mint_notBridge_reverts() (gas: 11165)
OptimismMintableERC20_Test:test_mint_succeeds() (gas: 63544)
OptimismMintableERC20_Test:test_remoteToken_succeeds() (gas: 7667)
OptimismMintableERC721Factory_Test:test_constructor_succeeds() (gas: 8351)
OptimismMintableERC721Factory_Test:test_createOptimismMintableERC721_sameTwice_reverts() (gas: 8937393460516801476)
OptimismMintableERC721Factory_Test:test_createOptimismMintableERC721_succeeds() (gas: 2363100)
OptimismMintableERC721Factory_Test:test_createOptimismMintableERC721_sameTwice_reverts() (gas: 8937393460516800041)
OptimismMintableERC721Factory_Test:test_createOptimismMintableERC721_succeeds() (gas: 2316109)
OptimismMintableERC721Factory_Test:test_createOptimismMintableERC721_zeroRemoteToken_reverts() (gas: 9418)
OptimismMintableERC721_Test:test_burn_notBridge_reverts() (gas: 136966)
OptimismMintableERC721_Test:test_burn_succeeds() (gas: 118832)
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"src/periphery/op-nft/OptimistInviter.sol": "0xfdd5b9d45205ef9372ba37f7a6394724695e676d27a47cb154ee6e4148490013",
"src/universal/OptimismMintableERC20.sol": "0x17fe6e955dc7e9e480e57bc62c227206838b204dcb660b8cb8f6f217319a22ba",
"src/universal/OptimismMintableERC20Factory.sol": "0x684a9445515e3797722b211e2c0d6a94b6244d6fa028cd2825a31538ef2dc59c",
"src/universal/OptimismMintableERC721.sol": "0x49dc863caf3e002bf0c90b3af3873990fb282771f4c63735fd61a885b7873983",
"src/universal/OptimismMintableERC721Factory.sol": "0x502438b009bfaf0ab187914662468261f10446fd85d44a79b29cdaef7b4982ba"
"src/universal/OptimismMintableERC721.sol": "0x4c73bf8474fa7eb091796a4db7e57bc5f26d50a3d1cfcb78d5efa47ced5ced2b",
"src/universal/OptimismMintableERC721Factory.sol": "0x935fd97018b6ef10fa813d9d43ab7a77c80885f7a8d7feb430097645cb2abd2c"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { ERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extension
import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
import { IOptimismMintableERC721 } from "./IOptimismMintableERC721.sol";
import { Semver } from "../universal/Semver.sol";
import { IOptimismMintableERC721 } from "src/universal/IOptimismMintableERC721.sol";
import { ISemver } from "src/universal/ISemver.sol";

/// @title OptimismMintableERC721
/// @notice This contract is the remote representation for some token that lives on another network,
/// typically an Optimism representation of an Ethereum-based token. Standard reference
/// implementation that can be extended or modified according to your needs.
contract OptimismMintableERC721 is ERC721Enumerable, IOptimismMintableERC721, Semver {
contract OptimismMintableERC721 is ERC721Enumerable, IOptimismMintableERC721, ISemver {
/// @inheritdoc IOptimismMintableERC721
uint256 public immutable REMOTE_CHAIN_ID;

Expand All @@ -31,7 +31,10 @@ contract OptimismMintableERC721 is ERC721Enumerable, IOptimismMintableERC721, Se
_;
}

/// @custom:semver 1.2.0
/// @notice Semantic version.
/// @custom:semver 1.3.0
string public constant version = "1.3.0";

/// @param _bridge Address of the bridge on this network.
/// @param _remoteChainId Chain ID where the remote token is deployed.
/// @param _remoteToken Address of the corresponding token on the other network.
Expand All @@ -45,7 +48,6 @@ contract OptimismMintableERC721 is ERC721Enumerable, IOptimismMintableERC721, Se
string memory _symbol
)
ERC721(_name, _symbol)
Semver(1, 2, 0)
{
require(_bridge != address(0), "OptimismMintableERC721: bridge cannot be address(0)");
require(_remoteChainId != 0, "OptimismMintableERC721: remote chain id cannot be zero");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import { OptimismMintableERC721 } from "./OptimismMintableERC721.sol";
import { Semver } from "./Semver.sol";
import { OptimismMintableERC721 } from "src/universal/OptimismMintableERC721.sol";
import { ISemver } from "src/universal/ISemver.sol";

/// @title OptimismMintableERC721Factory
/// @notice Factory contract for creating OptimismMintableERC721 contracts.
contract OptimismMintableERC721Factory is Semver {
contract OptimismMintableERC721Factory is ISemver {
/// @notice Address of the ERC721 bridge on this network.
address public immutable BRIDGE;

Expand All @@ -22,13 +22,16 @@ contract OptimismMintableERC721Factory is Semver {
/// @param deployer Address of the initiator of the deployment
event OptimismMintableERC721Created(address indexed localToken, address indexed remoteToken, address deployer);

/// @custom:semver 1.3.0
/// @notice Semantic version.
/// @custom:semver 1.4.0
string public constant version = "1.4.0";

/// @notice The semver MUST be bumped any time that there is a change in
/// the OptimismMintableERC721 token contract since this contract
/// is responsible for deploying OptimismMintableERC721 contracts.
/// @param _bridge Address of the ERC721 bridge on this network.
/// @param _remoteChainId Chain ID for the remote network.
constructor(address _bridge, uint256 _remoteChainId) Semver(1, 3, 0) {
constructor(address _bridge, uint256 _remoteChainId) {
BRIDGE = _bridge;
REMOTE_CHAIN_ID = _remoteChainId;
}
Expand Down

0 comments on commit c738508

Please sign in to comment.