From cd3679e8584efe2df68be9c27b6ad54c7708fbe6 Mon Sep 17 00:00:00 2001 From: Amiya Behera Date: Tue, 9 Jul 2024 22:40:31 +0530 Subject: [PATCH] traits shared storage --- custom-pallets/shared-storage/src/extras.rs | 22 +++++++++++++++++++++ traits/trait-shared-storage/src/lib.rs | 17 ++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/custom-pallets/shared-storage/src/extras.rs b/custom-pallets/shared-storage/src/extras.rs index 739df07..370bce3 100644 --- a/custom-pallets/shared-storage/src/extras.rs +++ b/custom-pallets/shared-storage/src/extras.rs @@ -16,6 +16,28 @@ impl SharedStorageLink for Pallet { fn set_positive_externality_link(address: Self::AccountId, score: i64) -> DispatchResult { Self::set_positive_externality(address, score) } + + fn add_reputation_score_to_department( + address: T::AccountId, + department: Vec, + amount: i64, + ) -> DispatchResult { + Self::add_reputation_score_to_department(address, department, amount) + } + fn subtract_reputation_score_from_department( + address: T::AccountId, + department: Vec, + amount: i64, + ) -> DispatchResult { + Self::subtract_reputation_score_from_department(address, department, amount) + } + + fn get_department_reputation_score(address: T::AccountId, department: Vec) -> Option { + Self::get_department_reputation_score(address, department) + } + fn get_total_reputation_score(address: T::AccountId) -> i64 { + Self::get_total_reputation_score(address) + } } impl Pallet { diff --git a/traits/trait-shared-storage/src/lib.rs b/traits/trait-shared-storage/src/lib.rs index f90d153..2402b43 100644 --- a/traits/trait-shared-storage/src/lib.rs +++ b/traits/trait-shared-storage/src/lib.rs @@ -8,4 +8,21 @@ pub trait SharedStorageLink { fn get_approved_citizen_count_link() -> u64; fn set_positive_externality_link(address: Self::AccountId, score: i64) -> DispatchResult; + fn add_reputation_score_to_department( + address: Self::AccountId, + department: Vec, + amount: i64, + ) -> DispatchResult; + fn subtract_reputation_score_from_department( + address: Self::AccountId, + department: Vec, + amount: i64, + ) -> DispatchResult; + + fn get_department_reputation_score( + address: Self::AccountId, + department: Vec, + ) -> Option; + + fn get_total_reputation_score(address: Self::AccountId) -> i64; }