You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: develop/parachains/customize-parachain/add-pallet-instances.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ parameter_types! {
44
44
45
45
For a single instance, the configuration would look like this:
46
46
47
-
```rust
47
+
```rust hl_lines="1"
48
48
implpallet_collective::ConfigforRuntime {
49
49
typeRuntimeOrigin=RuntimeOrigin;
50
50
typeProposal=RuntimeCall;
@@ -64,7 +64,7 @@ impl pallet_collective::Config for Runtime {
64
64
65
65
For multiple instances, you need to create a unique identifier for each instance using the `Instance` type with a number suffix, then implement the configuration for each one:
Copy file name to clipboardExpand all lines: llms.txt
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -3109,8 +3109,8 @@ Running multiple instances of the same pallet within a runtime is a powerful tec
3109
3109
3110
3110
## Understanding Instantiable Pallets
3111
3111
3112
-
Unlike standard pallets that exist as a single instance in a runtime, instantiable pallets require special configuration through an additional generic parameter `I`.
3113
-
This generic `I` creates a unique lifetime for each pallet instance, affecting the pallet's generic types and its configuration trait `T`.
3112
+
Unlike standard pallets that exist as a single instance in a runtime, instantiable pallets require special configuration through an additional [generic parameter](https://doc.rust-lang.org/reference/items/generics.html){target=\_blank} `I`.
3113
+
This generic `I` creates a unique [lifetime](https://doc.rust-lang.org/rust-by-example/scope/lifetime.html){target=\_blank} for each pallet instance, affecting the pallet's generic types and its configuration trait `T`.
3114
3114
3115
3115
You can identify an instantiable pallet by examining its `Pallet` struct definition, which will include both the standard generic `T` and the instantiation generic `I`:
3116
3116
@@ -3142,7 +3142,7 @@ parameter_types! {
3142
3142
3143
3143
For a single instance, the configuration would look like this:
3144
3144
3145
-
```rust
3145
+
```rust hl_lines="1"
3146
3146
impl pallet_collective::Config for Runtime {
3147
3147
type RuntimeOrigin = RuntimeOrigin;
3148
3148
type Proposal = RuntimeCall;
@@ -3162,7 +3162,7 @@ impl pallet_collective::Config for Runtime {
3162
3162
3163
3163
For multiple instances, you need to create a unique identifier for each instance using the `Instance` type with a number suffix, then implement the configuration for each one:
3164
3164
3165
-
```rust
3165
+
```rust hl_lines="2-3"
3166
3166
// Configure first instance
3167
3167
type Collective1 = pallet_collective::Instance1;
3168
3168
impl pallet_collective::Config<Collective1> for Runtime {
@@ -3180,7 +3180,8 @@ impl pallet_collective::Config<Collective1> for Runtime {
3180
3180
type KillOrigin = EnsureRoot<Self::AccountId>;
3181
3181
type Consideration = ();
3182
3182
}
3183
-
3183
+
```
3184
+
```rust hl_lines="2-3"
3184
3185
// Configure second instance
3185
3186
type Collective2 = pallet_collective::Instance2;
3186
3187
impl pallet_collective::Config<Collective2> for Runtime {
@@ -3209,7 +3210,7 @@ Finally, add both pallet instances to your runtime definition, ensuring each has
0 commit comments