@@ -62,38 +62,21 @@ where
62
62
let metadata_hash = BoundedVec :: try_from ( IPFS_CID . as_bytes ( ) . to_vec ( ) ) . unwrap ( ) ;
63
63
ProjectMetadata {
64
64
token_information : CurrencyMetadata { name : bounded_name, symbol : bounded_symbol, decimals : CT_DECIMALS } ,
65
- mainnet_token_max_supply : BalanceOf :: < T > :: try_from ( 1_000_000 * CT_UNIT )
66
- . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
67
- total_allocation_size : BalanceOf :: < T > :: try_from ( 1_000_000 * CT_UNIT )
68
- . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
65
+ mainnet_token_max_supply : 1_000_000u128 * CT_UNIT ,
66
+ total_allocation_size : 1_000_000u128 * CT_UNIT ,
69
67
auction_round_allocation_percentage : Percent :: from_percent ( 50u8 ) ,
70
68
minimum_price : PriceProviderOf :: < T > :: calculate_decimals_aware_price ( 10u128 . into ( ) , USD_DECIMALS , CT_DECIMALS )
71
69
. unwrap ( ) ,
72
70
73
71
bidding_ticket_sizes : BiddingTicketSizes {
74
- professional : TicketSize :: new (
75
- BalanceOf :: < T > :: try_from ( 5000 * USD_UNIT ) . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
76
- None ,
77
- ) ,
78
- institutional : TicketSize :: new (
79
- BalanceOf :: < T > :: try_from ( 5000 * USD_UNIT ) . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
80
- None ,
81
- ) ,
72
+ professional : TicketSize :: new ( 5000u128 * USD_UNIT , None ) ,
73
+ institutional : TicketSize :: new ( 5000u128 * USD_UNIT , None ) ,
82
74
phantom : Default :: default ( ) ,
83
75
} ,
84
76
contributing_ticket_sizes : ContributingTicketSizes {
85
- retail : TicketSize :: new (
86
- BalanceOf :: < T > :: try_from ( USD_UNIT ) . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
87
- None ,
88
- ) ,
89
- professional : TicketSize :: new (
90
- BalanceOf :: < T > :: try_from ( USD_UNIT ) . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
91
- None ,
92
- ) ,
93
- institutional : TicketSize :: new (
94
- BalanceOf :: < T > :: try_from ( USD_UNIT ) . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
95
- None ,
96
- ) ,
77
+ retail : TicketSize :: new ( USD_UNIT , None ) ,
78
+ professional : TicketSize :: new ( USD_UNIT , None ) ,
79
+ institutional : TicketSize :: new ( USD_UNIT , None ) ,
97
80
phantom : Default :: default ( ) ,
98
81
} ,
99
82
participation_currencies : vec ! [ AcceptedFundingAsset :: USDT ] . try_into ( ) . unwrap ( ) ,
105
88
pub fn default_evaluations < T : Config > ( ) -> Vec < UserToUSDBalance < T > >
106
89
where
107
90
<T as Config >:: Price : From < u128 > ,
108
- <T as Config >:: Balance : From < u128 > ,
109
91
T :: Hash : From < H256 > ,
110
92
{
111
93
let threshold = <T as Config >:: EvaluationSuccessThreshold :: get ( ) ;
@@ -134,7 +116,6 @@ where
134
116
pub fn default_bids < T : Config > ( ) -> Vec < BidParams < T > >
135
117
where
136
118
<T as Config >:: Price : From < u128 > ,
137
- <T as Config >:: Balance : From < u128 > ,
138
119
T :: Hash : From < H256 > ,
139
120
{
140
121
let default_project_metadata = default_project_metadata :: < T > ( account :: < AccountIdOf < T > > ( "issuer" , 0 , 0 ) ) ;
@@ -156,7 +137,6 @@ pub fn full_bids<T>() -> Vec<BidParams<T>>
156
137
where
157
138
T : Config ,
158
139
<T as Config >:: Price : From < u128 > ,
159
- <T as Config >:: Balance : From < u128 > ,
160
140
T :: Hash : From < H256 > ,
161
141
{
162
142
let inst = BenchInstantiator :: < T > :: new ( None ) ;
@@ -175,7 +155,6 @@ where
175
155
pub fn default_community_contributions < T : Config > ( ) -> Vec < ContributionParams < T > >
176
156
where
177
157
<T as Config >:: Price : From < u128 > ,
178
- <T as Config >:: Balance : From < u128 > ,
179
158
T :: Hash : From < H256 > ,
180
159
{
181
160
let inst = BenchInstantiator :: < T > :: new ( None ) ;
@@ -201,7 +180,6 @@ where
201
180
pub fn default_remainder_contributions < T : Config > ( ) -> Vec < ContributionParams < T > >
202
181
where
203
182
<T as Config >:: Price : From < u128 > ,
204
- <T as Config >:: Balance : From < u128 > ,
205
183
T :: Hash : From < H256 > ,
206
184
{
207
185
let inst = BenchInstantiator :: < T > :: new ( None ) ;
@@ -289,13 +267,12 @@ pub fn string_account<AccountId: Decode>(
289
267
290
268
#[ benchmarks(
291
269
where
292
- T : Config + frame_system:: Config <RuntimeEvent = <T as Config >:: RuntimeEvent > + pallet_balances:: Config <Balance = BalanceOf < T > > + sp_std:: fmt:: Debug ,
270
+ T : Config + frame_system:: Config <RuntimeEvent = <T as Config >:: RuntimeEvent > + pallet_balances:: Config <Balance = Balance > + sp_std:: fmt:: Debug ,
293
271
<T as Config >:: RuntimeEvent : TryInto <Event <T >> + Parameter + Member ,
294
272
<T as Config >:: Price : From <u128 >,
295
- <T as Config >:: Balance : From <u128 > + Into <u128 >,
296
273
T :: Hash : From <H256 >,
297
274
<T as frame_system:: Config >:: AccountId : Into <<<T as frame_system:: Config >:: RuntimeOrigin as OriginTrait >:: AccountId > + sp_std:: fmt:: Debug ,
298
- <T as pallet_balances:: Config >:: Balance : Into <BalanceOf < T > >,
275
+ <T as pallet_balances:: Config >:: Balance : Into <Balance >,
299
276
) ]
300
277
mod benchmarks {
301
278
use super :: * ;
@@ -327,7 +304,7 @@ mod benchmarks {
327
304
let ct_treasury_account_deposit = T :: ContributionTokenCurrency :: deposit_required ( 0 ) ;
328
305
inst. mint_plmc_to ( vec ! [ UserToPLMCBalance :: new(
329
306
issuer. clone( ) ,
330
- ed * 2u64 . into ( ) + metadata_deposit + ct_treasury_account_deposit,
307
+ ed * 2u128 + metadata_deposit + ct_treasury_account_deposit,
331
308
) ] ) ;
332
309
let jwt = get_mock_jwt_with_cid (
333
310
issuer. clone ( ) ,
@@ -411,10 +388,8 @@ mod benchmarks {
411
388
symbol : BoundedVec :: try_from ( "CTESTv2" . as_bytes ( ) . to_vec ( ) ) . unwrap ( ) ,
412
389
decimals : CT_DECIMALS - 2 ,
413
390
} ,
414
- mainnet_token_max_supply : BalanceOf :: < T > :: try_from ( 200_000 * CT_UNIT )
415
- . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
416
- total_allocation_size : BalanceOf :: < T > :: try_from ( 200_000 * CT_UNIT )
417
- . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
391
+ mainnet_token_max_supply : 200_000u128 * CT_UNIT ,
392
+ total_allocation_size : 200_000u128 * CT_UNIT ,
418
393
auction_round_allocation_percentage : Percent :: from_percent ( 30u8 ) ,
419
394
minimum_price : PriceProviderOf :: < T > :: calculate_decimals_aware_price (
420
395
11u128 . into ( ) ,
@@ -423,44 +398,14 @@ mod benchmarks {
423
398
)
424
399
. unwrap ( ) ,
425
400
bidding_ticket_sizes : BiddingTicketSizes {
426
- professional : TicketSize :: new (
427
- BalanceOf :: < T > :: try_from ( 5000 * USD_UNIT ) . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
428
- Some (
429
- BalanceOf :: < T > :: try_from ( 10_000 * USD_UNIT )
430
- . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
431
- ) ,
432
- ) ,
433
- institutional : TicketSize :: new (
434
- BalanceOf :: < T > :: try_from ( 5000 * USD_UNIT ) . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
435
- Some (
436
- BalanceOf :: < T > :: try_from ( 10_000 * USD_UNIT )
437
- . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
438
- ) ,
439
- ) ,
401
+ professional : TicketSize :: new ( 5000 * USD_UNIT , Some ( 10_000 * USD_UNIT ) ) ,
402
+ institutional : TicketSize :: new ( 5000 * USD_UNIT , Some ( 10_000 * USD_UNIT ) ) ,
440
403
phantom : Default :: default ( ) ,
441
404
} ,
442
405
contributing_ticket_sizes : ContributingTicketSizes {
443
- retail : TicketSize :: new (
444
- BalanceOf :: < T > :: try_from ( 5000 * USD_UNIT ) . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
445
- Some (
446
- BalanceOf :: < T > :: try_from ( 10_000 * USD_UNIT )
447
- . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
448
- ) ,
449
- ) ,
450
- professional : TicketSize :: new (
451
- BalanceOf :: < T > :: try_from ( 5000 * USD_UNIT ) . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
452
- Some (
453
- BalanceOf :: < T > :: try_from ( 10_000 * USD_UNIT )
454
- . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
455
- ) ,
456
- ) ,
457
- institutional : TicketSize :: new (
458
- BalanceOf :: < T > :: try_from ( 5000 * USD_UNIT ) . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
459
- Some (
460
- BalanceOf :: < T > :: try_from ( 10_000 * USD_UNIT )
461
- . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ,
462
- ) ,
463
- ) ,
406
+ retail : TicketSize :: new ( 5000 * USD_UNIT , Some ( 10_000 * USD_UNIT ) ) ,
407
+ professional : TicketSize :: new ( 5000 * USD_UNIT , Some ( 10_000 * USD_UNIT ) ) ,
408
+ institutional : TicketSize :: new ( 5000 * USD_UNIT , Some ( 10_000 * USD_UNIT ) ) ,
464
409
phantom : Default :: default ( ) ,
465
410
} ,
466
411
participation_currencies : vec ! [ AcceptedFundingAsset :: USDT , AcceptedFundingAsset :: USDC ] . try_into ( ) . unwrap ( ) ,
@@ -518,9 +463,9 @@ mod benchmarks {
518
463
// Storage
519
464
let stored_details = ProjectsDetails :: < T > :: get ( project_id) . unwrap ( ) ;
520
465
assert_eq ! ( stored_details. status, ProjectStatus :: EvaluationRound ) ;
521
- let starting_evaluation_info = EvaluationRoundInfoOf :: < T > {
522
- total_bonded_usd : Zero :: zero ( ) ,
523
- total_bonded_plmc : Zero :: zero ( ) ,
466
+ let starting_evaluation_info = EvaluationRoundInfo {
467
+ total_bonded_usd : Balance :: zero ( ) ,
468
+ total_bonded_plmc : Balance :: zero ( ) ,
524
469
evaluators_outcome : None ,
525
470
} ;
526
471
assert_eq ! ( stored_details. evaluation_round_info, starting_evaluation_info) ;
@@ -706,10 +651,8 @@ mod benchmarks {
706
651
whitelist_account ! ( bidder) ;
707
652
708
653
let mut project_metadata = default_project_metadata :: < T > ( issuer. clone ( ) ) ;
709
- project_metadata. mainnet_token_max_supply =
710
- ( 100_000 * CT_UNIT ) . try_into ( ) . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ;
711
- project_metadata. total_allocation_size =
712
- ( 100_000 * CT_UNIT ) . try_into ( ) . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ;
654
+ project_metadata. mainnet_token_max_supply = 100_000 * CT_UNIT ;
655
+ project_metadata. total_allocation_size = 100_000 * CT_UNIT ;
713
656
project_metadata. minimum_price = PriceProviderOf :: < T > :: calculate_decimals_aware_price (
714
657
PriceOf :: < T > :: checked_from_rational ( 100 , 1 ) . unwrap ( ) ,
715
658
USD_DECIMALS ,
@@ -790,7 +733,7 @@ mod benchmarks {
790
733
let auction_allocation =
791
734
project_metadata. auction_round_allocation_percentage * project_metadata. total_allocation_size ;
792
735
let bucket_size = Percent :: from_percent ( 10 ) * auction_allocation;
793
- ct_amount = bucket_size * ( y as u128 ) . into ( ) ;
736
+ ct_amount = bucket_size * ( y as u128 ) ;
794
737
usdt_for_filler_bidder = usdt_for_new_bidder;
795
738
}
796
739
let extrinsic_bid = BidParams :: new ( bidder. clone ( ) , ct_amount, 1u8 , AcceptedFundingAsset :: USDT ) ;
@@ -949,10 +892,8 @@ mod benchmarks {
949
892
whitelist_account ! ( issuer) ;
950
893
951
894
let mut project_metadata = default_project_metadata :: < T > ( issuer. clone ( ) ) ;
952
- project_metadata. mainnet_token_max_supply =
953
- BalanceOf :: < T > :: try_from ( 10_000_000 * CT_UNIT ) . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ;
954
- project_metadata. total_allocation_size =
955
- BalanceOf :: < T > :: try_from ( 10_000_000 * CT_UNIT ) . unwrap_or_else ( |_| panic ! ( "Failed to create BalanceOf" ) ) ;
895
+ project_metadata. mainnet_token_max_supply = 10_000_000 * CT_UNIT ;
896
+ project_metadata. total_allocation_size = 10_000_000 * CT_UNIT ;
956
897
project_metadata. auction_round_allocation_percentage = Percent :: from_percent ( 100u8 ) ;
957
898
958
899
let project_id = inst. create_auctioning_project (
@@ -990,7 +931,7 @@ mod benchmarks {
990
931
// This one needs to fill the remaining with the bucket, so that all "accepted" bids will take the CT from a rejected one
991
932
let last_rejected_bid = BidParams :: < T > :: new (
992
933
account :: < AccountIdOf < T > > ( "bidder" , 0 , 420 ) ,
993
- auction_allocation - ( min_bid_amount * CT_UNIT * ( y as u128 - 1u128 ) ) . into ( ) ,
934
+ auction_allocation - ( min_bid_amount * CT_UNIT * ( y as u128 - 1u128 ) ) ,
994
935
1u8 ,
995
936
AcceptedFundingAsset :: USDT ,
996
937
) ;
0 commit comments