Skip to content

Commit

Permalink
Fixing the documentation for lottery and hello contract (#122)
Browse files Browse the repository at this point in the history
* Fixing the documentation for lottery and hello contract

* Added a note for users

* Adding a smartcontract image and understanding
  • Loading branch information
AelfHarsh authored Jul 11, 2024
1 parent bc4d04d commit b0084e2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
14 changes: 11 additions & 3 deletions docs/quick-start/developers/_deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ You will be prompted to save your account, please do **save** your account as sh
? Save account info into a file? (Y/n) Y
```

**Make sure to choose Y to save your account information.**

:::tip
ℹ️ Note: If you do not save your account information (by selecting n or N), do not export the wallet password. Only **proceed to the next** step if you have saved your account information.
:::
Next, enter and confirm your password. Then export your wallet password as shown below:

```bash
Expand All @@ -34,7 +39,7 @@ import TabItem from '@theme/TabItem';
<Tabs>
<TabItem value="cli" label="CLI" default>

Run the following command to get testnet ELF tokens from faucet. Remember to either export your wallet address and wallet password or replace $WALLET_ADDRESS and $WALLET_ADDRESS with your wallet address and wallet password respectively.
Run the following command to get testnet ELF tokens from faucet. Remember to either export your wallet address and wallet password or replace `$WALLET_ADDRESS` and `$WALLET_PASSWORD` with your wallet address and wallet password respectively.

```bash
export WALLET_ADDRESS="YOUR_WALLET_ADDRESS"
Expand All @@ -59,7 +64,7 @@ You should see the result displaying your wallet's ELF balance.
</TabItem>
<TabItem value="web" label="Web" default>

Go to this url `<https://faucet-ui.aelf.dev>`. Enter your address and click `Get Tokens`.
Go to https://faucet-ui.aelf.dev Enter your address and click `Get Tokens`.

![result](/img/get-token-ui.png)

Expand All @@ -82,8 +87,11 @@ Please wait for approximately 1 to 2 minutes. If the deployment is successful, i

![result](/img/deploy-result.png)

Copy the smart contract address from the `address` field
![result](/img/Contract_Address.png)

Export your smart contract address:

```bash
export CONTRACT_ADDRESS="YOUR_SMART_CONTRACT_ADDRESS e.g. 2LUmicHyH4RXrMjG4beDwuDsiWJESyLkgkwPdGTR8kahRzq5XS"
```
```
21 changes: 17 additions & 4 deletions docs/quick-start/developers/lottery-game-smart-contract/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ management, event handling, and randomization in smart contracts.

## Step 1 - Setting up your development environment

import Setup from "../_setup.md"
import Setup from "../\_setup.md"

<Setup />

Expand Down Expand Up @@ -50,7 +50,7 @@ Firstly, rename `Protobuf/contract/hello_world_contract.proto` to `lottery_game_
mv Protobuf/contract/hello_world_contract.proto Protobuf/contract/lottery_game_contract.proto
```

Next, open the project with your IDE.
Next, open the project with your IDE.

The implementation of file `src/Protobuf/contract/lottery_game_contract.proto` is as follows:

Expand Down Expand Up @@ -1301,7 +1301,7 @@ You should see **LotteryGame.dll.patched** in the directory `lottery_game/src/bi

## Step 3 - Deploy Smart Contract

import Deploy from "../_deploy.md"
import Deploy from "../\_deploy.md"

<Deploy />

Expand Down Expand Up @@ -1332,12 +1332,25 @@ Enter the params one by one, type `Enter` to skip optional param:
aelf-command send $CONTRACT_ADDRESS -a $WALLET_ADDRESS -p $WALLET_PASSWORD -e https://tdvw-test-node.aelf.io Initialize
```

Output:
![result](/img/Initialize.png)

### Depositing funds into the Lottery Game Contract

```bash
aelf-command send $CONTRACT_ADDRESS -a $WALLET_ADDRESS -p $WALLET_PASSWORD -e https://tdvw-test-node.aelf.io Deposit
```

You will be prompted for the following:

```terminal
Enter the params one by one, type `Enter` to skip optional param:
? Enter the required param <value>: 20000
```

Output:
![result](/img/Deposit.png)

### Playing the Lottery Game

```bash
Expand All @@ -1355,4 +1368,4 @@ You will be prompted for the following:
```terminal
Enter the required param <symbol>: ELF
Enter the required param <owner>: $WALLET_ADDRESS
```
```
Binary file added static/img/Contract_Address.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/Deposit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/Initialize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b0084e2

Please sign in to comment.