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
Closing all open positions
Fields
position: PositionId
Next position to be closed
ResetLpBalances
Resetting all LP balances to 0 after all liquidity is drained
Liquifunding
Liquifund a position
Fields
position: PositionId
Next position to be liquifunded
Liquidation
Liquidate a position.
Includes max gains, take profit, and stop loss.
Fields
position: PositionId
Position to liquidate
liquidation_reason: LiquidationReason
Reason for the liquidation
DeferredExec
Deferred execution (open/update/closed) can be executed.
Fields
deferred_exec_id: DeferredExecId
ID to be processed
target: DeferredExecTarget
Target of the action
LimitOrder
Limit order can be opened
Completed
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 Freeze for CrankWorkInfo
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 moresource§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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
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>
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