Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Latest commit

 

History

History
126 lines (88 loc) · 4.34 KB

File metadata and controls

126 lines (88 loc) · 4.34 KB

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

  • git
    • You'll know you did it right if you can run git --version and you see a response like git version x.x.x
  • Nodejs
    • You'll know you've installed nodejs right if you can run:
      • node --version and get an ouput like: vx.x.x
  • Yarn instead of npm
    • You'll know you've installed yarn right if you can run:
      • yarn --version and get an output like: x.x.x
      • You might need to install it with npm

Quickstart

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

Typescript

COMING SOON...

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