@@ -13,25 +13,26 @@ Before we start, please make sure you have the following tools installed:
13
13
## Getting Started
14
14
15
15
Create a directory named ` coin-flip{:bash} ` in your filesystem.
16
- Open a terminal with ` coin-flip ` as the working directory and run ` forge init contracts ` to create a new Solidity project.
17
- You will see a new directory in ` coin-flip ` named ` contracts ` . ` contracts/src ` is where all your contract code will be.
16
+ We will use this directory as the working directory for the rest of the tutorial.
17
+ Let's initialize a new project in ` coin-flip{:bash} ` by running ` forge init contracts{:bash} ` .
18
+
19
+ This will create a new directory in ` coin-flip{:bash} ` named ` contracts/src ` , which will contain the smart contract code.
18
20
19
21
``` bash copy
20
22
mkdir coin-flip
21
23
cd coin-flip
22
24
forge init contracts
23
25
```
24
26
25
- Run ` cd contracts ` to make it your terminal's working directory — the following commands will need to be run from here.
26
- Next, install the Pyth Entropy SDK by running the following commands.
27
+ Now we will install the Pyth Entropy SDK in the ` contracts ` directory.
27
28
28
29
``` bash copy
29
30
cd contracts
30
31
npm init -y
31
32
npm install @pythnetwork/entropy-sdk-solidity
32
33
```
33
34
34
- Add a ` remappings.txt ` file to ` contracts ` directory with the following content.
35
+ Add a ` remappings.txt ` file to ` contracts ` directory with the following content to tell Foundry where to find the Pyth Entropy SDK .
35
36
36
37
``` text copy
37
38
@pythnetwork/entropy-sdk-solidity/=node_modules/@pythnetwork/entropy-sdk-solidity
@@ -97,8 +98,8 @@ contract CoinFlip {
97
98
98
99
Users will invoke the ` request ` method to initiate a coin flip, paying a fee in the process.
99
100
The method first retrieves the fee required to request a random number from Entropy.
100
- It then includes the fee in the ` requestV2 ` method call to Entropy.
101
- Finally, the method emits a ` FlipRequested ` event with a ` sequenceNumber ` . This event is also defined in the code snippet above.
101
+ It then includes the fee in the ` requestV2{:bash} ` method call to Entropy.
102
+ Finally, the method emits a ` FlipRequested{:bash} ` event with a ` sequenceNumber ` . This event is also defined in the code snippet above.
102
103
103
104
### Handle the callback
104
105
@@ -187,7 +188,7 @@ Deployed to: 0x8676ba0Dd492AB9813BC21D5Dce318427d1d73ae
187
188
Transaction hash: 0x2178aa6d402c94166a93e81822248d00dd003827675ebd49b3c542970f5a0189
188
189
```
189
190
190
- Let’ s export the coin flip contract address as environment variable for later use:
191
+ Let' s export the coin flip contract address as environment variable for later use:
191
192
192
193
``` bash copy
193
194
export COINFLIP_ADDRESS=< Deployed to address from above>
0 commit comments