Skip to content

jthoms/hardhat-openzeppelin-ts

Repository files navigation

hardhat-openzeppelin-ts

My first steps with

Based on:

Node via nvm

https://github.com/nvm-sh/nvm

Quick start

git clone https://github.com/jthoms/hardhat-openzeppelin-ts.git
cd hardhat-openzeppelin-ts
npm install
# list hardhat tasks:
npx hardhat

Clean, compile and test:

npx hardhat clean
npx hardhat compile
npx hardhat test

npx hardhat coverage

Local test deployment and upgrade

npx hardhat node

On a new terminal, go to the repository's root folder and run this to deploy your contract:

npx hardhat run --network localhost scripts/create-mytoken.ts

Edit scripts/upgrade-mytoken.ts, replace MYTOKEN_ADDRESS_FROM_create-mytoken with deployed address from above

npx hardhat run --network localhost scripts/upgrade-mytoken.ts

Rinkeby Testnet, Etherscan

Get ether on Rinkeby: https://faucet.rinkeby.io/

Create free accounts on: https://infura.io https://etherscan.io

Create .env (listed in .gitignore) supplying the following values:

RINKEBY_PRIVATE_KEY=
INFURA_API_KEY=
ETHERSCAN_API_KEY=
npx hardhat run --network rinkeby scripts/create-mytoken.ts

To verify via etherscan, use the address from the .openzeppelin/rinkeby.json generated from above:

npx hardhat verify --network rinkeby <ADDRESS_FROM_.openzeppelin/rinkeby.json>

To upgrade, use contract address from create-mytoken.ts Edit scripts/upgrade-mytoken.ts, replace MYTOKEN_ADDRESS_FROM_create-mytoken with deployed address from above:

npx hardhat run --network rinkeby scripts/upgrade-mytoken.ts

About

starter hardhat toolchain for openzeppelin-contracts-upgradeable in typescript

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published