Skip to content
Snippets Groups Projects

Replace bool by Result<(), dispatchError> for checks

Files

+ 2
7
@@ -71,7 +71,7 @@ pub mod pallet {
@@ -71,7 +71,7 @@ pub mod pallet {
/// Something that give the owner key of an identity
/// Something that give the owner key of an identity
type OwnerKeyOf: Convert<Self::IdtyIndex, Option<Self::AccountId>>;
type OwnerKeyOf: Convert<Self::IdtyIndex, Option<Self::AccountId>>;
///
///
type IsCertAllowed: IsCertAllowed<Self::IdtyIndex>;
type CheckCertAllowed: CheckCertAllowed<Self::IdtyIndex>;
#[pallet::constant]
#[pallet::constant]
/// Maximum number of active certifications by issuer
/// Maximum number of active certifications by issuer
type MaxByIssuer: Get<u32>;
type MaxByIssuer: Get<u32>;
@@ -242,8 +242,6 @@ pub mod pallet {
@@ -242,8 +242,6 @@ pub mod pallet {
pub enum Error<T, I = ()> {
pub enum Error<T, I = ()> {
/// An identity cannot certify itself
/// An identity cannot certify itself
CannotCertifySelf,
CannotCertifySelf,
/// Certification non autorisée
CertNotAllowed,
/// This identity has already issued the maximum number of certifications
/// This identity has already issued the maximum number of certifications
IssuedTooManyCert,
IssuedTooManyCert,
/// Issuer not found
/// Issuer not found
@@ -325,10 +323,7 @@ pub mod pallet {
@@ -325,10 +323,7 @@ pub mod pallet {
ensure!(issuer_owner_key == who, DispatchError::BadOrigin);
ensure!(issuer_owner_key == who, DispatchError::BadOrigin);
// Verify compatibility with other pallets state
// Verify compatibility with other pallets state
ensure!(
T::CheckCertAllowed::check_cert_allowed(issuer, receiver)?;
T::IsCertAllowed::is_cert_allowed(issuer, receiver),
Error::<T, I>::CertNotAllowed
);
// Verify rule MinReceivedCertToBeAbleToIssueCert
// Verify rule MinReceivedCertToBeAbleToIssueCert
let issuer_idty_cert_meta = <StorageIdtyCertMeta<T, I>>::get(issuer);
let issuer_idty_cert_meta = <StorageIdtyCertMeta<T, I>>::get(issuer);
Loading