pub struct Ctx {
pub network: Network,
pub account: Address,
pub keeping: Keeping,
pub nonce: u64,
}Expand description
Everything outside the amounts that a plan is made from.
Fields§
§network: Network§account: AddressThe account that moves the money.
keeping: Keeping§nonce: u64Implementations§
Source§impl Ctx
impl Ctx
Sourcepub fn usdc(&self) -> Balance
pub fn usdc(&self) -> Balance
Where USDC leaving the perp side is read back: spot USDC for a pooled
account, the main dex’s withdrawable otherwise.
Sourcepub fn class_transfer(
&self,
amount: Amount,
to_perp: bool,
) -> Result<Plan<UsdClassTransfer>, Refused>
pub fn class_transfer( &self, amount: Amount, to_perp: bool, ) -> Result<Plan<UsdClassTransfer>, Refused>
usdClassTransfer: USDC between the account’s own perp and spot. A
pooled account has one balance and nothing to move.
Sourcepub fn usd_send(
&self,
to: Address,
amount: Amount,
) -> Result<Plan<UsdSend>, Refused>
pub fn usd_send( &self, to: Address, amount: Amount, ) -> Result<Plan<UsdSend>, Refused>
usdSend: USDC to another account.
Sourcepub fn send_token(
&self,
to: Address,
token: &SpotToken,
amount: Amount,
) -> Result<Plan<SpotOut>, Refused>
pub fn send_token( &self, to: Address, token: &SpotToken, amount: Amount, ) -> Result<Plan<SpotOut>, Refused>
A spot token to another account, by the action the account takes.
Sourcepub fn to_evm(
&self,
token: &SpotToken,
amount: Amount,
) -> Result<Plan<SpotOut>, Refused>
pub fn to_evm( &self, token: &SpotToken, amount: Amount, ) -> Result<Plan<SpotOut>, Refused>
Core to HyperEVM: the token to its system address, arriving at the same address on HyperEVM.
The way back is crate::transfer::link::Linked::to_core.
Sourcepub fn between(
&self,
from: &str,
to: &str,
token: &SpotToken,
amount: Amount,
) -> Result<Plan<SendAsset>, Refused>
pub fn between( &self, from: &str, to: &str, token: &SpotToken, amount: Amount, ) -> Result<Plan<SendAsset>, Refused>
sendAsset to the account itself, from one of its balances to another
("" the main dex, spot, or a HIP-3 dex by name), signed by its own
key. A pooled account has one balance and nothing to move.
Sourcepub fn agent_between(
&self,
from: &str,
to: &str,
token: &SpotToken,
amount: Amount,
) -> Result<Plan<AgentSendAsset>, Refused>
pub fn agent_between( &self, from: &str, to: &str, token: &SpotToken, amount: Amount, ) -> Result<Plan<AgentSendAsset>, Refused>
Ctx::between as agentSendAsset, which an agent signs.
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
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
key and return true if they are equal.