pub trait Investment<AccountId> {
    type Amount;
    type TrancheAmount;
    type CurrencyId;
    type Error: Debug;
    type InvestmentId;

    // Required methods
    fn update_investment(
        who: &AccountId,
        investment_id: Self::InvestmentId,
        amount: Self::Amount
    ) -> Result<(), Self::Error>;
    fn investment(
        who: &AccountId,
        investment_id: Self::InvestmentId
    ) -> Result<Self::Amount, Self::Error>;
    fn update_redemption(
        who: &AccountId,
        investment_id: Self::InvestmentId,
        amount: Self::TrancheAmount
    ) -> Result<(), Self::Error>;
    fn redemption(
        who: &AccountId,
        investment_id: Self::InvestmentId
    ) -> Result<Self::TrancheAmount, Self::Error>;
}
Expand description

A trait, when implemented allows to invest into investment classes

Required Associated Types§

Required Methods§

source

fn update_investment( who: &AccountId, investment_id: Self::InvestmentId, amount: Self::Amount ) -> Result<(), Self::Error>

Updates the current investment amount of who into the investment class to amount. Meaning: if amount < previous investment, then investment will be reduced, and increases in the opposite case.

source

fn investment( who: &AccountId, investment_id: Self::InvestmentId ) -> Result<Self::Amount, Self::Error>

Returns, if possible, the currently unprocessed investment amount (in pool currency) of who into the given investment class.

NOTE: If the investment was (partially) processed, the unprocessed amount is only updated upon collecting.

source

fn update_redemption( who: &AccountId, investment_id: Self::InvestmentId, amount: Self::TrancheAmount ) -> Result<(), Self::Error>

Updates the current redemption amount (in tranche tokens) of who into the investment class to amount. Meaning: if amount < previous redemption, then the redemption will be reduced, and increased in the opposite case.

NOTE: Redemptions are bound by the processed investment amount.

source

fn redemption( who: &AccountId, investment_id: Self::InvestmentId ) -> Result<Self::TrancheAmount, Self::Error>

Returns, if possible, the currently unprocessed redemption amount (in tranche tokens) of who into the given investment class.

NOTE: If the redemption was (partially) processed, the unprocessed amount is only updated upon collecting.

Object Safety§

This trait is not object safe.

Implementors§