MCPcopy Index your code
hub / github.com/Concordium/concordium-rust-smart-contracts

github.com/Concordium/concordium-rust-smart-contracts @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
1,960 symbols 6,652 edges 166 files 515 documented · 26%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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 fmt

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

Extension points exported contracts — how you extend this code

IsTokenId (Interface)
Trait for marking types as CIS2 token IDs. For a type to be a valid CIS2 token ID it must implement `SchemaType` and `Se [7 …
concordium-cis2/src/lib.rs
DeserialWithState (Interface)
The `DeserialWithState` trait provides a means of reading structures from byte-sources ([`Read`]) for types that also ne [6 …
concordium-std/src/traits.rs
DebugInfoExt (Interface)
A trait implemented by types which can extract debug information from contract receive entrypoint executions. Note for [3 …
contract-testing/src/types.rs
IsMessage (Interface)
Trait definition of the `IsMessage`. This trait is implemented for the two types `WithdrawMessage` and `TransferMessage` [2 …
examples/cis5-smart-contract-wallet/src/lib.rs
ProxyTrait (Interface)
(no doc)
concordium-std/tests/derive-deserial-with-state/success-assoc-type.rs
IsTokenAmount (Interface)
Trait for marking types as CIS2 token amounts. For a type to be a valid CIS2 token amount it must implement SchemaType a [1 …
concordium-cis2/src/lib.rs
Deletable (Interface)
A type that can be deleted from the state. For simple types, such as `u8` and `String`, the `delete` methods is a no-op. [5 …
concordium-std/src/traits.rs
SigningAmount (Interface)
Trait definition of the `SigningAmount`. This trait is implemented for the two types `Amount` and `TokenAmount`. The `Si [2 …
examples/cis5-smart-contract-wallet/src/lib.rs

Core symbols most depended-on inside this repo

get
called by 333
concordium-std/src/impls.rs
contract_update
called by 231
contract-testing/src/impls.rs
parameter_cursor
called by 192
concordium-std/src/impls.rs
insert
called by 147
concordium-std/src/impls.rs
state
called by 117
concordium-std/src/impls.rs
unwrap_abort
called by 116
concordium-std/src/impls.rs
entry
called by 110
concordium-std/src/impls.rs
len
called by 109
concordium-std/src/state_btree.rs

Shape

Function 858
Method 536
Class 365
Enum 172
Interface 29

Languages

Rust100%

Modules by API surface

concordium-std/src/impls.rs176 symbols
concordium-cis2/src/lib.rs92 symbols
concordium-std/src/state_btree.rs82 symbols
contract-testing/src/impls.rs79 symbols
examples/cis2-multi/src/lib.rs77 symbols
examples/credential-registry/src/lib.rs75 symbols
contract-testing/src/types.rs75 symbols
templates/credential-registry/src/lib.rs65 symbols
concordium-std/src/types.rs61 symbols
examples/cis5-smart-contract-wallet/src/lib.rs57 symbols
examples/cis3-nft-sponsored-txs/src/lib.rs46 symbols
examples/nametoken/src/lib.rs43 symbols

For agents

$ claude mcp add concordium-rust-smart-contracts \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page