@@ -33,9 +33,18 @@ pub mod pallet {
33
33
34
34
#[ pallet:: trait_]
35
35
pub trait Trait : frame_system:: Trait {
36
+ /// Some comment
37
+ /// Some comment
36
38
#[ pallet:: const_]
37
39
type MyGetParam : Get < u32 > ;
40
+
41
+ /// Some comment
42
+ /// Some comment
43
+ #[ pallet:: const_]
44
+ type MyGetParam2 : Get < u32 > ;
45
+
38
46
type Balance : Parameter + Default ;
47
+
39
48
type Event : From < Event < Self > > + IsType < <Self as frame_system:: Trait >:: Event > ;
40
49
}
41
50
@@ -68,7 +77,7 @@ pub mod pallet {
68
77
impl < T : Trait > Call for Module < T > where T :: Balance : From < u64 > {
69
78
/// Doc comment put in metadata
70
79
#[ pallet:: weight( Weight :: from( * _foo) ) ]
71
- fn foo ( origin : OriginFor < T > , #[ pallet:: compact] _foo : u32 ) -> DispatchResultWithPostInfo {
80
+ fn foo ( origin : OriginFor < T > , #[ pallet:: compact] _foo : u32 , _bar : u32 ) -> DispatchResultWithPostInfo {
72
81
T :: Balance :: from ( 3u64 ) ; // Test for where clause
73
82
let _ = origin;
74
83
Self :: deposit_event ( Event :: Something ( 3 ) ) ;
@@ -174,6 +183,7 @@ pub mod pallet {
174
183
175
184
frame_support:: parameter_types!(
176
185
pub const MyGetParam : u32 = 10 ;
186
+ pub const MyGetParam2 : u32 = 11 ;
177
187
pub const BlockHashCount : u32 = 250 ;
178
188
pub const MaximumBlockWeight : frame_support:: weights:: Weight = 1024 ;
179
189
pub const MaximumBlockLength : u32 = 2 * 1024 ;
@@ -210,6 +220,7 @@ impl frame_system::Trait for Runtime {
210
220
impl pallet:: Trait for Runtime {
211
221
type Event = Event ;
212
222
type MyGetParam = MyGetParam ;
223
+ type MyGetParam2 = MyGetParam2 ;
213
224
type Balance = u64 ;
214
225
}
215
226
@@ -230,7 +241,7 @@ frame_support::construct_runtime!(
230
241
231
242
#[ test]
232
243
fn call_expand ( ) {
233
- let call_foo = pallet:: Call :: < Runtime > :: foo ( 3 ) ;
244
+ let call_foo = pallet:: Call :: < Runtime > :: foo ( 3 , 0 ) ;
234
245
assert_eq ! (
235
246
call_foo. get_dispatch_info( ) ,
236
247
DispatchInfo {
@@ -275,7 +286,7 @@ fn instance_expand() {
275
286
fn module_expand_deposit_event ( ) {
276
287
TestExternalities :: default ( ) . execute_with ( || {
277
288
frame_system:: Module :: < Runtime > :: set_block_number ( 1 ) ;
278
- pallet:: Call :: < Runtime > :: foo ( 3 ) . dispatch_bypass_filter ( None . into ( ) ) . unwrap ( ) ;
289
+ pallet:: Call :: < Runtime > :: foo ( 3 , 0 ) . dispatch_bypass_filter ( None . into ( ) ) . unwrap ( ) ;
279
290
assert_eq ! (
280
291
frame_system:: Module :: <Runtime >:: events( ) [ 0 ] . event,
281
292
Event :: pallet( pallet:: Event :: Something ( 3 ) ) ,
@@ -432,6 +443,10 @@ fn metadata() {
432
443
FunctionArgumentMetadata {
433
444
name: DecodeDifferent :: Decoded ( "_foo" . to_string( ) ) ,
434
445
ty: DecodeDifferent :: Decoded ( "Compact<u32>" . to_string( ) ) ,
446
+ } ,
447
+ FunctionArgumentMetadata {
448
+ name: DecodeDifferent :: Decoded ( "_bar" . to_string( ) ) ,
449
+ ty: DecodeDifferent :: Decoded ( "u32" . to_string( ) ) ,
435
450
}
436
451
] ) ,
437
452
documentation: DecodeDifferent :: Decoded ( vec![
@@ -477,7 +492,19 @@ fn metadata() {
477
492
name: DecodeDifferent :: Decoded ( "MyGetParam" . to_string( ) ) ,
478
493
ty: DecodeDifferent :: Decoded ( "u32" . to_string( ) ) ,
479
494
value: DecodeDifferent :: Decoded ( vec![ 10 , 0 , 0 , 0 ] ) ,
480
- documentation: DecodeDifferent :: Decoded ( vec![ ] ) ,
495
+ documentation: DecodeDifferent :: Decoded ( vec![
496
+ " Some comment" . to_string( ) ,
497
+ " Some comment" . to_string( ) ,
498
+ ] ) ,
499
+ } ,
500
+ ModuleConstantMetadata {
501
+ name: DecodeDifferent :: Decoded ( "MyGetParam2" . to_string( ) ) ,
502
+ ty: DecodeDifferent :: Decoded ( "u32" . to_string( ) ) ,
503
+ value: DecodeDifferent :: Decoded ( vec![ 11 , 0 , 0 , 0 ] ) ,
504
+ documentation: DecodeDifferent :: Decoded ( vec![
505
+ " Some comment" . to_string( ) ,
506
+ " Some comment" . to_string( ) ,
507
+ ] ) ,
481
508
} ,
482
509
] ) ,
483
510
errors : DecodeDifferent :: Decoded ( vec ! [
0 commit comments