Skip to content

Commit 22e56e0

Browse files
committed
Scaffold-ETH 2 migration
1 parent 2d6c73a commit 22e56e0

File tree

719 files changed

+119503
-8553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

719 files changed

+119503
-8553
lines changed

README.md

+50-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,42 @@
1-
# 🏗 Scaffold-ETH 2
1+
# OracleReader based on Scaffold-ETH 2
2+
3+
To run this example, which uses the Foundry tooling, we first need to fork the [Sepolia network](https://sepolia.etherscan.io/).
4+
5+
In a terminal window do
6+
7+
```
8+
export ETH_RPC_URL='https://your-sepolia-rpc-server/etc'
9+
yarn chainsep
10+
```
11+
12+
In a second terminal window do
13+
14+
```
15+
export DEPLOYER_PRIVATE_KEY="0xdeadbeefcafebabe"
16+
cd packages/foundry
17+
cp .env.example .env
18+
yarn deploy
19+
```
20+
21+
when this completes, you should be see a contract address in the output:
22+
23+
```
24+
...
25+
##### sepolia
26+
✅ [Success]Hash: 0xda5b4871929d1414a5b447769f4d8d757b1aea8e280555adb9dd7ec67bb6b683
27+
Contract Address: 0xA2B4473120b9d18abfE90EEb2722A57CB72C4212
28+
```
29+
30+
Now, you can verify that you can read with the Foundry `cast` command:
31+
32+
```
33+
🦄 cast call 0xA2B4473120b9d18abfE90EEb2722A57CB72C4212 'read()(uint)'
34+
3319415000000000000000 [3.319e21]
35+
```
36+
37+
Note that because this is a fork of the Sepolia network, you should be getting a pretty up-to-date value for `ETH/USD`.
38+
39+
# 🏗 Scaffold-ETH 2 [ORIGINAL README]
240

341
<h4 align="center">
442
<a href="https://docs.scaffoldeth.io">Documentation</a> |
@@ -7,7 +45,7 @@
745

846
🧪 An open-source, up-to-date toolkit for building decentralized applications (dapps) on the Ethereum blockchain. It's designed to make it easier for developers to create and deploy smart contracts and build user interfaces that interact with those contracts.
947

10-
⚙️ Built using NextJS, RainbowKit, Hardhat, Wagmi, Viem, and Typescript.
48+
⚙️ Built using NextJS, RainbowKit, Foundry, Wagmi, Viem, and Typescript.
1149

1250
-**Contract Hot Reload**: Your frontend auto-adapts to your smart contract as you edit it.
1351
- 🪝 **[Custom hooks](https://docs.scaffoldeth.io/hooks/)**: Collection of React hooks wrapper around [wagmi](https://wagmi.sh/) to simplify interactions with smart contracts with typescript autocompletion.
@@ -29,11 +67,10 @@ Before you begin, you need to install the following tools:
2967

3068
To get started with Scaffold-ETH 2, follow the steps below:
3169

32-
1. Clone this repo & install dependencies
70+
1. Install dependencies if it was skipped in CLI:
3371

3472
```
35-
git clone https://github.com/scaffold-eth/scaffold-eth-2.git
36-
cd scaffold-eth-2
73+
cd my-dapp-example
3774
yarn install
3875
```
3976

@@ -43,15 +80,15 @@ yarn install
4380
yarn chain
4481
```
4582

46-
This command starts a local Ethereum network using Hardhat. The network runs on your local machine and can be used for testing and development. You can customize the network configuration in `hardhat.config.ts`.
83+
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`.
4784

4885
3. On a second terminal, deploy the test contract:
4986

5087
```
5188
yarn deploy
5289
```
5390

54-
This command deploys a test smart contract to the local network. The contract is located in `packages/hardhat/contracts` and can be modified to suit your needs. The `yarn deploy` command uses the deploy script located in `packages/hardhat/deploy` to deploy the contract to the network. You can also customize the deploy script.
91+
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.
5592

5693
4. On a third terminal, start your NextJS app:
5794

@@ -61,11 +98,12 @@ yarn start
6198

6299
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`.
63100

64-
Run smart contract test with `yarn hardhat:test`
101+
Run smart contract test with `yarn foundry:test`
102+
103+
- Edit your smart contract `YourContract.sol` in `packages/foundry/contracts`
104+
- Edit your frontend homepage at `packages/nextjs/app/page.tsx`. For guidance on [routing](https://nextjs.org/docs/app/building-your-application/routing/defining-routes) and configuring [pages/layouts](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts) checkout the Next.js documentation.
105+
- Edit your deployment scripts in `packages/foundry/script`
65106

66-
- Edit your smart contract `YourContract.sol` in `packages/hardhat/contracts`
67-
- Edit your frontend in `packages/nextjs/pages`
68-
- Edit your deployment scripts in `packages/hardhat/deploy`
69107

70108
## Documentation
71109

@@ -77,4 +115,4 @@ To know more about its features, check out our [website](https://scaffoldeth.io)
77115

78116
We welcome contributions to Scaffold-ETH 2!
79117

80-
Please see [CONTRIBUTING.MD](https://github.com/scaffold-eth/scaffold-eth-2/blob/main/CONTRIBUTING.md) for more information and guidelines for contributing to Scaffold-ETH 2.
118+
Please see [CONTRIBUTING.MD](https://github.com/scaffold-eth/scaffold-eth-2/blob/main/CONTRIBUTING.md) for more information and guidelines for contributing to Scaffold-ETH 2.

package.json

+29-22
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,42 @@
44
"private": true,
55
"workspaces": {
66
"packages": [
7-
"packages/hardhat",
8-
"packages/nextjs"
7+
"packages/*"
98
]
109
},
1110
"scripts": {
12-
"account": "yarn workspace @se-2/hardhat account",
13-
"chain": "yarn workspace @se-2/hardhat chain",
14-
"fork": "yarn workspace @se-2/hardhat fork",
15-
"deploy": "yarn workspace @se-2/hardhat deploy",
16-
"verify": "yarn workspace @se-2/hardhat verify",
17-
"hardhat-verify": "yarn workspace @se-2/hardhat hardhat-verify",
18-
"compile": "yarn workspace @se-2/hardhat compile",
19-
"generate": "yarn workspace @se-2/hardhat generate",
20-
"hardhat:lint": "yarn workspace @se-2/hardhat lint",
21-
"hardhat:lint-staged": "yarn workspace @se-2/hardhat lint-staged",
22-
"hardhat:test": "yarn workspace @se-2/hardhat test",
23-
"test": "yarn hardhat:test",
24-
"start": "yarn workspace @se-2/nextjs dev",
25-
"next:lint": "yarn workspace @se-2/nextjs lint",
26-
"next:format": "yarn workspace @se-2/nextjs format",
27-
"next:check-types": "yarn workspace @se-2/nextjs check-types",
11+
"account": "yarn workspace @se-2/foundry account",
12+
"chain": "yarn workspace @se-2/foundry chain",
13+
"chainsep": "yarn workspace @se-2/foundry chainsep",
14+
"compile": "yarn workspace @se-2/foundry compile",
15+
"deploy": "yarn workspace @se-2/foundry deploy",
16+
"deploy:verify": "yarn workspace @se-2/foundry deploy:verify",
17+
"flatten": "yarn workspace @se-2/foundry flatten",
18+
"fork": "yarn workspace @se-2/foundry fork",
19+
"format": "yarn next:format && yarn foundry:format",
20+
"foundry:format": "yarn workspace @se-2/foundry format",
21+
"foundry:lint": "yarn workspace @se-2/foundry lint",
22+
"foundry:test": "yarn workspace @se-2/foundry test",
23+
"generate": "yarn workspace @se-2/foundry generate",
2824
"postinstall": "husky install",
25+
"next:build": "yarn workspace @se-2/nextjs build",
26+
"next:check-types": "yarn workspace @se-2/nextjs check-types",
27+
"next:format": "yarn workspace @se-2/nextjs format",
28+
"next:lint": "yarn workspace @se-2/nextjs lint",
29+
"next:serve": "yarn workspace @se-2/nextjs serve",
2930
"precommit": "lint-staged",
31+
"start": "yarn workspace @se-2/nextjs dev",
32+
"test": "yarn foundry:test",
3033
"vercel": "yarn workspace @se-2/nextjs vercel",
31-
"vercel:yolo": "yarn workspace @se-2/nextjs vercel:yolo"
34+
"vercel:yolo": "yarn workspace @se-2/nextjs vercel:yolo",
35+
"verify": "yarn workspace @se-2/foundry verify"
3236
},
33-
"packageManager": "[email protected]",
3437
"devDependencies": {
35-
"husky": "^8.0.1",
36-
"lint-staged": "^13.0.3"
38+
"husky": "~8.0.3",
39+
"lint-staged": "~13.2.2"
40+
},
41+
"packageManager": "[email protected]",
42+
"engines": {
43+
"node": ">=18.17.0"
3744
}
3845
}

packages/foundry/.env.example

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
DEPLOYER_PRIVATE_KEY=
2+
ETHERSCAN_API_KEY=
3+
ALCHEMY_API_KEY=
4+
5+
# The Chronicle ETH/USD oracle on Sepolia.
6+
CHRONICLE_ORACLE=0xdd6D76262Fd7BdDe428dcfCd94386EbAe0151603
7+
# The Chronicle SelfKisser contract on Sepolia.
8+
SELF_KISSER=0x0Dcc19657007713483A5cA76e6A7bbe5f56EA37d

packages/foundry/.gitignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Compiler files
2+
cache/
3+
out/
4+
5+
# Ignores development broadcast logs
6+
/broadcast/*/31337/
7+
/broadcast/**/dry-run/
8+
9+
# Docs
10+
docs/
11+
12+
# Dotenv file
13+
.env
14+
localhost.json

packages/foundry/.prettier.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"arrowParens": "avoid",
3+
"printWidth": 120,
4+
"tabWidth": 2,
5+
"trailingComma": "all"
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"transactions": [
3+
{
4+
"hash": "0xda5b4871929d1414a5b447769f4d8d757b1aea8e280555adb9dd7ec67bb6b683",
5+
"transactionType": "CREATE",
6+
"contractName": "OracleReader",
7+
"contractAddress": "0xa2b4473120b9d18abfe90eeb2722a57cb72c4212",
8+
"function": null,
9+
"arguments": [
10+
"0xdd6D76262Fd7BdDe428dcfCd94386EbAe0151603",
11+
"0x0Dcc19657007713483A5cA76e6A7bbe5f56EA37d"
12+
],
13+
"transaction": {
14+
"from": "0x39abd7819e5632fa06d2ecbba45dca5c90687ee3",
15+
"gas": "0x43c63",
16+
"value": "0x0",
17+
"input": "0x60c060405234801561001057600080fd5b506040516102b63803806102b683398101604081905261002f916100bb565b6001600160a01b03828116608081905290821660a081905260405163c529a67960e01b815260048101929092529063c529a67990602401600060405180830381600087803b15801561008057600080fd5b505af1158015610094573d6000803e3d6000fd5b5050505050506100ee565b80516001600160a01b03811681146100b657600080fd5b919050565b600080604083850312156100ce57600080fd5b6100d78361009f565b91506100e56020840161009f565b90509250929050565b60805160a05161019f6101176000396000604b01526000818160a5015260cb015261019f6000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806332f929fc1461004657806357de26a41461008a578063a34fa092146100a0575b600080fd5b61006d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100926100c7565b604051908152602001610081565b61006d7f000000000000000000000000000000000000000000000000000000000000000081565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa158015610127573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014b9190610150565b905090565b60006020828403121561016257600080fd5b505191905056fea26469706673582212208171d90821f24165a244cd58296d8fc377933541495688233f9cec0ab27025ad64736f6c63430008150033000000000000000000000000dd6d76262fd7bdde428dcfcd94386ebae01516030000000000000000000000000dcc19657007713483a5ca76e6a7bbe5f56ea37d",
18+
"nonce": "0x33c",
19+
"chainId": "0xaa36a7"
20+
},
21+
"additionalContracts": [],
22+
"isFixedGasLimit": false
23+
}
24+
],
25+
"receipts": [
26+
{
27+
"status": "0x1",
28+
"cumulativeGasUsed": "0x34255",
29+
"logs": [
30+
{
31+
"address": "0xdd6d76262fd7bdde428dcfcd94386ebae0151603",
32+
"topics": [
33+
"0x75d30ca40c7bcd48e685894b82b864808b9cb566090efc53444a2e61742f18a3",
34+
"0x0000000000000000000000000dcc19657007713483a5ca76e6a7bbe5f56ea37d",
35+
"0x000000000000000000000000a2b4473120b9d18abfe90eeb2722a57cb72c4212"
36+
],
37+
"data": "0x",
38+
"blockHash": "0x1b9223f34d862974e464028c955e3f43b319850ac6fdee340192495b824334e5",
39+
"blockNumber": "0x5f34ab",
40+
"blockTimestamp": "0x668590f5",
41+
"transactionHash": "0xda5b4871929d1414a5b447769f4d8d757b1aea8e280555adb9dd7ec67bb6b683",
42+
"transactionIndex": "0x0",
43+
"logIndex": "0x0",
44+
"removed": false
45+
},
46+
{
47+
"address": "0x0dcc19657007713483a5ca76e6a7bbe5f56ea37d",
48+
"topics": [
49+
"0x3b6e7e6ff858d016edf22112c8596ecf8f0a55591a3b84c35b993e0de85a0c84",
50+
"0x000000000000000000000000a2b4473120b9d18abfe90eeb2722a57cb72c4212",
51+
"0x000000000000000000000000dd6d76262fd7bdde428dcfcd94386ebae0151603",
52+
"0x000000000000000000000000a2b4473120b9d18abfe90eeb2722a57cb72c4212"
53+
],
54+
"data": "0x",
55+
"blockHash": "0x1b9223f34d862974e464028c955e3f43b319850ac6fdee340192495b824334e5",
56+
"blockNumber": "0x5f34ab",
57+
"blockTimestamp": "0x668590f5",
58+
"transactionHash": "0xda5b4871929d1414a5b447769f4d8d757b1aea8e280555adb9dd7ec67bb6b683",
59+
"transactionIndex": "0x0",
60+
"logIndex": "0x1",
61+
"removed": false
62+
}
63+
],
64+
"logsBloom": "0x00000000000008000000000000040000040000000000000000000000000000000000000000000000020000000000000000800000000000000000000000000000000000000000000000020000000000000000000020000000000000000000000000000080000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000008000000000000080000000000040020000000000000000001000000000000000000000000000000000000000000002000000000000000000000000000000000040000000000000000000000000000000000080000040000000000200000000000000",
65+
"type": "0x0",
66+
"transactionHash": "0xda5b4871929d1414a5b447769f4d8d757b1aea8e280555adb9dd7ec67bb6b683",
67+
"transactionIndex": "0x0",
68+
"blockHash": "0x1b9223f34d862974e464028c955e3f43b319850ac6fdee340192495b824334e5",
69+
"blockNumber": "0x5f34ab",
70+
"gasUsed": "0x34255",
71+
"effectiveGasPrice": "0x3eba38bf4",
72+
"blobGasPrice": "0x2c7c04a10",
73+
"from": "0x39abd7819e5632fa06d2ecbba45dca5c90687ee3",
74+
"to": null,
75+
"contractAddress": "0xa2b4473120b9d18abfe90eeb2722a57cb72c4212",
76+
"root": "0x0000000000000000000000000000000000000000000000000000000000000000"
77+
}
78+
],
79+
"libraries": [],
80+
"pending": [],
81+
"returns": {},
82+
"timestamp": 1720029434,
83+
"chain": 11155111,
84+
"commit": "ef41476"
85+
}
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ignore 31337 deployments
2+
31337.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"networkName": "Sepolia"
3+
}

packages/foundry/foundry.toml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[profile.default]
2+
src = 'contracts'
3+
out = 'out'
4+
libs = ['lib']
5+
fs_permissions = [{ access = "read-write", path = "./"}]
6+
7+
[rpc_endpoints]
8+
default_network = "http://127.0.0.1:8545"
9+
localhost = "http://127.0.0.1:8545"
10+
11+
mainnet = "https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_API_KEY}"
12+
sepolia = "https://eth-sepolia.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
13+
arbitrum = "https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
14+
arbitrumSepolia = "https://arb-sepolia.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
15+
optimism = "https://opt-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
16+
optimismSepolia = "https://opt-sepolia.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
17+
polygon = "https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
18+
polygonMumbai = "https://polygon-mumbai.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
19+
gnosis = "https://rpc.gnosischain.com"
20+
chiado = "https://rpc.chiadochain.net"
21+
base = "https://mainnet.base.org"
22+
baseGoerli = "https://goerli.base.org"
23+
baseSepolia = "https://sepolia.base.org"
24+
polygonZkEvm = "https://polygonzkevm-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
25+
polygonZkEvmTestnet = "https://polygonzkevm-testnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
26+
zkSyncTestnet = "https://testnet.era.zksync.dev"
27+
zkSync = "https://mainnet.era.zksync.io"
28+
scrollSepolia = "https://sepolia-rpc.scroll.io"
29+
scroll = "https://rpc.scroll.io"
30+
31+
[etherscan]
32+
polygonMumbai = { key = "${ETHERSCAN_API_KEY}" }
33+
sepolia = { key = "${ETHERSCAN_API_KEY}" }
34+
35+
36+
[fmt]
37+
line_length = 80
38+
multiline_func_header = "params_first"
39+
40+
# See more config options https://github.com/foundry-rs/foundry/tree/master/config
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/Vm.sol linguist-generated

0 commit comments

Comments
 (0)