pub enum CrankWorkInfo {
CloseAllPositions {
position: PositionId,
},
ResetLpBalances {},
Liquifunding {
position: PositionId,
},
Liquidation {
position: PositionId,
liquidation_reason: LiquidationReason,
},
DeferredExec {
deferred_exec_id: DeferredExecId,
target: DeferredExecTarget,
},
LimitOrder {
order_id: OrderId,
},
Completed {},
}
Expand description
What work is currently available for the crank.
Variants§
CloseAllPositions
Fields
position: PositionId
Next position to be closed
Closing all open positions
ResetLpBalances
Fields
Resetting all LP balances to 0 after all liquidity is drained
Liquifunding
Fields
position: PositionId
Next position to be liquifunded
Liquifund a position
Liquidation
Fields
position: PositionId
Position to liquidate
liquidation_reason: LiquidationReason
Reason for the liquidation
Liquidate a position.
Includes max gains, take profit, and stop loss.
DeferredExec
Fields
deferred_exec_id: DeferredExecId
ID to be processed
target: DeferredExecTarget
Target of the action
Deferred execution (open/update/closed) can be executed.
LimitOrder
Limit order can be opened
Completed
Fields
Finished all processing for a given price update
Implementations§
source§impl CrankWorkInfo
impl CrankWorkInfo
sourcepub fn receives_crank_rewards(&self) -> bool
pub fn receives_crank_rewards(&self) -> bool
Should a cranker receive rewards for performing this action?
We generally want to give out rewards for actions that are directly user initiated and will be receiving a crank fee paid into the system. Actions which are overall protocol maintenance without a specific user action may be unfunded. A simple “attack” we want to avoid is a cranker flooding the system with unnecessary price updates + cranks to continue making a profit off of “Completed” items.
Trait Implementations§
source§impl Clone for CrankWorkInfo
impl Clone for CrankWorkInfo
source§fn clone(&self) -> CrankWorkInfo
fn clone(&self) -> CrankWorkInfo
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CrankWorkInfo
impl Debug for CrankWorkInfo
source§impl<'de> Deserialize<'de> for CrankWorkInfo
impl<'de> Deserialize<'de> for CrankWorkInfo
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl JsonSchema for CrankWorkInfo
impl JsonSchema for CrankWorkInfo
source§fn schema_name() -> String
fn schema_name() -> String
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moresource§impl PartialEq for CrankWorkInfo
impl PartialEq for CrankWorkInfo
source§fn eq(&self, other: &CrankWorkInfo) -> bool
fn eq(&self, other: &CrankWorkInfo) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for CrankWorkInfo
impl Serialize for CrankWorkInfo
source§impl TryFrom<Event> for CrankWorkInfo
impl TryFrom<Event> for CrankWorkInfo
impl StructuralPartialEq for CrankWorkInfo
Auto Trait Implementations§
impl RefUnwindSafe for CrankWorkInfo
impl Send for CrankWorkInfo
impl Sync for CrankWorkInfo
impl Unpin for CrankWorkInfo
impl UnwindSafe for CrankWorkInfo
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere T: CastFrom<U>,
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read more