Skip to content

Commit

Permalink
correction department-funding
Browse files Browse the repository at this point in the history
  • Loading branch information
amiyatulu committed Nov 24, 2023
1 parent 1bd9105 commit 7f601f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions pallets/department-funding/src/extras.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ impl<T: Config> Pallet<T> {
pub fn ensure_can_stake_using_status(
department_id: DepartmentId,
) -> Result<DepartmentFundingStatus<BlockNumberOf<T>, FundingStatus>, DispatchError> {
let department_status_option =
DepartmentFundingStatusForDepartmentId::<T>::get(department_id);
let now = <frame_system::Pallet<T>>::block_number();
let department_funding_status =
DepartmentFundingStatus { block_number: now, status: FundingStatus::Processing };
let department_status_option =
DepartmentFundingStatusForDepartmentId::<T>::get(department_id);
match department_status_option {
Some(department_status) => {
let funding_status = department_status.status;
Expand All @@ -64,8 +64,7 @@ impl<T: Config> Pallet<T> {
let status_failed_time = TIME_FOR_STAKING_FUNDING_STATUS_FAILED;
let status_failed_time_block = Self::u64_to_block_saturated(status_failed_time);
let funding_status_block = department_status.block_number;
let time =
now.checked_sub(&funding_status_block).expect("Overflow");
let time = now.checked_sub(&funding_status_block).expect("Overflow");
if time >= status_failed_time_block {
Ok(department_funding_status)
} else {
Expand All @@ -76,8 +75,7 @@ impl<T: Config> Pallet<T> {
let status_success_time_block =
Self::u64_to_block_saturated(status_success_time);
let funding_status_block = department_status.block_number;
let time =
now.checked_sub(&funding_status_block).expect("Overflow");
let time = now.checked_sub(&funding_status_block).expect("Overflow");
if time >= status_success_time_block {
Ok(department_funding_status)
} else {
Expand Down
4 changes: 2 additions & 2 deletions pallets/department-funding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub mod pallet {
/// Event documentation should end with an array that provides descriptive names for event
/// parameters. [something, who]
SomethingStored { something: u32, who: T::AccountId },
ProjectCreated {
DepartmentFundCreated {
account: T::AccountId,
department_required_fund_id: DepartmentRequiredFundId,
},
Expand Down Expand Up @@ -214,7 +214,7 @@ pub mod pallet {
*n += 1;
});

Self::deposit_event(Event::ProjectCreated {
Self::deposit_event(Event::DepartmentFundCreated {
account: who,
department_required_fund_id: new_department_fund_id,
});
Expand Down

0 comments on commit 7f601f6

Please sign in to comment.