# Usage of UUPS

**URL:** <https://forum.openzeppelin.com/t/usage-of-uups/23304>\
**Category:** Contracts\
**Created:** [January 24, 2022, 1:36pm UTC](https://forum.openzeppelin.com/t/usage-of-uups/23304 "2022-01-24T13:36:24Z")\
**Posts on this page:** 5\
**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:** [January 24, 2022, 1:36pm UTC](https://forum.openzeppelin.com/t/usage-of-uups/23304/1 "2022-01-24T13:36:24Z")

</div>

I can't understand how to implement UUPS proxies. Should I create another proxy contract for this contract:

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

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

contract MyTokenV1 is Initializable, ERC20Upgradeable, UUPSUpgradeable, OwnableUpgradeable {
    function initialize() initializer public {
      __ERC20_init("MyToken", "MTK");
      __Ownable_init();
      __UUPSUpgradeable_init();

      _mint(msg.sender, 1000 * 10 ** decimals());
    }

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() initializer {}

    function _authorizeUpgrade(address) internal override onlyOwner {}
}

```

Or is this enough? If it is, how can I upgrade this contract?

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [January 24, 2022, 2:40pm UTC](https://forum.openzeppelin.com/t/usage-of-uups/23304/2 "2022-01-24T14:40:43Z")

</div>

Hi, I think you can have a look at this tutorial:

> [@UUPS Proxies: Tutorial (Solidity + JavaScript)](https://forum.openzeppelin.com/t/uups-proxies-tutorial-solidity-javascript/7786):
>
> UUPS Proxies: A Tutorial In this tutorial we will deploy an upgradeable contract using the UUPS proxy pattern. We assume some familiarity with Ethereum upgradeable proxies. Introduction to UUPS The original proxies included in OpenZeppelin followed the [Transparent Proxy Pattern](https://blog.openzeppelin.com/the-transparent-proxy-pattern/). While this pattern is still provided, our recommendation is now shifting towards UUPS proxies, which are both lightweight and versatile. The name UUPS comes from [EIP1822](https://eips.ethereum.org/EIPS/eip-1822), which first documented the pattern. While both …

---

<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:** [January 25, 2022, 12:21pm UTC](https://forum.openzeppelin.com/t/usage-of-uups/23304/3 "2022-01-25T12:21:21Z")

</div>

Thank you @Skyge! I read it. I got the basics things. But I don't understand this: Let's say we upgraded our contract. Then what happens to the balances in v1? Do I need a Proxy contract and my state (in this case, balances) in that Proxy contract or something else? I can't get it

---

<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 3, 2022, 2:22pm UTC](https://forum.openzeppelin.com/t/usage-of-uups/23304/4 "2022-02-03T14:22:31Z")

</div>

still I need an answer for this question.

---

<div class="post-metadata">

**Author:** ![Amxx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/amxx/32/668_2.png) [@Amxx](https://forum.openzeppelin.com/u/Amxx)\
**Post date:** [February 4, 2022, 9:53am UTC](https://forum.openzeppelin.com/t/usage-of-uups/23304/5 "2022-02-04T09:53:50Z")

</div>

Hello @0fatih

UUPS, just like all upgradeable proxy pattern rely on two things:

- A proxy
- An implementation

The code you shared corresponds to the code for an implementation with UUPS support. This means that you'll need a UUPS proxy pointing to that implementation.

The proxy is what users will interact with, and where all the state is stored. The implementation is just here to tell the proxy how to behave.

If you ever do an upgrade, you'll need to create a new implementation (that codes for a new behavior) and tell the proxy to use that instead. There is no new proxy. You keep the same proxy, at the same address, with the same data in storage. You just "upgrade" its implementation.
