From d4124c0af2610ff3cf88e82cab311f49c9a431ce Mon Sep 17 00:00:00 2001 From: Juan Ignacio Rios <54085674+JuaniRios@users.noreply.github.com> Date: Mon, 6 May 2024 15:45:48 +0200 Subject: [PATCH] Fix tests (#284) ## What? - Fixes all the existing tests from #283 --- integration-tests/src/tests/defaults.rs | 10 +-- integration-tests/src/tests/e2e.rs | 10 +-- pallets/funding/src/benchmarking.rs | 73 ++++++++++------------ pallets/funding/src/tests/1_application.rs | 27 ++++---- pallets/funding/src/tests/3_auction.rs | 30 ++++----- pallets/funding/src/tests/4_community.rs | 22 +++---- pallets/funding/src/tests/5_remainder.rs | 30 ++++----- pallets/funding/src/tests/misc.rs | 14 ++--- pallets/funding/src/tests/mod.rs | 20 +++--- 9 files changed, 114 insertions(+), 122 deletions(-) diff --git a/integration-tests/src/tests/defaults.rs b/integration-tests/src/tests/defaults.rs index 1bc6487ae..b5bd2fd58 100644 --- a/integration-tests/src/tests/defaults.rs +++ b/integration-tests/src/tests/defaults.rs @@ -76,14 +76,14 @@ pub fn default_project_metadata(issuer: AccountId) -> ProjectMetadataOf ProjectMetadataOf { ) .unwrap(), bidding_ticket_sizes: BiddingTicketSizes { - professional: TicketSize::new(Some(5000 * USD_UNIT), None), - institutional: TicketSize::new(Some(5000 * USD_UNIT), None), + professional: TicketSize::new(5000 * USD_UNIT, None), + institutional: TicketSize::new(5000 * USD_UNIT, None), phantom: Default::default(), }, contributing_ticket_sizes: ContributingTicketSizes { - retail: TicketSize::new(None, None), - professional: TicketSize::new(None, None), - institutional: TicketSize::new(None, None), + retail: TicketSize::new(USD_UNIT, None), + professional: TicketSize::new(USD_UNIT, None), + institutional: TicketSize::new(USD_UNIT, None), phantom: Default::default(), }, participation_currencies: vec![AcceptedFundingAsset::USDT].try_into().unwrap(), diff --git a/pallets/funding/src/benchmarking.rs b/pallets/funding/src/benchmarking.rs index 7f79d519c..07224b9fb 100644 --- a/pallets/funding/src/benchmarking.rs +++ b/pallets/funding/src/benchmarking.rs @@ -67,23 +67,28 @@ where bidding_ticket_sizes: BiddingTicketSizes { professional: TicketSize::new( - Some( - BalanceOf::::try_from(5000 * USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), - ), + BalanceOf::::try_from(5000 * USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), None, ), institutional: TicketSize::new( - Some( - BalanceOf::::try_from(5000 * USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), - ), + BalanceOf::::try_from(5000 * USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), None, ), phantom: Default::default(), }, contributing_ticket_sizes: ContributingTicketSizes { - retail: TicketSize::new(None, None), - professional: TicketSize::new(None, None), - institutional: TicketSize::new(None, None), + retail: TicketSize::new( + BalanceOf::::try_from(USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), + None, + ), + professional: TicketSize::new( + BalanceOf::::try_from(USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), + None, + ), + institutional: TicketSize::new( + BalanceOf::::try_from(USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), + None, + ), phantom: Default::default(), }, participation_currencies: vec![AcceptedFundingAsset::USDT].try_into().unwrap(), @@ -481,20 +486,14 @@ mod benchmarks { .unwrap(), bidding_ticket_sizes: BiddingTicketSizes { professional: TicketSize::new( - Some( - BalanceOf::::try_from(5000 * USD_UNIT) - .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), - ), + BalanceOf::::try_from(5000 * USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), Some( BalanceOf::::try_from(10_000 * USD_UNIT) .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), ), ), institutional: TicketSize::new( - Some( - BalanceOf::::try_from(5000 * USD_UNIT) - .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), - ), + BalanceOf::::try_from(5000 * USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), Some( BalanceOf::::try_from(10_000 * USD_UNIT) .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), @@ -504,30 +503,21 @@ mod benchmarks { }, contributing_ticket_sizes: ContributingTicketSizes { retail: TicketSize::new( - Some( - BalanceOf::::try_from(5000 * USD_UNIT) - .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), - ), + BalanceOf::::try_from(5000 * USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), Some( BalanceOf::::try_from(10_000 * USD_UNIT) .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), ), ), professional: TicketSize::new( - Some( - BalanceOf::::try_from(5000 * USD_UNIT) - .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), - ), + BalanceOf::::try_from(5000 * USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), Some( BalanceOf::::try_from(10_000 * USD_UNIT) .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), ), ), institutional: TicketSize::new( - Some( - BalanceOf::::try_from(5000 * USD_UNIT) - .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), - ), + BalanceOf::::try_from(5000 * USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), Some( BalanceOf::::try_from(10_000 * USD_UNIT) .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), @@ -2044,25 +2034,28 @@ mod benchmarks { .unwrap(), bidding_ticket_sizes: BiddingTicketSizes { professional: TicketSize::new( - Some( - BalanceOf::::try_from(5000 * USD_UNIT) - .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), - ), + BalanceOf::::try_from(5000 * USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), None, ), institutional: TicketSize::new( - Some( - BalanceOf::::try_from(5000 * USD_UNIT) - .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), - ), + BalanceOf::::try_from(5000 * USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), None, ), phantom: Default::default(), }, contributing_ticket_sizes: ContributingTicketSizes { - retail: TicketSize::new(None, None), - professional: TicketSize::new(None, None), - institutional: TicketSize::new(None, None), + retail: TicketSize::new( + BalanceOf::::try_from(USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), + None, + ), + professional: TicketSize::new( + BalanceOf::::try_from(USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), + None, + ), + institutional: TicketSize::new( + BalanceOf::::try_from(USD_UNIT).unwrap_or_else(|_| panic!("Failed to create BalanceOf")), + None, + ), phantom: Default::default(), }, participation_currencies: vec![AcceptedFundingAsset::USDT].try_into().unwrap(), diff --git a/pallets/funding/src/tests/1_application.rs b/pallets/funding/src/tests/1_application.rs index 3f90942bd..1d5211899 100644 --- a/pallets/funding/src/tests/1_application.rs +++ b/pallets/funding/src/tests/1_application.rs @@ -382,27 +382,26 @@ mod create_project_extrinsic { // min in bidding below 5k let mut wrong_project_1 = correct_project.clone(); - wrong_project_1.bidding_ticket_sizes.professional = TicketSize::new(Some(4999 * USD_UNIT), None); + wrong_project_1.bidding_ticket_sizes.professional = TicketSize::new(4999 * USD_UNIT, None); let mut wrong_project_2 = correct_project.clone(); - wrong_project_2.bidding_ticket_sizes.institutional = TicketSize::new(Some(4999 * USD_UNIT), None); + wrong_project_2.bidding_ticket_sizes.institutional = TicketSize::new(4999 * USD_UNIT, None); let mut wrong_project_3 = correct_project.clone(); - wrong_project_3.bidding_ticket_sizes.professional = TicketSize::new(Some(3000 * USD_UNIT), None); - wrong_project_3.bidding_ticket_sizes.institutional = TicketSize::new(Some(0 * USD_UNIT), None); + wrong_project_3.bidding_ticket_sizes.professional = TicketSize::new(3000 * USD_UNIT, None); + wrong_project_3.bidding_ticket_sizes.institutional = TicketSize::new(0 * USD_UNIT, None); let mut wrong_project_4 = correct_project.clone(); - wrong_project_4.bidding_ticket_sizes.professional = TicketSize::new(None, None); - wrong_project_4.bidding_ticket_sizes.institutional = TicketSize::new(None, None); + wrong_project_4.bidding_ticket_sizes.professional = TicketSize::new(USD_UNIT, None); + wrong_project_4.bidding_ticket_sizes.institutional = TicketSize::new(USD_UNIT, None); // min higher than max let mut wrong_project_5 = correct_project.clone(); - wrong_project_5.bidding_ticket_sizes.professional = - TicketSize::new(Some(5000 * USD_UNIT), Some(4990 * USD_UNIT)); + wrong_project_5.bidding_ticket_sizes.professional = TicketSize::new(5000 * USD_UNIT, Some(4990 * USD_UNIT)); let mut wrong_project_6 = correct_project.clone(); wrong_project_6.bidding_ticket_sizes.institutional = - TicketSize::new(Some(6000 * USD_UNIT), Some(5500 * USD_UNIT)); + TicketSize::new(6000 * USD_UNIT, Some(5500 * USD_UNIT)); let wrong_projects = vec![ wrong_project_1.clone(), @@ -835,14 +834,14 @@ mod edit_project_extrinsic { ) .unwrap(), bidding_ticket_sizes: BiddingTicketSizes { - professional: TicketSize::new(Some(10_000 * USD_UNIT), Some(20_000 * USD_UNIT)), - institutional: TicketSize::new(Some(20_000 * USD_UNIT), Some(30_000 * USD_UNIT)), + professional: TicketSize::new(10_000 * USD_UNIT, Some(20_000 * USD_UNIT)), + institutional: TicketSize::new(20_000 * USD_UNIT, Some(30_000 * USD_UNIT)), phantom: Default::default(), }, contributing_ticket_sizes: ContributingTicketSizes { - retail: TicketSize::new(Some(1_000 * USD_UNIT), Some(2_000 * USD_UNIT)), - professional: TicketSize::new(Some(2_000 * USD_UNIT), Some(3_000 * USD_UNIT)), - institutional: TicketSize::new(Some(3_000 * USD_UNIT), Some(4_000 * USD_UNIT)), + retail: TicketSize::new(1_000 * USD_UNIT, Some(2_000 * USD_UNIT)), + professional: TicketSize::new(2_000 * USD_UNIT, Some(3_000 * USD_UNIT)), + institutional: TicketSize::new(3_000 * USD_UNIT, Some(4_000 * USD_UNIT)), phantom: Default::default(), }, participation_currencies: vec![AcceptedFundingAsset::USDT, AcceptedFundingAsset::USDC] diff --git a/pallets/funding/src/tests/3_auction.rs b/pallets/funding/src/tests/3_auction.rs index 9fbc9159a..c000472a4 100644 --- a/pallets/funding/src/tests/3_auction.rs +++ b/pallets/funding/src/tests/3_auction.rs @@ -71,14 +71,14 @@ mod round_flow { auction_round_allocation_percentage: Percent::from_percent(50u8), minimum_price: decimal_aware_price, bidding_ticket_sizes: BiddingTicketSizes { - professional: TicketSize::new(Some(5000 * USD_UNIT), None), - institutional: TicketSize::new(Some(5000 * USD_UNIT), None), + professional: TicketSize::new(5000 * USD_UNIT, None), + institutional: TicketSize::new(5000 * USD_UNIT, None), phantom: Default::default(), }, contributing_ticket_sizes: ContributingTicketSizes { - retail: TicketSize::new(None, None), - professional: TicketSize::new(None, None), - institutional: TicketSize::new(None, None), + retail: TicketSize::new(USD_UNIT, None), + professional: TicketSize::new(USD_UNIT, None), + institutional: TicketSize::new(USD_UNIT, None), phantom: Default::default(), }, participation_currencies: vec![AcceptedFundingAsset::USDT].try_into().unwrap(), @@ -610,7 +610,7 @@ mod round_flow { auction_allocations_usd.push(auction_allocation_usd); let min_professional_bid_usd = - project_metadata.bidding_ticket_sizes.professional.usd_minimum_per_participation.unwrap(); + project_metadata.bidding_ticket_sizes.professional.usd_minimum_per_participation; min_bid_amounts_usd.push(min_professional_bid_usd); let min_professional_bid_ct = project_metadata.minimum_price.reciprocal().unwrap().saturating_mul_int(min_professional_bid_usd); @@ -1533,8 +1533,8 @@ mod bid_extrinsic { let mut project_metadata = default_project_metadata(ISSUER_1); project_metadata.total_allocation_size = 100_000 * CT_UNIT; project_metadata.bidding_ticket_sizes = BiddingTicketSizes { - professional: TicketSize::new(Some(8_000 * USD_UNIT), None), - institutional: TicketSize::new(Some(20_000 * USD_UNIT), None), + professional: TicketSize::new(8_000 * USD_UNIT, None), + institutional: TicketSize::new(20_000 * USD_UNIT, None), phantom: Default::default(), }; @@ -1589,8 +1589,8 @@ mod bid_extrinsic { let mut project_metadata = default_project_metadata(ISSUER_1); project_metadata.total_allocation_size = 100_000 * CT_UNIT; project_metadata.bidding_ticket_sizes = BiddingTicketSizes { - professional: TicketSize::new(Some(8_000 * USD_UNIT), None), - institutional: TicketSize::new(Some(20_000 * USD_UNIT), None), + professional: TicketSize::new(8_000 * USD_UNIT, None), + institutional: TicketSize::new(20_000 * USD_UNIT, None), phantom: Default::default(), }; project_metadata.minimum_price = PriceProviderOf::::calculate_decimals_aware_price( @@ -1671,14 +1671,14 @@ mod bid_extrinsic { let mut inst = MockInstantiator::new(Some(RefCell::new(new_test_ext()))); let mut project_metadata = default_project_metadata(ISSUER_1); project_metadata.bidding_ticket_sizes = BiddingTicketSizes { - professional: TicketSize::new(Some(8_000 * USD_UNIT), Some(100_000 * USD_UNIT)), - institutional: TicketSize::new(Some(20_000 * USD_UNIT), Some(500_000 * USD_UNIT)), + professional: TicketSize::new(8_000 * USD_UNIT, Some(100_000 * USD_UNIT)), + institutional: TicketSize::new(20_000 * USD_UNIT, Some(500_000 * USD_UNIT)), phantom: Default::default(), }; project_metadata.contributing_ticket_sizes = ContributingTicketSizes { - retail: TicketSize::new(None, Some(100_000 * USD_UNIT)), - professional: TicketSize::new(None, Some(20_000 * USD_UNIT)), - institutional: TicketSize::new(None, Some(50_000 * USD_UNIT)), + retail: TicketSize::new(USD_UNIT, Some(100_000 * USD_UNIT)), + professional: TicketSize::new(USD_UNIT, Some(20_000 * USD_UNIT)), + institutional: TicketSize::new(USD_UNIT, Some(50_000 * USD_UNIT)), phantom: Default::default(), }; let evaluations = default_evaluations(); diff --git a/pallets/funding/src/tests/4_community.rs b/pallets/funding/src/tests/4_community.rs index 20ce2a524..9b0d5611e 100644 --- a/pallets/funding/src/tests/4_community.rs +++ b/pallets/funding/src/tests/4_community.rs @@ -591,14 +591,14 @@ mod community_contribute_extrinsic { project_metadata.mainnet_token_max_supply = 80_000_000 * CT_UNIT; project_metadata.total_allocation_size = 10_000_000 * CT_UNIT; project_metadata.bidding_ticket_sizes = BiddingTicketSizes { - professional: TicketSize::new(Some(5000 * USD_UNIT), None), - institutional: TicketSize::new(Some(5000 * USD_UNIT), None), + professional: TicketSize::new(5000 * USD_UNIT, None), + institutional: TicketSize::new(5000 * USD_UNIT, None), phantom: Default::default(), }; project_metadata.contributing_ticket_sizes = ContributingTicketSizes { - retail: TicketSize::new(None, None), - professional: TicketSize::new(None, None), - institutional: TicketSize::new(None, None), + retail: TicketSize::new(USD_UNIT, None), + professional: TicketSize::new(USD_UNIT, None), + institutional: TicketSize::new(USD_UNIT, None), phantom: Default::default(), }; let evaluations = @@ -1019,9 +1019,9 @@ mod community_contribute_extrinsic { let mut inst = MockInstantiator::new(Some(RefCell::new(new_test_ext()))); let mut project_metadata = default_project_metadata(ISSUER_1); project_metadata.contributing_ticket_sizes = ContributingTicketSizes { - retail: TicketSize::new(Some(10 * USD_UNIT), None), - professional: TicketSize::new(Some(100_000 * USD_UNIT), None), - institutional: TicketSize::new(Some(200_000 * USD_UNIT), None), + retail: TicketSize::new(10 * USD_UNIT, None), + professional: TicketSize::new(100_000 * USD_UNIT, None), + institutional: TicketSize::new(200_000 * USD_UNIT, None), phantom: Default::default(), }; @@ -1112,9 +1112,9 @@ mod community_contribute_extrinsic { let mut inst = MockInstantiator::new(Some(RefCell::new(new_test_ext()))); let mut project_metadata = default_project_metadata(ISSUER_1); project_metadata.contributing_ticket_sizes = ContributingTicketSizes { - retail: TicketSize::new(None, Some(100_000 * USD_UNIT)), - professional: TicketSize::new(None, Some(20_000 * USD_UNIT)), - institutional: TicketSize::new(None, Some(50_000 * USD_UNIT)), + retail: TicketSize::new(USD_UNIT, Some(100_000 * USD_UNIT)), + professional: TicketSize::new(USD_UNIT, Some(20_000 * USD_UNIT)), + institutional: TicketSize::new(USD_UNIT, Some(50_000 * USD_UNIT)), phantom: Default::default(), }; diff --git a/pallets/funding/src/tests/5_remainder.rs b/pallets/funding/src/tests/5_remainder.rs index dcf3d56bc..5d9bb120f 100644 --- a/pallets/funding/src/tests/5_remainder.rs +++ b/pallets/funding/src/tests/5_remainder.rs @@ -497,14 +497,14 @@ mod remaining_contribute_extrinsic { ) .unwrap(), bidding_ticket_sizes: BiddingTicketSizes { - professional: TicketSize::new(Some(5000 * USD_UNIT), None), - institutional: TicketSize::new(Some(5000 * USD_UNIT), None), + professional: TicketSize::new(5000 * USD_UNIT, None), + institutional: TicketSize::new(5000 * USD_UNIT, None), phantom: Default::default(), }, contributing_ticket_sizes: ContributingTicketSizes { - retail: TicketSize::new(None, None), - professional: TicketSize::new(None, None), - institutional: TicketSize::new(None, None), + retail: TicketSize::new(USD_UNIT, None), + professional: TicketSize::new(USD_UNIT, None), + institutional: TicketSize::new(USD_UNIT, None), phantom: Default::default(), }, participation_currencies: vec![AcceptedFundingAsset::USDT].try_into().unwrap(), @@ -853,14 +853,14 @@ mod remaining_contribute_extrinsic { ) .unwrap(), bidding_ticket_sizes: BiddingTicketSizes { - professional: TicketSize::new(Some(8000 * USD_UNIT), None), - institutional: TicketSize::new(Some(20_000 * USD_UNIT), None), + professional: TicketSize::new(8000 * USD_UNIT, None), + institutional: TicketSize::new(20_000 * USD_UNIT, None), phantom: Default::default(), }, contributing_ticket_sizes: ContributingTicketSizes { - retail: TicketSize::new(Some(10 * USD_UNIT), None), - professional: TicketSize::new(Some(100_000 * USD_UNIT), None), - institutional: TicketSize::new(Some(200_000 * USD_UNIT), None), + retail: TicketSize::new(10 * USD_UNIT, None), + professional: TicketSize::new(100_000 * USD_UNIT, None), + institutional: TicketSize::new(200_000 * USD_UNIT, None), phantom: Default::default(), }, participation_currencies: vec![AcceptedFundingAsset::USDT].try_into().unwrap(), @@ -966,14 +966,14 @@ mod remaining_contribute_extrinsic { ) .unwrap(), bidding_ticket_sizes: BiddingTicketSizes { - professional: TicketSize::new(Some(5000 * USD_UNIT), None), - institutional: TicketSize::new(Some(5000 * USD_UNIT), None), + professional: TicketSize::new(5000 * USD_UNIT, None), + institutional: TicketSize::new(5000 * USD_UNIT, None), phantom: Default::default(), }, contributing_ticket_sizes: ContributingTicketSizes { - retail: TicketSize::new(None, Some(300_000 * USD_UNIT)), - professional: TicketSize::new(None, Some(20_000 * USD_UNIT)), - institutional: TicketSize::new(None, Some(50_000 * USD_UNIT)), + retail: TicketSize::new(USD_UNIT, Some(300_000 * USD_UNIT)), + professional: TicketSize::new(USD_UNIT, Some(20_000 * USD_UNIT)), + institutional: TicketSize::new(USD_UNIT, Some(50_000 * USD_UNIT)), phantom: Default::default(), }, participation_currencies: vec![AcceptedFundingAsset::USDT].try_into().unwrap(), diff --git a/pallets/funding/src/tests/misc.rs b/pallets/funding/src/tests/misc.rs index 2dbde49c5..e0d1fe702 100644 --- a/pallets/funding/src/tests/misc.rs +++ b/pallets/funding/src/tests/misc.rs @@ -176,14 +176,14 @@ mod helper_functions { ) .unwrap(), bidding_ticket_sizes: BiddingTicketSizes { - professional: TicketSize::new(Some(5000 * USD_UNIT), None), - institutional: TicketSize::new(Some(5000 * USD_UNIT), None), + professional: TicketSize::new(5000 * USD_UNIT, None), + institutional: TicketSize::new(5000 * USD_UNIT, None), phantom: Default::default(), }, contributing_ticket_sizes: ContributingTicketSizes { - retail: TicketSize::new(None, None), - professional: TicketSize::new(None, None), - institutional: TicketSize::new(None, None), + retail: TicketSize::new(USD_UNIT, None), + professional: TicketSize::new(USD_UNIT, None), + institutional: TicketSize::new(USD_UNIT, None), phantom: Default::default(), }, participation_currencies: vec![AcceptedFundingAsset::USDT].try_into().unwrap(), @@ -571,13 +571,13 @@ mod async_tests { let mut project_metadata = default_project_metadata(ISSUER_1.into()); let evaluations = default_evaluations(); let max_bids_per_project: u32 = ::MaxBidsPerProject::get(); - let min_bid = project_metadata.bidding_ticket_sizes.institutional.usd_minimum_per_participation.unwrap(); + let min_bid = project_metadata.bidding_ticket_sizes.institutional.usd_minimum_per_participation; let auction_allocation_percentage = project_metadata.auction_round_allocation_percentage; let auction_ct_required = min_bid.saturating_mul(max_bids_per_project as u128); let total_allocation_required = auction_allocation_percentage.saturating_reciprocal_mul(auction_ct_required); project_metadata.total_allocation_size = total_allocation_required; - let min_bid_usd = project_metadata.bidding_ticket_sizes.institutional.usd_minimum_per_participation.unwrap(); + let min_bid_usd = project_metadata.bidding_ticket_sizes.institutional.usd_minimum_per_participation; let min_bid_ct = project_metadata.minimum_price.reciprocal().unwrap().checked_mul_int(min_bid_usd).unwrap(); let max_bids = (0u32..max_bids_per_project) .map(|i| { diff --git a/pallets/funding/src/tests/mod.rs b/pallets/funding/src/tests/mod.rs index 800e85ec1..5ded52d14 100644 --- a/pallets/funding/src/tests/mod.rs +++ b/pallets/funding/src/tests/mod.rs @@ -97,14 +97,14 @@ pub mod defaults { auction_round_allocation_percentage: Percent::from_percent(50u8), minimum_price: decimal_aware_price, bidding_ticket_sizes: BiddingTicketSizes { - professional: TicketSize::new(Some(5000 * USD_UNIT), None), - institutional: TicketSize::new(Some(5000 * USD_UNIT), None), + professional: TicketSize::new(5000 * USD_UNIT, None), + institutional: TicketSize::new(5000 * USD_UNIT, None), phantom: Default::default(), }, contributing_ticket_sizes: ContributingTicketSizes { - retail: TicketSize::new(None, None), - professional: TicketSize::new(None, None), - institutional: TicketSize::new(None, None), + retail: TicketSize::new(USD_UNIT, None), + professional: TicketSize::new(USD_UNIT, None), + institutional: TicketSize::new(USD_UNIT, None), phantom: Default::default(), }, participation_currencies: vec![AcceptedFundingAsset::USDT].try_into().unwrap(), @@ -131,14 +131,14 @@ pub mod defaults { auction_round_allocation_percentage: Percent::from_percent(50u8), minimum_price: decimal_aware_price, bidding_ticket_sizes: BiddingTicketSizes { - professional: TicketSize::new(Some(5000 * USD_UNIT), None), - institutional: TicketSize::new(Some(5000 * USD_UNIT), None), + professional: TicketSize::new(5000 * USD_UNIT, None), + institutional: TicketSize::new(5000 * USD_UNIT, None), phantom: Default::default(), }, contributing_ticket_sizes: ContributingTicketSizes { - retail: TicketSize::new(None, None), - professional: TicketSize::new(None, None), - institutional: TicketSize::new(None, None), + retail: TicketSize::new(USD_UNIT, None), + professional: TicketSize::new(USD_UNIT, None), + institutional: TicketSize::new(USD_UNIT, None), phantom: Default::default(), }, participation_currencies: vec![AcceptedFundingAsset::USDT].try_into().unwrap(),