[][src]Struct pallet_commodities::Module

pub struct Module<T: Trait<I>, I: Instance = DefaultInstance>(_);

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]

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]

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]

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]

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]

type Call = Call<T, I>

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]

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]

impl<T: Trait<I>, I: Instance> ModuleErrorMetadata for Module<T, I>[src]

impl<T: Trait + Trait<I>, I: Instance> OffchainWorker<<T as Trait>::BlockNumber> for Module<T, I>[src]

impl<T: Trait + Trait<I>, I: Instance> OnFinalize<<T as Trait>::BlockNumber> for Module<T, I>[src]

impl<T: Trait + Trait<I>, I: Instance> OnInitialize<<T as Trait>::BlockNumber> for Module<T, I>[src]

impl<T: Trait<I>, I: Instance> OnRuntimeUpgrade for Module<T, I>[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.

Auto Trait Implementations

impl<T, I> RefUnwindSafe for Module<T, I> where
    I: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, I> Send for Module<T, I> where
    I: Send,
    T: Send

impl<T, I> Sync for Module<T, I> where
    I: Sync,
    T: Sync

impl<T, I> Unpin for Module<T, I> where
    I: Unpin,
    T: Unpin

impl<T, I> UnwindSafe for Module<T, I> where
    I: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IsType<T> for T[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    Outer: AsRef<T> + AsMut<T> + From<T>,
    T: From<Outer>, 
[src]

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

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe

impl<T> Member for T where
    T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatedConversion for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    S: TryInto<T>,
    T: Bounded

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,