Howdy,
I'm running into an issue while trying to set up a Clone Factory to make clones of a contract based on ERC721. I'm using Remix.
The issue is that instead of it cloning the ERC721 it clones the Clone Factory.
Here's the contract that I want to clone:
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
contract NFT is ERC721Upgradeable {
function initialize(string calldata _name, string calldata _symbol) external {
__ERC721_init(_name, _symbol);
}
}
And here is the factory:
pragma solidity ^0.8.0;
import "./NFT.sol";
import "@openzeppelin/contracts/proxy/Clones.sol";
contract NFTCloneFactory {
address immutable implementation;
constructor() {
implementation = address(new NFT());
}
function createClone(string calldata _name, string calldata _symbol) external returns (address) {
address clone = Clones.clone(implementation);
NFT(clone).initialize(_name, _symbol);
return clone;
}
}
When I get the new clone address from the return of the createClone function it ends up being a clone of the Factory contract and not the ERC721.
If anyone has any ideas or tips, I would greatly appreciate it! Perhaps I'm missing something super obvious!
Thank you.