Skip to content

Commit

Permalink
traits shared storage
Browse files Browse the repository at this point in the history
  • Loading branch information
amiyatulu committed Jul 9, 2024
1 parent a41f5fd commit cd3679e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
22 changes: 22 additions & 0 deletions custom-pallets/shared-storage/src/extras.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,28 @@ impl<T: Config> SharedStorageLink for Pallet<T> {
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<u8>,
amount: i64,
) -> DispatchResult {
Self::add_reputation_score_to_department(address, department, amount)
}
fn subtract_reputation_score_from_department(
address: T::AccountId,
department: Vec<u8>,
amount: i64,
) -> DispatchResult {
Self::subtract_reputation_score_from_department(address, department, amount)
}

fn get_department_reputation_score(address: T::AccountId, department: Vec<u8>) -> Option<i64> {
Self::get_department_reputation_score(address, department)
}
fn get_total_reputation_score(address: T::AccountId) -> i64 {
Self::get_total_reputation_score(address)
}
}

impl<T: Config> Pallet<T> {
Expand Down
17 changes: 17 additions & 0 deletions traits/trait-shared-storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>,
amount: i64,
) -> DispatchResult;
fn subtract_reputation_score_from_department(
address: Self::AccountId,
department: Vec<u8>,
amount: i64,
) -> DispatchResult;

fn get_department_reputation_score(
address: Self::AccountId,
department: Vec<u8>,
) -> Option<i64>;

fn get_total_reputation_score(address: Self::AccountId) -> i64;
}

0 comments on commit cd3679e

Please sign in to comment.