Commit 7e67e02b authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: add semver to mintable tokens

Even though the mintable tokens are not upgradable, this
commit adds semver to them in case we change the implementations
down the road and then update the factories to deploy the new
versions. I do think it would be nice to know what version
different mintable tokens are on, in case we decide to add
functionality to the mintable tokens.

This will make it very easy to know what version the mintable
tokens are at, in case newer mintable tokens have different
functionality in some way.
parent fff7b7d6
......@@ -12,8 +12,8 @@ contract OptimismMintableERC20_Test is Bridge_Initializer {
event Mint(address indexed account, uint256 amount);
event Burn(address indexed account, uint256 amount);
function setUp() public override {
super.setUp();
function test_semver_succeeds() external {
assertEq(L2Token.version(), "1.0.0");
}
function test_remoteToken_succeeds() external {
......
......@@ -44,6 +44,7 @@ contract OptimismMintableERC721_Test is ERC721Bridge_Initializer {
assertEq(L2Token.REMOTE_TOKEN(), address(L1Token));
assertEq(L2Token.BRIDGE(), address(L2Bridge));
assertEq(L2Token.REMOTE_CHAIN_ID(), 1);
assertEq(L2Token.version(), "1.0.0");
}
function test_safeMint_succeeds() external {
......
......@@ -4,6 +4,7 @@ pragma solidity 0.8.15;
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import { ILegacyMintableERC20, IOptimismMintableERC20 } from "./IOptimismMintableERC20.sol";
import { Semver } from "../universal/Semver.sol";
/**
* @title OptimismMintableERC20
......@@ -13,7 +14,7 @@ import { ILegacyMintableERC20, IOptimismMintableERC20 } from "./IOptimismMintabl
* Designed to be backwards compatible with the older StandardL2ERC20 token which was only
* meant for use on L2.
*/
contract OptimismMintableERC20 is IOptimismMintableERC20, ILegacyMintableERC20, ERC20 {
contract OptimismMintableERC20 is IOptimismMintableERC20, ILegacyMintableERC20, ERC20, Semver {
/**
* @notice Address of the corresponding version of this token on the remote chain.
*/
......@@ -59,7 +60,7 @@ contract OptimismMintableERC20 is IOptimismMintableERC20, ILegacyMintableERC20,
address _remoteToken,
string memory _name,
string memory _symbol
) ERC20(_name, _symbol) {
) ERC20(_name, _symbol) Semver(1, 0, 0) {
REMOTE_TOKEN = _remoteToken;
BRIDGE = _bridge;
}
......
......@@ -8,6 +8,7 @@ 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";
/**
* @title OptimismMintableERC721
......@@ -15,7 +16,7 @@ import { IOptimismMintableERC721 } from "./IOptimismMintableERC721.sol";
* 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 {
contract OptimismMintableERC721 is ERC721Enumerable, IOptimismMintableERC721, Semver {
/**
* @inheritdoc IOptimismMintableERC721
*/
......@@ -57,7 +58,7 @@ contract OptimismMintableERC721 is ERC721Enumerable, IOptimismMintableERC721 {
address _remoteToken,
string memory _name,
string memory _symbol
) ERC721(_name, _symbol) {
) ERC721(_name, _symbol) Semver(1, 0, 0) {
require(_bridge != address(0), "OptimismMintableERC721: bridge cannot be address(0)");
require(_remoteChainId != 0, "OptimismMintableERC721: remote chain id cannot be zero");
require(
......
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