# deployProxy does not deploy a ProxyAdmin

**URL:** <https://forum.openzeppelin.com/t/deployproxy-does-not-deploy-a-proxyadmin/39429>\
**Category:** Upgrades\
**Created:** [February 1, 2024, 7:35pm UTC](https://forum.openzeppelin.com/t/deployproxy-does-not-deploy-a-proxyadmin/39429 "2024-02-01T19:35:15Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamgauravpant](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/iamgauravpant/32/17639_2.png) [@iamgauravpant](https://forum.openzeppelin.com/u/iamgauravpant)\
**Post date:** [February 1, 2024, 7:35pm UTC](https://forum.openzeppelin.com/t/deployproxy-does-not-deploy-a-proxyadmin/39429/1 "2024-02-01T19:35:15Z")

</div>

Hey @ericglau , I am trying to implement TransparentUpgradeableProxy ( Openzeppelin v5 ) . I am following Patrick's video tutorial , in that tutorial , when he deployed using the deployProxy() method , 3 contracts got deployed ( i.e. Implementation , Proxy and Proxy Admin ) , but when I am trying to deploy using the same method , only 2 contracts got deployed . What am I doing wrong ?  
This is the file that is getting generated when I call my deploy script .

 ![image](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/3X/c/8/c81ab2a15add050e97d5727c0b7972c18c65f00c.png)

This is my script file code

 ![image](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/3X/1/f/1f6b8a31698875a4d7271ec3c6af17b169280a45.png)

---

<div class="post-metadata">

**Author:** ![ericglau](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ericglau/32/15149_2.png) [@ericglau](https://forum.openzeppelin.com/u/ericglau)\
**Post date:** [February 1, 2024, 8:12pm UTC](https://forum.openzeppelin.com/t/deployproxy-does-not-deploy-a-proxyadmin/39429/2 "2024-02-01T20:12:48Z")

</div>

@iamgauravpant Can you please provide the following information:

- What network did you deploy to and what are the addresses (please paste the addresses in text format)
- The output of the following commands:

```auto
npm list @openzeppelin/hardhat-upgrades

```

```auto
npm list @openzeppelin/upgrades-core

```

---

<div class="post-metadata">

**Author:** ![iamgauravpant](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/iamgauravpant/32/17639_2.png) [@iamgauravpant](https://forum.openzeppelin.com/u/iamgauravpant)\
**Post date:** [February 1, 2024, 8:46pm UTC](https://forum.openzeppelin.com/t/deployproxy-does-not-deploy-a-proxyadmin/39429/3 "2024-02-01T20:46:35Z")

</div>

> [@ericglau](#):
>
> - What network did you deploy to and what are the addresses (please paste the addresses in text format)

I deployed on PolygonMumbai .  
check these 2 transactions , when I ran deploy.js file , these 2 contracts got created . In Patrick's video , I also saw that the 2 of the deployed contracts was automatically named TransparentUpgradeableProxy and ProxyAdmin , but in my case I didn't see anything like that .

I guess this is my implementation contract ( this is an NFT contract ) : [https://mumbai.polygonscan.com/address/0x72d07c09c04bd4e83e5ced90cfebd46d36effd03](https://mumbai.polygonscan.com/address/0x72d07c09c04bd4e83e5ced90cfebd46d36effd03)

And I guess this is the proxy contract : [https://mumbai.polygonscan.com/address/0x902780f29c21a8ec2f852122ebb6884d107f2085](https://mumbai.polygonscan.com/address/0x902780f29c21a8ec2f852122ebb6884d107f2085)

> [@ericglau](#):
>
> The output of the following commands:

check this image attached .

 ![image](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/3X/4/d/4d868b3a6c993a000fd405fe38d2790ccc073d3b.png)

---

<div class="post-metadata">

**Author:** ![iamgauravpant](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/iamgauravpant/32/17639_2.png) [@iamgauravpant](https://forum.openzeppelin.com/u/iamgauravpant)\
**Post date:** [February 1, 2024, 8:52pm UTC](https://forum.openzeppelin.com/t/deployproxy-does-not-deploy-a-proxyadmin/39429/4 "2024-02-01T20:52:14Z")

</div>

> [@iamgauravpant](#):
>
> [https://mumbai.polygonscan.com/address/0x902780f29c21a8ec2f852122ebb6884d107f2085](https://mumbai.polygonscan.com/address/0x902780f29c21a8ec2f852122ebb6884d107f2085)

and if [https://mumbai.polygonscan.com/address/0x902780f29c21a8ec2f852122ebb6884d107f2085](https://mumbai.polygonscan.com/address/0x902780f29c21a8ec2f852122ebb6884d107f2085) is the proxy address , I am not able to call any of the implementation's functions using it (functions like nft contract's name , safeMint etc. ) . What may be wrong there ? How can I confirm 0x902780f29c21a8ec2f852122ebb6884d107f2085 is indeed my proxy address ?

---

<div class="post-metadata">

**Author:** ![ericglau](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ericglau/32/15149_2.png) [@ericglau](https://forum.openzeppelin.com/u/ericglau)\
**Post date:** [February 1, 2024, 10:04pm UTC](https://forum.openzeppelin.com/t/deployproxy-does-not-deploy-a-proxyadmin/39429/5 "2024-02-01T22:04:12Z")

</div>

In the latest versions of Hardhat Upgrades, which you are using, it is deploying proxy contracts from OpenZeppelin Contracts 5.0.

In OpenZeppelin Contracts 5.0, TransparentUpgradeableProxy [deploys its own ProxyAdmin in its constructor](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/proxy/transparent/TransparentUpgradeableProxy.sol#L78). Therefore, we no longer track the ProxyAdmin in the network file because each transparent proxy has its own admin.

[https://mumbai.polygonscan.com/address/0x72d07c09c04bd4e83e5ced90cfebd46d36effd03](https://mumbai.polygonscan.com/address/0x72d07c09c04bd4e83e5ced90cfebd46d36effd03) is your proxy contract.  
[https://mumbai.polygonscan.com/address/0x902780f29c21a8ec2f852122ebb6884d107f2085](https://mumbai.polygonscan.com/address/0x902780f29c21a8ec2f852122ebb6884d107f2085) is your implementation contract.

You can see from the [logs of the transaction](https://mumbai.polygonscan.com/tx/0xe41ad869d5d23942aa89b588f97e89963ca095693345119fdb76c9527b8c5d20#eventlog) which created your proxy contract, it has an `AdminChanged` event where the `newAdmin` is [https://mumbai.polygonscan.com/address/0x8FD657aDD9F3D882d4216Ff875b7a395a333e3d1](https://mumbai.polygonscan.com/address/0x8FD657aDD9F3D882d4216Ff875b7a395a333e3d1) -- that is your ProxyAdmin contract (which was deployed by the TransparentUpgradeableProxy).

When calling your implementation's functions, you should submit the function calls to your proxy address, not your implementation address. To help with this, you may want to verify your source code -- see the [`verify` task](https://docs.openzeppelin.com/upgrades-plugins/1.x/api-hardhat-upgrades#verify). Then from the block explorer, you will be able to interact with your contract from the proxy address using your implementation contract's ABI.

---

<div class="post-metadata">

**Author:** ![iamgauravpant](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/iamgauravpant/32/17639_2.png) [@iamgauravpant](https://forum.openzeppelin.com/u/iamgauravpant)\
**Post date:** [February 2, 2024, 6:45am UTC](https://forum.openzeppelin.com/t/deployproxy-does-not-deploy-a-proxyadmin/39429/6 "2024-02-02T06:45:46Z")

</div>

@ericglau thank you very much .  
I'm having issues in upgradeProxy() method now .  
Below is the code for upfrading proxy implementation that I wrote .

 ![image](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/3X/e/5/e5b275dd105f207a34c5ec6339fe17e4659f710f.png)

When I run this , Proxy's implementation is getting upgraded , but I don't know if there are limitations to what can be upgraded ?  
I started with a basic ERC721Upgradeable contract that we get from Openzeppelin wizard , called it NonFungibleTokenV1 ( name is NonFungibleTokenV1 , symbol is NFTV1 , and safeMint() function can only be called by owner of the NonFungibleTokenV1 contract that is passed in initializer function as parameter ) .  
Then , I modified this NFT contract , called it NonFungibleTokenV2 ( name is NonFungibleTokenV2 , symbol is NFTV2 , and safeMint() function can now be called by any address i.e. I've removed the onlyOwner modifier from safeMint() ) . What I see now is the contract name is still returning NonFungibleTokenV1 but safeMint() is upgraded as expected i.e. anyone can call safeMint() now . Why didn't the contract name get updated to NonFungibleTokenV2 but safeMint() got updated as expected ?

0xCD2967764cF838c7F57967815Dd5a4b0650E82f9 [NFT Proxy Address]  
0xaE654496322D1264bfa2F437cA6c8923699a8D26 [ProxyAdmin Address]

---

<div class="post-metadata">

**Author:** ![ericglau](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ericglau/32/15149_2.png) [@ericglau](https://forum.openzeppelin.com/u/ericglau)\
**Post date:** [February 2, 2024, 3:00pm UTC](https://forum.openzeppelin.com/t/deployproxy-does-not-deploy-a-proxyadmin/39429/7 "2024-02-02T15:00:32Z")

</div>

To call a function during upgrade, it should be like this (note the `call:` part)

```auto
  await upgrades.upgradeProxy(proxyAddress, MyImplementationV2, {
    call: { fn: 'myFunction', args: ['my function args] },
  });

```

The way you wrote caused it to upgrade without calling any function.

However, you **cannot** call your initializer again if it is using the `initializable` modifier, since it was already initialized in the first version. You can consider using a `reinitializer(version)` modifier instead. See [https://docs.openzeppelin.com/contracts/5.x/api/proxy#Initializable](https://docs.openzeppelin.com/contracts/5.x/api/proxy#Initializable)

---

<div class="post-metadata">

**Author:** ![iamgauravpant](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/iamgauravpant/32/17639_2.png) [@iamgauravpant](https://forum.openzeppelin.com/u/iamgauravpant)\
**Post date:** [February 3, 2024, 7:34am UTC](https://forum.openzeppelin.com/t/deployproxy-does-not-deploy-a-proxyadmin/39429/8 "2024-02-03T07:34:28Z")

</div>

@ericglau I am upgrading proxy's implementation in a different way than it is shown in the article that you've referred here .  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/3X/5/7/57b4958271ac80937ffc903f06efa992c95eb2f3.png)  
Here MyTokenV2 extends MyToken .  
In my case NonFungibleTokenV2 is a completely new contract ( it does not extend NonFungibleTokenV1 like the way MyTokenV2 does in the article ) .

Below is NonFungibleTokenV1 :

 ![image](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/3X/f/2/f25055cbb136d43e06b4306e32ce908aaa0a7348.png)

Below is NonFungibleTokenV2 :

 ![image](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/3X/d/d/dd1a3e452df8febfe1ca16a2d71794908410467c.png)

the way I've written v2 of implementation contract is okay or do I need to modify NonFungibleTokenV2 like MyTokenV2 ?  
what may go wrong in my implementation ?  
Is the article way recommend way to write different versions for implementation contracts using transparent upgradeable proxy ?

I am having one problem currently , I started with deploying a proxy for NonFungibleTokenV1 , then upgraded proxy's implementation to NonFungibleTokenV2 . But in polygon mumbai explorer it is still showing proxy contract's name as NonFungibleTokenV1 and contract's symbol as NFTV1 . It should rather show name as NonFungibleTokenV2 and symbol as NFTV2 .

Proxy: [https://mumbai.polygonscan.com/address/0x4424F5dEB3FD3774dD9114c557e05d72AC2e4F28](https://mumbai.polygonscan.com/address/0x4424F5dEB3FD3774dD9114c557e05d72AC2e4F28)

ProxyAdmin :

> **[ProxyAdmin | Address 0x9e2f91f412c9e418c8eD3bC7e24f3D55c8e010c8 | PolygonScan](https://mumbai.polygonscan.com/address/0x9e2f91f412c9e418c8eD3bC7e24f3D55c8e010c8)**
>
> The Contract Address 0x9e2f91f412c9e418c8eD3bC7e24f3D55c8e010c8 page allows users to view the source code, transactions, balances, and analytics for the contract address. Users can also interact and make transactions to the contract directly on...

---

<div class="post-metadata">

**Author:** ![ericglau](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ericglau/32/15149_2.png) [@ericglau](https://forum.openzeppelin.com/u/ericglau)\
**Post date:** [February 5, 2024, 2:57pm UTC](https://forum.openzeppelin.com/t/deployproxy-does-not-deploy-a-proxyadmin/39429/9 "2024-02-05T14:57:03Z")

</div>

Note that your `initialize` function in V2 is not protected so anyone can call it. That means you need to call it during upgrade, in the same transaction. Otherwise someone can overtake your proxy if they frontrun you in calling it.

From your contract, it doesn't look like it was upgraded though.

---

<div class="post-metadata">

**Author:** ![ericglau](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ericglau/32/15149_2.png) [@ericglau](https://forum.openzeppelin.com/u/ericglau)\
**Post date:** [August 21, 2024, 2:41pm UTC](https://forum.openzeppelin.com/t/deployproxy-does-not-deploy-a-proxyadmin/39429/10 "2024-08-21T14:41:54Z")

</div>

A post was split to a new topic: [Revert occurs when upgrading transparent proxy from Foundry](https://forum.openzeppelin.com/t/revert-occurs-when-upgrading-transparent-proxy-from-foundry/41409)
