Skip to content

Commit bd19fb6

Browse files
Merge pull request #11 from chronicleprotocol/Streamline
Streamline tutorial
2 parents 8ea836e + 972c69c commit bd19fb6

File tree

4 files changed

+38
-72
lines changed

4 files changed

+38
-72
lines changed

Diff for: OracleReader.png

246 KB
Loading

Diff for: README.md

+34-67
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,7 @@
1-
# OracleReader based on Scaffold-ETH 2
1+
# 🏗 OracleReader Built on Scaffold-ETH 2
22

3-
To run this example, which uses the Foundry tooling, we first need to fork the [Sepolia network](https://sepolia.etherscan.io/).
43

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]
40-
41-
<h4 align="center">
42-
<a href="https://docs.scaffoldeth.io">Documentation</a> |
43-
<a href="https://scaffoldeth.io">Website</a>
44-
</h4>
45-
46-
🧪 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.
4+
🧪 An open-source, toolkit for building decentralized applications (dapps) on the Ethereum blockchain and integrating with Chronicle Oracles. It's designed to make it easier for developers to create and deploy smart contracts and build user interfaces that interact with those contracts.
475

486
⚙️ Built using NextJS, RainbowKit, Foundry, Wagmi, Viem, and Typescript.
497

@@ -53,7 +11,8 @@ Note that because this is a fork of the Sepolia network, you should be getting a
5311
- 🔥 **Burner Wallet & Local Faucet**: Quickly test your application with a burner wallet and local faucet.
5412
- 🔐 **Integration with Wallet Providers**: Connect to different wallet providers and interact with the Ethereum network.
5513

56-
![Debug Contracts tab](https://github.com/scaffold-eth/scaffold-eth-2/assets/55535804/b237af0c-5027-4849-a5c1-2e31495cccb1)
14+
![Oracle Reader](OracleReader.png)
15+
5716

5817
## Requirements
5918

@@ -63,34 +22,55 @@ Before you begin, you need to install the following tools:
6322
- Yarn ([v1](https://classic.yarnpkg.com/en/docs/install/) or [v2+](https://yarnpkg.com/getting-started/install))
6423
- [Git](https://git-scm.com/downloads)
6524

66-
## Quickstart
25+
## 🏃🏻‍♂️ Running It
6726

68-
To get started with Scaffold-ETH 2, follow the steps below:
27+
To run this example, which uses the Foundry tooling in conjunction with [Scaffold-ETH2](https://scaffoldeth.io), you first need to fork the [Sepolia network](https://sepolia.etherscan.io/).
6928

70-
1. Install dependencies if it was skipped in CLI:
29+
In a terminal window install dependencies:
7130

7231
```
7332
cd my-dapp-example
7433
yarn install
7534
```
7635

77-
2. Run a local network in the first terminal:
36+
Fork your target network, leave this terminal window open as it runs your local chain.
7837

7938
```
80-
yarn chain
39+
export ETH_RPC_URL='https://your-sepolia-rpc-server/etc'
40+
yarn fork
8141
```
8242

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`.
8443

85-
3. On a second terminal, deploy the test contract:
44+
45+
In a second terminal window, you can now deploy your contracts to the local chain:
8646

8747
```
48+
export DEPLOYER_PRIVATE_KEY="0xdeadbeefcafebabe"
49+
cd packages/foundry
50+
cp .env.example .env
8851
yarn deploy
8952
```
9053

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.
54+
When this completes, you should see a contract address in the output:
55+
56+
```
57+
...
58+
##### sepolia
59+
✅ [Success]Hash: 0xda5b4871929d1414a5b447769f4d8d757b1aea8e280555adb9dd7ec67bb6b683
60+
Contract Address: 0xA2B4473120b9d18abfE90EEb2722A57CB72C4212
61+
```
9262

93-
4. On a third terminal, start your NextJS app:
63+
Now, you can verify that you can read with the Foundry `cast` command:
64+
65+
```
66+
🦄 cast call 0xA2B4473120b9d18abfE90EEb2722A57CB72C4212 'read()(uint)'
67+
3319415000000000000000 [3.319e21]
68+
```
69+
70+
Note that because this is a fork of the Sepolia network, you should be getting a pretty up-to-date value for `ETH/USD`.
71+
72+
73+
You can now start your NextJS app:
9474

9575
```
9676
yarn start
@@ -103,16 +83,3 @@ Run smart contract test with `yarn foundry:test`
10383
- Edit your smart contract `YourContract.sol` in `packages/foundry/contracts`
10484
- 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.
10585
- Edit your deployment scripts in `packages/foundry/script`
106-
107-
108-
## Documentation
109-
110-
Visit our [docs](https://docs.scaffoldeth.io) to learn how to start building with Scaffold-ETH 2.
111-
112-
To know more about its features, check out our [website](https://scaffoldeth.io).
113-
114-
## Contributing to Scaffold-ETH 2
115-
116-
We welcome contributions to Scaffold-ETH 2!
117-
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.

Diff for: packages/foundry/deployments/.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# Ignore 31337 deployments
2-
31337.json
1+
# Ignore 11155111 deployments
2+
11155111.json

Diff for: packages/foundry/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
"scripts": {
55
"account": "node script/ListAccount.js",
66
"chain": "anvil --config-out localhost.json",
7-
"chainsep": "anvil --fork-url ${ETH_RPC_URL}",
87
"compile": "forge compile",
9-
"deploy": "forge build --build-info --build-info-path out/build-info/ && forge script script/Deploy.s.sol --rpc-url ${1:-default_network} --broadcast --legacy && node script/generateTsAbis.js",
8+
"deploy": "forge build --build-info --build-info-path out/build-info/ && forge script script/Deploy.s.sol --rpc-url ${1:-default_network} --broadcast --legacy && node script/generateTsAbis.js --chain-id 31337",
109
"deploy:verify": "forge build --build-info --build-info-path out/build-info/ && forge script script/Deploy.s.sol --rpc-url ${1:-default_network} --broadcast --legacy --verify ; node script/generateTsAbis.js",
1110
"flatten": "forge flatten",
12-
"fork": "anvil --fork-url ${0:-mainnet} --chain-id 31337 --config-out localhost.json",
11+
"fork": "anvil --fork-url ${ETH_RPC_URL} --chain-id 31337 --config-out localhost.json",
1312
"format": "forge fmt && prettier --write ./script/**/*.js",
1413
"generate": "node script/generateAccount.js",
1514
"lint": "forge fmt --check && prettier --check ./script/**/*.js",

0 commit comments

Comments
 (0)