Crates.io | pallet-product-registry |
lib.rs | pallet-product-registry |
version | 2.0.0 |
source | src |
created_at | 2020-10-03 16:51:35.219923 |
updated_at | 2020-10-03 16:51:35.219923 |
description | Substrate Enterprise Sample - Product Registry pallet |
homepage | https://substrate.dev |
repository | https://github.com/paritytech/substrate/ |
max_upload_size | |
id | 295821 |
size | 27,062 |
The Product Registry pallet provides functionality for registering and managing master data (aka class-level) about products / trade items exchanged in a supply chain between various stakeholders. This data is typically registered once by the product's manufacturer / supplier to be shared with other network participants.
When this pallet is added to a Subtrate runtime, other custom Substrate pallets can then implement additional business logic leveraging this Product Registry pallet as a reference for known products and their owning organizations.
This pallet is part of the Substrate Enterprise sample.
It is inspired by existing projects & standards:
NOTE: This pallet implements the aforementionned process in a simplified way, thus it is intended for demonstration purposes and is not audited or ready for production use.
To register a product, one must send a transaction with a productRegistry.registerProduct
extrinsic with the following arguments:
id
as the Product ID, typically this would be a GS1 GTIN (Global Trade Item Number), or ASIN (Amazon Standard Identification Number), or similar, a numeric or alpha-numeric code with a well-defined data structure.owner
as the Substrate Account representing the organization owning this product, as in the manufacturer or supplier providing this product within the value chain.props
which is a series of properties (name & value) describing the product. Typically, there would at least be a textual description, and SKU. It could also contain instance / lot master data e.g. expiration, weight, harvest date.This pallet depends on on the [FRAME EnsureOrigin System trait]
frame_support::traits::EnsureOrigin;
This pallet depends on on the FRAME Timestamp pallet.
Run the tests with:
```
cargo test
```
Cargo.toml
To add this pallet to your runtime, simply include the following to your runtime's Cargo.toml
file:
[dependencies.product-registry]
default_features = false
package = 'pallet-product-registry'
version = '2.0.0'
and update your runtime's std
feature to include this pallet:
std = [
# --snip--
'product-registry/std',
]
lib.rs
You should implement it's trait like so:
impl product_registry::Trait for Runtime {
type Event = Event;
type CreateRoleOrigin = Origin;
}
and include it in your construct_runtime!
macro:
ProductRegistry: product_registry::{Module, Call, Storage, Event<T>},
This template pallet does not have any genesis configuration.
You can view the reference docs for this pallet by running:
cargo doc --open