#casper #cargo

app cargo-casper

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

33 releases (stable)

2.2.0 Feb 9, 2024
2.1.1 Nov 27, 2023
2.1.0 May 12, 2023
2.0.7 Mar 9, 2023
0.1.0 Nov 11, 2020

#644 in Magic Beans

Download history 71/week @ 2023-10-29 26/week @ 2023-11-05 12/week @ 2023-11-12 19/week @ 2023-11-19 245/week @ 2023-11-26 12/week @ 2023-12-03 58/week @ 2023-12-10 8/week @ 2023-12-17 78/week @ 2023-12-24 13/week @ 2023-12-31 7/week @ 2024-01-07 50/week @ 2024-01-14 49/week @ 2024-01-21 172/week @ 2024-01-28 36/week @ 2024-02-04 154/week @ 2024-02-11

423 downloads per month

Apache-2.0

23KB
439 lines

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.

Dependencies

~5–16MB
~191K SLoC