Commit a3242d4f authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

contracts-periphery: erc721 factory fixes (#3615)

These changes make the `OptimismMintableERC721Factory` in line
with the bedrock version of the `OptimismMintableERC20Factory`.
We might as well follow what we are doing with the new erc20
factory to keep things in line with each other.

These changes are very small, they just rename a function to
not follow the deprecated naming scheme, the function now returns
an address which makes testing/integration a bit easier and also
does a slight refactor to prevent the need to cast a type 3 times.
Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 0d673e5f
---
'@eth-optimism/integration-tests': patch
'@eth-optimism/contracts-periphery': patch
---
Fix erc721 factory to match erc21 factory
...@@ -113,12 +113,11 @@ describe('ERC721 Bridge', () => { ...@@ -113,12 +113,11 @@ describe('ERC721 Bridge', () => {
) )
// Create a L2 Standard ERC721 with the Standard ERC721 Factory // Create a L2 Standard ERC721 with the Standard ERC721 Factory
const tx = const tx = await OptimismMintableERC721Factory.createOptimismMintableERC721(
await OptimismMintableERC721Factory.createStandardOptimismMintableERC721( L1ERC721.address,
L1ERC721.address, 'L2ERC721',
'L2ERC721', 'L2'
'L2' )
)
const receipt = await tx.wait() const receipt = await tx.wait()
// Get the OptimismMintableERC721Created event // Get the OptimismMintableERC721Created event
......
...@@ -14,8 +14,13 @@ contract OptimismMintableERC721Factory is Semver { ...@@ -14,8 +14,13 @@ contract OptimismMintableERC721Factory is Semver {
* *
* @param localToken Address of the token on the this domain. * @param localToken Address of the token on the this domain.
* @param remoteToken Address of the token on the remote domain. * @param remoteToken Address of the token on the remote domain.
* @param deployer Address of the initiator of the deployment
*/ */
event OptimismMintableERC721Created(address indexed localToken, address indexed remoteToken); event OptimismMintableERC721Created(
address indexed localToken,
address indexed remoteToken,
address deployer
);
/** /**
* @notice Address of the ERC721 bridge on this network. * @notice Address of the ERC721 bridge on this network.
...@@ -30,7 +35,7 @@ contract OptimismMintableERC721Factory is Semver { ...@@ -30,7 +35,7 @@ contract OptimismMintableERC721Factory is Semver {
/** /**
* @notice Tracks addresses created by this factory. * @notice Tracks addresses created by this factory.
*/ */
mapping(address => bool) public isStandardOptimismMintableERC721; mapping(address => bool) public isOptimismMintableERC721;
/** /**
* @custom:semver 1.0.0 * @custom:semver 1.0.0
...@@ -58,25 +63,23 @@ contract OptimismMintableERC721Factory is Semver { ...@@ -58,25 +63,23 @@ contract OptimismMintableERC721Factory is Semver {
* @param _name ERC721 name. * @param _name ERC721 name.
* @param _symbol ERC721 symbol. * @param _symbol ERC721 symbol.
*/ */
function createStandardOptimismMintableERC721( function createOptimismMintableERC721(
address _remoteToken, address _remoteToken,
string memory _name, string memory _name,
string memory _symbol string memory _symbol
) external { ) external returns (address) {
require( require(
_remoteToken != address(0), _remoteToken != address(0),
"OptimismMintableERC721Factory: L1 token address cannot be address(0)" "OptimismMintableERC721Factory: L1 token address cannot be address(0)"
); );
OptimismMintableERC721 localToken = new OptimismMintableERC721( address localToken = address(
bridge, new OptimismMintableERC721(bridge, remoteChainId, _remoteToken, _name, _symbol)
remoteChainId,
_remoteToken,
_name,
_symbol
); );
isStandardOptimismMintableERC721[address(localToken)] = true; isOptimismMintableERC721[localToken] = true;
emit OptimismMintableERC721Created(address(localToken), _remoteToken); emit OptimismMintableERC721Created(localToken, _remoteToken, msg.sender);
return localToken;
} }
} }
...@@ -76,12 +76,11 @@ describe('OptimismMintableERC721Factory', () => { ...@@ -76,12 +76,11 @@ describe('OptimismMintableERC721Factory', () => {
}) })
it('should be able to create a standard ERC721 contract', async () => { it('should be able to create a standard ERC721 contract', async () => {
const tx = const tx = await OptimismMintableERC721Factory.createOptimismMintableERC721(
await OptimismMintableERC721Factory.createStandardOptimismMintableERC721( L1ERC721.address,
L1ERC721.address, 'L2ERC721',
'L2ERC721', 'ERC'
'ERC' )
)
const receipt = await tx.wait() const receipt = await tx.wait()
// Get the OptimismMintableERC721Created event // Get the OptimismMintableERC721Created event
...@@ -109,7 +108,7 @@ describe('OptimismMintableERC721Factory', () => { ...@@ -109,7 +108,7 @@ describe('OptimismMintableERC721Factory', () => {
expect(await OptimismMintableERC721.baseTokenURI()).to.equal(baseURI) expect(await OptimismMintableERC721.baseTokenURI()).to.equal(baseURI)
expect( expect(
await OptimismMintableERC721Factory.isStandardOptimismMintableERC721( await OptimismMintableERC721Factory.isOptimismMintableERC721(
OptimismMintableERC721.address OptimismMintableERC721.address
) )
).to.equal(true) ).to.equal(true)
...@@ -117,7 +116,7 @@ describe('OptimismMintableERC721Factory', () => { ...@@ -117,7 +116,7 @@ describe('OptimismMintableERC721Factory', () => {
it('should not be able to create a standard token with a 0 address for l1 token', async () => { it('should not be able to create a standard token with a 0 address for l1 token', async () => {
await expect( await expect(
OptimismMintableERC721Factory.createStandardOptimismMintableERC721( OptimismMintableERC721Factory.createOptimismMintableERC721(
ethers.constants.AddressZero, ethers.constants.AddressZero,
'L2ERC721', 'L2ERC721',
'ERC' 'ERC'
......
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