#smart-contracts #proc-macro #procedural #concordium #blockchain #testing #concordium-std

macro concordium-std-derive

Procedural macros to generate concordium type constants from strings, that makes writing smart contracts on the Concordium blockchain easier

1 stable release

new 6.0.0 Apr 4, 2024
5.2.0 May 8, 2023
5.1.0 Dec 14, 2022
5.0.0 Nov 21, 2022
0.3.0 Dec 15, 2020

#9 in #concordium

Download history 30/week @ 2023-12-18 13/week @ 2023-12-25 2/week @ 2024-01-01 23/week @ 2024-01-08 33/week @ 2024-01-15 14/week @ 2024-01-22 4/week @ 2024-01-29 17/week @ 2024-02-05 22/week @ 2024-02-12 42/week @ 2024-02-19 141/week @ 2024-02-26 53/week @ 2024-03-04 88/week @ 2024-03-11 39/week @ 2024-03-18 54/week @ 2024-03-25 455/week @ 2024-04-01

642 downloads per month

MPL-2.0 license

14KB
171 lines

Standard library for writing smart contracts for the Concordium blockchain

Contributor Covenant

This repository consists of libraries for writing and testing smart contracts for the Concordium blockchain in the Rust programming language. It also contains some sample smart contracts. The core library is concordium-std, and the testing library is concordium-smart-contract-testing.

The core library provides procedural macros to reduce the amount of boilerplate the user needs to write, while the concordium-std library exposes a high-level API that smart contract writers can use when writing contracts, alleviating them from the need to deal with low-level details of how the interaction with the chain works.

Versions

  • concordium-std prior to version 3 supported version 0 contracts
  • concordium-std version 3 only supports building version 1 contracts

cargo-concordium version dependencies

  • concordium-std version 4 only works with cargo-concordium version 2.1+.
  • concordium-std version 5 only works with cargo-concordium version 2.4+.

Examples

The examples directory contains some smart contracts that are used to test the standard library.

These contracts are not meant for production, they are used to illustrate how to use the standard library and the tooling Concordium provides. There is no claim that the logic of the contract is reasonable, or safe.

Do not use these contracts as-is for anything other then experimenting.

Submodules

The repository has concordium-rust-sdk as a submodule, and testing and builds are set-up to use the submodule version. When changes are made in concordium-rust-sdk they should be propagated to this repository.

Contributing

Contributor Covenant

This repository's CI automatically checks formatting and common problems in rust. Changes to any of the packages must be such that

  • cargo clippy --all produces no warnings
  • rustfmt makes no changes.

Everything in this repository should build with rust version 1.67 however the fmt tool must be from a nightly release since some of the configuration options are not stable. One way to run the fmt tool is

cargo +nightly-2023-04-01 fmt

(the exact version used by the CI can be found in .github/workflows/linter.yml file). You will need to have a recent enough nightly version installed, which can be done via

rustup toolchain install nightly-2023-04-01

or similar, using the rustup tool. See the documentation of the tool for more details.

In order to contribute you should make a pull request and ask at least two people familiar with the code to do a review.

Dependencies

~5.5MB
~102K SLoC