StoCallApi

Struct StoCallApi 

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

Implementations§

Source§

impl<'api> StoCallApi<'api>

Source

pub fn create_fundraiser( &self, offering_portfolio: PortfolioId, offering_asset: AssetId, raising_portfolio: PortfolioId, raising_asset: AssetId, tiers: Vec<PriceTier>, venue_id: VenueId, start: Option<u64>, end: Option<u64>, minimum_investment: u128, fundraiser_name: FundraiserName, ) -> Result<WrappedCall>

Create a new fundraiser for a security token offering.

This function creates a tiered pricing fundraiser where investors can purchase tokens at different price points. The fundraiser uses Polymesh’s settlement infrastructure to ensure compliant and secure token transfers.

§Parameters
  • offering_portfolio - Portfolio containing the tokens being offered for sale
  • offering_asset - Asset ID of the security token being sold
  • raising_portfolio - Portfolio that will receive the raised funds
  • raising_asset - Asset ID of the payment token (e.g., POLYX, stablecoin)
  • tiers - Vector of price tiers (1-10 tiers), each with total amount and price per unit
  • venue_id - STO venue ID for handling settlements (must be owned by caller)
  • start - Optional start time; if None, fundraiser begins immediately
  • end - Optional end time; if None, fundraiser runs indefinitely
  • minimum_investment - Minimum amount of raising_asset required per investment
  • fundraiser_name - Human-readable name for UI display (length limited)
§Permissions Required
  • Asset Agent: Caller must be an authorized external agent for offering_asset
  • Portfolio Custody: Caller must have custody of both offering_portfolio and raising_portfolio
  • Venue Ownership: The specified venue_id must be an STO venue owned by the caller
§Errors
  • InvalidVenue - Venue doesn’t exist, wrong type, or not owned by caller
  • InvalidPriceTiers - Invalid tier configuration (0 tiers, >10 tiers, zero amounts)
  • InvalidOfferingWindow - Start time is after end time
  • Overflow - Total offering amount calculation overflowed
Source

pub fn invest( &self, offering_asset: AssetId, fundraiser_id: FundraiserId, investment_portfolio: PortfolioId, funding: FundingMethod<AccountId, MultiSignature>, purchase_amount: u128, max_price: Option<u128>, ) -> Result<WrappedCall>

Invest in a fundraiser using on-chain or off-chain funding.

This function allows investors to purchase tokens from an active fundraiser. The investment is processed through multiple price tiers in order, starting with the lowest-priced tier. The purchase creates a settlement instruction that transfers tokens and payment between the appropriate portfolios.

§Parameters
  • offering_asset - Asset ID of the security token being purchased
  • fundraiser_id - Unique identifier of the fundraiser to invest in
  • investment_portfolio - Portfolio where purchased tokens will be deposited
  • funding - Payment method: either OnChain(portfolio_id) for on-chain assets or OffChain(receipt_details) for off-chain receipts with signature verification
  • purchase_amount - Number of offering_asset tokens to purchase
  • max_price - Optional maximum price per token; if specified, investment fails if the blended price across tiers exceeds this limit
§Permissions Required
  • Portfolio Custody: Caller must have custody of investment_portfolio
  • Funding Portfolio: If using on-chain funding, caller must have custody of the funding portfolio specified in the FundingMethod
§Errors
  • FundraiserNotFound - Specified fundraiser doesn’t exist
  • FundraiserNotLive - Fundraiser is frozen or closed
  • FundraiserExpired - Current time is outside fundraiser’s active window
  • InsufficientTokensRemaining - Not enough tokens available across all tiers
  • InvestmentAmountTooLow - Total cost is below minimum investment threshold
  • MaxPriceExceeded - Blended price exceeds investor’s maximum price limit
  • OffchainFundingNotAllowed - Off-chain funding not enabled for this fundraiser
  • InvalidSignature - Off-chain receipt signature verification failed
Source

pub fn freeze_fundraiser( &self, offering_asset: AssetId, fundraiser_id: FundraiserId, ) -> Result<WrappedCall>

Temporarily freeze a fundraiser to prevent new investments.

When a fundraiser is frozen, it cannot accept new investments but remains otherwise intact. This is useful for pausing activity while resolving issues or during maintenance periods. The fundraiser can be unfrozen later to resume normal operations.

§Parameters
  • offering_asset - Asset ID associated with the fundraiser to freeze
  • fundraiser_id - Unique identifier of the fundraiser to freeze
§Permissions Required
  • Asset Agent: Caller must be an authorized external agent for offering_asset
§Errors
  • FundraiserNotFound - Specified fundraiser doesn’t exist
  • FundraiserClosed - Fundraiser has already been permanently closed
  • Unauthorized - Caller lacks required asset agent permissions
Source

pub fn unfreeze_fundraiser( &self, offering_asset: AssetId, fundraiser_id: FundraiserId, ) -> Result<WrappedCall>

Resume a frozen fundraiser to allow new investments.

This function unfreezes a previously frozen fundraiser, returning it to the Live status where it can accept new investments. The fundraiser must not be permanently closed for this operation to succeed.

§Parameters
  • offering_asset - Asset ID associated with the fundraiser to unfreeze
  • fundraiser_id - Unique identifier of the fundraiser to unfreeze
§Permissions Required
  • Asset Agent: Caller must be an authorized external agent for offering_asset
§Errors
  • FundraiserNotFound - Specified fundraiser doesn’t exist
  • FundraiserClosed - Fundraiser has been permanently closed and cannot be unfrozen
  • Unauthorized - Caller lacks required asset agent permissions
Source

pub fn modify_fundraiser_window( &self, offering_asset: AssetId, fundraiser_id: FundraiserId, start: u64, end: Option<u64>, ) -> Result<WrappedCall>

Modify the time window when a fundraiser is active for investments.

This function allows authorized agents to update the start and end times of an active fundraiser. This can be useful for extending fundraising periods, adjusting launch timing, or responding to market conditions. The fundraiser must not be permanently closed to modify its window.

§Parameters
  • offering_asset - Asset ID associated with the fundraiser to modify
  • fundraiser_id - Unique identifier of the fundraiser to modify
  • start - New start time for the fundraiser (can be in the past or future)
  • end - New optional end time; if None, the fundraiser runs indefinitely
§Permissions Required
  • Asset Agent: Caller must be an authorized external agent for offering_asset
§Errors
  • FundraiserNotFound - Specified fundraiser doesn’t exist
  • FundraiserClosed - Fundraiser has been permanently closed
  • FundraiserExpired - Fundraiser has already expired (past its original end time)
  • InvalidOfferingWindow - New start time is after new end time
  • Unauthorized - Caller lacks required asset agent permissions
Source

pub fn stop( &self, offering_asset: AssetId, fundraiser_id: FundraiserId, ) -> Result<WrappedCall>

Permanently stop a fundraiser and unlock remaining tokens.

This function permanently closes a fundraiser, preventing any further investments. Any remaining tokens that haven’t been sold are unlocked and returned to the offering portfolio. Once stopped, a fundraiser cannot be restarted.

§Parameters
  • offering_asset - Asset ID associated with the fundraiser to stop
  • fundraiser_id - Unique identifier of the fundraiser to stop
§Permissions Required
  • Asset Agent: Caller must be an authorized external agent for offering_asset OR be the original creator of the fundraiser
§Errors
  • FundraiserNotFound - Specified fundraiser doesn’t exist
  • FundraiserClosed - Fundraiser has already been permanently closed
  • Unauthorized - Caller lacks required permissions
Source

pub fn enable_offchain_funding( &self, offering_asset: AssetId, fundraiser_id: FundraiserId, ticker: Ticker, ) -> Result<WrappedCall>

Enable off-chain funding support for a fundraiser.

This function allows a fundraiser to accept off-chain payments through cryptographically signed receipts. Once enabled, investors can use the invest function with FundingMethod::OffChain to provide payment receipts instead of on-chain portfolio transfers.

§Parameters
  • offering_asset - Asset ID associated with the fundraiser
  • fundraiser_id - Unique identifier of the fundraiser to enable off-chain funding for
  • ticker - Ticker symbol of the off-chain asset that will be accepted as payment
§Permissions Required
  • Asset Agent: Caller must be an authorized external agent for offering_asset OR be the original creator of the fundraiser
§Errors
  • FundraiserNotFound - Specified fundraiser doesn’t exist
  • FundraiserClosed - Fundraiser has been permanently closed
  • Unauthorized - Caller lacks required permissions

Trait Implementations§

Source§

impl<'api> Clone for StoCallApi<'api>

Source§

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

Returns a duplicate 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 StoCallApi<'api>

Source§

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

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'api> Freeze for StoCallApi<'api>

§

impl<'api> !RefUnwindSafe for StoCallApi<'api>

§

impl<'api> Send for StoCallApi<'api>

§

impl<'api> Sync for StoCallApi<'api>

§

impl<'api> Unpin for StoCallApi<'api>

§

impl<'api> !UnwindSafe for StoCallApi<'api>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CheckedConversion for T

Source§

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
Source§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where 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.

Source§

impl<T> Instrument for T

Source§

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

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

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 T
where 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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Src, Dest> IntoTuple<Dest> for Src
where Dest: FromTuple<Src>,

Source§

fn into_tuple(self) -> Dest

Source§

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

Source§

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

Get a reference to the inner from the outer.

Source§

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

Get a mutable reference to the inner from the outer.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatedConversion for T

Source§

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

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

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

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

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

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

Source§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
Source§

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

Source§

fn unique_saturated_into(self) -> T

Consume self to return an equivalent value of T.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> JsonSchemaMaybe for T

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSendSync for T