[−][src]Struct pallet_commodities::Module
Implementations
impl<T: Trait<I> + 'static, I: Instance> Module<T, I>
[src]
pub fn total() -> u128
[src]
The total number of this type of commodity that exists (minted - burned).
pub fn burned() -> u128
[src]
The total number of this type of commodity that has been burned (may overflow).
pub fn total_for_account<K: EncodeLike<T::AccountId>>(key: K) -> u64
[src]
The total number of this type of commodity owned by an account.
pub fn commodities_for_account<K: EncodeLike<T::AccountId>>(
key: K
) -> Vec<Commodity<T, I>>
[src]
key: K
) -> Vec<Commodity<T, I>>
A mapping from an account to a list of all of the commodities of this type that are owned by it.
pub fn account_for_commodity<K: EncodeLike<CommodityId<T>>>(
key: K
) -> T::AccountId
[src]
key: K
) -> T::AccountId
A mapping from a commodity ID to the account that owns it.
impl<T: Trait<I>, I: Instance> Module<T, I>
[src]
Can also be called using Call
.
pub fn mint(
origin: T::Origin,
owner_account: T::AccountId,
commodity_info: T::CommodityInfo
) -> DispatchResult
[src]
origin: T::Origin,
owner_account: T::AccountId,
commodity_info: T::CommodityInfo
) -> DispatchResult
Create a new commodity from the provided commodity info and identify the specified account as its owner. The ID of the new commodity will be equal to the hash of the info that defines it, as calculated by the runtime system's hashing algorithm.
The dispatch origin for this call must be the commodity admin.
This function will throw an error if it is called with commodity info that describes an existing (duplicate) commodity, if the maximum number of this type of commodity already exists or if the specified owner already owns the maximum number of this type of commodity.
owner_account
: Receiver of the commodity.commodity_info
: The information that defines the commodity.
NOTE: Calling this function will bypass origin filters.
pub fn burn(origin: T::Origin, commodity_id: CommodityId<T>) -> DispatchResult
[src]
Destroy the specified commodity.
The dispatch origin for this call must be the commodity owner.
commodity_id
: The hash (calculated by the runtime system's hashing algorithm) of the info that defines the commodity to destroy.
NOTE: Calling this function will bypass origin filters.
pub fn transfer(
origin: T::Origin,
dest_account: T::AccountId,
commodity_id: CommodityId<T>
) -> DispatchResult
[src]
origin: T::Origin,
dest_account: T::AccountId,
commodity_id: CommodityId<T>
) -> DispatchResult
Transfer a commodity to a new owner.
The dispatch origin for this call must be the commodity owner.
This function will throw an error if the new owner already owns the maximum number of this type of commodity.
dest_account
: Receiver of the commodity.commodity_id
: The hash (calculated by the runtime system's hashing algorithm) of the info that defines the commodity to destroy.
NOTE: Calling this function will bypass origin filters.
Trait Implementations
impl<T: Trait<I>, I: Instance> Callable<T> for Module<T, I>
[src]
impl<T: Clone + Trait<I>, I: Clone + Instance> Clone for Module<T, I>
[src]
impl<T: Copy + Trait<I>, I: Copy + Instance> Copy for Module<T, I>
[src]
impl<T: Trait<I>, I: Instance> Debug for Module<T, I> where
T: Debug,
I: Debug,
[src]
T: Debug,
I: Debug,
impl<T: Eq + Trait<I>, I: Eq + Instance> Eq for Module<T, I>
[src]
impl<T: Trait<I>, I: Instance> IntegrityTest for Module<T, I>
[src]
fn integrity_test()
[src]
impl<T: Trait<I>, I: Instance> ModuleErrorMetadata for Module<T, I>
[src]
fn metadata() -> &'static [ErrorMetadata]
[src]
impl<T: Trait + Trait<I>, I: Instance> OffchainWorker<<T as Trait>::BlockNumber> for Module<T, I>
[src]
fn offchain_worker(_n: BlockNumber)
[src]
impl<T: Trait + Trait<I>, I: Instance> OnFinalize<<T as Trait>::BlockNumber> for Module<T, I>
[src]
fn on_finalize(_n: BlockNumber)
[src]
impl<T: Trait + Trait<I>, I: Instance> OnInitialize<<T as Trait>::BlockNumber> for Module<T, I>
[src]
fn on_initialize(_n: BlockNumber) -> u64
[src]
impl<T: Trait<I>, I: Instance> OnRuntimeUpgrade for Module<T, I>
[src]
fn on_runtime_upgrade() -> u64
[src]
impl<T: PartialEq + Trait<I>, I: PartialEq + Instance> PartialEq<Module<T, I>> for Module<T, I>
[src]
impl<T: Trait<I>, I: Instance> StructuralEq for Module<T, I>
[src]
impl<T: Trait<I>, I: Instance> StructuralPartialEq for Module<T, I>
[src]
impl<T: Trait<I>, I: Instance> UniqueAssets<<T as Trait>::AccountId> for Module<T, I>
[src]
type AssetId = CommodityId<T>
The type used to identify unique assets.
type AssetInfo = T::CommodityInfo
The attributes that distinguish unique assets.
type AssetLimit = T::CommodityLimit
The maximum number of this type of asset that may exist (minted - burned).
type UserAssetLimit = T::UserCommodityLimit
The maximum number of this type of asset that any single account may own.
fn total() -> u128
[src]
fn burned() -> u128
[src]
fn total_for_account(account: &T::AccountId) -> u64
[src]
fn assets_for_account(account: &T::AccountId) -> Vec<Commodity<T, I>>
[src]
fn owner_of(commodity_id: &CommodityId<T>) -> T::AccountId
[src]
fn mint(
owner_account: &T::AccountId,
commodity_info: <T as Trait<I>>::CommodityInfo
) -> Result<CommodityId<T>, DispatchError>
[src]
owner_account: &T::AccountId,
commodity_info: <T as Trait<I>>::CommodityInfo
) -> Result<CommodityId<T>, DispatchError>
fn burn(commodity_id: &CommodityId<T>) -> DispatchResult
[src]
fn transfer(
dest_account: &T::AccountId,
commodity_id: &CommodityId<T>
) -> DispatchResult
[src]
dest_account: &T::AccountId,
commodity_id: &CommodityId<T>
) -> DispatchResult
Auto Trait Implementations
impl<T, I> RefUnwindSafe for Module<T, I> where
I: RefUnwindSafe,
T: RefUnwindSafe,
I: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, I> Send for Module<T, I> where
I: Send,
T: Send,
I: Send,
T: Send,
impl<T, I> Sync for Module<T, I> where
I: Sync,
T: Sync,
I: Sync,
T: Sync,
impl<T, I> Unpin for Module<T, I> where
I: Unpin,
T: Unpin,
I: Unpin,
T: Unpin,
impl<T, I> UnwindSafe for Module<T, I> where
I: UnwindSafe,
T: UnwindSafe,
I: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedConversion for T
[src]
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
[src]
Self: TryFrom<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
[src]
Self: TryInto<T>,
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IsType<T> for T
[src]
fn from_ref(t: &T) -> &T
[src]
fn into_ref(&self) -> &T
[src]
fn from_mut(t: &mut T) -> &mut T
[src]
fn into_mut(&mut self) -> &mut T
[src]
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
[src]
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
fn from_ref(outer: &Outer) -> &T
[src]
Get a reference to the inner from the outer.
fn from_mut(outer: &mut Outer) -> &mut T
[src]
Get a mutable reference to the inner from the outer.
impl<T> MaybeDebug for T where
T: Debug,
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
T: Debug,
impl<T> MaybeRefUnwindSafe for T where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Member for T where
T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug,
[src]
T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> SaturatedConversion for T
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Self: UniqueSaturatedFrom<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Self: UniqueSaturatedInto<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
[src]
T: UncheckedFrom<S>,
fn unchecked_into(self) -> T
[src]
impl<T, S> UniqueSaturatedInto<T> for S where
S: TryInto<T>,
T: Bounded,
S: TryInto<T>,
T: Bounded,
fn unique_saturated_into(self) -> T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,