Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
phase data all
Browse files Browse the repository at this point in the history
  • Loading branch information
amiyatulu committed Jan 12, 2024
1 parent 43361c3 commit 2c439f9
Show file tree
Hide file tree
Showing 9 changed files with 164 additions and 37 deletions.
87 changes: 54 additions & 33 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions pallets/posts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional
frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
sp-runtime = { version = "7.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
# polars = {version = "0.36.2", default-features = false}

# Substrate dependencies
pallet-support = { default-features = false, path = '../support' }
Expand Down
3 changes: 2 additions & 1 deletion pallets/profile-validation/src/extras.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ impl<T: Config> ChallengeEvidencePost<T> {

impl<T: Config> Pallet<T> {
pub(super) fn get_phase_data() -> PhaseData<T> {
T::SchellingGameSharedSource::create_phase_data(50, 5, 3, 100, (100, 100))
T::SchellingGameSharedSource::create_phase_with_all_data(10, 100, 100, 100, 100, 100, 100, 5, 3, 100, (100, 100))
// T::SchellingGameSharedSource::create_phase_data(100, 5, 3, 100, (100, 100))
}

// pub(super) fn get_citizen_accountid(
Expand Down
2 changes: 1 addition & 1 deletion pallets/profile-validation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ pub mod pallet {
/// than required. If the funded amount matches the required amount, the profile validation is marked
/// as completed, and a link is set to the evidence period in the Schelling Game.
///
/// ```
/// ```rust,ignore
/// #[pallet::call]
/// fn add_profile_stake(
/// origin: OriginFor<T>,
Expand Down
27 changes: 27 additions & 0 deletions pallets/schelling-game-shared/src/extras.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
use crate::*;

impl<T: Config> Pallet<T> {
pub(super) fn create_phase_with_all_data(
evidence_length: u64,
end_of_staking_time: u64,
staking_length: u64,
drawing_length: u64,
commit_length: u64,
vote_length: u64,
appeal_length: u64,
max_draws: u64,
min_number_juror_staked: u64,
min_juror_stake: u64,
juror_incentives: (u64, u64),
) -> PhaseDataOf<T> {
PhaseData::create_phase_with_all_data(
evidence_length,
end_of_staking_time,
staking_length,
drawing_length,
commit_length,
vote_length,
appeal_length,
max_draws,
min_number_juror_staked,
min_juror_stake,
juror_incentives,
)
}
pub(super) fn create_phase_data(
block_length: u64,
max_draws: u64,
Expand Down
37 changes: 37 additions & 0 deletions pallets/schelling-game-shared/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,41 @@ impl<T: Config> PhaseData<T> {
juror_incentives,
}
}

pub fn create_phase_with_all_data(
evidence_length: u64,
end_of_staking_time: u64,
staking_length: u64,
drawing_length: u64,
commit_length: u64,
vote_length: u64,
appeal_length: u64,
max_draws: u64,
min_number_juror_staked: u64,
min_juror_stake: u64,
juror_incentives: (u64, u64),
) -> Self {
let evidence_length = evidence_length.saturated_into::<BlockNumberOf<T>>();
let end_of_staking_time = end_of_staking_time.saturated_into::<BlockNumberOf<T>>();
let staking_length = staking_length.saturated_into::<BlockNumberOf<T>>();
let drawing_length = drawing_length.saturated_into::<BlockNumberOf<T>>();
let commit_length = commit_length.saturated_into::<BlockNumberOf<T>>();
let vote_length = vote_length.saturated_into::<BlockNumberOf<T>>();
let appeal_length = appeal_length.saturated_into::<BlockNumberOf<T>>();

let min_juror_stake = min_juror_stake.saturated_into::<BalanceOf<T>>();
PhaseData {
evidence_length,
end_of_staking_time,
staking_length,
drawing_length,
commit_length,
vote_length,
appeal_length,
max_draws,
min_number_juror_staked,
min_juror_stake,
juror_incentives,
}
}
}
28 changes: 28 additions & 0 deletions pallets/schelling-game-shared/src/share_link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,34 @@ impl<T: Config> SchellingGameSharedLink for Pallet<T> {
)
}

fn create_phase_with_all_data(
evidence_length: u64,
end_of_staking_time: u64,
staking_length: u64,
drawing_length: u64,
commit_length: u64,
vote_length: u64,
appeal_length: u64,
max_draws: u64,
min_number_juror_staked: u64,
min_juror_stake: u64,
juror_incentives: (u64, u64),
) -> Self::PhaseData {
Self::create_phase_with_all_data(
evidence_length,
end_of_staking_time,
staking_length,
drawing_length,
commit_length,
vote_length,
appeal_length,
max_draws,
min_number_juror_staked,
min_juror_stake,
juror_incentives,
)
}

/// Get the Period
fn get_period_link(key: Self::SumTreeName) -> Option<Period> {
Self::get_period(key)
Expand Down
File renamed without changes.
16 changes: 14 additions & 2 deletions traits/schelling-game-shared-link/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ pub trait SchellingGameSharedLink {
min_juror_stake: u64,
juror_incentives: (u64, u64),
) -> Self::PhaseData;

fn create_phase_with_all_data(
evidence_length: u64,
end_of_staking_time: u64,
staking_length: u64,
drawing_length: u64,
commit_length: u64,
vote_length: u64,
appeal_length: u64,
max_draws: u64,
min_number_juror_staked: u64,
min_juror_stake: u64,
juror_incentives: (u64, u64),
) -> Self::PhaseData;
fn get_period_link(key: Self::SumTreeName) -> Option<Self::Period>;

fn set_to_evidence_period_link(
Expand Down Expand Up @@ -130,6 +144,4 @@ pub trait SchellingGameSharedLink {
fn get_drawn_jurors(key: Self::SumTreeName) -> Vec<(Self::AccountId, u64)>;

fn get_winning_decision_value_link(key: Self::SumTreeName) -> Self::WinningDecision;


}

0 comments on commit 2c439f9

Please sign in to comment.