generated from w3hc/tuesday-heartbreak
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e3d84da
Showing
77 changed files
with
16,508 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DEPLOYER_KEY='888888888888888888888888888888888888888888888888888888888888888888' | ||
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID='88888888888888888888888888888888' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": [ | ||
"next/core-web-vitals", | ||
"prettier" | ||
], | ||
"plugins": [ | ||
"prettier" | ||
], | ||
"rules": { | ||
"prettier/prettier": ["error"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env*.local | ||
.env* | ||
!.env.template | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
# hardhat | ||
contracts/node_modules | ||
contracts/.env | ||
contracts/coverage | ||
contracts/coverage.json | ||
contracts/typechain | ||
contracts/typechain-types | ||
|
||
contracts/cache | ||
contracts/artifacts | ||
|
||
# wagmi recommends to ignore their generated file | ||
# /src/abis.ts | ||
|
||
# subgraph | ||
subgraph/node_modules | ||
subgraph/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"semi": false, | ||
"singleQuote": true, | ||
"printWidth": 150, | ||
"bracketSameLine": true, | ||
"useTabs": false, | ||
"tabWidth": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["esbenp.prettier-vscode"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 wslyvh | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Tuesday Heartbreak | ||
|
||
A variant of [Nexth](https://github.com/wslyvh/nexth/), a boilerplate built by [wslyvh](https://github.com/wslyvh) and [others](https://github.com/wslyvh/nexth/graphs/contributors). | ||
|
||
## Features | ||
|
||
- [Next.js](https://nextjs.org/docs) | ||
- [Chakra UI](https://chakra-ui.com/) | ||
- [Ethers v6](https://docs.ethers.org/v6/) | ||
- [viem](https://viem.sh/) | ||
- [wagmi](https://wagmi.sh/) | ||
- [Web3Modal SDK from WalletConnect](https://docs.walletconnect.com/) | ||
- [Sign-In with Ethereum](https://www.login.xyz/) | ||
- [usehooks-ts](https://usehooks-ts.com/) | ||
- [next-SEO](https://github.com/garmeeh/next-seo) | ||
- [TypeScript](https://www.typescriptlang.org/) | ||
- [eslint](https://eslint.org/) | ||
- [prettier](https://prettier.io/) | ||
- [Husky](https://typicode.github.io/husky/) | ||
|
||
## Install | ||
|
||
```bash | ||
pnpm install | ||
``` | ||
|
||
## Run | ||
|
||
Create a `.env` on the model of `.env.template`: | ||
|
||
```sh | ||
cp .env.template .env | ||
``` | ||
|
||
Add your own keys in your `.env` file, then: | ||
|
||
```bash | ||
pnpm dev | ||
``` | ||
|
||
## Build | ||
|
||
```bash | ||
pnpm build | ||
``` | ||
|
||
## Versions | ||
|
||
- Node [v18.17.1](https://nodejs.org/uk/blog/release/v18.17.1/) | ||
- PNPM [v8.7.5](https://pnpm.io/pnpm-vs-npm) | ||
|
||
## Support | ||
|
||
You can contact me via [Element](https://matrix.to/#/@julienbrg:matrix.org), [Telegram](https://t.me/julienbrg), [Twitter](https://twitter.com/julienbrg), [Discord](https://discord.gg/uSxzJp3J76), or [LinkedIn](https://www.linkedin.com/in/julienberanger/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Smart Contracts | ||
|
||
This project demonstrates how to add smart contracts to your project using [Hardhat](https://hardhat.org/docs). It provides a sample `Message` contract, a test and deployment scripts. | ||
|
||
Try running some of the following tasks: | ||
|
||
``` | ||
yarn build | ||
yarn deploy | ||
yarn test | ||
yarn coverage | ||
``` | ||
|
||
## Deploy | ||
|
||
Once you're ready to deploy your contracts, setup a deployer account using `DEPLOYER_KEY` and try to run e.g. | ||
|
||
``` | ||
yarn deploy --network sepolia | ||
``` | ||
|
||
Note that you need testnet Ethers for that. More info and faucet links can be found on [Sepolia Dev](https://sepolia.dev/). You can set up different networks using [Hardhat's network configuration](https://hardhat.org/hardhat-runner/docs/config#networks-configuration). | ||
|
||
## Verify | ||
|
||
Contracts are automatically verified on Etherscan if you've set up the `ETHERSCAN_API_KEY` environment variable. You can also verify contracts manually using | ||
|
||
``` | ||
yarn verify | ||
``` | ||
|
||
## Wagmi CLI | ||
|
||
The front-end uses the [Wagmi CLI](https://wagmi.sh/cli/getting-started) to automatically generate types and default hooks for your contracts. You can find the generated files in `src/abi.test`. | ||
|
||
``` | ||
yarn wagmi | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.6.0 <0.9.0; | ||
|
||
// import "hardhat/console.sol"; | ||
|
||
contract Message { | ||
string public message = "Quickly ship Web3 Apps!"; | ||
|
||
event SetMessage(address sender, string purpose); | ||
|
||
constructor() { } | ||
|
||
function setMessage(string memory _message) public payable { | ||
message = _message; | ||
// console.log(msg.sender, "is updating message to", _message); | ||
emit SetMessage(msg.sender, _message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | ||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
import "@openzeppelin/contracts/utils/Counters.sol"; | ||
|
||
contract NexthFT is ERC721, Ownable { | ||
using Counters for Counters.Counter; | ||
|
||
Counters.Counter private _tokenIdCounter; | ||
|
||
constructor() ERC721("NexthFT", "NFT") { } | ||
|
||
function safeMint(address to) public onlyOwner { | ||
uint256 tokenId = _tokenIdCounter.current(); | ||
_tokenIdCounter.increment(); | ||
_safeMint(to, tokenId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { HardhatUserConfig } from 'hardhat/config' | ||
import { join } from 'path' | ||
import dotenv from 'dotenv' | ||
import '@nomicfoundation/hardhat-toolbox' | ||
|
||
dotenv.config({ path: join(process.cwd(), '../.env') }) | ||
|
||
const deployerKey = process.env.DEPLOYER_KEY | ||
if (!deployerKey) { | ||
console.warn('DEPLOYER_KEY not found in .env file. Running with default config') | ||
} | ||
const etherscanApiKey = process.env.ETHERSCAN_API_KEY ?? '' | ||
if (!etherscanApiKey) { | ||
console.warn('ETHERSCAN_API_KEY not found in .env file. Will skip Etherscan verification') | ||
} | ||
const polygonApiKey = process.env.POLYSCAN_API_KEY ?? '' | ||
if (!polygonApiKey) { | ||
console.warn('POLYSCAN_API_KEY not found in .env file. Will skip Etherscan verification') | ||
} | ||
|
||
const config: HardhatUserConfig = { | ||
solidity: '0.8.18', | ||
defaultNetwork: 'hardhat', | ||
etherscan: { | ||
apiKey: { | ||
mainnet: etherscanApiKey, | ||
sepolia: etherscanApiKey, | ||
polygonMumbai: polygonApiKey, | ||
}, | ||
}, | ||
networks: { | ||
hardhat: { | ||
chainId: 31337, | ||
}, | ||
localhost: { | ||
chainId: 31337, | ||
url: 'http://127.0.0.1:8545', | ||
}, | ||
sepolia: { | ||
chainId: 11155111, | ||
url: 'https://rpc.sepolia.org/', | ||
accounts: [deployerKey as string], | ||
}, | ||
mumbai: { | ||
chainId: 80001, | ||
url: 'https://rpc-mumbai.maticvigil.com/', | ||
accounts: [deployerKey as string], | ||
}, | ||
}, | ||
} | ||
|
||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "nexth-contracts", | ||
"version": "0.1.0", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "hardhat compile", | ||
"deploy": "npx hardhat run scripts/deploy.ts", | ||
"deploy:nft": "npx hardhat run scripts/nft.ts", | ||
"coverage": "hardhat coverage", | ||
"test": "REPORT_GAS=true hardhat test" | ||
}, | ||
"devDependencies": { | ||
"@ethersproject/abi": "^5.4.7", | ||
"@ethersproject/providers": "^5.4.7", | ||
"@nomicfoundation/hardhat-chai-matchers": "^1.0.0", | ||
"@nomicfoundation/hardhat-network-helpers": "^1.0.0", | ||
"@nomicfoundation/hardhat-toolbox": "^2.0.0", | ||
"@nomiclabs/hardhat-ethers": "^2.0.0", | ||
"@nomiclabs/hardhat-etherscan": "^3.0.0", | ||
"@openzeppelin/contracts": "^4.8.2", | ||
"@typechain/ethers-v5": "^10.1.0", | ||
"@typechain/hardhat": "^6.1.2", | ||
"@types/chai": "^4.2.0", | ||
"@types/mocha": ">=9.1.0", | ||
"@types/node": ">=12.0.0", | ||
"chai": "^4.2.0", | ||
"dotenv": "^16.0.3", | ||
"ethers": "^5.4.7", | ||
"hardhat": "^2.13.0", | ||
"hardhat-gas-reporter": "^1.0.8", | ||
"solidity-coverage": "^0.8.0", | ||
"ts-node": ">=8.0.0", | ||
"typechain": "^8.1.0", | ||
"typescript": ">=4.5.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { ethers, network, run } from 'hardhat' | ||
|
||
async function main() { | ||
console.log('Deploying Message...') | ||
|
||
const args: any[] = [] | ||
const Message = await ethers.getContractFactory('Message') | ||
const message = await Message.deploy(...args) | ||
|
||
await message.deployed() | ||
|
||
console.log(`Message deployed to ${message.address}`) | ||
|
||
// no need to verify on localhost or hardhat | ||
if (network.config.chainId != 31337 && process.env.ETHERSCAN_API_KEY) { | ||
console.log(`Waiting for block confirmation...`) | ||
await message.deployTransaction.wait(5) | ||
|
||
console.log('Verifying contract...') | ||
try { | ||
run('verify:verify', { | ||
address: message.address, | ||
constructorArguments: args, | ||
}) | ||
} catch (e) { | ||
console.log(e) | ||
} | ||
} | ||
} | ||
|
||
// We recommend this pattern to be able to use async/await everywhere | ||
// and properly handle errors. | ||
main().catch((error) => { | ||
console.error(error) | ||
process.exitCode = 1 | ||
}) |
Oops, something went wrong.