Skip to content

Commit

Permalink
change(pallet-assets): improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pandres95 committed Jan 16, 2024
1 parent a3e49e2 commit 8a83b22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
6 changes: 5 additions & 1 deletion substrate/frame/assets/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,11 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
})
}

/// Do set sufficiency
/// Set the sufficiency of an asset class
///
/// ### Errors
///
/// - [`Unknown`][crate::Error::Unknown] when the asset ID is unknown.
pub(super) fn do_set_sufficiency(asset_id: T::AssetId, is_sufficient: bool) -> DispatchResult {
Asset::<T, I>::try_mutate(asset_id, |maybe_asset| {
if let Some(asset) = maybe_asset {
Expand Down
16 changes: 4 additions & 12 deletions substrate/frame/assets/src/traits.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
pub mod sufficiency {
use sp_runtime::DispatchResult;

/// Trait for providing the sufficient state of an asset.
/// Trait for providing the sufficiency of an asset.
pub trait Inspect<AssetId> {
/// Returns whether an asset is sufficient or not.
fn is_sufficient(asset_id: AssetId) -> bool;
}

/// Trait for mutating the sufficient state of an asset
/// Trait for mutating the sufficiency of an asset
pub trait Mutate<AssetId> {
/// Makes the asset to be sufficient.
///
/// ### Errors
///
/// - [`Unknown`][crate::Error::Unknown] when the asset ID is unknown.
/// Makes the asset sufficient.
fn make_sufficient(asset_id: AssetId) -> DispatchResult;

/// Makes the asset to be insufficient.
///
/// ### Errors
///
/// - [`Unknown`][crate::Error::Unknown] when the asset ID is unknown.
/// Makes the asset insufficient.
fn make_insufficient(asset_id: AssetId) -> DispatchResult;
}
}

0 comments on commit 8a83b22

Please sign in to comment.