How to deploy new instances using beacon proxy from a factory when using @openzeppelin/hardhat-upgrades

Hi @gate3,

The deployBeacon function deploys up to 2 contracts: an implementation (if it has not already been deployed) and a beacon.

The deployBeaconProxy function does not deploy the implementation or beacon. It only deploys 1 contract: a beacon proxy which points to an existing beacon.

If you are trying to deploy new beacon proxies using a factory, then you would be using your factory instead of deployBeaconProxy. In your example, your immutable beacon variable should not be a BeaconProxy, but it should be an UpgradeableBeacon (which can be the beacon address that was deployed by deployBeacon).

See this post for another example of a beacon proxy factory.

1 Like