Skip to content

Commit

Permalink
Need to fix failing import or thread_rng
Browse files Browse the repository at this point in the history
  • Loading branch information
ndkazu committed Oct 24, 2023
1 parent b0ddcda commit 4d93531
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 14 deletions.
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions pallets/bidding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ 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 = {version = "0.8.5", features=["alloc"]}
pallet-share_distributor = { default-features = false, path="../share_distributor" }
rand = {version = "0.8.5", default-features = false, features=["std_rng","getrandom"]}
getrandom = { version = "0.2.10", default-features = false, features = ["js"] }


[dev-dependencies]

sp-core = { version = "21.0.0", git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.1.0" }
sp-io = { version = "23.0.0", git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.1.0" }
sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.1.0" }
Expand All @@ -43,6 +47,7 @@ sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/polkadot
default = ["std"]
std = [
"codec/std",
"rand/std",
"frame-benchmarking/std",
"sp-std/std",
"frame-support/std",
Expand All @@ -56,7 +61,8 @@ std = [
"pallet-onboarding/std",
"pallet-nft/std",
"pallet-housing_fund/std",
"pallet-finalizer/std"
"pallet-finalizer/std",
"getrandom/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
Expand Down
15 changes: 7 additions & 8 deletions pallets/bidding/src/functions.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
pub use super::*;
use rand::{Rng, seq::IteratorRandom};
use rand::seq::SliceRandom;
use sp_runtime::{BoundedVec,Percent};
use frame_support::pallet_prelude::ConstU32;
use Onboarding::Zero;

pub use rand::prelude::*;
pub use sp_runtime::{BoundedVec,Percent};
pub use frame_support::pallet_prelude::ConstU32;
pub use Onboarding::Zero;
pub use pallet_roles::vec;


impl<T: Config> Pallet<T> {

pub fn process(collection_id: T::NftCollectionId, item_id: T::NftItemId){
pub fn initial_investors_list(collection_id: T::NftCollectionId, item_id: T::NftItemId){
//get asset price
let asset = Onboarding::Pallet::<T>::houses(collection_id,item_id).unwrap();
let asset_price = asset.price.unwrap();
Expand All @@ -31,7 +30,7 @@ impl<T: Config> Pallet<T> {
});

//Get a random sample of qualified investors
let mut rng = rand::thread_rng();
let mut rng = thread_rng();

//Build a sample of 10 investors
let inv_dist = investors.choose_multiple(&mut rng, 10);
Expand Down
8 changes: 7 additions & 1 deletion pallets/bidding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub use pallet_roles as Roles;
pub use pallet_housing_fund as Houses;
pub use pallet_finalizer as Finalizer;
pub use pallet_nft as Nft;
pub use pallet_share_distributor as Share;


// All pallet logic is defined in its own module and must be annotated by the `pallet` attribute.
Expand All @@ -45,7 +46,8 @@ pub mod pallet {
+ Roles::Config
+ Onboarding::Config
+ Houses::Config
+ Nft::Config {
+ Nft::Config
+ Share::Config {
/// The overarching runtime event type.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

Expand All @@ -60,6 +62,10 @@ pub mod pallet {
#[pallet::getter(fn something)]
pub type Something<T> = StorageValue<_, u32>;

#[pallet::storage]
#[pallet::getter(fn round)]
pub type InvestmentRound<T> = StorageValue<_, u32>;

/// Events that functions in this pallet can emit.
///
/// Events are a simple means of indicating to the outside world (such as dApps, chain explorers
Expand Down
11 changes: 8 additions & 3 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ pallet-onboarding = { version = "4.0.0-dev", default-features = false, path = ".
pallet-council = { version = "4.0.0-dev", default-features = false, path = "../pallets/council" }
pallet-finalizer = { version = "4.0.0-dev", default-features = false, path = "../pallets/finalizer" }
pallet-share_distributor = { version = "4.0.0-dev", default-features = false, path = "../pallets/share_distributor" }
pallet-bidding = { version = "4.0.0-dev", default-features = false, path = "../pallets/bidding" }

[build-dependencies]
substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", optional = true , tag = "polkadot-v1.1.0" }
Expand Down Expand Up @@ -122,7 +123,8 @@ std = [
"pallet-assets/std",
"pallet-nfts/std",
"pallet-nfts-runtime-api/std",
"pallet-share_distributor/std"
"pallet-share_distributor/std",
"pallet-bidding/std"
### add new std
]
runtime-benchmarks = [
Expand All @@ -149,7 +151,8 @@ runtime-benchmarks = [
"pallet-preimage/runtime-benchmarks",
"pallet-democracy/runtime-benchmarks",
"pallet-nfts/runtime-benchmarks",
"pallet-share_distributor/runtime-benchmarks"
"pallet-share_distributor/runtime-benchmarks",
"pallet-bidding/runtime-benchmarks"
### add new runtime-benchmarks
]
try-runtime = [
Expand All @@ -175,6 +178,8 @@ try-runtime = [
"pallet-preimage/try-runtime",
"pallet-democracy/try-runtime",
"pallet-nfts/try-runtime",
"pallet-share_distributor/try-runtime"
"pallet-share_distributor/try-runtime",
"pallet-bidding/try-runtime"

### add new try-runtime
]
7 changes: 7 additions & 0 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub use pallet_onboarding;
pub use pallet_council;
use pallet_nft::NftPermissions;
pub use pallet_share_distributor;
pub use pallet_bidding;
pub use pallet_nft::{self, Acc, CollectionId, ItemId, NftPermission};
// flag add pallet use

Expand Down Expand Up @@ -288,6 +289,10 @@ impl pallet_roles::Config for Runtime {
//type WeightInfo = pallet_roles::weights::SubstrateWeight<Runtime>;
}

impl pallet_bidding::Config for Runtime{
type RuntimeEvent = RuntimeEvent;
}

impl pallet_finalizer::Config for Runtime{
type RuntimeEvent = RuntimeEvent;
//type WeightInfo =
Expand Down Expand Up @@ -690,6 +695,7 @@ construct_runtime!(
CouncilModule: pallet_council,
FinalizerModule: pallet_finalizer,
ShareDistributorModule: pallet_share_distributor,
BiddingModule: pallet_bidding,
// flag add pallet runtime
}
);
Expand Down Expand Up @@ -740,6 +746,7 @@ mod benches {
[pallet_nfts, Nfts]
[pallet_timestamp, Timestamp]
[pallet_roles, RolesModule]
//[pallet_bidding,BiddingModule]
//[pallet_council, CouncilModule]
//[pallet_share_distributor,ShareDistributorModule]
//[pallet_housing_fund, HousingFundModule]
Expand Down

0 comments on commit 4d93531

Please sign in to comment.