11 个版本 (稳定)
| 2.0.8 | 2021 年 3 月 5 日 |
|---|---|
| 2.0.7 | 2020 年 9 月 28 日 |
| 2.0.6-rc6 | 2020 年 8 月 21 日 |
| 2.0.4 | 2020 年 5 月 26 日 |
| 2.0.0 | 2020 年 3 月 23 日 |
#43 在 #调度
每月 50 次下载
7KB
授权托盘
一个 Substrate 托盘,允许从运行时模块(如 collective)使用 sudo 函数。

用法
添加依赖
编辑 runtime/Cargo.toml 并添加以下内容
[dependencies.mandate]
default-features = false
version = '2.0.0'
package = "pallet-mandate"
然后将 mandate/std 添加到 [features] 部分,它应该看起来像这样
[dependencies.mandate]
default-features = false
version = '2.0.0'
package = "pallet-mandate"
[features]
default = ['std']
std = [
# Your substrate modules /std calls here
# ...
'mandate/std',
]
将模块添加到您的运行时
特质实现
您可以使用 ExternalOrigin 类型来指定谁可以向模块调度调用。例如,您可以与 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>;
}
添加模块
在 construct_runtime 宏调用中,只需添加 Mandate: mandate::{Module, Call},它应该看起来像这样
construct_runtime!(
pub enum Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
// Your modules here
// ...
Mandate: mandate::{Module, Call},
}
);
依赖项
~8–17MB
~237K SLoC