Home

Awesome

Update: Head to Cyfrin Updraft

ℹ️ Important: This repo is no longer maintained; we invite all people learning Solidity to head to Cyfrin Updraft! The 100% free #1 smart contract education platform on earth. Developed with love by Patrick & Cyfrin <3

Hardhat MetaMorphic Upgrades

This is a section of the Javascript Blockchain/Smart Contract FreeCodeCamp Course. This is not a complete repo, but a way to show users how to interact with metamorphic contracts that use create2.

This repo has been updated to work with Goerli over Rinkeby

Full Repo

This project is apart of the Hardhat FreeCodeCamp video.

Video coming soon...

Getting Started

Requirements

Quickstart

git clone https://github.com/PatrickAlphaC/hardhat-metamorphic-upgrades-fcc
cd hardhat-metamorphic-upgrades-fcc
yarn

Typescript

COMING SOON...

<!-- For the typescript edition, run: ``` git checkout typescript ``` -->

Usage

Deploy:

yarn hardhat deploy

You should see an output similar to this:

----------------------------------------------------
Box address is: 0x5FbDB2315678afecb367f032d93F642f64180aa3
Proxy address is: 0xa7D9Bf84f60248DfBb0ab5512e1eAbBf12c9a4b2
Value is: 77
Version is: 1
----------------------------------------------------
----------------------------------------------------
Box address is: 0x0165878A594ca255338adfa4d48449f69242Eb8F
Proxy address is: 0xa7D9Bf84f60248DfBb0ab5512e1eAbBf12c9a4b2
Value is: 1
Version is: 2
----------------------------------------------------

The important thing to note, is that the Proxy address stayed the same, while the Box address changed. By deleting our proxy contract, we destroyed storage, and started over with our BoxV2 contract, but kept the same address!

You'll want to check for function and storage clashes when working with something like this!

Linting

To check linting / code formatting:

yarn lint

or, to fix:

yarn lint:fix

Formatting

yarn format

Resources

Thank you!

If you appreciated this, feel free to follow me or donate!

ETH/Polygon/Avalanche/etc Address: 0x9680201d9c93d65a3603d2088d125e955c73BD65

Patrick Collins Twitter Patrick Collins YouTube Patrick Collins Linkedin Patrick Collins Medium