Skip to content

Commit

Permalink
fix(pallets/communities): lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pandres95 committed Sep 21, 2023
1 parent 2c175f0 commit 7e9fa54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 3 additions & 2 deletions pallets/communities/src/functions/fungibles.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::*;
use frame_support::traits::tokens::fungibles::{roles::Inspect, Create, Destroy};
use sp_runtime::traits::Zero;

impl<T: Config> Pallet<T> {
pub(crate) fn do_create_asset(
Expand All @@ -13,7 +14,7 @@ impl<T: Config> Pallet<T> {
T::Assets::create(
asset_id.clone(),
community_account_id,
community_assets_count == 0,
community_assets_count.is_zero(),
min_balance,
)?;

Expand All @@ -31,7 +32,7 @@ impl<T: Config> Pallet<T> {
return Err(Error::<T>::CannotDestroyUncontrolledAsset)?;
}

T::Assets::start_destroy(asset_id.clone(), Some(community_account_id.clone()))?;
T::Assets::start_destroy(asset_id.clone(), Some(community_account_id))?;
T::Assets::destroy_accounts(asset_id.clone(), u32::MAX)?;
T::Assets::destroy_approvals(asset_id.clone(), u32::MAX)?;
T::Assets::finish_destroy(asset_id)?;
Expand Down
7 changes: 2 additions & 5 deletions pallets/communities/src/tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ pub(super) fn get_asset(asset_id: AssetId) -> Option<Vec<u8>> {
let prefix = storage_prefix(b"Assets", b"Asset");
let asset_key = Blake2_128Concat::hash(&asset_id.to_le_bytes());

match sp_io::storage::get(&[prefix.to_vec(), asset_key].concat()) {
Some(bytes) => Some(bytes.to_vec()),
None => None,
}
sp_io::storage::get(&[prefix.to_vec(), asset_key].concat()).map(|bytes| bytes.to_vec())
}

pub(super) fn assert_sufficiency(
Expand All @@ -25,7 +22,7 @@ pub(super) fn assert_sufficiency(

let community_account_id = Communities::get_community_account_id(&community_id);

let value = get_asset(asset_id.clone()).expect("we just saved this asset");
let value = get_asset(asset_id).expect("we just saved this asset");
let value_expected = [
community_account_id.to_le_bytes().to_vec(), // owner
community_account_id.to_le_bytes().to_vec(), // issuer
Expand Down

0 comments on commit 7e9fa54

Please sign in to comment.