#[repr(C)]
pub struct ContractStateV4 { pub token: Pubkey, pub owner: Pubkey, pub admin: Pubkey, pub commission_addr: Pubkey, pub treasury_addr: Pubkey, pub swap_state: Pubkey, pub sold: u64, pub vest: VestState, pub drop: Option<DropV2>, pub current_round: Option<Pubkey>, pub completed_rounds_count: u64, }

Fields§

§token: Pubkey

Associated token mint

§owner: Pubkey

Alice

§admin: Pubkey

required for priveleged operations

§commission_addr: Pubkey

comission WSOL account

§treasury_addr: Pubkey

owner treasury

§swap_state: Pubkey

swap state

§sold: u64

tokens sold

§vest: VestState

vesting state

§drop: Option<DropV2>

in progress drop. use helper methods to access this field

§current_round: Option<Pubkey>

round in progress, used for vesting 10% of tokens

§completed_rounds_count: u64

completed rounds count

Implementations§

source§

impl ContractStateV4

source

pub fn calculate_buy_split( &self, now: UnixTimestamp, token_amount: u64, expected_price: u64 ) -> Result<BuySplit, ProgramError>

source

pub fn calculate_split_by_lamports(lamports: u64) -> Option<BuySplit>

source

pub fn create_drop( &mut self, price: u64, id: u64, amount: u64, now: UnixTimestamp, start_date: UnixTimestamp, end_date: UnixTimestamp ) -> Result<(), ProgramError>

source

pub fn clear_drop(&mut self)

Trait Implementations§

source§

impl BorshDeserialize for ContractStateV4where Pubkey: BorshDeserialize, u64: BorshDeserialize, VestState: BorshDeserialize, Option<DropV2>: BorshDeserialize, Option<Pubkey>: BorshDeserialize,

source§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
source§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
source§

impl BorshSerialize for ContractStateV4where Pubkey: BorshSerialize, u64: BorshSerialize, VestState: BorshSerialize, Option<DropV2>: BorshSerialize, Option<Pubkey>: BorshSerialize,

source§

fn serialize<W: Write>(&self, writer: &mut W) -> Result<(), Error>

source§

fn try_to_vec(&self) -> Result<Vec<u8, Global>, Error>

Serialize this instance into a vector of bytes.
source§

impl Debug for ContractStateV4

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Entity for ContractStateV4

source§

const SIZE: usize = 513usize

source§

const MAGIC: u8 = 69u8

source§

const DATA_SIZE: usize = Self::SIZE - 1

source§

fn serialize_to(&self, data: &mut [u8]) -> Result<(), ProgramError>

source§

fn deserialize_from(data: &[u8]) -> Result<Self, ProgramError>

source§

fn is_initialized(data: &[u8]) -> bool

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> AbiExample for T

§

default fn example() -> T

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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

§

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

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

§

fn vzip(self) -> V