Skip to main content

create_v2

Function create_v2 

Source
pub fn create_v2(
    ctx: Context<'_, '_, '_, '_, Create<'_>>,
    start_time: u64,
    net_amount_deposited: u64,
    period: u64,
    amount_per_period: u64,
    cliff: u64,
    cliff_amount: u64,
    cancelable_by_sender: bool,
    cancelable_by_recipient: bool,
    automatic_withdrawal: bool,
    transferable_by_sender: bool,
    transferable_by_recipient: bool,
    can_topup: bool,
    stream_name: [u8; 64],
    withdraw_frequency: u64,
    pausable: bool,
    can_update_rate: bool,
    nonce: u32,
) -> Result<()>
Expand description

Create a Stream with PDA-based metadata (v2)

This is similar to create but uses a PDA for the metadata account instead of an ephemeral signer keypair. The metadata PDA is derived from: ["strm-met", mint, sender, nonce_be_bytes]

Use streamflow_sdk::state::derive_metadata to compute the metadata PDA address.

ยงArguments

  • ctx - Accounts that will be used on Stream creation
  • start_time - Unix Timestamp for Stream start, can be 0 to use current time
  • net_amount_deposited - Amount of Tokens to deposit to the Stream
  • period - Unlock Period in Seconds, tokens will be unlocked every period seconds
  • amount_per_period - Unlock Amount, every period we unlock amount_per_period tokens
  • cliff - Unix Timestamp of Cliff (first unlock), can be 0 to use current time or not use at all
  • cliff_amount - Cliff Amount of tokens, can 0 to not use Cliff at all
  • cancelable_by_sender - Whether Stream can by cancelled by Sender
  • cancelable_by_recipient - Whether Stream can be cancelled by Recipient
  • automatic_withdrawal - Whether automatic withdrawals are enabled
  • transferable_by_sender - Whether Stream can be transferred by Sender
  • transferable_by_recipient - Whether Stream can be transferred by Recipient
  • can_topup - Whether Stream can be topped up (deposit additional tokens) by Sender
  • stream_name - Name of the Stream
  • withdraw_frequency - if automatic_withdrawal is on, every withdraw_frequency seconds all unlocked tokens will be sent to the recipient
  • pausable - Whether Stream can be paused by Sender
  • can_update_rate - Whether Sender can update amount_per_period value of the Stream via update method
  • nonce - Nonce used for PDA derivation of the metadata account