Skip to content

Commit

Permalink
Add missing portfolio events for allow/revoke create portfolio permis…
Browse files Browse the repository at this point in the history
…sions. (#1752)

Co-authored-by: Adam Dossa <[email protected]>
  • Loading branch information
Neopallium and adamdossa authored Nov 26, 2024
1 parent 7254db2 commit b6c926c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pallets/common/src/traits/portfolio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,25 @@ decl_event! {
IdentityId,
PortfolioId,
AssetId
)
),
/// Allow another identity to create portfolios.
///
/// # Parameters
/// * [`IdentityId`] of the caller.
/// * [`IdentityId`] allowed to create portfolios.
AllowIdentityToCreatePortfolios(
IdentityId,
IdentityId,
),
/// Revoke another identities permission to create portfolios.
///
/// # Parameters
/// * [`IdentityId`] of the caller.
/// * [`IdentityId`] permissions to create portfolios is revoked.
RevokeCreatePortfoliosPermission(
IdentityId,
IdentityId,
),
}
}

Expand Down
8 changes: 8 additions & 0 deletions pallets/portfolio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,10 @@ impl<T: Config> Module<T> {
Error::<T>::SelfAdditionNotAllowed
);
AllowedCustodians::insert(callers_did, trusted_identity, true);
Self::deposit_event(Event::AllowIdentityToCreatePortfolios(
callers_did,
trusted_identity,
));
Ok(())
}

Expand All @@ -873,6 +877,10 @@ impl<T: Config> Module<T> {
) -> DispatchResult {
let callers_did = Identity::<T>::ensure_perms(origin)?;
AllowedCustodians::remove(callers_did, identity);
Self::deposit_event(Event::RevokeCreatePortfoliosPermission(
callers_did,
identity,
));
Ok(())
}

Expand Down

0 comments on commit b6c926c

Please sign in to comment.