Skip to content

Commit

Permalink
bidding process
Browse files Browse the repository at this point in the history
  • Loading branch information
ndkazu committed Oct 18, 2023
1 parent b5a8632 commit d65b361
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pallets/bidding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pallet-onboarding = { default-features = false, path="../onboarding" }
pallet-housing_fund = { default-features = false, path="../housing_fund" }
pallet-nft = { default-features = false, path="../nft" }
pallet-finalizer = { default-features = false, path="../finalizer" }
rand = "0.8.5"
rand = {version = "0.8.5", features=["alloc"]}

[dev-dependencies]
sp-core = { version = "21.0.0", git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.1.0" }
Expand Down
15 changes: 10 additions & 5 deletions pallets/bidding/src/functions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub use super::*;
use rand::Rng;
use rand::distributions::Slice;
use rand::{Rng, seq::IteratorRandom};
use rand::seq::SliceRandom;
use sp_runtime::{BoundedVec,Percent};
use frame_support::pallet_prelude::ConstU32;
use Onboarding::Zero;
Expand All @@ -13,6 +13,7 @@ impl<T: Config> Pallet<T> {
//get asset price
let asset = Onboarding::Pallet::<T>::houses(collection_id,item_id).unwrap();
let asset_price = asset.price.unwrap();
let mut remaining_amount = asset_price.clone();
//Max contribution from asset Price
//Min contribution from asset price

Expand All @@ -25,13 +26,17 @@ impl<T: Config> Pallet<T> {
let contribution = Self::u128_to_onboarding_bal(contribution0).unwrap();
//user contributed more than 5% of asset_price
contribution > Percent::from_percent(5) * asset_price //should be minimun contribution calculated from asset price.
//true
//ToDo: We also want to only include users that did not contributed to a purchase for y_blocks (to be defined).

});

//Get a random sample of qualified investors
let inv_dist = Slice::new(&investors).unwrap();
//Get a random sample of qualified investors
let mut rng = rand::thread_rng();

//Build a sample of 10 investors
let inv_dist = investors.choose_multiple(&mut rng, 10);
//let inv:BoundedVec<T,ConstU32<5>> = BoundedVec::truncate_from(inv_dist);

}

// Conversion of BalanceOf<T> to u128
Expand Down

0 comments on commit d65b361

Please sign in to comment.