pub struct CapitalDistributionCallApi<'api> { /* private fields */ }

Implementations§

source§

impl<'api> CapitalDistributionCallApi<'api>

source

pub fn distribute( &self, ca_id: CAId, portfolio: Option<PortfolioNumber>, currency: Ticker, per_share: u128, amount: u128, payment_at: u64, expires_at: Option<u64> ) -> Result<WrappedCall>

Start and attach a capital distribution, to the CA identified by ca_id, with amount funds in currency withdrawn from portfolio belonging to origin’s DID.

The distribution will commence at payment_at and expire at expires_at, if provided, or if None, then there’s no expiry.

The funds will be locked in portfolio from when distribute is called. When there’s no expiry, some funds may be locked indefinitely in portfolio, due to claimants not withdrawing or no benefits being pushed to them. For indivisible currencies, unlocked amounts, of less than one whole unit, will not be transferable from portfolio. However, if we imagine that users Alice and Bob both are entitled to 1.5 units, and only receive 1 units each, then 0.5 + 0.5 = 1 units are left in portfolio, which is now transferrable.

Arguments
  • origin is a signer that has permissions to act as an agent of ca_id.ticker.
  • ca_id identifies the CA to start a capital distribution for.
  • portfolio specifies the portfolio number of the agent to distribute amount from.
  • currency to withdraw and distribute from the portfolio.
  • per_share amount of currency to withdraw and distribute. Specified as a per-million, i.e. 1 / 10^6th of one currency token.
  • amount of currency to withdraw and distribute at most.
  • payment_at specifies when benefits may first be pushed or claimed.
  • expires_at specifies, if provided, when remaining benefits are forfeit and may be reclaimed by origin.
Errors
  • UnauthorizedAgent if origin is not agent-permissioned for ticker.
  • ExpiryBeforePayment if expires_at.unwrap() <= payment_at.
  • NoSuchCA if ca_id does not identify an existing CA.
  • NoRecordDate if CA has no record date.
  • RecordDateAfterStart if CA’s record date > payment_at.
  • UnauthorizedCustodian if the caller is not the custodian of portfolio.
  • InsufficientPortfolioBalance if portfolio has less than amount of currency.
  • InsufficientBalance if the protocol fee couldn’t be charged.
  • CANotBenefit if the CA is not of kind PredictableBenefit/UnpredictableBenefit
  • DistributionAmountIsZero if the amount is zero.
  • DistributionPerShareIsZero if the per_share is zero.
Permissions
  • Asset
  • Portfolio
source

pub fn claim(&self, ca_id: CAId) -> Result<WrappedCall>

Claim a benefit of the capital distribution attached to ca_id.

Taxes are withheld as specified by the CA. Post-tax earnings are then transferred to the default portfolio of the origin’s DID.

All benefits are rounded by truncation, down to first integer below. Moreover, before post-tax earnings, in indivisible currencies are transferred, they are rounded down to a whole unit.

Arguments
  • origin which must be a holder of the asset and eligible for the distribution.
  • ca_id identifies the CA to start a capital distribution for.
Errors
  • HolderAlreadyPaid if origin’s DID has already received its benefit.
  • NoSuchDistribution if there’s no capital distribution for ca_id.
  • CannotClaimBeforeStart if now < payment_at.
  • CannotClaimAfterExpiry if now > expiry_at.unwrap().
  • NoSuchCA if ca_id does not identify an existing CA.
  • NotTargetedByCA if the CA does not target origin’s DID.
  • BalanceAmountProductOverflowed if ba = balance * amount would overflow.
  • BalanceAmountProductSupplyDivisionFailed if ba * supply would overflow.
  • Other errors can occur if the compliance manager rejects the transfer.
source

pub fn push_benefit( &self, ca_id: CAId, holder: IdentityId ) -> Result<WrappedCall>

Push benefit of an ongoing distribution to the given holder.

Taxes are withheld as specified by the CA. Post-tax earnings are then transferred to the default portfolio of the origin’s DID.

All benefits are rounded by truncation, down to first integer below. Moreover, before post-tax earnings, in indivisible currencies are transferred, they are rounded down to a whole unit.

Arguments
  • origin is a signer that has permissions to act as an agent of ca_id.ticker.
  • ca_id identifies the CA with a capital distributions to push benefits for.
  • holder to push benefits to.
Errors
  • UnauthorizedAgent if origin is not agent-permissioned for ticker.
  • NoSuchDistribution if there’s no capital distribution for ca_id.
  • CannotClaimBeforeStart if now < payment_at.
  • CannotClaimAfterExpiry if now > expiry_at.unwrap().
  • NoSuchCA if ca_id does not identify an existing CA.
  • NotTargetedByCA if the CA does not target holder.
  • BalanceAmountProductOverflowed if ba = balance * amount would overflow.
  • BalanceAmountProductSupplyDivisionFailed if ba * supply would overflow.
  • Other errors can occur if the compliance manager rejects the transfer.
source

pub fn reclaim(&self, ca_id: CAId) -> Result<WrappedCall>

Assuming a distribution has expired, unlock the remaining amount in the distributor portfolio.

Arguments
  • origin which must be the creator of the capital distribution tied to ca_id.
  • ca_id identifies the CA with a capital distribution to reclaim for.
Errors
  • NoSuchDistribution if there’s no capital distribution for ca_id.
  • AlreadyReclaimed if this function has already been called successfully.
  • NotExpired if now < expiry.
source

pub fn remove_distribution(&self, ca_id: CAId) -> Result<WrappedCall>

Removes a distribution that hasn’t started yet, unlocking the full amount in the distributor portfolio.

Arguments
  • origin is a signer that has permissions to act as an agent of ca_id.ticker.
  • ca_id identifies the CA with a not-yet-started capital distribution to remove.
Errors
  • UnauthorizedAgent if origin is not agent-permissioned for ticker.
  • NoSuchDistribution if there’s no capital distribution for ca_id.
  • DistributionStarted if payment_at <= now.

Trait Implementations§

source§

impl<'api> Clone for CapitalDistributionCallApi<'api>

source§

fn clone(&self) -> CapitalDistributionCallApi<'api>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'api> From<&'api Api> for CapitalDistributionCallApi<'api>

source§

fn from(api: &'api Api) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CheckedConversion for T

§

fn checked_from<T>(t: T) -> Option<Self>where Self: TryFrom<T>,

Convert from a value of T into an equivalent instance of Option<Self>. Read more
§

fn checked_into<T>(self) -> Option<T>where Self: TryInto<T>,

Consume self to return Some equivalent value of Option<T>. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,

§

fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

§

fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatedConversion for T

source§

fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,

Convert from a value of T into an equivalent instance of Self. Read more
source§

fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,

Consume self to return an equivalent value of T. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,

§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
source§

impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,

source§

fn unique_saturated_into(self) -> T

Consume self to return an equivalent value of T.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> JsonSchemaMaybe for T

§

impl<T> MaybeSend for Twhere T: Send,