Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions pallets/fund-admin/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ impl<T: Config> Pallet<T> {
},
CUDAction::Delete => {
// Ensure admin cannot delete themselves
ensure!(user.0 != admin, Error::<T>::AdministatorsCannotDeleteThemselves);
ensure!(user.0 != admin, Error::<T>::AdministratorsCannotDeleteThemselves,
);

Self::do_delete_user(
user.0.clone()
Expand Down Expand Up @@ -545,6 +546,8 @@ impl<T: Config> Pallet<T> {
user_info.email = mod_email[0].clone();
}
if let Some(documents) = documents {
// Ensure user is an investor
ensure!(user_info.role == ProxyRole::Investor, Error::<T>::UserIsNotAnInvestor);
user_info.documents = Some(documents);
}
Ok(())
Expand Down Expand Up @@ -972,7 +975,7 @@ impl<T: Config> Pallet<T> {
match drawdown_data.drawdown_type {
DrawdownType::EB5 => {
// Ensure transactions_feedback is some
let mod_transactions_feedback = transactions_feedback.ok_or(Error::<T>::EB5FeebackMissing)?;
let mod_transactions_feedback = transactions_feedback.ok_or(Error::<T>::EB5MissingFeedback)?;

for (transaction_id, field_description) in mod_transactions_feedback {
// Update transaction feedback
Expand Down Expand Up @@ -1259,7 +1262,7 @@ impl<T: Config> Pallet<T> {
Self::is_authorized(admin.clone(), &Self::get_global_scope(), ProxyPermission::Expenditures)?;

// Ensure projects is not empty
ensure!(!projects.is_empty(), Error::<T>::ProjectsIsEmpty);
ensure!(!projects.is_empty(), Error::<T>::InflationRateMissingProjectIds);

// Match each CUD action
for project in projects {
Expand Down Expand Up @@ -1313,7 +1316,7 @@ impl<T: Config> Pallet<T> {

/// Get global scope
pub fn get_global_scope() -> [u8;32] {
let global_scope = <GlobalScope<T>>::try_get().map_err(|_| Error::<T>::NoneValue).unwrap();
let global_scope = <GlobalScope<T>>::try_get().map_err(|_| Error::<T>::NoGlobalScopeValueWasFound).unwrap();
global_scope
}

Expand Down Expand Up @@ -1672,7 +1675,7 @@ impl<T: Config> Pallet<T> {
//Remove user from UsersInfo storage map
<UsersInfo<T>>::remove(admin.clone());

// Remove administrator to rbac pallet
// Remove administrator from rbac pallet
T::Rbac::remove_role_from_user(
admin.clone(),
Self::pallet_id(),
Expand Down
Loading