#[repr(C)]pub struct Contract {Show 37 fields
pub magic: u64,
pub version: u8,
pub created_at: u64,
pub amount_withdrawn: u64,
pub canceled_at: u64,
pub end_time: u64,
pub last_withdrawn_at: u64,
pub sender: Pubkey,
pub sender_tokens: Pubkey,
pub recipient: Pubkey,
pub recipient_tokens: Pubkey,
pub mint: Pubkey,
pub escrow_tokens: Pubkey,
pub streamflow_treasury: Pubkey,
pub streamflow_treasury_tokens: Pubkey,
pub streamflow_fee_total: u64,
pub streamflow_fee_withdrawn: u64,
pub streamflow_fee_percent: f32,
pub partner: Pubkey,
pub partner_tokens: Pubkey,
pub partner_fee_total: u64,
pub partner_fee_withdrawn: u64,
pub partner_fee_percent: f32,
pub ix: CreateParams,
pub ix_padding: [u8; 121],
pub closed: bool,
pub current_pause_start: u64,
pub pause_cumulative: u64,
pub last_rate_change_time: u64,
pub funds_unlocked_at_last_rate_change: u64,
pub creation_fee: u32,
pub creation_fee_claimed: bool,
pub auto_claim_fee: u32,
pub auto_claim_fee_claimed: bool,
pub old_metadata: Pubkey,
pub payer: Pubkey,
pub bump: u8,
}Expand description
Struct that represents Stream Contract stored on chain, this account DOES NOT have a discriminator.
May be read like so
let stream_metadata: Contract = match try_from_slice_unchecked(&stream_data) {
Ok(v) => v,
Err(_) => return err!(ErrorCode::InvalidStreamMetadata),
};Fields§
§magic: u64Magic bytes
version: u8Version of the program
created_at: u64Timestamp when stream was created
amount_withdrawn: u64Amount of funds withdrawn
canceled_at: u64Timestamp when stream was canceled (if canceled)
end_time: u64Timestamp at which stream can be safely canceled by a 3rd party (Stream is either fully vested or there isn’t enough capital to keep it active)
last_withdrawn_at: u64Timestamp of the last withdrawal
sender: PubkeyPubkey of the stream initializer
sender_tokens: PubkeyPubkey of the stream initializer’s token account
recipient: PubkeyPubkey of the stream recipient
recipient_tokens: PubkeyPubkey of the stream recipient’s token account
mint: PubkeyPubkey of the token mint
escrow_tokens: PubkeyEscrow account holding the locked tokens for recipient
streamflow_treasury: PubkeyStreamflow treasury authority
streamflow_treasury_tokens: PubkeyEscrow account holding the locked tokens for Streamflow (fee account)
streamflow_fee_total: u64The total fee amount for streamflow
streamflow_fee_withdrawn: u64The withdrawn fee amount for streamflow
streamflow_fee_percent: f32Fee percentage for Streamflow
partner: PubkeyStreamflow partner authority
partner_tokens: PubkeyEscrow account holding the locked tokens for Streamflow partner (fee account)
partner_fee_total: u64The total fee amount for the partner
partner_fee_withdrawn: u64The withdrawn fee amount for the partner
partner_fee_percent: f32Fee percentage for partner
ix: CreateParamsThe stream instruction
ix_padding: [u8; 121]Padding for ix: CreateParams to allow for future upgrades.
closed: boolWhether Stream is closed
current_pause_start: u64time of the current pause. 0 signifies unpaused state
pause_cumulative: u64total time the contract was paused for
last_rate_change_time: u64timestamp of last rate change for this stream.
Rate can be changed with update instruction
funds_unlocked_at_last_rate_change: u64Accumulated unlocked tokens before last rate change (excluding cliff_amount)
creation_fee: u32Creation SOL fee
creation_fee_claimed: boolWhether SOL fees have been claimed from the metadata account
auto_claim_fee: u32Auto-claim SOL fee
auto_claim_fee_claimed: boolWhether SOL fees have been claimed from the metadata account
old_metadata: PubkeyPubkey of the old (drained) metadata account, used for escrow PDA derivation. Zero (default) means this IS the original metadata – escrow derives from self.
payer: PubkeyWallet that paid for the Contract creation, may be used for PDA derivation
bump: u8Bump used for the Contract Metadata if it’s a PDA
Implementations§
Source§impl Contract
impl Contract
pub fn start_time(&self) -> u64
pub fn effective_start_time(&self) -> u64
pub fn pause_time(&self, now: u64) -> u64
Sourcepub fn vested_available(&self, now: u64) -> u64
pub fn vested_available(&self, now: u64) -> u64
amount available that is vested (excluding cliff)
pub fn available_to_claim(&self, now: u64, fee_percentage: f32) -> u64
pub fn cliff_available(&self, now: u64) -> u64
Trait Implementations§
Source§impl BorshDeserialize for Contract
impl BorshDeserialize for Contract
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for Contractwhere
u64: BorshSerialize,
u8: BorshSerialize,
Pubkey: BorshSerialize,
f32: BorshSerialize,
CreateParams: BorshSerialize,
[u8; 121]: BorshSerialize,
bool: BorshSerialize,
u32: BorshSerialize,
impl BorshSerialize for Contractwhere
u64: BorshSerialize,
u8: BorshSerialize,
Pubkey: BorshSerialize,
f32: BorshSerialize,
CreateParams: BorshSerialize,
[u8; 121]: BorshSerialize,
bool: BorshSerialize,
u32: BorshSerialize,
Auto Trait Implementations§
impl Freeze for Contract
impl RefUnwindSafe for Contract
impl Send for Contract
impl Sync for Contract
impl Unpin for Contract
impl UnsafeUnpin for Contract
impl UnwindSafe for Contract
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more