https://github.com/samlior/hardhat-erc20-example
hardhat-erc20-example
https://github.com/samlior/hardhat-erc20-example
erc20 example hardhat
Last synced: 6 months ago
JSON representation
hardhat-erc20-example
- Host: GitHub
- URL: https://github.com/samlior/hardhat-erc20-example
- Owner: samlior
- Created: 2021-06-02T02:43:06.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-04T06:20:23.000Z (over 4 years ago)
- Last Synced: 2025-03-30T12:13:23.232Z (10 months ago)
- Topics: erc20, example, hardhat
- Language: JavaScript
- Homepage:
- Size: 258 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hardhat-erc20-example



## Environment variable
```sh
# the api key of infura(if you want to connect mainnet or ethereum testnet, you must provide this key).
export INFURA_API_KEY=xxx
# the mnemonic of deployer(if not provided, the deployer will be the first account of the default accouts).
export MNEMONIC="test test test test test test test test test test test junk"
# deployer address, it should match the mnemonic
export DEV_ADDR=0x...abc
# etherscan api key, used to verify and publish the contracts
export ETHERSCAN_KEY=xxx
```
## Install
```sh
npm i
```
## Compile
```sh
npm run build
```
## Deploy
### Deploy to mainnet
```sh
npm run deploy:mainnet
```
### Deploy to localhost
```sh
npm run node
```
## Tasks
```
accounts Prints the list of accounts
balance Prints an account's balance
balance:erc20 Prints an account's ERC20 balance
mint Mint ERC20 token to account
verify Verifies contract on Etherscan
```
You can get detailed options of the task like this:
```sh
npx hardhat mint --help
```
You can simply run the task like this:
```sh
npx hardhat --network localhost balance --account 0x...abc
npx hardhat --network localhost mint --account 0x...abc
```
## Test
```sh
npm run test
```
## Verify
**notice: please first make sure you can access [api.etherscan.io](https://api.etherscan.io)**
```sh
npx hardhat verify --network mainnet 0x...abc "LV Coin" "LV" "18"
```
## LICENSE
[MIT](https://opensource.org/licenses/MIT)