laurentknauss / transparent_proxy_pattern

Implementation of the transparent proxy pattern engineered by Openzeppelin in the context of a smart contract upgrade.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sample Hardhat Project

This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract
and a script that deploys that contract to the goelir network.

Try running some of the following tasks:

npx hardhat test

Deploy the contract to the testnet of your choice by changing the values in hardhat.config.js (in our example below we deploy to goerli) :

yarn hardhat run scripts/deploy.js --network goerli 

The first implementation contract to be deployed on goerli is the Box.sol contract The second implementation to be deployed on goerli is the ProxyAdmin contract The third implementation to be deployed on goerli is the TransparentProxy contract

Those 2 last contracts are verified on goerli.etherscan.io but not the first one.

Once done, go to your cli and enter the hardhat console by typing:

npx hardhat console --network goerli 


Once in the hardhat console, type:

const Box  = await ethers.getContractFactory("Box")<br>
const box  = await Box.attach("....address of the deployed TransparentProxy contract on goerli.....")<br>
(await box.retrieve()).toString()

The result should indicate : '42'

About

Implementation of the transparent proxy pattern engineered by Openzeppelin in the context of a smart contract upgrade.

License:MIT License


Languages

Language:JavaScript 73.2%Language:Solidity 25.2%Language:Shell 1.5%