Testing upgradeable contracts deployed by a factory

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;

		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));
		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 :slight_smile:!

Hey @Ash. First of all please note that @openzeppelin/upgrades is now deprecated and no longer maintained.

Our current tooling for upgrades are the OpenZeppelin Upgrades Plugins for Hardhat and Truffle. I believe the "prepare upgrade" you refer to is in the plugins so you may already be using them.

Currently the plugin is lacking features for working with factories and I can't think of workarounds to offer. There's a couple of features in the roadmap that may help. Maybe https://github.com/OpenZeppelin/openzeppelin-upgrades/issues/175.