pub struct Ctx {
pub network: Network,
pub nonce: u64,
pub now_ms: u64,
}Expand description
Everything outside the amounts that a plan is made from.
Fields§
§network: Network§nonce: u64§now_ms: u64Now, milliseconds: a lockup is measured from it.
Implementations§
Source§impl Ctx
impl Ctx
Sourcepub fn deposit(
&self,
vault: &VaultDetails,
usdc: Dec,
) -> Result<Plan<VaultTransfer>, Refused>
pub fn deposit( &self, vault: &VaultDetails, usdc: Dec, ) -> Result<Plan<VaultTransfer>, Refused>
USDC from the perp balance into vault, locked for its lockup.
Sourcepub fn withdraw(
&self,
equity: &VaultEquity,
usdc: Dec,
) -> Result<Plan<VaultTransfer>, Refused>
pub fn withdraw( &self, equity: &VaultEquity, usdc: Dec, ) -> Result<Plan<VaultTransfer>, Refused>
usdc out of the vault equity is in, once its lockup has passed.
Sourcepub fn withdraw_all(
&self,
equity: &VaultEquity,
) -> Result<Plan<VaultTransfer>, Refused>
pub fn withdraw_all( &self, equity: &VaultEquity, ) -> Result<Plan<VaultTransfer>, Refused>
The whole equity, cut to millionths so it never asks for more.
Trait Implementations§
impl Copy for Ctx
impl Eq for Ctx
impl StructuralPartialEq for Ctx
Auto Trait Implementations§
impl Freeze for Ctx
impl RefUnwindSafe for Ctx
impl Send for Ctx
impl Sync for Ctx
impl Unpin for Ctx
impl UnsafeUnpin for Ctx
impl UnwindSafe for Ctx
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.