Trait cfg_traits::investments::Investment
source · 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§
type Amount
type TrancheAmount
type CurrencyId
type Error: Debug
type InvestmentId
Required Methods§
sourcefn update_investment(
who: &AccountId,
investment_id: Self::InvestmentId,
amount: Self::Amount
) -> Result<(), Self::Error>
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.
sourcefn investment(
who: &AccountId,
investment_id: Self::InvestmentId
) -> Result<Self::Amount, Self::Error>
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.
sourcefn update_redemption(
who: &AccountId,
investment_id: Self::InvestmentId,
amount: Self::TrancheAmount
) -> Result<(), Self::Error>
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.
sourcefn redemption(
who: &AccountId,
investment_id: Self::InvestmentId
) -> Result<Self::TrancheAmount, Self::Error>
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.