Trait cfg_traits::investments::InvestmentAccountant
source · pub trait InvestmentAccountant<AccountId> {
type Error;
type InvestmentId;
type InvestmentInfo;
type Amount;
// Required methods
fn info(id: Self::InvestmentId) -> Result<Self::InvestmentInfo, Self::Error>;
fn balance(id: Self::InvestmentId, who: &AccountId) -> Self::Amount;
fn transfer(
id: Self::InvestmentId,
source: &AccountId,
dest: &AccountId,
amount: Self::Amount
) -> Result<(), Self::Error>;
fn deposit(
buyer: &AccountId,
id: Self::InvestmentId,
amount: Self::Amount
) -> Result<(), Self::Error>;
fn withdraw(
seller: &AccountId,
id: Self::InvestmentId,
amount: Self::Amount
) -> Result<(), Self::Error>;
}
Expand description
A trait who’s implementer provides means of accounting for investments of a generic kind.
Required Associated Types§
Required Methods§
sourcefn info(id: Self::InvestmentId) -> Result<Self::InvestmentInfo, Self::Error>
fn info(id: Self::InvestmentId) -> Result<Self::InvestmentInfo, Self::Error>
Information about an asset. Must allow to derive owner, payment and denomination currency
sourcefn balance(id: Self::InvestmentId, who: &AccountId) -> Self::Amount
fn balance(id: Self::InvestmentId, who: &AccountId) -> Self::Amount
Return the balance of a given user for the given investmnet
sourcefn transfer(
id: Self::InvestmentId,
source: &AccountId,
dest: &AccountId,
amount: Self::Amount
) -> Result<(), Self::Error>
fn transfer( id: Self::InvestmentId, source: &AccountId, dest: &AccountId, amount: Self::Amount ) -> Result<(), Self::Error>
Transfer a given investment from source, to destination
sourcefn deposit(
buyer: &AccountId,
id: Self::InvestmentId,
amount: Self::Amount
) -> Result<(), Self::Error>
fn deposit( buyer: &AccountId, id: Self::InvestmentId, amount: Self::Amount ) -> Result<(), Self::Error>
Increases the existence of
sourcefn withdraw(
seller: &AccountId,
id: Self::InvestmentId,
amount: Self::Amount
) -> Result<(), Self::Error>
fn withdraw( seller: &AccountId, id: Self::InvestmentId, amount: Self::Amount ) -> Result<(), Self::Error>
Reduce the existence of an asset
Object Safety§
This trait is not object safe.