#substrate #module #dispatch #pallet #calls #sudo #root

no-std pallet-mandate

A Substrate pallet to help over modules dispatch root calls

11 releases (stable)

2.0.8 Mar 5, 2021
2.0.7 Sep 28, 2020
2.0.6-rc6 Aug 21, 2020
2.0.4 May 26, 2020
2.0.0 Mar 23, 2020

#34 in #sudo

50 downloads per month

Custom license

7KB

Mandate Pallet

A Substrate pallet to allow the use of sudo functions from a runtime module like the collective.

Screen Shot 2020-02-13 at 12 30 21 PM

Usage

Add the depedency

Edit runtime/Cargo.toml and add the following:

[dependencies.mandate]
default-features = false
version = '2.0.0'
package = "pallet-mandate"

Then add the mandate/std to the [features] section in the std array, it should look like this:

[dependencies.mandate]
default-features = false
version = '2.0.0'
package = "pallet-mandate"

[features]
default = ['std']
std = [
    # Your substrate modules /std calls here
    # ...

    'mandate/std',
]

Add the module to your runtime

Trait implementation

You can use the ExternalOrigin type to specify who can dispatch calls to the module. For instance you can use with the collective:

impl mandate::Trait for Runtime {
    type Proposal = Call;

    // A majority of the committee can dispatch root calls
    type ExternalOrigin =
        collective::EnsureProportionAtLeast<_1, _2, AccountId, TechnicalCollective>;
}

Adding the module

In the construct_runtime macro call just add the Mandate: mandate::{Module, Call}, it should look like this:

construct_runtime!(
    pub enum Runtime where
        Block = Block,
        NodeBlock = Block,
        UncheckedExtrinsic = UncheckedExtrinsic
    {
    	// Your modules here
    	// ...
        Mandate: mandate::{Module, Call},
    }
);

Dependencies

~8–17MB
~240K SLoC