Skip to main content


This doc contains description of how the OpenBrush library can be imported and used.

The OpenBrush is using ink! stable release v3.0.0 branch at the moment. So you should use the same version of the ink! across your project.

The default toml of your project with OpenBrush:#

[dependencies]# Import of all ink! cratesink_primitives = { tag = "v3.0.1", git = "", default-features = false }ink_metadata = { tag = "v3.0.1", git = "", default-features = false, features = ["derive"], optional = true }ink_env = { tag = "v3.0.1", git = "", default-features = false }ink_storage = { tag = "v3.0.1", git = "", default-features = false }ink_lang = { tag = "v3.0.1", git = "", default-features = false }ink_prelude = { tag = "v3.0.1", git = "", default-features = false }
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }scale-info = { version = "2", default-features = false, features = ["derive"], optional = true }
# Brush dependencybrush = { tag = "v1.6.1", git = "", default-features = false }
[features]default = ["std"]std = [  "ink_primitives/std",  "ink_metadata",  "ink_metadata/std",  "ink_env/std",  "ink_storage/std",  "ink_lang/std",  "scale/std",  "scale-info",  "scale-info/std",
  # Brush dependency  "brush/std",]ink-as-dependency = []

To avoid unexpected compilation errors better to always import all ink! crates.

By default, the brush crate provides macros for simplification of the development and traits of contracts(you can implement them by yourself, and you can use them for a cross-contract calls).

The OpenBrush also provides the default implementation of traits that can be enabled via crate features. A list of all available features you can find here. The default implementation of traits requires the usage of the unstable feature min-specialization. You can enable it by adding #![feature(min_specialization)] at the top of your root module(for more information check rust official documentation).

Note: ink! requires put #![cfg_attr(not(feature = "std"), no_std)] at the top of root crate.

Note: Some default implementations for traits provide additional methods that can be overridden. These methods are defined in a separate internal trait. It has the name of the original trait + suffix Internal. If you want to override them you need to do that in the impl section of the internal trait.

Also, that doc contains links to the examples of how to reuse and customize the default implementation of traits.