pub struct Ctx {
pub network: Network,
pub nonce: u64,
}Expand description
Everything outside the amounts that a plan is made from.
Fields§
§network: Network§nonce: u64Implementations§
Source§impl Ctx
impl Ctx
Sourcepub fn supply(
&self,
token: u32,
amount: Dec,
reserves: &[(u32, ReserveState)],
) -> Result<Plan<BorrowLend>, Refused>
pub fn supply( &self, token: u32, amount: Dec, reserves: &[(u32, ReserveState)], ) -> Result<Plan<BorrowLend>, Refused>
Supplies amount of token, already cut to its weiDecimals.
Sourcepub fn withdraw(
&self,
token: u32,
amount: Option<Dec>,
state: &UserState,
) -> Result<Plan<BorrowLend>, Refused>
pub fn withdraw( &self, token: u32, amount: Option<Dec>, state: &UserState, ) -> Result<Plan<BorrowLend>, Refused>
Takes back amount of what is supplied, or with None all of it.
Sourcepub fn borrow(
&self,
token: u32,
amount: Dec,
reserves: &[(u32, ReserveState)],
) -> Result<Plan<BorrowLend>, Refused>
pub fn borrow( &self, token: u32, amount: Dec, reserves: &[(u32, ReserveState)], ) -> Result<Plan<BorrowLend>, Refused>
Borrows amount of token, at most what its reserve can lend.
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.