pub struct StoCallApi<'api> { /* private fields */ }Implementations§
Source§impl<'api> StoCallApi<'api>
impl<'api> StoCallApi<'api>
Sourcepub 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>
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 saleoffering_asset- Asset ID of the security token being soldraising_portfolio- Portfolio that will receive the raised fundsraising_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 unitvenue_id- STO venue ID for handling settlements (must be owned by caller)start- Optional start time; ifNone, fundraiser begins immediatelyend- Optional end time; ifNone, fundraiser runs indefinitelyminimum_investment- Minimum amount ofraising_assetrequired per investmentfundraiser_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_portfolioandraising_portfolio - Venue Ownership: The specified
venue_idmust be an STO venue owned by the caller
§Errors
InvalidVenue- Venue doesn’t exist, wrong type, or not owned by callerInvalidPriceTiers- Invalid tier configuration (0 tiers, >10 tiers, zero amounts)InvalidOfferingWindow- Start time is after end timeOverflow- Total offering amount calculation overflowed
Sourcepub 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>
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 purchasedfundraiser_id- Unique identifier of the fundraiser to invest ininvestment_portfolio- Portfolio where purchased tokens will be depositedfunding- Payment method: eitherOnChain(portfolio_id)for on-chain assets orOffChain(receipt_details)for off-chain receipts with signature verificationpurchase_amount- Number ofoffering_assettokens to purchasemax_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 existFundraiserNotLive- Fundraiser is frozen or closedFundraiserExpired- Current time is outside fundraiser’s active windowInsufficientTokensRemaining- Not enough tokens available across all tiersInvestmentAmountTooLow- Total cost is below minimum investment thresholdMaxPriceExceeded- Blended price exceeds investor’s maximum price limitOffchainFundingNotAllowed- Off-chain funding not enabled for this fundraiserInvalidSignature- Off-chain receipt signature verification failed
Sourcepub fn freeze_fundraiser(
&self,
offering_asset: AssetId,
fundraiser_id: FundraiserId,
) -> Result<WrappedCall>
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 freezefundraiser_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 existFundraiserClosed- Fundraiser has already been permanently closedUnauthorized- Caller lacks required asset agent permissions
Sourcepub fn unfreeze_fundraiser(
&self,
offering_asset: AssetId,
fundraiser_id: FundraiserId,
) -> Result<WrappedCall>
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 unfreezefundraiser_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 existFundraiserClosed- Fundraiser has been permanently closed and cannot be unfrozenUnauthorized- Caller lacks required asset agent permissions
Sourcepub fn modify_fundraiser_window(
&self,
offering_asset: AssetId,
fundraiser_id: FundraiserId,
start: u64,
end: Option<u64>,
) -> Result<WrappedCall>
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 modifyfundraiser_id- Unique identifier of the fundraiser to modifystart- New start time for the fundraiser (can be in the past or future)end- New optional end time; ifNone, the fundraiser runs indefinitely
§Permissions Required
- Asset Agent: Caller must be an authorized external agent for
offering_asset
§Errors
FundraiserNotFound- Specified fundraiser doesn’t existFundraiserClosed- Fundraiser has been permanently closedFundraiserExpired- Fundraiser has already expired (past its original end time)InvalidOfferingWindow- New start time is after new end timeUnauthorized- Caller lacks required asset agent permissions
Sourcepub fn stop(
&self,
offering_asset: AssetId,
fundraiser_id: FundraiserId,
) -> Result<WrappedCall>
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 stopfundraiser_id- Unique identifier of the fundraiser to stop
§Permissions Required
- Asset Agent: Caller must be an authorized external agent for
offering_assetOR be the original creator of the fundraiser
§Errors
FundraiserNotFound- Specified fundraiser doesn’t existFundraiserClosed- Fundraiser has already been permanently closedUnauthorized- Caller lacks required permissions
Sourcepub fn enable_offchain_funding(
&self,
offering_asset: AssetId,
fundraiser_id: FundraiserId,
ticker: Ticker,
) -> Result<WrappedCall>
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 fundraiserfundraiser_id- Unique identifier of the fundraiser to enable off-chain funding forticker- 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_assetOR be the original creator of the fundraiser
§Errors
FundraiserNotFound- Specified fundraiser doesn’t existFundraiserClosed- Fundraiser has been permanently closedUnauthorized- Caller lacks required permissions
Trait Implementations§
Source§impl<'api> Clone for StoCallApi<'api>
impl<'api> Clone for StoCallApi<'api>
Source§fn clone(&self) -> StoCallApi<'api>
fn clone(&self) -> StoCallApi<'api>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
Source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T. Read moreSource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T.