Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eteissonniere/pallet-mandate
A Substrate pallet to allow the use of sudo functions from a runtime module like the collective.
https://github.com/eteissonniere/pallet-mandate
Last synced: 5 days ago
JSON representation
A Substrate pallet to allow the use of sudo functions from a runtime module like the collective.
- Host: GitHub
- URL: https://github.com/eteissonniere/pallet-mandate
- Owner: ETeissonniere
- License: mit
- Created: 2020-02-13T19:33:11.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-16T12:34:00.000Z (almost 3 years ago)
- Last Synced: 2024-09-16T17:50:01.706Z (2 months ago)
- Language: Rust
- Homepage:
- Size: 154 KB
- Stars: 5
- Watchers: 2
- Forks: 6
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://user-images.githubusercontent.com/10683430/74475712-c9557480-4e5c-11ea-91e1-626412815cd4.png)
# Usage
## Add the depedency
Edit `runtime/Cargo.toml` and add the following:
```toml
[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:
```toml
[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`:
```rust
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:
```rust
construct_runtime!(
pub enum Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
// Your modules here
// ...
Mandate: mandate::{Module, Call},
}
);
```