Skip to content

Commit 9e36898

Browse files
authored
fix(docs): minor changes to foundry guides (#556)
2 parents 49acab2 + 153e839 commit 9e36898

File tree

2 files changed

+36
-49
lines changed

2 files changed

+36
-49
lines changed

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

Lines changed: 13 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -35,64 +35,30 @@ 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+
## Clone the Foundry template
3939

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

4242
```bash
43-
mkdir ftsov2-app && cd ftsov2-app
43+
git clone https://github.com/flare-foundation/flare-foundry-starter.git
44+
cd flare-foundry-starter
4445
```
4546

46-
2. Initialize an empty Foundry project:
47+
2. Install the project dependencies:
4748

4849
```bash
49-
forge init
50+
forge soldeer install
5051
```
5152

52-
This creates several subdirectories like `src` and `test`, with some sample contracts in them.
53-
54-
3. Verify the setup by running the sample test:
55-
56-
```bash
57-
forge test
58-
```
59-
60-
The output should look similar to this:
61-
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:
53+
3. You might need to modify `remappings.txt` so `/src` paths are read correctly, e.g.:
9254

9355
```plaintext title="remappings.txt"
94-
@flarenetwork/flare-periphery-contracts/=node_modules/@flarenetwork/flare-periphery-contracts/
95-
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts
56+
@openzeppelin-contracts/=dependencies/@openzeppelin-contracts-5.2.0-rc.1/
57+
flare-periphery/=dependencies/flare-periphery-0.0.1/
58+
forge-std/=dependencies/forge-std-1.9.5/src/
59+
forge-std/=dependencies/forge-std-1.9.5/
60+
surl/=dependencies/surl-0.0.0/src/
61+
surl/=dependencies/surl-0.0.0/
9662
```
9763

9864
## Create and compile a contract

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

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Install the following prerequisites:
172172

173173
#### Cloning and installing dependencies
174174

175-
Clone the [template repository](https://github.com/flare-foundation/flare-foundry-starter) and navigate into the project directory.
175+
Clone the [flare-foundry-starter](https://github.com/flare-foundation/flare-foundry-starter) and navigate into the project directory.
176176

177177
```bash
178178
git clone https://github.com/flare-foundation/flare-foundry-starter.git
@@ -182,11 +182,24 @@ cd flare-foundry-starter
182182
Install the project dependencies.
183183

184184
```bash
185-
forge install
185+
forge soldeer install
186+
```
187+
188+
You might need to modify `remappings.txt` so `/src` paths are read correctly, e.g.:
189+
190+
```bash
191+
@openzeppelin-contracts/=dependencies/@openzeppelin-contracts-5.2.0-rc.1/
192+
flare-periphery/=dependencies/flare-periphery-0.0.1/
193+
forge-std/=dependencies/forge-std-1.9.5/src/
194+
forge-std/=dependencies/forge-std-1.9.5/
195+
surl/=dependencies/surl-0.0.0/src/
196+
surl/=dependencies/surl-0.0.0/
186197
```
187198

188199
#### Setting up environment variables
189200

201+
Copy `.env.example` to `.env` and update it with your settings.
202+
190203
Add `PRIVATE_KEY` to your environment variables.
191204

192205
```text
@@ -201,6 +214,14 @@ PRIVATE_KEY=your_private_key_here
201214

202215
:::
203216

217+
You now need to add the information from the `.env` file to your bash profile:
218+
219+
```bash
220+
source .env
221+
```
222+
223+
You need to do this every time you open a new terminal or change the `.env` file.
224+
204225
### Compile, test and deploy
205226

206227
Compile the smart contracts to generate the necessary artifacts.

0 commit comments

Comments
 (0)