Skip to content

Unable to get Deterministic Address for Factory Contract Across Networks using deployProxy method #1142

Open
@saholo21

Description

@saholo21

Trying to deploy a factory contract using hardhat and openzeppelin defenders to have the same address across different networks when using the same salt.

The issue arises because the factory is deployed using deployProxy function, creating a TransparentUpgradeableProxy, which does not result in a deterministic address across networks. This causes inconsistencies in the deployment addresses.

Attempts Made

  • Deploying the factory as a UUPS proxy instead of a TransparentUpgradeableProxy, but this resulted in an error because the contract does not inherit from UUPSUpgradeable.
  • Deploying the factory using deployContract, but this assumes the contract is non-upgradeable, which is not the case and throws an error.
  • Deploying the factory using deployProxy, which always results in a TransparentUpgradeableProxy, leading to non-deterministic addresses across networks.

Constraints

  • I cannot modify the contract code.
  • I can modify the deployment script.

Expected Behavior

The factory contract should have the same address across different networks when using the same salt.

Actual Behavior

The factory contract address changes across different networks due to the TransparentUpgradeableProxy deployment process.

Steps to Reproduce

  1. Deploy the factory contract using deployProxy on different networks using the same salt.
  2. Observe that the resulting address for the TransparentUpgradeableProxy is different on each network.

Possible Solutions / Help Needed

  • Is there a way to deploy the factory deterministically while still keeping it upgradeable?
  • Can deployProxy be configured to produce deterministic addresses across networks? If that's something that is possible now, am I missing some configuration?
  • Is there another deployment method that ensures both upgradeability and deterministic addresses?

Any insights or suggestions would be appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions