|
1 |
| -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). |
2 |
| - |
3 |
| -## Getting Started |
4 |
| - |
5 |
| -First, run the development server: |
6 |
| - |
7 |
| -```bash |
8 |
| -npm run dev |
9 |
| -# or |
10 |
| -yarn dev |
| 1 | +# Advanced Sample Hardhat Project |
| 2 | + |
| 3 | +This project demonstrates an advanced Hardhat use case, integrating other tools commonly used alongside Hardhat in the ecosystem. |
| 4 | + |
| 5 | +The project comes with a sample contract, a test for that contract, a sample script that deploys that contract, and an example of a task implementation, which simply lists the available accounts. It also comes with a variety of other tools, preconfigured to work with the project code. |
| 6 | + |
| 7 | +Try running some of the following tasks: |
| 8 | + |
| 9 | +```shell |
| 10 | +npx hardhat accounts |
| 11 | +npx hardhat compile |
| 12 | +npx hardhat clean |
| 13 | +npx hardhat test |
| 14 | +npx hardhat node |
| 15 | +npx hardhat help |
| 16 | +REPORT_GAS=true npx hardhat test |
| 17 | +npx hardhat coverage |
| 18 | +npx hardhat run scripts/deploy.ts |
| 19 | +TS_NODE_FILES=true npx ts-node scripts/deploy.ts |
| 20 | +npx eslint '**/*.{js,ts}' |
| 21 | +npx eslint '**/*.{js,ts}' --fix |
| 22 | +npx prettier '**/*.{json,sol,md}' --check |
| 23 | +npx prettier '**/*.{json,sol,md}' --write |
| 24 | +npx solhint 'contracts/**/*.sol' |
| 25 | +npx solhint 'contracts/**/*.sol' --fix |
11 | 26 | ```
|
12 | 27 |
|
13 |
| -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. |
14 |
| - |
15 |
| -You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. |
| 28 | +# Etherscan verification |
16 | 29 |
|
17 |
| -[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`. |
| 30 | +To try out Etherscan verification, you first need to deploy a contract to an Ethereum network that's supported by Etherscan, such as Ropsten. |
18 | 31 |
|
19 |
| -The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. |
| 32 | +In this project, copy the .env.example file to a file named .env, and then edit it to fill in the details. Enter your Etherscan API key, your Ropsten node URL (eg from Alchemy), and the private key of the account which will send the deployment transaction. With a valid .env file in place, first deploy your contract: |
20 | 33 |
|
21 |
| -## Learn More |
22 |
| - |
23 |
| -To learn more about Next.js, take a look at the following resources: |
24 |
| - |
25 |
| -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. |
26 |
| -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. |
| 34 | +```shell |
| 35 | +hardhat run --network ropsten scripts/sample-script.ts |
| 36 | +``` |
27 | 37 |
|
28 |
| -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! |
| 38 | +Then, copy the deployment address and paste it in to replace `DEPLOYED_CONTRACT_ADDRESS` in this command: |
29 | 39 |
|
30 |
| -## Deploy on Vercel |
| 40 | +```shell |
| 41 | +npx hardhat verify --network ropsten DEPLOYED_CONTRACT_ADDRESS "Hello, Hardhat!" |
| 42 | +``` |
31 | 43 |
|
32 |
| -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. |
| 44 | +# Performance optimizations |
33 | 45 |
|
34 |
| -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. |
| 46 | +For faster runs of your tests and scripts, consider skipping ts-node's type checking by setting the environment variable `TS_NODE_TRANSPILE_ONLY` to `1` in hardhat's environment. For more details see [the documentation](https://hardhat.org/guides/typescript.html#performance-optimizations). |
0 commit comments