Hey, I have a smart contract that deploys upgradeable instances of another contract as such:
pragma solidity >=0.5.0 <0.8.0;
import "@openzeppelin/upgrades/contracts/upgradeability/ProxyFactory.sol";
contract FuturesFactory is ProxyFactory {
address internal organizerAddress;
address internal celestialAddress;
address internal admin;
uint public salt;
constructor(
address _organizerAddress,
address _celestialAddress,
address _proxyAdminAddress
) public {
organizerAddress = _organizerAddress;
celestialAddress = _celestialAddress;
admin = _proxyAdminAddress;
}
function createNewContract(address _stablecoinAddress, uint _initialBorrow, string memory _name, string memory _symbol) public returns (address) {
require (msg.sender == organizerAddress);
bytes memory payload = abi.encodeWithSignature("initialize(address,uint256,string,string)", _stablecoinAddress, _initialBorrow, _name, _symbol);
address FuturesAddress = address(deploy(salt, celestialAddress, admin, payload));
salt++;
return FuturesAddress;
}
}
First off, I wanted to see if this looked correct. Secondly, I was wondering how I would test this at a high level because I believe there is no way to call prepare upgrade on a contract that isn't deployed using the upgrade plugins. I am using truffle. Thank you for any help !