You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -34,13 +34,13 @@ The **Ping-Pong app** is a very simple decentralized application that allows use
34
34
35
35
Endpoints available:
36
36
37
-
-`ping`: sending funds to the contract.
37
+
-`ping`: sending funds to the contract;
38
38
-`pong`: claiming the same amount back.
39
39
40
40
Rules:
41
41
42
-
- Each user can only `ping` once before they `pong`.
43
-
- The `ping` amount must be exactly the specified value—no more, no less.
42
+
- Each user can only `ping` once before they `pong`;
43
+
- The `ping` amount must be exactly the specified value - no more, no less;
44
44
-`pong` becomes available only after a set waiting period following a `ping`.
45
45
46
46
[comment]: #(mx-exclude-context)
@@ -55,7 +55,7 @@ Rules:
55
55
56
56
For the web application, we will have two pages:
57
57
58
-
-**Sign in** - The page where you can authenticate using the **xPortal app**, **Ledger**, **DeFi Wallet**, **xAlias**, **Web Wallet**, **Passkey Proxy** or with **Metamask proxy**;
58
+
-**Sign in** - The page where you can authenticate using the **xPortal App**, **Ledger**, **DeFi Wallet**, **xAlias**, **Web Wallet**, **Passkey Proxy** or **Metamask Proxy**;
59
59
-**Dashboard** - Here, you can either `ping` or `pong`. If you have already deposited, you will see a countdown timer until the time interval resets.
60
60
61
61
[comment]: #(mx-context-auto)
@@ -73,14 +73,14 @@ The contract also includes several views, storage mappers and one event:
73
73
-`getPongEnableTimestamp`: **view** that provides the timestamp when `pong` will be available for a given address;
74
74
-`getTimeToPong`: **view** that shows the remaining time until `pong` is enabled for a specific address;
75
75
-`getAcceptedPaymentToken`: **storage mapper** that saves the token type allowed for deposits;
76
-
-`getPingAmount`: **storage mapper** that records recording the total amount of tokens deposited;
77
-
-`getDurationTimestamp`: **storage mapper** that saves the lock duration (in seconds) before `pong` can be called after a `ping`;
76
+
-`getPingAmount`: **storage mapper** that records the total amount of tokens deposited;
77
+
-`getDurationTimestamp`: **storage mapper** that saves the lock duration (in milliseconds) before `pong` can be called after a `ping`;
78
78
-`getUserPingTimestamp`: **storage mapper** that saves the timestamp of the block where the user `ping`-ed;
79
79
-`pongEvent`: **event** that signals a successful `pong` by the user with amount.
80
80
81
81
Think of this smart contract as the API for our dApp, handling all the core business logic.
82
82
83
-
To test it out, we will use [MultiversX Blockchain Devnet Explorer](https://devnet-explorer.multiversx.com/)—a public test network maintained by our community.
83
+
To test it out, we will use [MultiversX Blockchain Devnet Explorer](https://devnet-explorer.multiversx.com/) - a public test network maintained by our community.
84
84
85
85
[comment]: #(mx-context-auto)
86
86
@@ -107,7 +107,7 @@ By the time we are done, our project will have three subfolders: wallet, contrac
107
107
108
108
### Create wallet
109
109
110
-
To deploy a smart contract to the blockchain, you will need a wallet-a PEM file is recommended for simplicity and ease of testing.
110
+
To deploy a smart contract to the blockchain, you will need a wallet: a **PEM file** is recommended for simplicity and ease of testing.
111
111
112
112
:::important
113
113
Make sure you are in the `ping-pong/` folder before continuing.
@@ -124,7 +124,7 @@ PEM wallets are recommended only for testing and experimenting with non-producti
124
124
125
125
To initiate transactions on the blockchain, your wallet needs funds to cover transaction fees, commonly referred to as **gas**.
126
126
127
-
The [MultiversX Devnet](https://devnet-wallet.multiversx.com/dashboard) offers a **faucet** where you can claim **5 EGLDevery 24 hours**. Here’s how to fund your wallet:
127
+
The [MultiversX Devnet](https://devnet-wallet.multiversx.com/dashboard) offers a **faucet** where you can claim **5 EGLD**. You can recall the faucet every **24 hours** if your balance is **lower than 1 EGLD**. Here’s how to fund your wallet:
128
128
129
129
1. Go to [Devnet Wallet MultiversX](https://devnet-wallet.multiversx.com/unlock/pem) and log in using your newly generated **PEM** file;
130
130
2. Once logged in, open the **Faucet** from the **Tools**;
@@ -136,9 +136,9 @@ The [MultiversX Devnet](https://devnet-wallet.multiversx.com/dashboard) offers a
136
136
137
137
## The Blockchain Layer
138
138
139
-
With the wallet setup complete, let's move on to the backend—the blockchain layer.
139
+
With the wallet setup complete, let's move on to the backend - the blockchain layer.
140
140
141
-
Let's start with the smart contract. You will first clone the Ping-Pong sample contract repository from [here](https://github.com/multiversx/mx-ping-pong-sc).
141
+
Let's start with the smart contract. You will first clone the Ping-Pong sample contract [repository](https://github.com/multiversx/mx-ping-pong-sc).
142
142
143
143
:::important
144
144
Make sure you are still in the `ping-pong/` folder.
@@ -154,7 +154,7 @@ This will create a **contract** folder within ping-pong, containing all the nece
154
154
155
155
### Build the Smart Contract
156
156
157
-
Now that you have the source code for the smart contract, you need to compile it into a **binary** that the **MultiversX Virtual Machine** can execute. Since the VM runs Web Assembly (WASM) code, you need to compile our Rust source code into a WASM file.
157
+
Now that you have the source code for the smart contract, you need to compile it into a **binary** that the **MultiversX Virtual Machine**(VM) can execute. Since the VM runs Web Assembly (WASM) code, you need to compile our Rust source code into a WASM file.
158
158
159
159
At path `ping-pong/`, run the following command to build the smart contract into a WASM file.
160
160
@@ -179,32 +179,30 @@ Ensure that `wallet_owner.pem` is in the `wallet/` folder and that the smart con
179
179
180
180
Before deploying, you will need to modify the wallet from which transactions are made. Currently, they are made from a test wallet. To use the wallet you created [earlier](./your-first-dapp.md#create-wallet), you will need to make the following changes:
181
181
182
-
In the file `interact.rs` located at the path `ping-pong/contract/ping-pong/interactor/src`, the variable `alice_wallet_address` from `new` function will be modified.
182
+
In the file [`interact.rs`](https://github.com/multiversx/mx-ping-pong-sc/blob/e1b3e0e9657e83ad11cc0069c0fc7183f91a2fe1/ping-pong/interactor/src/interact.rs#L84) located at the path `ping-pong/contract/ping-pong/interactor/src`, the variable `wallet_address_1` from `new` function will be modified.
You need to replace with the relative path from the **interactor crate** to the **created wallet**.
196
196
197
-
The interactor crate is located at `ping-pong/contract/ping-pong/interactor` and the wallet is in a higher-level directory: `ping-pong/wallet`.
197
+
The interactor crate is located at `ping-pong/contract/ping-pong/interactor`, and the wallet is in a higher-level directory: `ping-pong/wallet`.
198
198
199
-
To access `wallet-owner.pem`you must navigate up three folders: `../../../`, then into the **wallet** directory.
199
+
Alternatively, you can add the absolute path of `wallet-owner.pem`.
200
200
:::
201
201
202
-
Make sure to add the absolute path at `Wallet::from_pem_file("/ping-pong/wallet/wallet-owner.pem")`, completing the missing directories above "ping-pong".
203
-
204
202
This next command deploys the Ping-Pong contract with the following settings:
0 commit comments