Can We Control The Address Where the Proxy for an Upgradeable Contract is Deployed?


If I have two contracts 'A' and 'B'. Is there a way that I can ensure that the address of the deployed proxy for 'A' is less than the address of the deployed proxy for 'B'? I should clarify that those are upgradeable contracts deployed using the deployProxy() method.

Thanks in advance.

Maybe you can have a look at this: Create2.sol | openzeppelin-contracts, you can use it to compute in advance the contract address.

1 Like

Thanks @Skyge I am using the deployProxy method to deploy the upgradeable contracts. Can Create2 be used with that? I am not sure how to make use of Create2 when it comes to deploying upgradeable contracts.

I am not sure what your target is, if you want to get a special address, such as 0x1234xxx, you can use Creat2, if you want to know the contract address that will be deployed by a deployer account, you can calculate it, it depends on deployer account address and nonce.
And maybe you can have a check for this question:
How is the address of an Ethereum contract computed? - Ethereum Stack Exchange

Create2 currently can't be used with deployProxy. You can use deployImplementation and then use that with a custom proxy factory contract that uses Create2.