Trait primitives::traits::AssetRecorder [−][src]
pub trait AssetRecorder<AccountId, AssetId, Balance> {
fn add_liquid(
caller: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> DispatchResult;
fn add_saft(
caller: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> DispatchResult;
fn insert_asset_availability(
asset_id: AssetId,
availability: AssetAvailability
) -> Option<AssetAvailability>;
fn remove_liquid(
who: &AccountId,
id: AssetId,
units: Balance,
nav: Balance,
recipient: Option<AccountId>
) -> DispatchResult;
fn remove_saft(
who: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> DispatchResult;
}
Expand description
Abstract core features of the AssetIndex
shared across pallets.
Required methods
fn add_liquid(
caller: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> DispatchResult
fn add_liquid(
caller: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> DispatchResult
Add an liquid asset into the index. This moves the given units from the caller’s balance into the index’s and issues PINT accordingly.
fn add_saft(
caller: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> DispatchResult
fn add_saft(
caller: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> DispatchResult
Mints the SAFT into the index and awards the caller with given amount of PINT token. If an asset with the given AssetId does not already exist, it will be registered as SAFT. Fails if the availability of the asset is liquid.
fn insert_asset_availability(
asset_id: AssetId,
availability: AssetAvailability
) -> Option<AssetAvailability>
fn insert_asset_availability(
asset_id: AssetId,
availability: AssetAvailability
) -> Option<AssetAvailability>
Sets the availability of the given asset.
If the asset was already registered, the old AssetAvailability
is
returned.
fn remove_liquid(
who: &AccountId,
id: AssetId,
units: Balance,
nav: Balance,
recipient: Option<AccountId>
) -> DispatchResult
fn remove_liquid(
who: &AccountId,
id: AssetId,
units: Balance,
nav: Balance,
recipient: Option<AccountId>
) -> DispatchResult
Dispatches transfer to move liquid assets out of the index’s account. Updates the index by burning the given amount of index token from the caller’s account.
fn remove_saft(
who: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> DispatchResult
fn remove_saft(
who: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> DispatchResult
Burns the given amount of SAFT token from the index and the nav from the caller’s account