pub struct AssetCallApi<'api> { /* private fields */ }

Implementations§

source§

impl<'api> AssetCallApi<'api>

source

pub fn register_ticker(&self, ticker: Ticker) -> Result<WrappedCall>

Registers a new ticker or extends validity of an existing ticker. NB: Ticker validity does not get carry forward when renewing ticker.

Arguments
  • origin It contains the secondary key of the caller (i.e. who signed the transaction to execute this function).
  • ticker ticker to register.
Permissions
  • Asset
source

pub fn accept_ticker_transfer(&self, auth_id: u64) -> Result<WrappedCall>

Accepts a ticker transfer.

Consumes the authorization auth_id (see pallet_identity::consume_auth). NB: To reject the transfer, call remove auth function in identity module.

Arguments
  • origin It contains the secondary key of the caller (i.e. who signed the transaction to execute this function).
  • auth_id Authorization ID of ticker transfer authorization.
Errors
  • AuthorizationError::BadType if auth_id is not a valid ticket transfer authorization.
source

pub fn accept_asset_ownership_transfer( &self, auth_id: u64 ) -> Result<WrappedCall>

This function is used to accept a token ownership transfer. NB: To reject the transfer, call remove auth function in identity module.

Arguments
  • origin It contains the secondary key of the caller (i.e. who signed the transaction to execute this function).
  • auth_id Authorization ID of the token ownership transfer authorization.
source

pub fn create_asset( &self, name: AssetName, ticker: Ticker, divisible: bool, asset_type: AssetType, identifiers: Vec<AssetIdentifier>, funding_round: Option<FundingRoundName> ) -> Result<WrappedCall>

Initializes a new security token, with the initiating account as its owner. The total supply will initially be zero. To mint tokens, use issue.

Arguments
  • origin - contains the secondary key of the caller (i.e. who signed the transaction to execute this function).
  • name - the name of the token.
  • ticker - the ticker symbol of the token.
  • divisible - a boolean to identify the divisibility status of the token.
  • asset_type - the asset type.
  • identifiers - a vector of asset identifiers.
  • funding_round - name of the funding round.
Errors
  • InvalidAssetIdentifier if any of identifiers are invalid.
  • MaxLengthOfAssetNameExceeded if name’s length exceeds T::AssetNameMaxLength.
  • FundingRoundNameMaxLengthExceeded if the name of the funding round is longer that T::FundingRoundNameMaxLength.
  • AssetAlreadyCreated if asset was already created.
  • TickerTooLong if ticker’s length is greater than config.max_ticker_length chain parameter.
  • TickerNotAlphanumeric if ticker is not yet registered, and contains non-alphanumeric characters or any character after first occurrence of \0.
Permissions
  • Portfolio
source

pub fn freeze(&self, ticker: Ticker) -> Result<WrappedCall>

Freezes transfers and minting of a given token.

Arguments
  • origin - the secondary key of the sender.
  • ticker - the ticker of the token.
Errors
  • AlreadyFrozen if ticker is already frozen.
Permissions
  • Asset
source

pub fn unfreeze(&self, ticker: Ticker) -> Result<WrappedCall>

Unfreezes transfers and minting of a given token.

Arguments
  • origin - the secondary key of the sender.
  • ticker - the ticker of the frozen token.
Errors
  • NotFrozen if ticker is not frozen yet.
Permissions
  • Asset
source

pub fn rename_asset( &self, ticker: Ticker, name: AssetName ) -> Result<WrappedCall>

Renames a given token.

Arguments
  • origin - the secondary key of the sender.
  • ticker - the ticker of the token.
  • name - the new name of the token.
Errors
  • MaxLengthOfAssetNameExceeded if length of name is greater than T::AssetNameMaxLength.
Permissions
  • Asset
source

pub fn issue( &self, ticker: Ticker, amount: u128, portfolio_kind: PortfolioKind ) -> Result<WrappedCall>

Issue, or mint, new tokens to the caller, which must be an authorized external agent.

Arguments
  • origin - A signer that has permissions to act as an agent of ticker.
  • ticker - The [Ticker] of the token.
  • amount - The amount of tokens that will be issued.
  • portfolio_kind - The [PortfolioKind] of the portfolio that will receive the minted tokens.
Permissions
  • Asset
  • Portfolio
source

pub fn redeem(&self, ticker: Ticker, value: u128) -> Result<WrappedCall>

Redeems existing tokens by reducing the balance of the caller’s default portfolio and the total supply of the token

Arguments
  • origin is a signer that has permissions to act as an agent of ticker.
  • ticker Ticker of the token.
  • value Amount of tokens to redeem.
Errors
  • Unauthorized If called by someone without the appropriate external agent permissions
  • InvalidGranularity If the amount is not divisible by 10^6 for non-divisible tokens
  • InsufficientPortfolioBalance If the caller’s default portfolio doesn’t have enough free balance
Permissions
  • Asset
  • Portfolio
source

pub fn make_divisible(&self, ticker: Ticker) -> Result<WrappedCall>

Makes an indivisible token divisible.

Arguments
  • origin is a signer that has permissions to act as an agent of ticker.
  • ticker Ticker of the token.
Errors
  • AssetAlreadyDivisible if ticker is already divisible.
Permissions
  • Asset
source

pub fn add_documents( &self, docs: Vec<Document>, ticker: Ticker ) -> Result<WrappedCall>

Add documents for a given token.

Arguments
  • origin is a signer that has permissions to act as an agent of ticker.
  • ticker Ticker of the token.
  • docs Documents to be attached to ticker.
Permissions
  • Asset
source

pub fn remove_documents( &self, ids: Vec<DocumentId>, ticker: Ticker ) -> Result<WrappedCall>

Remove documents for a given token.

Arguments
  • origin is a signer that has permissions to act as an agent of ticker.
  • ticker Ticker of the token.
  • ids Documents ids to be removed from ticker.
Permissions
  • Asset
source

pub fn set_funding_round( &self, ticker: Ticker, name: FundingRoundName ) -> Result<WrappedCall>

Sets the name of the current funding round.

Arguments
  • origin - a signer that has permissions to act as an agent of ticker.
  • ticker - the ticker of the token.
  • name - the desired name of the current funding round.
Errors
  • FundingRoundNameMaxLengthExceeded if length of name is greater than T::FundingRoundNameMaxLength.
Permissions
  • Asset
source

pub fn update_identifiers( &self, ticker: Ticker, identifiers: Vec<AssetIdentifier> ) -> Result<WrappedCall>

Updates the asset identifiers.

Arguments
  • origin - a signer that has permissions to act as an agent of ticker.
  • ticker - the ticker of the token.
  • identifiers - the asset identifiers to be updated in the form of a vector of pairs of IdentifierType and AssetIdentifier value.
Errors
  • InvalidAssetIdentifier if identifiers contains any invalid identifier.
Permissions
  • Asset
source

pub fn controller_transfer( &self, ticker: Ticker, value: u128, from_portfolio: PortfolioId ) -> Result<WrappedCall>

Forces a transfer of token from from_portfolio to the caller’s default portfolio.

Arguments
  • origin Must be an external agent with appropriate permissions for a given ticker.
  • ticker Ticker symbol of the asset.
  • value Amount of tokens need to force transfer.
  • from_portfolio From whom portfolio tokens gets transferred.
source

pub fn register_custom_asset_type(&self, ty: Vec<u8>) -> Result<WrappedCall>

Registers a custom asset type.

The provided ty will be bound to an ID in storage. The ID can then be used in AssetType::Custom. Should the ty already exist in storage, no second ID is assigned to it.

Arguments
  • origin who called the extrinsic.
  • ty contains the string representation of the asset type.
source

pub fn create_asset_with_custom_type( &self, name: AssetName, ticker: Ticker, divisible: bool, custom_asset_type: Vec<u8>, identifiers: Vec<AssetIdentifier>, funding_round: Option<FundingRoundName> ) -> Result<WrappedCall>

Utility extrinsic to batch create_asset and register_custom_asset_type.

source

pub fn set_asset_metadata( &self, ticker: Ticker, key: AssetMetadataKey, value: AssetMetadataValue, detail: Option<AssetMetadataValueDetail<u64>> ) -> Result<WrappedCall>

Set asset metadata value.

Arguments
  • origin is a signer that has permissions to act as an agent of ticker.
  • ticker Ticker of the token.
  • key Metadata key.
  • value Metadata value.
  • details Optional Metadata value details (expire, lock status).
Errors
  • AssetMetadataKeyIsMissing if the metadata type key doesn’t exist.
  • AssetMetadataValueIsLocked if the metadata value for key is locked.
  • AssetMetadataValueMaxLengthExceeded if the metadata value exceeds the maximum length.
Permissions
  • Agent
  • Asset
source

pub fn set_asset_metadata_details( &self, ticker: Ticker, key: AssetMetadataKey, detail: AssetMetadataValueDetail<u64> ) -> Result<WrappedCall>

Set asset metadata value details (expire, lock status).

Arguments
  • origin is a signer that has permissions to act as an agent of ticker.
  • ticker Ticker of the token.
  • key Metadata key.
  • details Metadata value details (expire, lock status).
Errors
  • AssetMetadataKeyIsMissing if the metadata type key doesn’t exist.
  • AssetMetadataValueIsLocked if the metadata value for key is locked.
Permissions
  • Agent
  • Asset
source

pub fn register_and_set_local_asset_metadata( &self, ticker: Ticker, name: AssetMetadataName, spec: AssetMetadataSpec, value: AssetMetadataValue, detail: Option<AssetMetadataValueDetail<u64>> ) -> Result<WrappedCall>

Registers and set local asset metadata.

Arguments
  • origin is a signer that has permissions to act as an agent of ticker.
  • ticker Ticker of the token.
  • name Metadata name.
  • spec Metadata type definition.
  • value Metadata value.
  • details Optional Metadata value details (expire, lock status).
Errors
  • AssetMetadataLocalKeyAlreadyExists if a local metadata type with name already exists for ticker.
  • AssetMetadataNameMaxLengthExceeded if the metadata name exceeds the maximum length.
  • AssetMetadataTypeDefMaxLengthExceeded if the metadata spec type definition exceeds the maximum length.
  • AssetMetadataValueMaxLengthExceeded if the metadata value exceeds the maximum length.
Permissions
  • Agent
  • Asset
source

pub fn register_asset_metadata_local_type( &self, ticker: Ticker, name: AssetMetadataName, spec: AssetMetadataSpec ) -> Result<WrappedCall>

Registers asset metadata local type.

Arguments
  • origin is a signer that has permissions to act as an agent of ticker.
  • ticker Ticker of the token.
  • name Metadata name.
  • spec Metadata type definition.
Errors
  • AssetMetadataLocalKeyAlreadyExists if a local metadata type with name already exists for ticker.
  • AssetMetadataNameMaxLengthExceeded if the metadata name exceeds the maximum length.
  • AssetMetadataTypeDefMaxLengthExceeded if the metadata spec type definition exceeds the maximum length.
Permissions
  • Agent
  • Asset
source

pub fn register_asset_metadata_global_type( &self, name: AssetMetadataName, spec: AssetMetadataSpec ) -> Result<WrappedCall>

Registers asset metadata global type.

Arguments
  • origin is a signer that has permissions to act as an agent of ticker.
  • name Metadata name.
  • spec Metadata type definition.
Errors
  • AssetMetadataGlobalKeyAlreadyExists if a globa metadata type with name already exists.
  • AssetMetadataNameMaxLengthExceeded if the metadata name exceeds the maximum length.
  • AssetMetadataTypeDefMaxLengthExceeded if the metadata spec type definition exceeds the maximum length.
source

pub fn redeem_from_portfolio( &self, ticker: Ticker, value: u128, portfolio: PortfolioKind ) -> Result<WrappedCall>

Redeems existing tokens by reducing the balance of the caller’s portfolio and the total supply of the token

Arguments
  • origin is a signer that has permissions to act as an agent of ticker.
  • ticker Ticker of the token.
  • value Amount of tokens to redeem.
  • portfolio From whom portfolio tokens gets transferred.
Errors
  • Unauthorized If called by someone without the appropriate external agent permissions
  • InvalidGranularity If the amount is not divisible by 10^6 for non-divisible tokens
  • InsufficientPortfolioBalance If the caller’s portfolio doesn’t have enough free balance
  • PortfolioDoesNotExist If the portfolio doesn’t exist.
Permissions
  • Asset
  • Portfolio
source

pub fn update_asset_type( &self, ticker: Ticker, asset_type: AssetType ) -> Result<WrappedCall>

Updates the type of an asset.

Arguments
  • origin - the secondary key of the sender.
  • ticker - the ticker of the token.
  • asset_type - the new type of the token.
Errors
  • InvalidCustomAssetTypeId if asset_type is of type custom and has an invalid type id.
Permissions
  • Asset
source

pub fn remove_local_metadata_key( &self, ticker: Ticker, local_key: AssetMetadataLocalKey ) -> Result<WrappedCall>

Removes the asset metadata key and value of a local key.

Arguments
  • origin - the secondary key of the sender.
  • ticker - the ticker of the local metadata key.
  • local_key - the local metadata key.
Errors
  • SecondaryKeyNotAuthorizedForAsset - if called by someone without the appropriate external agent permissions.
  • UnauthorizedAgent - if called by someone without the appropriate external agent permissions.
  • AssetMetadataKeyIsMissing - if the key doens’t exist.
  • AssetMetadataValueIsLocked - if the value of the key is locked.
  • AssetMetadataKeyBelongsToNFTCollection - if the key is a mandatory key in an NFT collection.
Permissions
  • Asset
source

pub fn remove_metadata_value( &self, ticker: Ticker, metadata_key: AssetMetadataKey ) -> Result<WrappedCall>

Removes the asset metadata value of a metadata key.

Arguments
  • origin - the secondary key of the sender.
  • ticker - the ticker of the local metadata key.
  • metadata_key - the metadata key that will have its value deleted.
Errors
  • SecondaryKeyNotAuthorizedForAsset - if called by someone without the appropriate external agent permissions.
  • UnauthorizedAgent - if called by someone without the appropriate external agent permissions.
  • AssetMetadataKeyIsMissing - if the key doens’t exist.
  • AssetMetadataValueIsLocked - if the value of the key is locked.
Permissions
  • Asset
source

pub fn exempt_ticker_affirmation(&self, ticker: Ticker) -> Result<WrappedCall>

Pre-approves the receivement of the asset for all identities.

Arguments
  • origin - the secondary key of the sender.
  • ticker - the [Ticker] that will be exempt from affirmation.
Permissions
  • Root
source

pub fn remove_ticker_affirmation_exemption( &self, ticker: Ticker ) -> Result<WrappedCall>

Removes the pre-approval of the asset for all identities.

Arguments
  • origin - the secondary key of the sender.
  • ticker - the [Ticker] that will have its exemption removed.
Permissions
  • Root
source

pub fn pre_approve_ticker(&self, ticker: Ticker) -> Result<WrappedCall>

Pre-approves the receivement of an asset.

Arguments
  • origin - the secondary key of the sender.
  • ticker - the [Ticker] that will be exempt from affirmation.
Permissions
  • Asset
source

pub fn remove_ticker_pre_approval(&self, ticker: Ticker) -> Result<WrappedCall>

Removes the pre approval of an asset.

Arguments
  • origin - the secondary key of the sender.
  • ticker - the [Ticker] that will have its exemption removed.
Permissions
  • Asset

Trait Implementations§

source§

impl<'api> Clone for AssetCallApi<'api>

source§

fn clone(&self) -> AssetCallApi<'api>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'api> From<&'api Api> for AssetCallApi<'api>

source§

fn from(api: &'api Api) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'api> !RefUnwindSafe for AssetCallApi<'api>

§

impl<'api> Send for AssetCallApi<'api>

§

impl<'api> Sync for AssetCallApi<'api>

§

impl<'api> Unpin for AssetCallApi<'api>

§

impl<'api> !UnwindSafe for AssetCallApi<'api>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CheckedConversion for T

§

fn checked_from<T>(t: T) -> Option<Self>
where Self: TryFrom<T>,

Convert from a value of T into an equivalent instance of Option<Self>. Read more
§

fn checked_into<T>(self) -> Option<T>
where Self: TryInto<T>,

Consume self to return Some equivalent value of Option<T>. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

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

§

fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

§

fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatedConversion for T

source§

fn saturated_from<T>(t: T) -> Self
where Self: UniqueSaturatedFrom<T>,

Convert from a value of T into an equivalent instance of Self. Read more
source§

fn saturated_into<T>(self) -> T
where Self: UniqueSaturatedInto<T>,

Consume self to return an equivalent value of T. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<S, T> UncheckedInto<T> for S
where T: UncheckedFrom<S>,

§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
source§

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

source§

fn unique_saturated_into(self) -> T

Consume self to return an equivalent value of T.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> JsonSchemaMaybe for T

§

impl<T> MaybeSend for T
where T: Send,