# Testing Proxies with Hardhat

**URL:** <https://forum.openzeppelin.com/t/testing-proxies-with-hardhat/24016>\
**Category:** Upgrades\
**Tags:** proxies, solidity, hardhat\
**Created:** [February 4, 2022, 12:00pm UTC](https://forum.openzeppelin.com/t/testing-proxies-with-hardhat/24016 "2022-02-04T12:00:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![0fatih](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/0fatih/32/8407_2.png) [@0fatih](https://forum.openzeppelin.com/u/0fatih)\
**Post date:** [February 4, 2022, 12:00pm UTC](https://forum.openzeppelin.com/t/testing-proxies-with-hardhat/24016/1 "2022-02-04T12:00:39Z")

</div>

Hi, I have a smart contract that was inherited from UUPSUpgradeable smart contract. I am deploying it first as `v1` and then deploying my proxy contract. Here is my proxy contract:

```auto
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;

import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract Proxy is UUPSUpgradeable, Ownable {

    constructor(address _impl) {
        _upgradeTo(_impl);
    }
    
    function _authorizeUpgrade(address) internal override onlyOwner {}
}

```

I am giving the `v1.address` as constructor parameter to the proxy. Am I doing the right thing? If I am, how can I send tx to proxy to delegate? I am using hardhat for testing, as you can see in the title.

---

<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 4, 2022, 2:55pm UTC](https://forum.openzeppelin.com/t/testing-proxies-with-hardhat/24016/2 "2022-02-04T14:55:18Z")

</div>

Hi @0fatih, keep in mind the differences between a proxy contract and an implementation contract -- generally you only need to write your implementation contract and that is the contract that should inherit `UUPSUpgradable`. You can use [https://wizard.openzeppelin.com/](https://wizard.openzeppelin.com/) and select UUPS to see an example. The proxy contract ([ERC1967Proxy](https://docs.openzeppelin.com/contracts/4.x/api/proxy#ERC1967Proxy) for UUPS) can just be deployed directly.

To simplify the above, you can use [OpenZeppelin Upgrades Plugins](https://docs.openzeppelin.com/upgrades-plugins/1.x/) to help deploy both the implementation and proxy contracts (which also verifies that your implementation contract is upgrade safe).

---

<div class="post-metadata">

**Author:** ![0fatih](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/0fatih/32/8407_2.png) [@0fatih](https://forum.openzeppelin.com/u/0fatih)\
**Post date:** [February 5, 2022, 9:08am UTC](https://forum.openzeppelin.com/t/testing-proxies-with-hardhat/24016/3 "2022-02-05T09:08:06Z")

</div>

Thanks for replying @ericglau! Can you share with me an example Proxy contract?

---

<div class="post-metadata">

**Author:** ![0fatih](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/0fatih/32/8407_2.png) [@0fatih](https://forum.openzeppelin.com/u/0fatih)\
**Post date:** [February 5, 2022, 9:14am UTC](https://forum.openzeppelin.com/t/testing-proxies-with-hardhat/24016/4 "2022-02-05T09:14:38Z")

</div>

@ericglau I used OZ Upgrades Plugin and I saw what does looks like. Thank you very much!
