Skip to content

Commit

Permalink
added: hardhat boilerplate, moved app to client directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Salmandabbakuti committed Jun 28, 2024
1 parent e36fdca commit c1bf00f
Show file tree
Hide file tree
Showing 28 changed files with 5,809 additions and 13,576 deletions.
63 changes: 29 additions & 34 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
# Build and Release Folders
bin-debug/
bin-release/
[Oo]bj/
[Bb]in/

# Other files and folders
.settings/
node_modules/
package-lock.json
yarn.lock

# Executables
*.swf
*.air
*.ipa
*.apk
*.env

# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
# should NOT be excluded as they contain compiler settings and other important
# information for Eclipse / Flash Builder.
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
#Hardhat files
cache
artifacts/
coverage/
coverage.json
typechain/
typechain-types/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Salman Dabbakuti

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
78 changes: 58 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,74 @@
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).
# Hardhat Boilerplate(Minimal)

This project demonstrates a basic Hardhat use case. It 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 with balances.

## Getting Started

First, run the development server:
> Recommended to use Node.js v18+ and npm v8+
Try running some of the following tasks:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
npm install

# Set/Read/Remove hardhat config variables
# npx hardhat vars set API_KEY
# npx hardhat vars get API_KEY
# npx hardhat vars DELETE API_KEY
# npx hardhat vars list

# set PRIVATE_KEY
npx hardhat vars set PRIVATE_KEY


# starts local node
npx hardhat node

# compile contracts
npx hardhat compile

# deploy contract in scripts/deploy.ts on specified network
npx hardhat run scripts/deploy.ts --network localhost

# verify contract
npx hardhat verify --network <deployed network> <deployed contract address> "<constructor1>" "<constructor2>"

# check coverage using solidity-coverage plugin: supports hardhat network only
npx hardhat coverage --network hardhat

# unit tests including gas usage
npx hardhat test

# remove all compiled and deployed artifacts
npx hardhat clean

# show help
npx hardhat help
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
## Change Log

You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file.
#### v1.2.3

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
- Replaced deprecated mumbai network with amoy network in `hardhat.config.ts`
- Compiler version updated to `0.8.24`
- Hardhat deps update
- Generalized `deploy.ts` script for any contract with minimal changes
- README.md sections update

## Learn More
## References

To learn more about Next.js, take a look at the following resources:
- [Hardhat](https://hardhat.org/)
- [Hardhat Docs](https://hardhat.org/getting-started/)
- [Ethers.js](https://docs.ethers.io/v5/)
- [Solidity](https://docs.soliditylang.org/en/v0.8.25/)

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
## Safety

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
This is experimental software and subject to change over time.

## Deploy on Vercel
This is a proof of concept and is not ready for production use. It is not audited and has not been tested for security. Use at your own risk. I do not give any warranties and will not be liable for any loss incurred through any use of this codebase.

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.
## License

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
File renamed without changes.
36 changes: 36 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
36 changes: 36 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

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.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "fluid-funds",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@ant-design/icons": "^5.3.7",
"@ethersproject/contracts": "^5.7.0",
"@ethersproject/units": "^5.7.0",
"@thirdweb-dev/chains": "^0.1.120",
"@thirdweb-dev/react": "^4.9.4",
"antd": "^5.18.3",
"next": "14.2.4",
"react": "^18",
"react-dom": "^18"
},
"devDependencies": {
"eslint": "^8",
"eslint-config-next": "14.2.4"
}
}
File renamed without changes
File renamed without changes
4 changes: 4 additions & 0 deletions contracts/FluidFunds.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

contract FluidFunds {}
34 changes: 34 additions & 0 deletions contracts/Lock.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.24;

// Uncomment this line to use console.log
// import "hardhat/console.sol";

contract Lock {
uint public unlockTime;
address payable public owner;

event Withdrawal(uint amount, uint when);

constructor(uint _unlockTime) payable {
require(
block.timestamp < _unlockTime,
"Unlock time should be in the future"
);

unlockTime = _unlockTime;
owner = payable(msg.sender);
}

function withdraw() public {
// Uncomment this line, and the import of "hardhat/console.sol", to print a log in your terminal
// console.log("Unlock time is %o and block timestamp is %o", unlockTime, block.timestamp);

require(block.timestamp >= unlockTime, "You can't withdraw yet");
require(msg.sender == owner, "You aren't the owner");

emit Withdrawal(address(this).balance, block.timestamp);

owner.transfer(address(this).balance);
}
}
54 changes: 54 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { HardhatUserConfig, vars } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";

const accounts = vars.has("PRIVATE_KEY") ? [vars.get("PRIVATE_KEY")] : [];

const config: HardhatUserConfig = {
solidity: "0.8.24",
defaultNetwork: "localhost",
networks: {
localhost: {
url: "http://127.0.0.1:8545"
},
amoy: {
url: "https://rpc-amoy.polygon.technology/",
accounts
},
scrollSepolia: {
url: "https://sepolia-rpc.scroll.io",
chainId: 534351,
accounts
},
scrollMainnet: {
url: "https://rpc.scroll.io",
chainId: 534352,
accounts
}
},
etherscan: {
// API key for Polygonscan
apiKey: {
scrollSepolia: vars.get("SCROLLSCAN_API_KEY")
},
customChains: [
{
network: "scrollSepolia",
chainId: 534351,
urls: {
apiURL: "https://api-sepolia.scrollscan.com/api",
browserURL: "https://sepolia.scrollscan.com/"
}
},
{
network: "scrollMainnet",
chainId: 534352,
urls: {
apiURL: "https://api.scrollscan.com/api",
browserURL: "https://scrollscan.com/"
}
}
]
}
};

export default config;
Loading

0 comments on commit c1bf00f

Please sign in to comment.