Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,22 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v4

- name: Setup node env
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: yarn
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.0.0

- name: Install dependencies
run: yarn install --immutable
run: pnpm install --frozen-lockfile

- name: Install foundry-toolchain
uses: foundry-rs/foundry-toolchain@v1
Expand All @@ -38,10 +44,10 @@ jobs:
- name: Run foundry node, deploy contracts (& generate contracts typescript output)
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
run: yarn chain & yarn deploy
run: pnpm chain & pnpm deploy

- name: Run nextjs lint
run: yarn next:lint --max-warnings=0
run: pnpm next:lint --max-warnings=0

- name: Check typings on nextjs
run: yarn next:check-types
run: pnpm next:check-types
11 changes: 2 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
# dependencies
node_modules

# yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.pnpm-debug.log

# eslint
.eslintcache
Expand All @@ -20,4 +13,4 @@ node_modules
.idea

# cli
dist
dist
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged --verbose
pnpm lint-staged --verbose
6 changes: 3 additions & 3 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const path = require("path");

const buildNextEslintCommand = (filenames) =>
`yarn next:lint --fix --file ${filenames
`pnpm next:lint --fix --file ${filenames
.map((f) => path.relative(path.join("packages", "nextjs"), f))
.join(" --file ")}`;

const checkTypesNextCommand = () => "yarn next:check-types";
const checkTypesNextCommand = () => "pnpm next:check-types";

const buildHardhatEslintCommand = (filenames) =>
`yarn hardhat:lint-staged --fix ${filenames
`pnpm hardhat:lint-staged --fix ${filenames
.map((f) => path.relative(path.join("packages", "hardhat"), f))
.join(" ")}`;

Expand Down
541 changes: 0 additions & 541 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

9 changes: 0 additions & 9 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

This file was deleted.

783 changes: 0 additions & 783 deletions .yarn/releases/yarn-3.2.3.cjs

This file was deleted.

13 changes: 0 additions & 13 deletions .yarnrc.yml

This file was deleted.

22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ And this workshop will introduce how to build a simple dapp on the Monad chain.
Before you begin, you need to install the following tools:

- [Node (>= v18.17)](https://nodejs.org/en/download/)
- Yarn ([v1](https://classic.yarnpkg.com/en/docs/install/) or [v2+](https://yarnpkg.com/getting-started/install))
- [Git](https://git-scm.com/downloads)
- [pnpm](https://pnpm.io/installation)
- Scaffold-ETH2 toolkit: Type folder name you want, and choose `Foundry`
```
npx [email protected]
Expand All @@ -28,22 +28,22 @@ And we need to open 3 separate terminals.
1. Run a local network in the first terminal:

```
yarn chain
pnpm chain
```
This command starts a local Ethereum network using Foundry. The network runs on your local machine and can be used for testing and development. You can customize the network configuration in `packages/foundry/foundry.toml`.

2. On a second terminal, deploy the test contract:

```
yarn deploy
pnpm deploy
```

This command deploys a test smart contract to the local network. The contract is located in `packages/foundry/contracts` and can be modified to suit your needs. The `yarn deploy` command uses the deploy script located in `packages/foundry/script` to deploy the contract to the network. You can also customize the deploy script.
This command deploys a test smart contract to the local network. The contract is located in `packages/foundry/contracts` and can be modified to suit your needs. The `pnpm deploy` command uses the deploy script located in `packages/foundry/script` to deploy the contract to the network. You can also customize the deploy script.

3. On a third terminal, start your NextJS app:

```
yarn start
pnpm start
```
Visit your app on: `http://localhost:3000`. You can interact with your smart contract using the `Debug Contracts` page. You can tweak the app config in `packages/nextjs/scaffold.config.ts`.

Expand All @@ -56,8 +56,8 @@ Visit your app on: `http://localhost:3000`. You can interact with your smart con
1. Edit solidity contract: We use "Tug of War Game" demo.
Copy the content of file `https://github.com/tokenlin/monad-demo/blob/main/packages/foundry/contracts/YourContract.sol`, and repleat the content of local file `packages/foundry/contracts/YourContract.sol`.
2. Modify the test script: Copy the content of file `https://github.com/tokenlin/monad-demo/blob/main/packages/foundry/test/YourContract.t.sol`, and repleat the content of local file `packages/foundry/test/YourContract.t.sol`.
3. Use `yarn test` command on the second terminal to test the solidity contract edited by us.
4. Use `yarn deploy` command again on the second terminal to deploy the contract to the local network.
3. Use `pnpm test` command on the second terminal to test the solidity contract edited by us.
4. Use `pnpm deploy` command again on the second terminal to deploy the contract to the local network.



Expand Down Expand Up @@ -90,21 +90,21 @@ Copy the content of file `https://github.com/tokenlin/monad-demo/blob/main/packa
3. Deploy to Chain
- `sepolia`: Make sure the address of your privatekey has enough ETH to pay gas.
```
yarn deploy --network sepolia
pnpm deploy --network sepolia
```
- `monad`: Make sure the address of your privatekey has enough MON to pay gas.
```
yarn deploy --network monad
pnpm deploy --network monad
```

4. Verify Contract:
- `sepolia`:
```
yarn verify --network sepolia
pnpm verify --network sepolia
```
- `monad`: Foundry contract verification does not support Monad Devnet, but will be enabled on Testnet by entering the command:
```
yarn verify --network monad
pnpm verify --network monad
```


Expand Down
46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,36 @@
]
},
"scripts": {
"account": "yarn workspace @se-2/foundry account",
"chain": "yarn workspace @se-2/foundry chain",
"compile": "yarn workspace @se-2/foundry compile",
"deploy": "yarn workspace @se-2/foundry deploy",
"deploy:verify": "yarn workspace @se-2/foundry deploy:verify",
"flatten": "yarn workspace @se-2/foundry flatten",
"fork": "yarn workspace @se-2/foundry fork",
"format": "yarn next:format && yarn foundry:format",
"foundry:format": "yarn workspace @se-2/foundry format",
"foundry:lint": "yarn workspace @se-2/foundry lint",
"foundry:test": "yarn workspace @se-2/foundry test",
"generate": "yarn workspace @se-2/foundry generate",
"account": "pnpm --filter @se-2/foundry account",
"chain": "pnpm --filter @se-2/foundry chain",
"compile": "pnpm --filter @se-2/foundry compile",
"deploy": "pnpm --filter @se-2/foundry deploy",
"deploy:verify": "pnpm --filter @se-2/foundry deploy:verify",
"flatten": "pnpm --filter @se-2/foundry flatten",
"fork": "pnpm --filter @se-2/foundry fork",
"format": "pnpm next:format && pnpm foundry:format",
"foundry:format": "pnpm --filter @se-2/foundry format",
"foundry:lint": "pnpm --filter @se-2/foundry lint",
"foundry:test": "pnpm --filter @se-2/foundry test",
"generate": "pnpm --filter @se-2/foundry generate",
"postinstall": "husky install",
"next:build": "yarn workspace @se-2/nextjs build",
"next:check-types": "yarn workspace @se-2/nextjs check-types",
"next:format": "yarn workspace @se-2/nextjs format",
"next:lint": "yarn workspace @se-2/nextjs lint",
"next:serve": "yarn workspace @se-2/nextjs serve",
"next:build": "pnpm --filter @se-2/nextjs build",
"next:check-types": "pnpm --filter @se-2/nextjs check-types",
"next:format": "pnpm --filter @se-2/nextjs format",
"next:lint": "pnpm --filter @se-2/nextjs lint",
"next:serve": "pnpm --filter @se-2/nextjs serve",
"precommit": "lint-staged",
"start": "yarn workspace @se-2/nextjs dev",
"test": "yarn foundry:test",
"vercel": "yarn workspace @se-2/nextjs vercel",
"vercel:yolo": "yarn workspace @se-2/nextjs vercel:yolo",
"verify": "yarn workspace @se-2/foundry verify"
"start": "pnpm --filter @se-2/nextjs dev",
"test": "pnpm foundry:test",
"vercel": "pnpm --filter @se-2/nextjs vercel",
"vercel:yolo": "pnpm --filter @se-2/nextjs vercel:yolo",
"verify": "pnpm --filter @se-2/foundry verify"
},
"devDependencies": {
"husky": "~8.0.3",
"lint-staged": "~13.2.2"
},
"packageManager": "[email protected]",
"packageManager": "[email protected]",
"engines": {
"node": ">=18.17.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/foundry/script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ contract DeployScript is ScaffoldETHDeploy {
uint256 deployerPrivateKey = setupLocalhostEnv();
if (deployerPrivateKey == 0) {
revert InvalidPrivateKey(
"You don't have a deployer account. Make sure you have set DEPLOYER_PRIVATE_KEY in .env or use `yarn generate` to generate a new random account"
"You don't have a deployer account. Make sure you have set DEPLOYER_PRIVATE_KEY in .env or use `pnpm generate` to generate a new random account"
);
}
vm.startBroadcast(deployerPrivateKey);
Expand Down
2 changes: 1 addition & 1 deletion packages/foundry/script/ListAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async function main() {

if (!privateKey) {
console.log(
"🚫️ You don't have a deployer account. Run `yarn generate` first"
"🚫️ You don't have a deployer account. Run `pnpm generate` first"
);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/app/blockexplorer/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const BlockExplorer: NextPage = () => {
<>
<p className="font-bold mt-0 mb-1">Cannot connect to local provider</p>
<p className="m-0">
- Did you forget to run <code className="italic bg-base-300 text-base font-bold">yarn chain</code> ?
- Did you forget to run <code className="italic bg-base-300 text-base font-bold">pnpm chain</code> ?
</p>
<p className="mt-1 break-normal">
- Or you can change <code className="italic bg-base-300 text-base font-bold">targetNetwork</code> in{" "}
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/components/scaffold-eth/Faucet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const Faucet = () => {
<>
<p className="font-bold mt-0 mb-1">Cannot connect to local provider</p>
<p className="m-0">
- Did you forget to run <code className="italic bg-base-300 text-base font-bold">yarn chain</code> ?
- Did you forget to run <code className="italic bg-base-300 text-base font-bold">pnpm chain</code> ?
</p>
<p className="mt-1 break-normal">
- Or you can change <code className="italic bg-base-300 text-base font-bold">targetNetwork</code> in{" "}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const useScaffoldWriteContract = <TContractName extends ContractName>(
options?: ScaffoldWriteContractOptions,
) => {
if (!deployedContractData) {
notification.error("Target Contract is not deployed, did you forget to run `yarn deploy`?");
notification.error("Target Contract is not deployed, did you forget to run `pnpm deploy`?");
return;
}

Expand Down Expand Up @@ -90,7 +90,7 @@ export const useScaffoldWriteContract = <TContractName extends ContractName>(
options?: Omit<ScaffoldWriteContractOptions, "onBlockConfirmation" | "blockConfirmations">,
) => {
if (!deployedContractData) {
notification.error("Target Contract is not deployed, did you forget to run `yarn deploy`?");
notification.error("Target Contract is not deployed, did you forget to run `pnpm deploy`?");
return;
}
if (!chain?.id) {
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/vercel.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"installCommand": "yarn install"
"installCommand": "pnpm install --frozen-lockfile"
}
Loading
Loading