@@ -49,8 +49,8 @@ fn create_funded_user<T: Config>(
4949 balance_factor : u32 ,
5050) -> T :: AccountId {
5151 let user = account ( string, n, SEED ) ;
52- let balance = T :: Currency :: minimum_balance ( ) * balance_factor. into ( ) ;
53- let _ = T :: Currency :: make_free_balance_be ( & user, balance) ;
52+ let balance = < T as pallet :: Config > :: Currency :: minimum_balance ( ) * balance_factor. into ( ) ;
53+ let _ = < T as pallet :: Config > :: Currency :: make_free_balance_be ( & user, balance) ;
5454 user
5555}
5656
@@ -90,7 +90,10 @@ fn register_candidates<T: Config>(count: u32) {
9090 assert ! ( CandidacyBond :: <T >:: get( ) > 0u32 . into( ) , "Bond cannot be zero!" ) ;
9191
9292 for who in candidates {
93- T :: Currency :: make_free_balance_be ( & who, CandidacyBond :: < T > :: get ( ) * 3u32 . into ( ) ) ;
93+ <T as pallet:: Config >:: Currency :: make_free_balance_be (
94+ & who,
95+ CandidacyBond :: < T > :: get ( ) * 3u32 . into ( ) ,
96+ ) ;
9497 <CollatorSelection < T > >:: register_as_candidate ( RawOrigin :: Signed ( who) . into ( ) ) . unwrap ( ) ;
9598 }
9699}
@@ -144,7 +147,7 @@ mod benchmarks {
144147 T :: UpdateOrigin :: try_successful_origin ( ) . map_err ( |_| BenchmarkError :: Weightless ) ?;
145148
146149 // need to fill up candidates
147- CandidacyBond :: < T > :: put ( T :: Currency :: minimum_balance ( ) ) ;
150+ CandidacyBond :: < T > :: put ( < T as pallet :: Config > :: Currency :: minimum_balance ( ) ) ;
148151 DesiredCandidates :: < T > :: put ( c) ;
149152 // get accounts and keys for the `c` candidates
150153 let mut candidates = ( 0 ..c) . map ( |cc| validator :: < T > ( cc) ) . collect :: < Vec < _ > > ( ) ;
@@ -161,13 +164,13 @@ mod benchmarks {
161164 // ... and register them.
162165 for ( who, _) in candidates. iter ( ) {
163166 let deposit = CandidacyBond :: < T > :: get ( ) ;
164- T :: Currency :: make_free_balance_be ( who, deposit * 1000_u32 . into ( ) ) ;
167+ < T as pallet :: Config > :: Currency :: make_free_balance_be ( who, deposit * 1000_u32 . into ( ) ) ;
165168 CandidateList :: < T > :: try_mutate ( |list| {
166169 list. try_push ( CandidateInfo { who : who. clone ( ) , deposit } ) . unwrap ( ) ;
167170 Ok :: < ( ) , BenchmarkError > ( ( ) )
168171 } )
169172 . unwrap ( ) ;
170- T :: Currency :: reserve ( who, deposit) ?;
173+ < T as pallet :: Config > :: Currency :: reserve ( who, deposit) ?;
171174 LastAuthoredBlock :: < T > :: insert (
172175 who. clone ( ) ,
173176 frame_system:: Pallet :: < T > :: block_number ( ) + T :: KickThreshold :: get ( ) ,
@@ -226,7 +229,8 @@ mod benchmarks {
226229 c : Linear < 0 , { T :: MaxCandidates :: get ( ) } > ,
227230 k : Linear < 0 , { T :: MaxCandidates :: get ( ) } > ,
228231 ) -> Result < ( ) , BenchmarkError > {
229- let initial_bond_amount: BalanceOf < T > = T :: Currency :: minimum_balance ( ) * 2u32 . into ( ) ;
232+ let initial_bond_amount: BalanceOf < T > =
233+ <T as pallet:: Config >:: Currency :: minimum_balance ( ) * 2u32 . into ( ) ;
230234 CandidacyBond :: < T > :: put ( initial_bond_amount) ;
231235 register_validators :: < T > ( c) ;
232236 register_candidates :: < T > ( c) ;
@@ -236,12 +240,12 @@ mod benchmarks {
236240 let bond_amount = if k > 0 {
237241 CandidateList :: < T > :: mutate ( |candidates| {
238242 for info in candidates. iter_mut ( ) . skip ( kicked as usize ) {
239- info. deposit = T :: Currency :: minimum_balance ( ) * 3u32 . into ( ) ;
243+ info. deposit = < T as pallet :: Config > :: Currency :: minimum_balance ( ) * 3u32 . into ( ) ;
240244 }
241245 } ) ;
242- T :: Currency :: minimum_balance ( ) * 3u32 . into ( )
246+ < T as pallet :: Config > :: Currency :: minimum_balance ( ) * 3u32 . into ( )
243247 } else {
244- T :: Currency :: minimum_balance ( )
248+ < T as pallet :: Config > :: Currency :: minimum_balance ( )
245249 } ;
246250
247251 #[ extrinsic_call]
@@ -255,7 +259,7 @@ mod benchmarks {
255259 fn update_bond (
256260 c : Linear < { min_candidates :: < T > ( ) + 1 } , { T :: MaxCandidates :: get ( ) } > ,
257261 ) -> Result < ( ) , BenchmarkError > {
258- CandidacyBond :: < T > :: put ( T :: Currency :: minimum_balance ( ) ) ;
262+ CandidacyBond :: < T > :: put ( < T as pallet :: Config > :: Currency :: minimum_balance ( ) ) ;
259263 DesiredCandidates :: < T > :: put ( c) ;
260264
261265 register_validators :: < T > ( c) ;
@@ -264,8 +268,8 @@ mod benchmarks {
264268 let caller = CandidateList :: < T > :: get ( ) [ 0 ] . who . clone ( ) ;
265269 v2:: whitelist!( caller) ;
266270
267- let bond_amount: BalanceOf < T > =
268- T :: Currency :: minimum_balance ( ) + T :: Currency :: minimum_balance ( ) ;
271+ let bond_amount: BalanceOf < T > = < T as pallet :: Config > :: Currency :: minimum_balance ( ) +
272+ < T as pallet :: Config > :: Currency :: minimum_balance ( ) ;
269273
270274 #[ extrinsic_call]
271275 _ ( RawOrigin :: Signed ( caller. clone ( ) ) , bond_amount) ;
@@ -275,7 +279,7 @@ mod benchmarks {
275279 ) ;
276280 assert ! (
277281 CandidateList :: <T >:: get( ) . iter( ) . last( ) . unwrap( ) . deposit ==
278- T :: Currency :: minimum_balance( ) * 2u32 . into( )
282+ < T as pallet :: Config > :: Currency :: minimum_balance( ) * 2u32 . into( )
279283 ) ;
280284 Ok ( ( ) )
281285 }
@@ -284,15 +288,15 @@ mod benchmarks {
284288 // one.
285289 #[ benchmark]
286290 fn register_as_candidate ( c : Linear < 1 , { T :: MaxCandidates :: get ( ) - 1 } > ) {
287- CandidacyBond :: < T > :: put ( T :: Currency :: minimum_balance ( ) ) ;
291+ CandidacyBond :: < T > :: put ( < T as pallet :: Config > :: Currency :: minimum_balance ( ) ) ;
288292 DesiredCandidates :: < T > :: put ( c + 1 ) ;
289293
290294 register_validators :: < T > ( c) ;
291295 register_candidates :: < T > ( c) ;
292296
293297 let caller: T :: AccountId = whitelisted_caller ( ) ;
294- let bond: BalanceOf < T > = T :: Currency :: minimum_balance ( ) * 2u32 . into ( ) ;
295- T :: Currency :: make_free_balance_be ( & caller, bond) ;
298+ let bond: BalanceOf < T > = < T as pallet :: Config > :: Currency :: minimum_balance ( ) * 2u32 . into ( ) ;
299+ < T as pallet :: Config > :: Currency :: make_free_balance_be ( & caller, bond) ;
296300
297301 <session:: Pallet < T > >:: set_keys (
298302 RawOrigin :: Signed ( caller. clone ( ) ) . into ( ) ,
@@ -311,15 +315,15 @@ mod benchmarks {
311315
312316 #[ benchmark]
313317 fn take_candidate_slot ( c : Linear < { min_candidates :: < T > ( ) + 1 } , { T :: MaxCandidates :: get ( ) } > ) {
314- CandidacyBond :: < T > :: put ( T :: Currency :: minimum_balance ( ) ) ;
318+ CandidacyBond :: < T > :: put ( < T as pallet :: Config > :: Currency :: minimum_balance ( ) ) ;
315319 DesiredCandidates :: < T > :: put ( 1 ) ;
316320
317321 register_validators :: < T > ( c) ;
318322 register_candidates :: < T > ( c) ;
319323
320324 let caller: T :: AccountId = whitelisted_caller ( ) ;
321- let bond: BalanceOf < T > = T :: Currency :: minimum_balance ( ) * 10u32 . into ( ) ;
322- T :: Currency :: make_free_balance_be ( & caller, bond) ;
325+ let bond: BalanceOf < T > = < T as pallet :: Config > :: Currency :: minimum_balance ( ) * 10u32 . into ( ) ;
326+ < T as pallet :: Config > :: Currency :: make_free_balance_be ( & caller, bond) ;
323327
324328 <session:: Pallet < T > >:: set_keys (
325329 RawOrigin :: Signed ( caller. clone ( ) ) . into ( ) ,
@@ -342,7 +346,7 @@ mod benchmarks {
342346 // worse case is the last candidate leaving.
343347 #[ benchmark]
344348 fn leave_intent ( c : Linear < { min_candidates :: < T > ( ) + 1 } , { T :: MaxCandidates :: get ( ) } > ) {
345- CandidacyBond :: < T > :: put ( T :: Currency :: minimum_balance ( ) ) ;
349+ CandidacyBond :: < T > :: put ( < T as pallet :: Config > :: Currency :: minimum_balance ( ) ) ;
346350 DesiredCandidates :: < T > :: put ( c) ;
347351
348352 register_validators :: < T > ( c) ;
@@ -360,23 +364,23 @@ mod benchmarks {
360364 // worse case is paying a non-existing candidate account.
361365 #[ benchmark]
362366 fn note_author ( ) {
363- CandidacyBond :: < T > :: put ( T :: Currency :: minimum_balance ( ) ) ;
364- T :: Currency :: make_free_balance_be (
367+ CandidacyBond :: < T > :: put ( < T as pallet :: Config > :: Currency :: minimum_balance ( ) ) ;
368+ < T as pallet :: Config > :: Currency :: make_free_balance_be (
365369 & <CollatorSelection < T > >:: account_id ( ) ,
366- T :: Currency :: minimum_balance ( ) * 4u32 . into ( ) ,
370+ < T as pallet :: Config > :: Currency :: minimum_balance ( ) * 4u32 . into ( ) ,
367371 ) ;
368372 let author = account ( "author" , 0 , SEED ) ;
369373 let new_block: BlockNumberFor < T > = 10u32 . into ( ) ;
370374
371375 frame_system:: Pallet :: < T > :: set_block_number ( new_block) ;
372- assert ! ( T :: Currency :: free_balance( & author) == 0u32 . into( ) ) ;
376+ assert ! ( < T as pallet :: Config > :: Currency :: free_balance( & author) == 0u32 . into( ) ) ;
373377
374378 #[ block]
375379 {
376380 <CollatorSelection < T > as EventHandler < _ , _ > >:: note_author ( author. clone ( ) )
377381 }
378382
379- assert ! ( T :: Currency :: free_balance( & author) > 0u32 . into( ) ) ;
383+ assert ! ( < T as pallet :: Config > :: Currency :: free_balance( & author) > 0u32 . into( ) ) ;
380384 assert_eq ! ( frame_system:: Pallet :: <T >:: block_number( ) , new_block) ;
381385 }
382386
@@ -386,7 +390,7 @@ mod benchmarks {
386390 r : Linear < 1 , { T :: MaxCandidates :: get ( ) } > ,
387391 c : Linear < 1 , { T :: MaxCandidates :: get ( ) } > ,
388392 ) {
389- CandidacyBond :: < T > :: put ( T :: Currency :: minimum_balance ( ) ) ;
393+ CandidacyBond :: < T > :: put ( < T as pallet :: Config > :: Currency :: minimum_balance ( ) ) ;
390394 DesiredCandidates :: < T > :: put ( c) ;
391395 frame_system:: Pallet :: < T > :: set_block_number ( 0u32 . into ( ) ) ;
392396
0 commit comments