├── .github
├── ISSUE_TEMPLATE
│ ├── bug-report.yml
│ └── feature-creation.yml
└── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── .gitpod.yml
├── LICENSE
├── README.md
├── apps
├── hardhat-ts
│ ├── .editorconfig
│ ├── .eslintignore
│ ├── .eslintrc.js
│ ├── .gitignore
│ ├── .mocharc.js
│ ├── .prettierignore
│ ├── .solhint.json
│ ├── .solhintignore
│ ├── .vscode
│ │ ├── extensions.json
│ │ ├── launch.json
│ │ └── settings.json
│ ├── README.md
│ ├── _scripts.js
│ ├── deploy
│ │ └── 001_deploy_storage.ts
│ ├── hardhat.config.ts
│ ├── package.json
│ ├── scripts
│ │ ├── fundingFromCoinbase.ts
│ │ ├── seed.ts
│ │ └── setMessage.ts
│ ├── src
│ │ └── Storage
│ │ │ └── Storage.sol
│ ├── test
│ │ ├── Storage.test.ts
│ │ ├── chai-setup.ts
│ │ └── utils
│ │ │ └── index.ts
│ ├── tsconfig.json
│ └── utils
│ │ └── network.ts
└── web
│ ├── .eslintrc.js
│ ├── README.md
│ ├── ethereum.d.ts
│ ├── next-env.d.ts
│ ├── next.config.js
│ ├── package.json
│ ├── postcss.config.js
│ ├── src
│ ├── pages
│ │ ├── _app.tsx
│ │ └── index.tsx
│ └── styles
│ │ └── global.css
│ ├── tailwind.config.js
│ └── tsconfig.json
├── gitpod-port.png
├── package.json
├── packages
├── config
│ ├── eslint-preset.js
│ ├── package.json
│ ├── postcss.config.js
│ └── tailwind.config.js
├── tsconfig
│ ├── README.md
│ ├── base.json
│ ├── hardhat.json
│ ├── nextjs.json
│ ├── package.json
│ └── react-library.json
└── ui
│ ├── Button.tsx
│ ├── WagmiProvider.tsx
│ ├── WalletConnectModal.tsx
│ ├── index.ts
│ ├── package.json
│ └── tsconfig.json
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
└── wallet.png
/.github/ISSUE_TEMPLATE/bug-report.yml:
--------------------------------------------------------------------------------
1 | name: Bug Report
2 | description: File a bug report
3 | title: "[Bug]: "
4 | labels: ["bug"]
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: |
9 | Thanks for taking the time to fill out this bug report!
10 | - type: textarea
11 | id: what-happened
12 | attributes:
13 | label: What happened?
14 | description: Also tell us, what did you expect to happen?
15 | placeholder: Tell us what you see!
16 | value: "A bug happened!"
17 | validations:
18 | required: true
19 | - type: textarea
20 | id: repo-steps
21 | attributes:
22 | label: How to reproduce the bug?
23 | description: Please explain how to reproduce the bug
24 | placeholder: Tell us how to repo the bug!
25 | value: |
26 | 1. Go to '...'
27 | 2. Click on '...'
28 | 3. Scroll down to '...'
29 | 4. See error
30 | validations:
31 | required: true
32 | - type: "checkboxes"
33 | id: browsers
34 | attributes:
35 | label: What browsers are you seeing the problem on?
36 | options:
37 | - label: Firefox
38 | - label: Chrome
39 | - label: Safari
40 | - label: Microsoft Edge
41 | - type: checkboxes
42 | id: devices
43 | attributes:
44 | label: What device type(s) did you see the problem on?
45 | options:
46 | - label: "Desktop"
47 | - label: "Mobile"
48 | - label: "Tablet"
49 | - type: checkboxes
50 | id: operating-system
51 | attributes:
52 | label: "What operating system(s) did you see the problem on?"
53 | options:
54 | - label: "macOS"
55 | - label: "Windows"
56 | - label: "Linux"
57 | - type: textarea
58 | id: additional
59 | attributes:
60 | label: Additional information
61 | description: Use this section to provide any additional information you may have like screenshots, logs, notes, video links, etc...
62 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature-creation.yml:
--------------------------------------------------------------------------------
1 | name: "Feature request"
2 | description: "File a Feature request"
3 | title: "[Feature]: "
4 | labels: ["enhancement"]
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: |
9 | Thanks for taking the time to fill out a feature request!
10 | - type: textarea
11 | id: context
12 | attributes:
13 | label: Context / Background / How This Idea Came To Fruition
14 | description: Please provide some context around your idea
15 | validations:
16 | required: true
17 | - type: textarea
18 | id: problem
19 | attributes:
20 | label: Problem / Opportunity
21 | description: What are we trying to solve/improve with this feature?
22 | validations:
23 | required: true
24 | - type: textarea
25 | id: solution
26 | attributes:
27 | label: Proposed Solution / How It Can Be Improved
28 | description: What will your feature / enhancement look like? (i.e frontend changes should have accompanying screenshots around the solution)
29 | validations:
30 | required: true
31 | - type: textarea
32 | id: testing
33 | attributes:
34 | label: Testing the changes
35 | description: Please provide a high level description of how you'll verify your changes work and won't break existing functionality?
36 | validations:
37 | required: true
38 | - type: textarea
39 | id: additional
40 | attributes:
41 | label: Additional Information
42 | description: Please provide any additional information around your request here
43 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### What does it do?
2 |
3 | ### Any helpful background information?
4 |
5 | ### Any new dependencies? Why were they added?
6 |
7 | ### Relevant screenshots/gifs
8 |
9 | ### Does it close any issues?
10 |
11 | Closes #...
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | node_modules
5 | .pnp
6 | .pnp.js
7 |
8 | # testing
9 | coverage
10 |
11 | # next.js
12 | .next/
13 | out/
14 | build
15 |
16 | # misc
17 | .DS_Store
18 | *.pem
19 |
20 | # debug
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 | .pnpm-debug.log*
25 |
26 | # local env files
27 | .env.local
28 | .env.development.local
29 | .env.test.local
30 | .env.production.local
31 |
32 | # turbo
33 | .turbo
34 |
35 | # hardhat
36 | typechain
--------------------------------------------------------------------------------
/.gitpod.yml:
--------------------------------------------------------------------------------
1 | tasks:
2 | - init: pnpm install
3 | command: pnpm dev
4 | ports:
5 | - port: 3000
6 | visibility: public
7 | - port: 8545
8 | visibility: public
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Nafees Nazik
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # full-stack dApp starter for solidity smart contract development
2 |
3 | A monorepo boilerplate code for typesafe full-stack [Solidity](https://soliditylang.org/) development.
4 |
5 | ## Contents
6 | - [Prerequisites](#prerequisites)
7 | - [Features](#features)
8 | - [Run in Gitpod](#run-in-gitpod)
9 | - [Run Locally](#run-locally)
10 | - [Build For Production](#build-for-production)
11 | - [Acknowledgements](#acknowledgements)
12 | - [License](#license)
13 |
14 | ## Prerequisites
15 |
16 | - [pnpm](https://pnpm.io/)
17 | - [Node.js](https://nodejs.org/en/download/)
18 | - [MetaMask wallet browser extension](https://metamask.io/download.html).
19 |
20 | ## Features
21 |
22 | Here's an overview of the included frameworks and tools.
23 |
24 | - **Next.js** - Minimalistic framework for server-rendered React applications.
25 | - **Typescript** - Superset of JavaScript which primarily provides optional static typing, classes and interfaces.
26 | - **ESLint** - The pluggable linting utility.
27 | - **Turborepo** - High-performance build system for JavaScript and TypeScript codebases.
28 | - **PNPM** - Fast, disk space efficient package manager.
29 | - **Wagmi** - React Hooks library for Ethereum.
30 | - **Tailwind CSS** - Rapidly build modern websites without ever leaving your HTML.
31 | - **Typechain** - TypeScript bindings for Ethereum smart contracts.
32 | - **Hardhat** - Ethereum development environment for professionals.
33 | - **Hardhat-deploy** - A Hardhat Plugin For Replicable Deployments And Easy Testing.
34 | - **Chai** - A BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework.
35 | - **Mocha** - A feature-rich JavaScript test framework.
36 |
37 | ## Run in Gitpod
38 | To run this project in Gitpod, follow these steps:
39 |
40 | 1. Click this link to deploy to gitpod
41 |
42 |
43 | [](https://gitpod.io/#github.com/G3root/nextjs-dapp-starter-ts)
44 |
45 | 2. Import the RPC address given to you by GitPod into your MetaMask wallet
46 |
47 | This endpoint will look something like this:
48 |
49 | ```bash
50 | https://8545-copper-swordtail-j1mvhxv3.ws-eu18.gitpod.io/
51 | ```
52 |
53 | The chain ID should be 1337. If you have a localhost rpc set up, you may need to overwrite it.
54 |
55 |
56 | 
57 |
58 | you can also change your status of your open ports by going to port settings.
59 |
60 |
61 | 
62 |
63 | ## Run Locally
64 |
65 | Clone the project
66 |
67 | ```bash
68 | npx degit G3root/nextjs-dapp-starter-ts my-project
69 | ```
70 |
71 | Go to the project directory
72 |
73 | ```bash
74 | cd my-project
75 | ```
76 |
77 | Install dependencies
78 |
79 | ```bash
80 | pnpm install
81 | ```
82 |
83 | Start the development server
84 |
85 | ```bash
86 | pnpm dev
87 | ```
88 |
89 | ## Build For Production
90 |
91 | To generate production build
92 |
93 | ```bash
94 | pnpm build
95 | ```
96 | ## Acknowledgements
97 |
98 | - [template-ethereum-contracts](https://github.com/wighawag/template-ethereum-contracts)
99 |
100 | ## License
101 |
102 | [MIT](https://choosealicense.com/licenses/mit/)
--------------------------------------------------------------------------------
/apps/hardhat-ts/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | end_of_line = lf
5 | insert_final_newline = true
6 | charset = utf-8
7 | indent_style = space
8 | indent_size = 2
9 | trim_trailing_whitespace = true
10 |
11 | [*.sol]
12 | indent_size = 4
--------------------------------------------------------------------------------
/apps/hardhat-ts/.eslintignore:
--------------------------------------------------------------------------------
1 | export/
2 | deployments/
3 | artifacts/
4 | cache/
5 | coverage/
6 | node_modules/
7 | package.json
8 | typechain/
--------------------------------------------------------------------------------
/apps/hardhat-ts/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | parser: '@typescript-eslint/parser',
4 | parserOptions: {
5 | ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
6 | sourceType: 'module', // Allows for the use of imports
7 | },
8 | env: {
9 | commonjs: true,
10 | },
11 | plugins: ['@typescript-eslint'],
12 | extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
13 | rules: {
14 | 'no-empty': 'off',
15 | 'no-empty-function': 'off',
16 | '@typescript-eslint/no-empty-function': 'off',
17 | },
18 | };
--------------------------------------------------------------------------------
/apps/hardhat-ts/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .env
3 | coverage
4 | coverage.json
5 | typechain
6 |
7 | #Hardhat files
8 | cache
9 | artifacts
10 |
11 | .yalc
12 | yalc.lock
13 |
14 | contractsInfo.json
15 | deployments/hardhat
16 | deployments/localhost
17 |
18 | .dapp/
19 | _lib/
--------------------------------------------------------------------------------
/apps/hardhat-ts/.mocharc.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | process.env.TS_NODE_FILES = true;
3 | module.exports = {
4 | 'allow-uncaught': true,
5 | diff: true,
6 | extension: ['ts'],
7 | recursive: true,
8 | reporter: 'spec',
9 | require: ['ts-node/register', 'hardhat/register'], // ['ts-node/register/transpile-only'], (for yarn link )
10 | slow: 300,
11 | spec: 'test/**/*.test.ts',
12 | timeout: 20000,
13 | ui: 'bdd',
14 | watch: false,
15 | 'watch-files': ['src/**/*.sol', 'test/**/*.ts'],
16 | };
--------------------------------------------------------------------------------
/apps/hardhat-ts/.prettierignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | artifacts
3 | cache
4 | coverage*
5 | gasReporterOutput.json
6 |
--------------------------------------------------------------------------------
/apps/hardhat-ts/.solhint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "solhint:recommended",
3 | "plugins": [
4 | "prettier"
5 | ],
6 | "rules": {
7 | "prettier/prettier": [
8 | "error",
9 | {
10 | "endOfLine": "auto"
11 | }
12 | ],
13 | "code-complexity": [
14 | "error",
15 | 7
16 | ],
17 | "compiler-version": [
18 | "error",
19 | "^0.8.9"
20 | ],
21 | "const-name-snakecase": "off",
22 | "func-name-mixedcase": "off",
23 | "constructor-syntax": "error",
24 | "func-visibility": [
25 | "error",
26 | {
27 | "ignoreConstructors": true
28 | }
29 | ],
30 | "not-rely-on-time": "off",
31 | "reason-string": [
32 | "warn",
33 | {
34 | "maxLength": 64
35 | }
36 | ]
37 | }
38 | }
--------------------------------------------------------------------------------
/apps/hardhat-ts/.solhintignore:
--------------------------------------------------------------------------------
1 | export/
2 | deployments/
3 | artifacts/
4 | cache/
5 | coverage/
6 | node_modules/
7 |
--------------------------------------------------------------------------------
/apps/hardhat-ts/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "dbaeumer.vscode-eslint",
4 | "editorconfig.editorconfig",
5 | "esbenp.prettier-vscode",
6 | "hbenl.vscode-mocha-test-adapter",
7 | "juanblanco.solidity"
8 | ],
9 | }
10 |
--------------------------------------------------------------------------------
/apps/hardhat-ts/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "type": "node",
6 | "request": "launch",
7 | "name": "hardhat node",
8 | "skipFiles": ["/**"],
9 | "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/hardhat",
10 | "args": ["node"],
11 | "cwd": "${workspaceFolder}"
12 | }
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/apps/hardhat-ts/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "editor.formatOnSave": true,
3 | "editor.defaultFormatter": "esbenp.prettier-vscode",
4 | "editor.codeActionsOnSave": {
5 | "source.fixAll": true
6 | },
7 | "solidity.linter": "solhint",
8 | "solidity.defaultCompiler": "remote",
9 | "solidity.compileUsingRemoteVersion": "v0.8.9+commit.e5eed63a",
10 | "solidity.packageDefaultDependenciesContractsDirectory": "",
11 | "solidity.enabledAsYouTypeCompilationErrorCheck": true,
12 | "solidity.validationDelay": 1500,
13 | "solidity.packageDefaultDependenciesDirectory": "node_modules",
14 | "mochaExplorer.env": {
15 | "HARDHAT_CONFIG": "hardhat.config.ts",
16 | "HARDHAT_COMPILE": "true"
17 | },
18 | "mochaExplorer.require": ["ts-node/register/transpile-only"]
19 | }
20 |
--------------------------------------------------------------------------------
/apps/hardhat-ts/README.md:
--------------------------------------------------------------------------------
1 | # Boilerplate for ethereum solidity smart contract development
2 |
3 | ## INSTALL
4 |
5 | ```bash
6 | pnpm install
7 | ```
8 |
9 | ## TEST
10 |
11 |
12 | - test using hardhat that can leverage hardhat-deploy to reuse deployment procedures and named accounts:
13 |
14 | ```bash
15 | pnpm test
16 | ```
17 |
18 |
19 | ## SCRIPTS
20 |
21 | Here is the list of npm scripts you can execute:
22 |
23 | Some of them relies on [./\_scripts.js](./_scripts.js) to allow parameterizing it via command line argument (have a look inside if you need modifications)
24 |
25 |
26 | `pnpm prepare`
27 |
28 | As a standard lifecycle npm script, it is executed automatically upon install. It generate config file and typechain to get you started with type safe contract interactions
29 |
30 |
31 | `pnpm lint` and `pnpm lint:fix`
32 |
33 | These commands will lint your code. the `:fix` version will modifiy the files to match the requirement specified in `.eslintrc`.
34 |
35 |
36 | `pnpm compile`
37 |
38 | These will compile your contracts
39 |
40 |
41 | `pnpm void:deploy`
42 |
43 | This will deploy your contracts on the in-memory hardhat network and exit, leaving no trace. quick way to ensure deployments work as intended without consequences
44 |
45 |
46 | `pnpm test [mocha args...]`
47 |
48 | These will execute your tests using mocha. you can pass extra arguments to mocha
49 |
50 |
51 | `pnpm coverage`
52 |
53 | These will produce a coverage report in the `coverage/` folder
54 |
55 |
56 | `pnpm gas`
57 |
58 | These will produce a gas report for function used in the tests
59 |
60 |
61 | `pnpm dev`
62 |
63 | These will run a local hardhat network on `localhost:8545` and deploy your contracts on it. Plus it will watch for any changes and redeploy them.
64 |
65 |
66 | `pnpm local:dev`
67 |
68 | This assumes a local node it running on `localhost:8545`. It will deploy your contracts on it. Plus it will watch for any changes and redeploy them.
69 |
70 |
71 | `pnpm execute [args...]`
72 |
73 | This will execute the script `` against the specified network
74 |
75 |
76 | `pnpm deploy [args...]`
77 |
78 | This will deploy the contract on the specified network.
79 |
80 | Behind the scene it uses `hardhat deploy` command so you can append any argument for it
81 |
82 |
83 | `pnpm export `
84 |
85 | This will export the abi+address of deployed contract to ``
86 |
87 |
88 | `pnpm fork:execute [--blockNumber ] [--deploy] [args...]`
89 |
90 | This will execute the script `` against a temporary fork of the specified network
91 |
92 | if `--deploy` is used, deploy scripts will be executed
93 |
94 |
95 | `pnpm fork:deploy [--blockNumber ] [args...]`
96 |
97 | This will deploy the contract against a temporary fork of the specified network.
98 |
99 | Behind the scene it uses `hardhat deploy` command so you can append any argument for it
100 |
101 |
102 | `pnpm fork:test [--blockNumber ] [mocha args...]`
103 |
104 | This will test the contract against a temporary fork of the specified network.
105 |