pub struct TradeModuleData {
pub asset_address: Address,
pub sub_id: U256,
pub limit_price: Decimal,
pub amount: Decimal,
pub max_fee: Decimal,
pub recipient_id: u64,
pub is_bid: bool,
}Expand description
Trade-action module payload signed into every private/order request.
Fields§
§asset_address: AddressERC-20 asset address from the instrument ticker (base_asset_address).
sub_id: U256Sub-id from the instrument ticker (base_asset_sub_id).
limit_price: DecimalLimit price; scaled to 1e18 on encode.
amount: DecimalOrder amount (base units); scaled to 1e18 on encode.
max_fee: DecimalMax-fee cap per contract in USDC; scaled to 1e18 on encode.
recipient_id: u64Subaccount that receives the position (typically the signing subaccount).
is_bid: booltrue for bids, false for asks.
Implementations§
Source§impl TradeModuleData
impl TradeModuleData
Sourcepub fn encode(&self) -> Result<Vec<u8>, TradeEncodeError>
pub fn encode(&self) -> Result<Vec<u8>, TradeEncodeError>
Encode the trade payload into the ABI tuple consumed by the venue’s trade module contract.
§Errors
Returns TradeEncodeError::DecimalOverflow when any decimal scales
outside the signed/unsigned 256-bit range.
Trait Implementations§
Source§impl Clone for TradeModuleData
impl Clone for TradeModuleData
Source§fn clone(&self) -> TradeModuleData
fn clone(&self) -> TradeModuleData
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TradeModuleData
impl Debug for TradeModuleData
Source§impl ModuleData for TradeModuleData
impl ModuleData for TradeModuleData
Source§fn to_abi_encoded(&self) -> Result<Vec<u8>, ModuleEncodeError>
fn to_abi_encoded(&self) -> Result<Vec<u8>, ModuleEncodeError>
ABI-encode this module payload using the field tuple defined in the
upstream Solidity action contract. Read more
Auto Trait Implementations§
impl Freeze for TradeModuleData
impl RefUnwindSafe for TradeModuleData
impl Send for TradeModuleData
impl Sync for TradeModuleData
impl Unpin for TradeModuleData
impl UnsafeUnpin for TradeModuleData
impl UnwindSafe for TradeModuleData
Blanket Implementations§
impl<T> Allocation for T
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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