Skip to content

Commit 12fe507

Browse files
committed
Small changes to foundry tutorials
1 parent 49acab2 commit 12fe507

File tree

2 files changed

+44
-54
lines changed

2 files changed

+44
-54
lines changed

docs/ftso/guides/build-first-app.mdx

Lines changed: 20 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -35,65 +35,32 @@ Ensure you have the following tools installed:
3535
- [Foundry](https://book.getfoundry.sh/getting-started/installation)
3636
- [Node.js](https://nodejs.org/en/download/)
3737

38-
## Create a Foundry project
38+
## Start with flare template of a Foundry project
3939

40-
1. Create a new directory to hold your app and navigate inside it:
40+
Clone the [flare template](https://github.com/flare-foundation/flare-foundry-starter) and navigate into the project directory:
4141

42-
```bash
43-
mkdir ftsov2-app && cd ftsov2-app
44-
```
45-
46-
2. Initialize an empty Foundry project:
47-
48-
```bash
49-
forge init
50-
```
51-
52-
This creates several subdirectories like `src` and `test`, with some sample contracts in them.
42+
```bash
43+
git clone https://github.com/flare-foundation/flare-foundry-starter.git
44+
cd flare-foundry-starter
45+
```
5346

54-
3. Verify the setup by running the sample test:
47+
Install the project dependencies.
5548

56-
```bash
57-
forge test
58-
```
49+
```bash
50+
forge soldeer install
51+
```
5952

60-
The output should look similar to this:
53+
You might have to modify the `remappings.txt` so that `/src` part of path is before the non src part
54+
Like this
6155

62-
```plaintext
63-
[⠢] Compiling...
64-
No files changed, compilation skipped
65-
66-
Running 2 tests for test/Counter.t.sol:CounterTest
67-
[PASS] testFuzz_SetNumber(uint256) (runs: 256, μ: 27864, ~: 28409)
68-
[PASS] test_Increment() (gas: 28379)
69-
Test result: ok. 2 passed; 0 failed; 0 skipped; finished in 12.30ms
70-
71-
Ran 1 test suites: 2 tests passed, 0 failed, 0 skipped (2 total tests)
72-
```
73-
74-
4. Clean up by deleting the sample contracts and tests:
75-
76-
```bash
77-
rm -r src/* test/*
78-
```
79-
80-
## Install the Flare periphery
81-
82-
Install the Flare periphery package to interact with [FTSOv2 contracts](/ftso/solidity-reference).
83-
84-
1. Initialize an npm project and install the Flare periphery package:
85-
86-
```bash
87-
npm init -y
88-
npm i @flarenetwork/flare-periphery-contracts
89-
```
90-
91-
2. Create a file `remappings.txt` in the main directory, and add the following remappings to ensure Foundry can locate the installed packages:
92-
93-
```plaintext title="remappings.txt"
94-
@flarenetwork/flare-periphery-contracts/=node_modules/@flarenetwork/flare-periphery-contracts/
95-
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts
96-
```
56+
```bash
57+
@openzeppelin-contracts/=dependencies/@openzeppelin-contracts-5.2.0-rc.1/
58+
flare-periphery/=dependencies/flare-periphery-0.0.1/
59+
forge-std/=dependencies/forge-std-1.9.5/src/
60+
forge-std/=dependencies/forge-std-1.9.5/
61+
surl/=dependencies/surl-0.0.0/src/
62+
surl/=dependencies/surl-0.0.0/
63+
```
9764

9865
## Create and compile a contract
9966

docs/network/guides/hardhat-foundry-starter-kit.mdx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,25 @@ cd flare-foundry-starter
182182
Install the project dependencies.
183183

184184
```bash
185-
forge install
185+
forge soldeer install
186+
```
187+
188+
You might have to modify the `remappings.txt` so that `/src` part of path is before the non src part
189+
Like this
190+
191+
```bash
192+
@openzeppelin-contracts/=dependencies/@openzeppelin-contracts-5.2.0-rc.1/
193+
flare-periphery/=dependencies/flare-periphery-0.0.1/
194+
forge-std/=dependencies/forge-std-1.9.5/src/
195+
forge-std/=dependencies/forge-std-1.9.5/
196+
surl/=dependencies/surl-0.0.0/src/
197+
surl/=dependencies/surl-0.0.0/
186198
```
187199

188200
#### Setting up environment variables
189201

202+
Copy `.env.example` to `.env` and update it with your settings.
203+
190204
Add `PRIVATE_KEY` to your environment variables.
191205

192206
```text
@@ -201,6 +215,15 @@ PRIVATE_KEY=your_private_key_here
201215

202216
:::
203217

218+
You now need to add the information from the `.env` file to your bash profile.
219+
Run the following command to add the information to your bash profile.
220+
221+
```bash
222+
source .env
223+
```
224+
225+
You need to do this every time you open a new terminal or change the `.env` file.
226+
204227
### Compile, test and deploy
205228

206229
Compile the smart contracts to generate the necessary artifacts.

0 commit comments

Comments
 (0)