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§

source

fn info(id: Self::InvestmentId) -> Result<Self::InvestmentInfo, Self::Error>

Information about an asset. Must allow to derive owner, payment and denomination currency

source

fn balance(id: Self::InvestmentId, who: &AccountId) -> Self::Amount

Return the balance of a given user for the given investmnet

source

fn transfer( id: Self::InvestmentId, source: &AccountId, dest: &AccountId, amount: Self::Amount ) -> Result<(), Self::Error>

Transfer a given investment from source, to destination

source

fn deposit( buyer: &AccountId, id: Self::InvestmentId, amount: Self::Amount ) -> Result<(), Self::Error>

Increases the existence of

source

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.

Implementors§