24 releases (stable)

4.0.0 Nov 21, 2023
3.0.0 May 11, 2023
2.0.0 May 9, 2023
1.4.4 Apr 6, 2022
0.1.0 Nov 11, 2020

#1350 in Magic Beans

Download history 357/week @ 2024-03-14 335/week @ 2024-03-21 426/week @ 2024-03-28 324/week @ 2024-04-04 322/week @ 2024-04-11 301/week @ 2024-04-18 323/week @ 2024-04-25 283/week @ 2024-05-02 370/week @ 2024-05-09 347/week @ 2024-05-16 393/week @ 2024-05-23 346/week @ 2024-05-30 322/week @ 2024-06-06 353/week @ 2024-06-13 474/week @ 2024-06-20 485/week @ 2024-06-27

1,703 downloads per month
Used in 43 crates (32 directly)

Apache-2.0

1MB
21K SLoC

casper-contract

LOGO

Crates.io Documentation License

A library for developing Casper network smart contracts.

no_std

The crate is no_std, but uses the core and alloc crates. It is recommended to build Wasm smart contracts in a no_std environment as this generally yields smaller, and hence cheaper, binaries.

Compile-time features

no-std-helpers

Enabled by default.

Given that the library is intended to be consumed by smart-contract binaries, and that in a no_std environment these will all require to provide an alloc error handler and an eh_personality, then this crate provides these when no-std-helpers is enabled. This unfortunately requires the use of nightly Rust.

For further convenience, enabling this feature also provides a global allocator suitable for use in a no_std environment.

If you wish to use a different global allocator, or provide different panic/out-of-memory handlers, then add the following to your Cargo.toml:

casper-contract = { version = "1", default-features = false }

test-support

Disabled by default.

To help support smart contract debugging, enabling the test-support feature makes the function contract_api::runtime::print(text: &str) available. If the contract is being tested offchain using the casper-engine-test-support crate, then the contract can output text to the console for debugging.

casper-contract = { version = "1", features = ["test-support"] }

License

Licensed under the Apache License Version 2.0.

Dependencies

~8MB
~162K SLoC