cargo-casper

Crates.iocargo-casper
lib.rscargo-casper
version2.2.0
sourcesrc
created_at2020-11-11 16:22:22.398049
updated_at2024-02-09 12:29:53.437257
descriptionA command line tool for creating a Wasm smart contract and tests for use on the Casper network.
homepagehttps://casperlabs.io
repositoryhttps://github.com/casper-ecosystem/cargo-casper
max_upload_size
id311294
size68,495
(casperlabs-drone)

documentation

https://docs.rs/cargo-casper

README

cargo-casper

Crates.io License

A command line tool for creating a Wasm smart contract and tests for use on the Casper network.


Installation

cargo casper is a Cargo subcommand which can be installed via cargo install:

cargo install cargo-casper

To install from the latest dev branch:

git clone https://github.com/casper-ecosystem/cargo-casper
cargo install cargo-casper --path=cargo-casper

Usage

To create a folder "my_project" containing a basic example contract and a separate test crate for the contract:

cargo casper my_project

This creates the following files:

my_project/
├── contract
│   ├── .cargo
│   │   └── config.toml
│   ├── Cargo.toml
│   └── src
│       └── main.rs
├── Makefile
├── rust-toolchain
├── tests
│   ├── Cargo.toml
│   └── src
│       └── integration_tests.rs
└── .travis.yml

Building the contract

To build the contract, the correct version of Rust must be installed along with the Wasm target:

cd my_project
make prepare

The contract can now be built using:

make build-contract

and will be built to my_project/contract/target/wasm32-unknown-unknown/release/contract.wasm.

Testing the contract

Running the test will automatically build the contract in release mode, copy it to the "tests/wasm" folder, then build and run the test:

make test

License

Licensed under the Apache License Version 2.0.

Commit count: 183

cargo fmt