Deploy ProxyFactory with Buidler

Hi @abcoathup ,

Thanks for the sample example code (How to deploy minimal proxies using ProxyFactory in Truffle?), I was trying it on Buidler/waffle development platform.
I was getting some error message, and this message “ProxyFactory.sol:12: Contract ProxyFactory has a constructor” in stack trace is surprising me.

Am I making any error w.r.to compiler version or npm package dependency conflicit.

Code Repo

Complete Trace Log

 ✘ kanthasiva@tufmac1  ~/dscbox/sun/ws-020-blocks/ws-002-chainlink/sp007-ref-buid-gem/cl-chg-2020-agem   master  yarn run test
yarn run v1.22.4
$ yarn run test:contracts
$ cross-env SOLPP_FLAGS="FLAG_IS_TEST,FLAG_IS_DEBUG" buidler test --show-stack-traces
Compiling...


@openzeppelin/upgrades/contracts/upgradeability/ProxyFactory.sol:87:15: Warning: The "create2" instruction is only available for Constantinople-compatible VMs. You are currently compiling for "byzantium", where it will be interpreted as an invalid instruction.
      addr := create2(0, add(code, 0x20), mload(code), salt)
              ^--------------------------------------------^

Compiled 17 contracts successfully


  Token Test
    1) "before all" hook for "1st Test"


  0 passing (191ms)
  1 failing

  1) Token Test
       "before all" hook for "1st Test":
     Error: Contract `SimpleTokenFactory` is not upgrade safe

@openzeppelin/upgrades/contracts/upgradeability/ProxyFactory.sol:12: Contract `ProxyFactory` has a constructor
    Define an initializer instead
    https://zpl.in/upgrades/error-001
      at Object.assertUpgradeSafe (node_modules/@openzeppelin/upgrades-core/src/validate.ts:160:11)
      at Proxy.deployProxy (node_modules/@openzeppelin/buidler-upgrades/src/deploy-proxy.ts:33:5)

package.json config

tsconfig.json config

Thanks

1 Like

Hi,

I found topic is marked “This topic has solution”, any pointers to solution :slight_smile:

Thanks,

1 Like

Hi @shamb0,

Welcome to the community :wave:

ProxyFactory has a constructor so you can’t deploy as an upgradeable contract.

Taking a step back, what are you trying to create?

Hi @shamb0,

The example I created is to be deployed as a regular contract as ProxyFactory has a constructor. Which is why it doesn’t work when deployed as an upgradeable contract.

Hi @abcoathup, Thanks, Happy to be part of openzeppelin community :slight_smile:

I am Playing on Chainlink Hackathon

I hope you may aware Chainlink oracle network,
needs LINK token to access the service.

So explored the possibility of, split application logic as two part ( static proxy & up-gradable chainlink service logic contract ).

So that deploy static proxy once on Kovan testnet and transfer Link tokens to the proxy.

And update the proxy with upgraded logic part. and execute the logic under the context of proxy.

So Link Tokens are always binded to Proxy layer. and logic part is decoupled from Link token dependency.

May be I need little bit more study on understating the usage part of “ProxyFactory”. Will get back soon with clarity …

1 Like

Hi @shamb0,

Good luck with the Chainlink Hackathon. It looks like you have a week left.

From your description, you want the upgradeable contract to hold the $LINK tokens that you need to use ChainLink with the ability to upgrade the logic in the implementation contract.

I suggest that you look at OpenZeppelin Upgrades Plugins which are available for Truffle and Buidler (https://docs.openzeppelin.com/upgrades-plugins/1.x/). I also wrote some guides on using them: OpenZeppelin Truffle Upgrades and OpenZeppelin Buidler Upgrades

Feel free to ask all the questions that you need.

Hi @abcoathup, Thanks a lot. As a blockchain beginner, find it happy to see your inviting message for questions. Soon will get back with sample repo of my issue …

1 Like