ℹ️ 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
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
This project is apart of the Hardhat FreeCodeCamp video.
Video coming soon...
- git
- You'll know you did it right if you can run
git --version
and you see a response likegit version x.x.x
- You'll know you did it right if you can run
- Nodejs
- You'll know you've installed nodejs right if you can run:
node --version
and get an ouput like:vx.x.x
- You'll know you've installed nodejs right if you can run:
- 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
- You'll know you've installed yarn right if you can run:
git clone https://github.com/PatrickAlphaC/hardhat-metamorphic-upgrades-fcc
cd hardhat-metamorphic-upgrades-fcc
yarn
COMING SOON...
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!
To check linting / code formatting:
yarn lint
or, to fix:
yarn lint:fix
yarn format
- MetaMorphic Contracts
- How do I read the implementation address of a proxy?
- Create2 Video
- Function Selector
- Understanding storage collisions in upgrades
If you appreciated this, feel free to follow me or donate!
ETH/Polygon/Avalanche/etc Address: 0x9680201d9c93d65a3603d2088d125e955c73BD65