Trait tulipv2_sdk_common::traits::vault::TokenizedSharesHolder
source · [−]pub trait TokenizedSharesHolder {
fn shares_to_give(&self, vault: &impl TokenizedShares, amount: u64) -> u64;
fn underlying_to_redeem(
&self,
vault: &impl TokenizedShares,
amount: u64
) -> Option<u64>;
fn record_deposit(&mut self, amount: u64, shares: u64);
fn record_withdraw(
&mut self,
vault: &impl TokenizedShares,
amount: u64
) -> u64;
fn deposited_balance(&self) -> u64;
fn issued_shares(&self) -> u64;
fn total_deposited_underlying(&self) -> u64;
fn total_withdrawn_underlying(&self) -> u64;
fn withdraw_shares<'info>(
&mut self,
deposit_account: &AccountInfo<'info>,
hold_account: &AccountInfo<'info>,
pda_account: &AccountInfo<'info>,
receiving_shares_account: &AccountInfo<'info>,
token_program: &AccountInfo<'info>,
amount: u64
) -> Result<()>;
}Expand description
implementation of a holder of tokenized vault shares
Required Methods
returns the amount of shares to given in exchange for depositing the specified amount of underlying tokens
sourcefn underlying_to_redeem(
&self,
vault: &impl TokenizedShares,
amount: u64
) -> Option<u64>
fn underlying_to_redeem(
&self,
vault: &impl TokenizedShares,
amount: u64
) -> Option<u64>
returns the amount of underlying to redeem in exchange for burning the amount of shares returns None if vault is locked for the share holder
sourcefn record_deposit(&mut self, amount: u64, shares: u64)
fn record_deposit(&mut self, amount: u64, shares: u64)
used to record the effects of depositing underlying asset into the vault
sourcefn record_withdraw(&mut self, vault: &impl TokenizedShares, amount: u64) -> u64
fn record_withdraw(&mut self, vault: &impl TokenizedShares, amount: u64) -> u64
used to record the effect of withdrawing and burning the shares for their underlying assets. note you will need to calculate the shares to burn and the corresponding balance to remove
sourcefn deposited_balance(&self) -> u64
fn deposited_balance(&self) -> u64
returns the current deposited underlying managed by this account, not considering compounding rewards
returns the current number of shares managed by this account
sourcefn total_deposited_underlying(&self) -> u64
fn total_deposited_underlying(&self) -> u64
returns the total amount of underlying that has been deposited into this account over time
sourcefn total_withdrawn_underlying(&self) -> u64
fn total_withdrawn_underlying(&self) -> u64
returns the total amount of underlying that has ever been withdrawn from this account over time
withdraw shares from the deposit tracking account