Skip to content

Commit

Permalink
reputation score
Browse files Browse the repository at this point in the history
  • Loading branch information
amiyatulu committed Jul 4, 2024
1 parent 55153c9 commit 6bb5549
Show file tree
Hide file tree
Showing 8 changed files with 974 additions and 843 deletions.
20 changes: 10 additions & 10 deletions container-chains/nodes/simple/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ where
C::Api: BlockBuilder<Block>,
P: TransactionPool + Sync + Send + 'static,
C::Api: profile_validation_runtime_api::ProfileValidationApi<Block, AccountId>,
C::Api: department_funding_runtime_api::DepartmentFundingApi<Block, AccountId>,
C::Api: positive_externality_runtime_api::PositiveExternalityApi<Block, AccountId>,
C::Api: project_tips_runtime_api::ProjectTipsApi<Block, AccountId>,
C::Api: department_funding_runtime_api::DepartmentFundingApi<Block, AccountId>,
C::Api: positive_externality_runtime_api::PositiveExternalityApi<Block, AccountId>,
C::Api: project_tips_runtime_api::ProjectTipsApi<Block, AccountId>,
{
use substrate_frame_rpc_system::{System, SystemApiServer};
use department_funding_rpc::DepartmentFundingApiServer;
use positive_externality_rpc::PositiveExternalityApiServer;
use profile_validation_rpc::ProfileValidationApiServer;
use project_tips_rpc::ProjectTipsApiServer;
use positive_externality_rpc::PositiveExternalityApiServer;
use profile_validation_rpc::ProfileValidationApiServer;
use project_tips_rpc::ProjectTipsApiServer;
use substrate_frame_rpc_system::{System, SystemApiServer};

let mut module = RpcExtension::new(());
let FullDeps {
Expand Down Expand Up @@ -113,9 +113,9 @@ where
}

module.merge(profile_validation_rpc::ProfileValidation::new(client.clone()).into_rpc())?;
module.merge(department_funding_rpc::DepartmentFunding::new(client.clone()).into_rpc())?;
module.merge(positive_externality_rpc::PositiveExternality::new(client.clone()).into_rpc())?;
module.merge(project_tips_rpc::ProjectTips::new(client.clone()).into_rpc())?;
module.merge(department_funding_rpc::DepartmentFunding::new(client.clone()).into_rpc())?;
module.merge(positive_externality_rpc::PositiveExternality::new(client.clone()).into_rpc())?;
module.merge(project_tips_rpc::ProjectTips::new(client.clone()).into_rpc())?;

Ok(module)
}
195 changes: 97 additions & 98 deletions container-chains/runtime-templates/simple/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ pub type SignedBlock = generic::SignedBlock<Block>;
/// BlockId type as expected by this runtime.
pub type BlockId = generic::BlockId<Block>;


pub type ChallengePostId = u64;

pub type DepartmentRequiredFundId = u64;
Expand Down Expand Up @@ -788,103 +787,103 @@ mod benches {
impl_runtime_apis! {
impl profile_validation_runtime_api::ProfileValidationApi<Block, AccountId> for Runtime {

fn get_challengers_evidence(profile_user_account: AccountId, offset: u64, limit: u16) -> Vec<ChallengePostId> {
ProfileValidation::get_challengers_evidence(profile_user_account, offset, limit)
}

fn get_evidence_period_end_block(profile_user_account: AccountId) -> Option<u32> {
ProfileValidation::get_evidence_period_end_block(profile_user_account)
}

fn get_staking_period_end_block(profile_user_account: AccountId) -> Option<u32> {
ProfileValidation::get_staking_period_end_block(profile_user_account)
}
fn get_drawing_period_end(profile_user_account: AccountId) -> (u64, u64, bool) {
ProfileValidation::get_drawing_period_end(profile_user_account)
}
fn get_commit_period_end_block(profile_user_account: AccountId) -> Option<u32> {
ProfileValidation::get_commit_period_end_block(profile_user_account)
}

fn get_vote_period_end_block(profile_user_account: AccountId) -> Option<u32> {
ProfileValidation::get_vote_period_end_block(profile_user_account)
}
fn selected_as_juror(profile_user_account: AccountId, who: AccountId) -> bool {
ProfileValidation::selected_as_juror(profile_user_account, who)
}
}

impl department_funding_runtime_api::DepartmentFundingApi<Block, AccountId> for Runtime {

fn get_evidence_period_end_block(department_required_fund_id: DepartmentRequiredFundId) -> Option<u32> {
DepartmentFunding::get_evidence_period_end_block(department_required_fund_id)
}

fn get_staking_period_end_block(department_required_fund_id: DepartmentRequiredFundId) -> Option<u32> {
DepartmentFunding::get_staking_period_end_block(department_required_fund_id)
}
fn get_drawing_period_end(department_required_fund_id: DepartmentRequiredFundId) -> (u64, u64, bool) {
DepartmentFunding::get_drawing_period_end(department_required_fund_id)
}
fn get_commit_period_end_block(department_required_fund_id: DepartmentRequiredFundId) -> Option<u32> {
DepartmentFunding::get_commit_period_end_block(department_required_fund_id)
}

fn get_vote_period_end_block(department_required_fund_id: DepartmentRequiredFundId) -> Option<u32> {
DepartmentFunding::get_vote_period_end_block(department_required_fund_id)
}
fn selected_as_juror(department_required_fund_id: DepartmentRequiredFundId, who: AccountId) -> bool {
DepartmentFunding::selected_as_juror(department_required_fund_id, who)
}
}

impl positive_externality_runtime_api::PositiveExternalityApi<Block, AccountId> for Runtime {

fn get_evidence_period_end_block(user_to_calculate: AccountId) -> Option<u32> {
PositiveExternality::get_evidence_period_end_block(user_to_calculate)
}

fn get_staking_period_end_block(user_to_calculate: AccountId) -> Option<u32> {
PositiveExternality::get_staking_period_end_block(user_to_calculate)
}
fn get_drawing_period_end(user_to_calculate: AccountId) -> (u64, u64, bool) {
PositiveExternality::get_drawing_period_end(user_to_calculate)
}
fn get_commit_period_end_block(user_to_calculate: AccountId) -> Option<u32> {
PositiveExternality::get_commit_period_end_block(user_to_calculate)
}

fn get_vote_period_end_block(user_to_calculate: AccountId) -> Option<u32> {
PositiveExternality::get_vote_period_end_block(user_to_calculate)
}
fn selected_as_juror(user_to_calculate: AccountId, who: AccountId) -> bool {
PositiveExternality::selected_as_juror(user_to_calculate, who)
}
}

impl project_tips_runtime_api::ProjectTipsApi<Block, AccountId> for Runtime {

fn get_evidence_period_end_block(project_id: ProjectId) -> Option<u32> {
ProjectTips::get_evidence_period_end_block(project_id)
}

fn get_staking_period_end_block(project_id: ProjectId) -> Option<u32> {
ProjectTips::get_staking_period_end_block(project_id)
}
fn get_drawing_period_end(project_id: ProjectId) -> (u64, u64, bool) {
ProjectTips::get_drawing_period_end(project_id)
}
fn get_commit_period_end_block(project_id: ProjectId) -> Option<u32> {
ProjectTips::get_commit_period_end_block(project_id)
}

fn get_vote_period_end_block(project_id: ProjectId) -> Option<u32> {
ProjectTips::get_vote_period_end_block(project_id)
}
fn selected_as_juror(project_id: ProjectId, who: AccountId) -> bool {
ProjectTips::selected_as_juror(project_id, who)
}
}
fn get_challengers_evidence(profile_user_account: AccountId, offset: u64, limit: u16) -> Vec<ChallengePostId> {
ProfileValidation::get_challengers_evidence(profile_user_account, offset, limit)
}

fn get_evidence_period_end_block(profile_user_account: AccountId) -> Option<u32> {
ProfileValidation::get_evidence_period_end_block(profile_user_account)
}

fn get_staking_period_end_block(profile_user_account: AccountId) -> Option<u32> {
ProfileValidation::get_staking_period_end_block(profile_user_account)
}
fn get_drawing_period_end(profile_user_account: AccountId) -> (u64, u64, bool) {
ProfileValidation::get_drawing_period_end(profile_user_account)
}
fn get_commit_period_end_block(profile_user_account: AccountId) -> Option<u32> {
ProfileValidation::get_commit_period_end_block(profile_user_account)
}

fn get_vote_period_end_block(profile_user_account: AccountId) -> Option<u32> {
ProfileValidation::get_vote_period_end_block(profile_user_account)
}
fn selected_as_juror(profile_user_account: AccountId, who: AccountId) -> bool {
ProfileValidation::selected_as_juror(profile_user_account, who)
}
}

impl department_funding_runtime_api::DepartmentFundingApi<Block, AccountId> for Runtime {

fn get_evidence_period_end_block(department_required_fund_id: DepartmentRequiredFundId) -> Option<u32> {
DepartmentFunding::get_evidence_period_end_block(department_required_fund_id)
}

fn get_staking_period_end_block(department_required_fund_id: DepartmentRequiredFundId) -> Option<u32> {
DepartmentFunding::get_staking_period_end_block(department_required_fund_id)
}
fn get_drawing_period_end(department_required_fund_id: DepartmentRequiredFundId) -> (u64, u64, bool) {
DepartmentFunding::get_drawing_period_end(department_required_fund_id)
}
fn get_commit_period_end_block(department_required_fund_id: DepartmentRequiredFundId) -> Option<u32> {
DepartmentFunding::get_commit_period_end_block(department_required_fund_id)
}

fn get_vote_period_end_block(department_required_fund_id: DepartmentRequiredFundId) -> Option<u32> {
DepartmentFunding::get_vote_period_end_block(department_required_fund_id)
}
fn selected_as_juror(department_required_fund_id: DepartmentRequiredFundId, who: AccountId) -> bool {
DepartmentFunding::selected_as_juror(department_required_fund_id, who)
}
}

impl positive_externality_runtime_api::PositiveExternalityApi<Block, AccountId> for Runtime {

fn get_evidence_period_end_block(user_to_calculate: AccountId) -> Option<u32> {
PositiveExternality::get_evidence_period_end_block(user_to_calculate)
}

fn get_staking_period_end_block(user_to_calculate: AccountId) -> Option<u32> {
PositiveExternality::get_staking_period_end_block(user_to_calculate)
}
fn get_drawing_period_end(user_to_calculate: AccountId) -> (u64, u64, bool) {
PositiveExternality::get_drawing_period_end(user_to_calculate)
}
fn get_commit_period_end_block(user_to_calculate: AccountId) -> Option<u32> {
PositiveExternality::get_commit_period_end_block(user_to_calculate)
}

fn get_vote_period_end_block(user_to_calculate: AccountId) -> Option<u32> {
PositiveExternality::get_vote_period_end_block(user_to_calculate)
}
fn selected_as_juror(user_to_calculate: AccountId, who: AccountId) -> bool {
PositiveExternality::selected_as_juror(user_to_calculate, who)
}
}

impl project_tips_runtime_api::ProjectTipsApi<Block, AccountId> for Runtime {

fn get_evidence_period_end_block(project_id: ProjectId) -> Option<u32> {
ProjectTips::get_evidence_period_end_block(project_id)
}

fn get_staking_period_end_block(project_id: ProjectId) -> Option<u32> {
ProjectTips::get_staking_period_end_block(project_id)
}
fn get_drawing_period_end(project_id: ProjectId) -> (u64, u64, bool) {
ProjectTips::get_drawing_period_end(project_id)
}
fn get_commit_period_end_block(project_id: ProjectId) -> Option<u32> {
ProjectTips::get_commit_period_end_block(project_id)
}

fn get_vote_period_end_block(project_id: ProjectId) -> Option<u32> {
ProjectTips::get_vote_period_end_block(project_id)
}
fn selected_as_juror(project_id: ProjectId, who: AccountId) -> bool {
ProjectTips::selected_as_juror(project_id, who)
}
}

impl sp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion {
Expand Down
Loading

0 comments on commit 6bb5549

Please sign in to comment.