pub struct VaultV1Operations<'a> { /* private fields */ }Expand description
Wrapper for V1 vault operations that automatically uses the signer’s address.
Implementations§
Source§impl<'a> VaultV1Operations<'a>
impl<'a> VaultV1Operations<'a>
Sourcepub async fn deposit(
&self,
vault: Address,
amount: U256,
) -> Result<TransactionReceipt>
pub async fn deposit( &self, vault: Address, amount: U256, ) -> Result<TransactionReceipt>
Deposit assets into a vault, receiving shares to the signer’s address.
Sourcepub async fn withdraw(
&self,
vault: Address,
amount: U256,
) -> Result<TransactionReceipt>
pub async fn withdraw( &self, vault: Address, amount: U256, ) -> Result<TransactionReceipt>
Withdraw assets from a vault to the signer’s address (withdrawing signer’s shares).
Sourcepub async fn balance(&self, vault: Address) -> Result<U256>
pub async fn balance(&self, vault: Address) -> Result<U256>
Get the signer’s vault share balance.
Sourcepub async fn approve(
&self,
vault: Address,
amount: U256,
) -> Result<Option<TransactionReceipt>>
pub async fn approve( &self, vault: Address, amount: U256, ) -> Result<Option<TransactionReceipt>>
Approve a vault to spend the signer’s tokens if needed. Returns the transaction receipt if approval was performed, None if already approved.
Sourcepub async fn get_asset(&self, vault: Address) -> Result<Address>
pub async fn get_asset(&self, vault: Address) -> Result<Address>
Get the underlying asset address of a vault.
Sourcepub async fn get_decimals(&self, token: Address) -> Result<u8>
pub async fn get_decimals(&self, token: Address) -> Result<u8>
Get the decimals of a token.
Sourcepub fn signer_address(&self) -> Address
pub fn signer_address(&self) -> Address
Get the signer’s address.
Auto Trait Implementations§
impl<'a> Freeze for VaultV1Operations<'a>
impl<'a> !RefUnwindSafe for VaultV1Operations<'a>
impl<'a> Send for VaultV1Operations<'a>
impl<'a> Sync for VaultV1Operations<'a>
impl<'a> Unpin for VaultV1Operations<'a>
impl<'a> !UnwindSafe for VaultV1Operations<'a>
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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