-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creating a new file for interacting with smart contract
- Loading branch information
Showing
3 changed files
with
62 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
docs/tutorials/dapp-development/lottery-game/interact-smart-contact.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
sidebar_position: 4 | ||
title: Interact with the Smart Contract | ||
description: Interacting with the smartcontract | ||
--- | ||
|
||
### Approving Smart Contract Spending | ||
|
||
```bash | ||
aelf-command send ASh2Wt7nSEmYqnGxPPzp4pnVDU4uhj1XW9Se5VeZcX2UDdyjx -a $WALLET_ADDRESS -p $WALLET_PASSWORD -e https://tdvw-test-node.aelf.io Approve | ||
``` | ||
|
||
:::tip | ||
ℹ️ Note: `ASh2Wt7nSEmYqnGxPPzp4pnVDU4uhj1XW9Se5VeZcX2UDdyjx` is the contract address of `Multitoken Contract` on aelf Testnet Sidechain (tDVW). | ||
::: | ||
|
||
When prompted, enter the following parameters to approve the spending of 90 ELF tokens: | ||
|
||
```terminal | ||
Enter the params one by one, type `Enter` to skip optional param: | ||
? Enter the required param <spender>: $CONTRACT_ADDRESS | ||
? Enter the required param <symbol>: ELF | ||
? Enter the required param <amount>: 9000000000 | ||
``` | ||
|
||
### Initializing Lottery Game Contract | ||
|
||
```bash | ||
aelf-command send $CONTRACT_ADDRESS -a $WALLET_ADDRESS -p $WALLET_PASSWORD -e https://tdvw-test-node.aelf.io Initialize | ||
``` | ||
|
||
### 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 | ||
``` | ||
|
||
### Playing the Lottery Game | ||
|
||
```bash | ||
aelf-command send $CONTRACT_ADDRESS -a $WALLET_ADDRESS -p $WALLET_PASSWORD -e https://tdvw-test-node.aelf.io Play | ||
``` | ||
|
||
Let's check the `balance` | ||
|
||
```bash | ||
aelf-command call ASh2Wt7nSEmYqnGxPPzp4pnVDU4uhj1XW9Se5VeZcX2UDdyjx -a $WALLET_ADDRESS -p $WALLET_PASSWORD -e https://tdvw-test-node.aelf.io GetBalance | ||
``` | ||
|
||
You will be prompted for the following: | ||
|
||
```terminal | ||
Enter the required param <symbol>: ELF | ||
Enter the required param <owner>: $WALLET_ADDRESS | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters