Skip to main content

create

Function create 

Source
pub fn create(
    ctx: &mut SpendContext,
    creator: &Owner<'_>,
    funding_coin: Coin,
    terms: &OptionTerms,
) -> Result<OptionSpend>
Expand description

Build the unsigned coin spends that CREATE an option per terms, funded from funding_coin and authorized by creator.

Locks terms.underlying_amount mojos of XCH as the underlying and mints the option singleton to terms.owner_puzzle_hash, exercisable for terms.strike_type until terms.expiry_seconds. funding_coin must hold at least underlying_amount + 1 mojos (the underlying plus the 1-mojo singleton); any excess is left as an implicit fee.

The returned OptionSpend::created is Some: retain it to exercise or claw back the option once this spend is confirmed. Pure: does NOT sign or broadcastcreator authorizes the funding-coin spend; the caller signs the reported messages (crate::required_signatures).