How to upgrade a contract deployed from a factory contract?

Hi, I have a factory contract from which I can create another product contract. It uses App.sol so that the product contract can also be upgradeable later following this:
The process is:

  1. I deployed the Factory contract using Oz cli: oz deploy-> upgradeable
  2. I then created an instance of the Product contract from inside Factory through : oz send-tx and can interact with it programmatically with a js script.
  3. Now, if I make some changes in the Product contract, and run "oz-upgrade" to upgrade the Factory contract, will my Product contract be upgraded too? (coz that is what I want to do, right?)
    I tried to do this and sadly, I was unable to do so..

Or do I have to upgrade the product contract programmatically separately?
If so... then can you provide me with an example of how I can do that?
I've checked this one :,interaction%2C%20and%20source%20code%20verification.
But still, I wasn't clear as to how or if i can follow the same pattern for my Product contract that's already been deployed using Factory contract...

And btw, how's this solution conducted in steps?

How can the network.json be modified as per this?

1 Like

Hi @asmeedhungana,

We can use a factory to deploy upgradeable contracts. We can also make the factory upgradeable, though upgrading the factory only changes the factory and not any of the already created contracts by the factory.

To upgrade contracts deployed by the factory, the admin of each contract would need to upgrade the contract, we could do this programmatically. As the contracts weren’t deployed using the CLI we wouldn’t be able to use the CLI for this. I wouldn’t recommend trying to manually modify the CLI config to be able to upgrade using the CLI.

I suggest not using App.sol: When should I use App.sol in my project?

1 Like

Can you tell me what I'll need to use if I don't use App.sol in my project to create upgradeable product instances from the upgradeable factory contract?

And can I get a pre-implemented example for what you're suggesting please? or anywhere I can look for them...
I am just lost... I've checked so many places but haven't been able to figure our what to do exactly...

1 Like

And can you tell me how I can do this if I don't use App.sol?

Is there a pre-implemented example for ProxyFactory that you can provide me with, please?

1 Like

Hi @asmeedhungana,

I had a quick look and don’t appear to have an example unfortunately.

If you have a factory deploying using App.sol I would use that for testing and I can see what I can find later in the week regards an example of deploying a proxy contract via a factory.

1 Like

Shall I provide my factory contract code? Is that what you mean?

1 Like

Hi @asmeedhungana,

I need to come back to you with an example later in the week.

1 Like

pragma solidity >=0.5.0;

import “@openzeppelin/upgrades/contracts/Initializable.sol”;
import “@openzeppelin/upgrades/contracts/application/App.sol”;
// import “@openzeppelin/upgrades/contracts/upgradeability/AdminUpgradeabilityProxy.sol”;

import ‘./Token.sol’;

contract TokenFactory is Initializable {

App private app;

event TokenCreated(address);

function initialize (App _app) public initializer {
    app = _app;

address[] public activeTokens;    //track list of campaigns running
mapping (address => address) public tokenManager;   // token addr to manager addr
mapping (address => address) myToken;    //tokenMgr to his token's address
address public admin;
mapping (string => bool) private tokenExists;

function createToken(string memory _name, string memory _symbol, uint256 _mintAmount) public {
    // address newToken = address(new Token(_name, _symbol, _mintAmount));
    require(!tokenExists[_name], "name already taken!!");

    admin = msg.sender;

    address newToken = address (

    tokenManager[newToken] = msg.sender;
    myToken[msg.sender] = newToken;
    tokenExists[_name] = true;
    emit TokenCreated(newToken);

function getActiveTokens() public view returns (address[] memory) {
    return activeTokens;

function getManager(address _token) public view returns (address) {
    return tokenManager[_token];

function getMyToken() public view returns (address) {
    return myToken[msg.sender];


Thank you as always… looking forward to getting it soon! :smiley: :heart:
What I want to do is to be able to upgrade the Token contracts that I create from the TokenFactory contract. I can interact with them via manual scripts but haven’t been able to find a way to upgrade them.

Hey @abcoathup!
I wanted to remind you that I’m waiting (i know you’re a busy man, so :smiley: )…
Were you able to make or find one example?

1 Like

Hi @asmeedhungana,

There isn’t a ready made example. I have started to create one but ran into an issue, so it will be next week before I get to look at it again unfortunately. (It is Friday afternoon in Melbourne).

1 Like

Ohh sure! You can do it accordingly!
And… have a happy weekend! :grinning:

1 Like

hey @abcoathup,
any progress in here ?

1 Like