pub trait ForeignInvestment<AccountId> {
    type Amount;
    type TrancheAmount;
    type CurrencyId;
    type InvestmentId;

    // Required methods
    fn increase_foreign_investment(
        who: &AccountId,
        investment_id: Self::InvestmentId,
        amount: Self::Amount,
        foreign_payment_currency: Self::CurrencyId
    ) -> DispatchResult;
    fn cancel_foreign_investment(
        who: &AccountId,
        investment_id: Self::InvestmentId,
        foreign_payment_currency: Self::CurrencyId
    ) -> DispatchResult;
    fn increase_foreign_redemption(
        who: &AccountId,
        investment_id: Self::InvestmentId,
        amount: Self::TrancheAmount,
        foreign_payout_currency: Self::CurrencyId
    ) -> DispatchResult;
    fn cancel_foreign_redemption(
        who: &AccountId,
        investment_id: Self::InvestmentId,
        foreign_payout_currency: Self::CurrencyId
    ) -> Result<Self::TrancheAmount, DispatchError>;
}
Expand description

Trait to handle investments in (presumably) foreign currencies, i.e., other currencies than the pool currency.

NOTE: Has many similarities with the Investment trait.

Required Associated Types§

Required Methods§

source

fn increase_foreign_investment( who: &AccountId, investment_id: Self::InvestmentId, amount: Self::Amount, foreign_payment_currency: Self::CurrencyId ) -> DispatchResult

Initiates the increment of a foreign investment amount in foreign_payment_currency of who into the investment class pool_currency to amount.

NOTE: In general, we can assume that the foreign and pool currencies mismatch and that swapping one into the other happens asynchronously. In that case, the finalization of updating the investment needs to be handled decoupled from the ForeignInvestment trait, e.g., by some hook.

source

fn cancel_foreign_investment( who: &AccountId, investment_id: Self::InvestmentId, foreign_payment_currency: Self::CurrencyId ) -> DispatchResult

Initiates a cancellation of a foreign investment in foreign_payment_currency of who into the investment class pool_currency to amount.

NOTE: In general, we can assume that the foreign and pool currencies mismatch and that swapping one into the other happens asynchronously. In that case, the finalization of updating the investment needs to be handled decoupled from the ForeignInvestment trait, e.g., by some hook.

source

fn increase_foreign_redemption( who: &AccountId, investment_id: Self::InvestmentId, amount: Self::TrancheAmount, foreign_payout_currency: Self::CurrencyId ) -> DispatchResult

Initiates the increment of a foreign redemption amount for the given investment id.

NOTE: The foreign_payout_currency is only required to ensure subsequent redemption updating calls match to the original chosen foreign_payment_currency.

source

fn cancel_foreign_redemption( who: &AccountId, investment_id: Self::InvestmentId, foreign_payout_currency: Self::CurrencyId ) -> Result<Self::TrancheAmount, DispatchError>

Initiates the cancellation of a foreign redemption. Returns the cancelled tranche tokens amount.

NOTES:

  • The decrementing redemption amount is bound by the previously incremented redemption amount.
  • The foreign_payout_currency is only required for the potential dispatch of a response message.

Object Safety§

This trait is not object safe.

Implementors§