# 5.0 TransparentUpgradeableProxy upgradeAndCall error

**URL:** <https://forum.openzeppelin.com/t/5-0-transparentupgradeableproxy-upgradeandcall-error/41540>\
**Category:** Upgrades\
**Tags:** erc20\
**Created:** [September 3, 2024, 8:04am UTC](https://forum.openzeppelin.com/t/5-0-transparentupgradeableproxy-upgradeandcall-error/41540 "2024-09-03T08:04:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hubeixuegao](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/hubeixuegao/32/21639_2.png) [@hubeixuegao](https://forum.openzeppelin.com/u/hubeixuegao)\
**Post date:** [September 3, 2024, 8:04am UTC](https://forum.openzeppelin.com/t/5-0-transparentupgradeableproxy-upgradeandcall-error/41540/1 "2024-09-03T08:04:15Z")

</div>

#### 🔢 Code to reproduce

I'm writing a Solidity deploy script using Foundry.

1. I'm executing the Deploy using this command

```auto
forge script script/Deployer.s.sol:DeployerScript --rpc-url http://127.0.0.1:8545 --private-key $env:PRIVATE_KEY --broadcast -vvvvv

```

github code: [fishcake-contracts/script/Deployer.s.sol at main · WarriorFromLongAgo/fishcake-contracts (github.com)](https://github.com/WarriorFromLongAgo/fishcake-contracts/blob/main/script/Deployer.s.sol)

1. Upgrade investorSalePool contract

```auto
forge script script/UpgradeInvestorSalePoolDeployer.s.sol:UpgradeInvestorSalePoolDeployer --rpc-url http://127.0.0.1:8545 --private-key $env:PRIVATE_KEY --broadcast -vvvv

```

github code: [fishcake-contracts/script/UpgradeInvestorSalePoolDeployer.s.sol at main · WarriorFromLongAgo/fishcake-contracts (github.com)](https://github.com/WarriorFromLongAgo/fishcake-contracts/blob/main/script/UpgradeInvestorSalePoolDeployer.s.sol)

3, deploy err log

```auto
== Logs ==
  New InvestorSalePool implementation deployed at: 0x0613c549d358fB743037bE6De52E4348AdA96Ad0
  proxyAdmin deployed at: 0x5094103dE460dF9BC1A0F2D69d6D6547cc97c050
  proxyAdmin owner deployed at: 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720
  deployerAddress deployed at: 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720
  run 1 msg.sender deployed at: 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720
Error:
script failed: <empty revert data>

```

4， deploy err stack

```auto
  [1458402] UpgradeInvestorSalePoolDeployer::run()
    ├─ [0] VM::envUint("PRIVATE_KEY") [staticcall]
    │ └─ ← [Return] <env var value>
    ├─ [0] VM::addr(<pk>) [staticcall]
    │ └─ ← [Return] 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720
    ├─ [0] VM::startBroadcast(<pk>)
    │ └─ ← [Return]
    ├─ [1394180] → new InvestorSalePool@0x0613c549d358fB743037bE6De52E4348AdA96Ad0
    │ ├─ emit Initialized(version: 18446744073709551615 [1.844e19])
    │ └─ ← [Return] 6821 bytes of code
    ├─ [0] console::log("New InvestorSalePool implementation deployed at:", InvestorSalePool: [0x0613c549d358fB743037bE6De52E4348AdA96Ad0]) [staticcall]
    │ └─ ← [Stop]
    ├─ [0] console::log("proxyAdmin deployed at:", 0x5094103dE460dF9BC1A0F2D69d6D6547cc97c050) [staticcall]
    │ └─ ← [Stop]
    ├─ [2298] 0x5094103dE460dF9BC1A0F2D69d6D6547cc97c050::owner() [staticcall]
    │ └─ ← [Return] 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720
    ├─ [0] console::log("proxyAdmin owner deployed at:", 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720) [staticcall]
    │ └─ ← [Stop]
    ├─ [0] console::log("deployerAddress deployed at:", 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720) [staticcall]
    │ └─ ← [Stop]
    ├─ [298] 0x5094103dE460dF9BC1A0F2D69d6D6547cc97c050::owner() [staticcall]
    │ └─ ← [Return] 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720
    ├─ [0] console::log("run 1 msg.sender deployed at:", 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720) [staticcall]
    │ └─ ← [Stop]
    ├─ [9510] 0x5094103dE460dF9BC1A0F2D69d6D6547cc97c050::upgradeAndCall(0x0D8694F47cDC22Bb8C6D2668a38d07a439F378F9, InvestorSalePool: [0x0613c549d358fB743037bE6De52E4348AdA96Ad0], 0xc4d66de8000000000000000000000000a0ee7a142d267c1f36714e4a8f75612f20a79720)
    │ ├─ [5568] 0x0D8694F47cDC22Bb8C6D2668a38d07a439F378F9::upgradeToAndCall(InvestorSalePool: [0x0613c549d358fB743037bE6De52E4348AdA96Ad0], 0xc4d66de8000000000000000000000000a0ee7a142d267c1f36714e4a8f75612f20a79720)
    │ │ ├─ [696] 0xA922C3227149D9bc5001D796aA418b590D0C4a7B::upgradeToAndCall(InvestorSalePool: [0x0613c549d358fB743037bE6De52E4348AdA96Ad0], 0xc4d66de8000000000000000000000000a0ee7a142d267c1f36714e4a8f75612f20a79720) [delegatecall]
    │ │ │ └─ ← [Revert] EvmError: Revert
    │ │ └─ ← [Revert] EvmError: Revert
    │ └─ ← [Revert] EvmError: Revert
    └─ ← [Revert] EvmError: Revert

```

#### 💻 Environment

I'm writing a Solidity deploy script using Foundry.

---

<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:** [September 3, 2024, 5:53pm UTC](https://forum.openzeppelin.com/t/5-0-transparentupgradeableproxy-upgradeandcall-error/41540/2 "2024-09-03T17:53:03Z")

</div>

When creating the TransparentUpgradeableProxy, the second parameter of the constructor that you are calling [here](https://github.com/WarriorFromLongAgo/fishcake-contracts/blob/main/script/Deployer.s.sol#L46) should be the `initialOwner` that you want to use (e.g. `deployerAddress` in your example), not the proxy admin address.

With OpenZeppelin Contracts 5.0, the TransparentUpgradeableProxy deploys its own ProxyAdmin using that `initialOwner` as the owner of the ProxyAdmin -- don't pre-deploy your own ProxyAdmin first.

Also, you may want to check out the [Foundry Upgrades](https://docs.openzeppelin.com/upgrades-plugins/1.x/foundry-upgrades) plugin to help with upgradeable deployments.

---

<div class="post-metadata">

**Author:** ![hubeixuegao](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/hubeixuegao/32/21639_2.png) [@hubeixuegao](https://forum.openzeppelin.com/u/hubeixuegao)\
**Post date:** [September 8, 2024, 10:00am UTC](https://forum.openzeppelin.com/t/5-0-transparentupgradeableproxy-upgradeandcall-error/41540/3 "2024-09-08T10:00:45Z")

</div>

Thanks!!!

Thank you for your response! After several attempts, Upgrades resolved the deployment and upgrade issues.

* * *

Resolution Guide:

README.md (executing command)

```auto
https://github.com/WarriorFromLongAgo/fishcake-contracts/blob/main/README.md

```

use upgrades Deployer

```auto
https://github.com/WarriorFromLongAgo/fishcake-contracts/blob/main/script/DeployerV2.s.sol

```

use upgrades Upgrade

```auto
https://github.com/WarriorFromLongAgo/fishcake-contracts/blob/main/script/UpgradeInvestorSalePoolDeployerV2.s.sol

```
