Skip to content

Commit

Permalink
Showcase CLI demo
Browse files Browse the repository at this point in the history
  • Loading branch information
mgralinski-bright committed Jan 30, 2024
1 parent 0c55a74 commit bcc8ff2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
*.mov filter=lfs diff=lfs merge=lfs -text
8 changes: 5 additions & 3 deletions README.md
Expand Up @@ -5,12 +5,14 @@ This project is a dApp for raising and solving the disputes on the Substrate-bas
1. `cargo-contract 3.0.1`
2. `ink-wrapper 0.5.0`
3. `rustc-1.69`
4. `jq`

## Build (manually)
Before building a smart contract we need to download submodules:
Before running anything, please update submodules.
```
git submodule update --init --recursive
```
## Build (manually)
Bright Disputes is actually a smart contract and a CLI, which allows to execute commands on the Substrate node. In this section we will present how to manually build them.

### Building smart contract
To build a smart contract locally we can run:
Expand All @@ -31,7 +33,7 @@ Follow the instructions from the [README](https://github.com/bright/bright-dispu
## Build (docker)
Smart contract can be build with the Docker:
```
DOCKER_BUILDKIT=1 docker build -f docker/Dockerfile --output artifacts .
DOCKER_BUILDKIT=1 docker build -f docker/Dockerfile --output artifacts .
```
This will export *bright_disputes.json*, *bright_disputes.wasm*, *bright_disputes.contract*, to the *artifacts* directory.

Expand Down
8 changes: 6 additions & 2 deletions doc/README_CLI.md
Expand Up @@ -16,9 +16,13 @@ When the `deploy.sh` script succeed our smart contract will be deployed on the a
```
or we can find it in the file `scripts/addresses.json`.

Cli allows us to set smart contract address by calling:
CLI allows us to set smart contract address by calling:
```
../cli/target/release/bright_disputes_cli set-contract 5F3bNYZMgeDvqVCnS4sMdWavuyWDwht6yuK8sL2gxc3PP2xg
../cli/target/release/bright_disputes_cli set-contract 5D9yNgyQMjJ98K3mW3BKY5Rt57eWxyFBwD8jTtCviWTGeyWj
```
Please note, if you are not on the linux platform you can use `cli.sh` script to run commands as follow:
```
bash ../scripts/cli.sh "cli/target/release/bright_disputes_cli set-contract 5D9yNgyQMjJ98K3mW3BKY5Rt57eWxyFBwD8jTtCviWTGeyWj"
```

We will start from creating a new dispute, and we are going to use accounts from our script:
Expand Down
3 changes: 3 additions & 0 deletions doc/showcase_cli.mov
Git LFS file not shown
10 changes: 10 additions & 0 deletions scripts/cli.sh
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

export SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
export INK_DEV_IMAGE="brightinventions/disputes-ink-dev"
docker run --rm \
-v "${SCRIPT_DIR}/../":/code \
--network host \
--entrypoint /bin/sh \
"${INK_DEV_IMAGE}" \
-c "cd /code/cli && ${1}"

0 comments on commit bcc8ff2

Please sign in to comment.