UPDATE: This repository has been archived. Pallets that are used in production are moved to universal-dot-node.
This is a playground for new pallets that are developed for Substrate.
The pallets used in production have been moved to the node.
Pallets are developed separately from Runtime and injected into the Runtime.
Custom Pallet cargo versions shall remain consistent with Runtime package versions.
To build each pallet, run:
cargo build
Optionally, you can install clippy which is a rust tool that check for Rust to improve common mistakes. To install clippy: https://github.com/rust-lang/rust-clippy
To run clippy locally, run:
cargo clippy
To add a specific pallet to a Runtime, navigate to the Universal-dot-node. In the /Runtime/Cargo.toml add each pallet dependency. For example, to add the Profile pallet, the following configuration should be added:
[dependencies.pallet-profile]
default-features = false
git = 'https://github.com/UniversalDot/pallets.git'
version = '0.0.67'
Pallet test depend on substrate Runtime. To be able to run these pallet test, first we must construct a mock Runtime environment. Mocks for runtime are constructed for each pallet separately and are located in their respective /src/ folder.
More information regarding constructing Mock Runtime at the following link.
Tests are functions, annotated with the #[test] macro. To test specific functionality, we use assert macros to match our expectations with the expected result. There are already several predefine assert macros such as:
- assert_eq!
- assert_ok!
- assert_noop!
For more information on how to create tests, refer to the following link.
To run test each pallet, simply run at pallet root:
cargo test
To run benchmark tests for each pallet, simply run at pallet root:
cargo test --features runtime-benchmarks