Thank you so much for the prompt reply @ericglau !
Totally understood. I'm using what this post suggested.
Now that I am trying to create a factory that creates an instance of my upgradeable contract, this is what it looks like:
//SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
import "./MyUpgradeable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/v4.4.1/contracts/proxy/utils/Initializable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/v4.4.1/contracts/security/PausableUpgradeable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/v4.4.1/contracts/access/AccessControlUpgradeable.sol";
contract FactoryContract is Initializable, PausableUpgradeable, AccessControlUpgradeable {
bytes32 public constant URI_SETTER_ROLE = keccak256("URI_SETTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
address immutable myUpgradeableImplementation;
event MyUpgradeableDeployed(address tokenAddress);
address payable public factoryManagerAccount;
MyUpgradeable[] public myUpgradeablesArray;
function initialize() initializer public {
factoryManagerAccount = payable(msg.sender);
__AccessControl_init();
__Pausable_init();
_grantRole(DEFAULT_ADMIN_ROLE, factoryManagerAccount);
_grantRole(PAUSER_ROLE, msg.sender);
}
*ERROR LINE IS THE FOLLOWING*
function createMyUpgradeable(uint8 _Number, string _Name) external returns (address) {
ERC1967Proxy proxy = new ERC1967Proxy(myUpgradeableImplementation, abi.encodeWithSelector(MyUpgradeable(address(0)).initialize.selector, _Number, _Name));
emit MyUpgradeableDeployed(address(proxy));
return address(proxy);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(
// ERC1155Upgradeable,
AccessControlUpgradeable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
}
I'm using remix with the 0.8.7 compiler version and it throws on the ERROR LINE:
TypeError: Data location must be "memory" or "calldata" for parameter in external function, but none was given.
-->
What am I missing from the proxy creation?