Skip to content

Commit

Permalink
Fix audit changes (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhath-labs authored Dec 22, 2023
1 parent 6cd5ed8 commit 4d16de2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pallets/carbon-credits/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl<T: Config> Pallet<T> {
let project = project.as_mut().ok_or(Error::<T>::ProjectNotFound)?;

// approved projects cannot be modified
ensure!(!project.approved.is_approved(), Error::<T>::CannotModifyApprovedProject);
ensure!(project.approved.is_rejected(), Error::<T>::CannotModifyApprovedProject);

// only originator can resubmit
ensure!(project.originator == admin, Error::<T>::NotAuthorised);
Expand Down
12 changes: 12 additions & 0 deletions pallets/carbon-credits/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,16 @@ impl ProjectApprovalStatus {
Rejected => false,
}
}

/// Check if the project is rejected.
///
/// Returns `true` if the project is rejected, `false` otherwise.
pub fn is_rejected(self) -> bool {
use ProjectApprovalStatus::*;
match self {
Approved => false,
Pending => false,
Rejected => true,
}
}
}
2 changes: 0 additions & 2 deletions pallets/dex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,6 @@ pub mod pallet {
NoReceivables,
/// receivable amount is less than payment
ReceivableLessThanPayment,
/// Payments list is full
PaymentsListFull,
/// User has too many open orders
OpenOrderLimitExceeded,
/// User has too many units as unpaid open orders
Expand Down

0 comments on commit 4d16de2

Please sign in to comment.