Cargo partisia-contract

Installation

To install the tool, go the folder this tool resides in and run the command

bash cargo install --path .

This will compile the command and install it in your Cargo bin directory.

Usage

Compiles Smart Contracts for the Partisia Blockchain to WASM- and ABI-files for deployment on-chain

``` text USAGE: cargo partisia-contract

OPTIONS: -h, --help Print help information

-V, --version
        Print version information

SUBCOMMANDS: build Compile the contract to WASM and generate an ABI file. help Print this message or the help of the given subcommand(s) new Create a new smart contract project. path-of-abi Print the expected ABI file path based on the context of Cargo.toml path-of-wasm Print the expected WASM file path based on the context of Cargo.toml print-version Print the client and binder version of the contract.

```

build

Compile the contract to WASM and generate an ABI file.

``` text USAGE: cargo partisia-contract build [OPTIONS]

OPTIONS: -h, --help Print help information -n, --no-abi Skip generating .abi file -r, --release Build artifacts in release mode, with optimizations ```

new

Create a new smart contract project.

``` text USAGE: cargo partisia-contract new [OPTIONS]

ARGS: The contract folder that will be created

OPTIONS: -h, --help Print help information -n, --name Set the name of the contract project created -v Initialize a new VCS repository for the given version control system. (git, hg, pijul, or fossil) or do not initialize any version control at all (none). If not specified, defaults to git.

```

path-of-abi

Print the expected ABI file path based on the context of Cargo.toml

``` text USAGE: cargo partisia-contract path-of-abi [OPTIONS]

OPTIONS: -h, --help Print help information -r, --release File is in release folder instead of debug ```

path-of-wasm

Print the expected WASM file path based on the context of Cargo.toml

``` text USAGE: cargo partisia-contract path-of-wasm [OPTIONS]

OPTIONS: -h, --help Print help information -r, --release File is in release folder instead of debug ```

print-version

This command prints the client and binder version of the contract. This is used to determine which binder can execute this contract and which version of the client code can read the ABI.

``` text USAGE: cargo partisia-contract print-version [OPTIONS]

ARGS: The wasm file to load

OPTIONS: -b, --bashlike Print the version as bash variables -h, --help Print help information ```

How to use

Go into the rust project containing your Cargo.toml and the contract.

An example for a contract written in rust can be found here.

When you are standing in the directory, run the following command to compile the contract and generate the ABI.

bash cargo partisia-contract build

This will build and write the contract and ABI files in the target/wasm32-unknown-unknown/debug.

If you run it with the flag --release, then the files will be in target/wasm32-unknown-unknown/release.