Trait shot_runtime::traits::AssetRecorder [−][src]
pub trait AssetRecorder<AccountId, AssetId, Balance> {
fn add_liquid(
caller: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> Result<(), DispatchError>;
fn add_saft(
caller: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> Result<(), DispatchError>;
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>
) -> Result<(), DispatchError>;
fn remove_saft(
who: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> Result<(), DispatchError>;
}
Expand description
Abstract core features of the AssetIndex
shared across pallets.
Required methods
fn add_liquid(
caller: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> Result<(), DispatchError>
fn add_liquid(
caller: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> Result<(), DispatchError>
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.
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>
) -> Result<(), DispatchError>
fn remove_liquid(
who: &AccountId,
id: AssetId,
units: Balance,
nav: Balance,
recipient: Option<AccountId>
) -> Result<(), DispatchError>
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
) -> Result<(), DispatchError>
fn remove_saft(
who: &AccountId,
id: AssetId,
units: Balance,
nav: Balance
) -> Result<(), DispatchError>
Burns the given amount of SAFT token from the index and the nav from the caller’s account
Implementations on Foreign Types
Creates an entry in the assets map and contributes the given amount of asset to the treasury.