Enum levana_perpswap_cosmos::contracts::market::entry::ExecuteMsg
source · pub enum ExecuteMsg {
Show 31 variants
Owner(ExecuteOwnerMsg),
Receive {
sender: RawAddr,
amount: Uint128,
msg: Binary,
},
OpenPosition {
slippage_assert: Option<SlippageAssert>,
leverage: LeverageToBase,
direction: DirectionToBase,
stop_loss_override: Option<PriceBaseInQuote>,
take_profit: TakeProfitTrader,
},
UpdatePositionAddCollateralImpactLeverage {
id: PositionId,
},
UpdatePositionAddCollateralImpactSize {
id: PositionId,
slippage_assert: Option<SlippageAssert>,
},
UpdatePositionRemoveCollateralImpactLeverage {
id: PositionId,
amount: NonZero<Collateral>,
},
UpdatePositionRemoveCollateralImpactSize {
id: PositionId,
amount: NonZero<Collateral>,
slippage_assert: Option<SlippageAssert>,
},
UpdatePositionLeverage {
id: PositionId,
leverage: LeverageToBase,
slippage_assert: Option<SlippageAssert>,
},
UpdatePositionMaxGains {
id: PositionId,
max_gains: MaxGainsInQuote,
},
UpdatePositionTakeProfitPrice {
id: PositionId,
price: TakeProfitTrader,
},
UpdatePositionStopLossPrice {
id: PositionId,
stop_loss: StopLoss,
},
SetTriggerOrder {
id: PositionId,
stop_loss_override: Option<PriceBaseInQuote>,
take_profit: Option<TakeProfitTrader>,
},
PlaceLimitOrder {
trigger_price: PriceBaseInQuote,
leverage: LeverageToBase,
direction: DirectionToBase,
stop_loss_override: Option<PriceBaseInQuote>,
take_profit: TakeProfitTrader,
},
CancelLimitOrder {
order_id: OrderId,
},
ClosePosition {
id: PositionId,
slippage_assert: Option<SlippageAssert>,
},
DepositLiquidity {
stake_to_xlp: bool,
},
ReinvestYield {
stake_to_xlp: bool,
amount: Option<NonZero<Collateral>>,
},
WithdrawLiquidity {
lp_amount: Option<NonZero<LpToken>>,
claim_yield: bool,
},
ClaimYield {},
StakeLp {
amount: Option<NonZero<LpToken>>,
},
UnstakeXlp {
amount: Option<NonZero<LpToken>>,
},
StopUnstakingXlp {},
CollectUnstakedLp {},
Crank {
execs: Option<u32>,
rewards: Option<RawAddr>,
},
NftProxy {
sender: RawAddr,
msg: ExecuteMsg,
},
LiquidityTokenProxy {
sender: RawAddr,
kind: LiquidityTokenKind,
msg: ExecuteMsg,
},
TransferDaoFees {},
CloseAllPositions {},
ProvideCrankFunds {},
SetManualPrice {
price: PriceBaseInQuote,
price_usd: PriceCollateralInUsd,
},
PerformDeferredExec {
id: DeferredExecId,
price_point_timestamp: Timestamp,
},
}
Expand description
Execute message for the market contract
Variants§
Owner(ExecuteOwnerMsg)
Owner-only executions
Receive
cw20
OpenPosition
Open a new position
Fields
slippage_assert: Option<SlippageAssert>
Assertion that the price has not moved too far
leverage: LeverageToBase
Leverage of new position
direction: DirectionToBase
Direction of new position
stop_loss_override: Option<PriceBaseInQuote>
Stop loss price of new position
take_profit: TakeProfitTrader
Take profit price of new position
UpdatePositionAddCollateralImpactLeverage
Add collateral to a position, causing leverage to decrease
The amount of collateral to add must be attached as funds
Fields
id: PositionId
ID of position to update
UpdatePositionAddCollateralImpactSize
Add collateral to a position, causing notional size to increase
The amount of collateral to add must be attached as funds
Fields
id: PositionId
ID of position to update
slippage_assert: Option<SlippageAssert>
Assertion that the price has not moved too far
UpdatePositionRemoveCollateralImpactLeverage
Remove collateral from a position, causing leverage to increase
Fields
id: PositionId
ID of position to update
amount: NonZero<Collateral>
Amount of funds to remove from the position
UpdatePositionRemoveCollateralImpactSize
Remove collateral from a position, causing notional size to decrease
Fields
id: PositionId
ID of position to update
amount: NonZero<Collateral>
Amount of funds to remove from the position
slippage_assert: Option<SlippageAssert>
Assertion that the price has not moved too far
UpdatePositionLeverage
Modify the leverage of the position
This will impact the notional size of the position
Fields
id: PositionId
ID of position to update
leverage: LeverageToBase
New leverage of the position
slippage_assert: Option<SlippageAssert>
Assertion that the price has not moved too far
UpdatePositionMaxGains
Modify the max gains of a position
Fields
id: PositionId
ID of position to update
max_gains: MaxGainsInQuote
New max gains of the position
UpdatePositionTakeProfitPrice
Modify the take profit price of a position
Fields
id: PositionId
ID of position to update
price: TakeProfitTrader
New take profit price of the position
UpdatePositionStopLossPrice
Update the stop loss price of a position
Fields
id: PositionId
ID of position to update
SetTriggerOrder
Set a stop loss or take profit override. Deprecated, use UpdatePositionStopLossPrice instead
Fields
id: PositionId
ID of position to modify
stop_loss_override: Option<PriceBaseInQuote>
New stop loss price of the position Passing None will remove the override.
take_profit: Option<TakeProfitTrader>
New take profit price of the position, merely as a trigger. Passing None will bypass changing this This does not affect the locked up counter collateral (or borrow fees etc.). if this override is further away than the position’s take profit price, the position’s will be triggered first if you want to update the position itself, use ExecuteMsg::UpdatePositionTakeProfitPrice
PlaceLimitOrder
Set a limit order to open a position when the price of the asset hits the specified trigger price.
Fields
trigger_price: PriceBaseInQuote
Price when the order should trigger
leverage: LeverageToBase
Leverage of new position
direction: DirectionToBase
Direction of new position
stop_loss_override: Option<PriceBaseInQuote>
Stop loss price of new position
take_profit: TakeProfitTrader
Take profit price of new position
CancelLimitOrder
Cancel an open limit order
ClosePosition
Close a position
Fields
id: PositionId
ID of position to close
slippage_assert: Option<SlippageAssert>
Assertion that the price has not moved too far
DepositLiquidity
Deposits send funds into the unlocked liquidity fund
ReinvestYield
Like ExecuteMsg::DepositLiquidity, but reinvests pending yield instead of receiving new funds.
Fields
amount: Option<NonZero<Collateral>>
Amount of rewards to reinvest.
If None
, reinvests all pending rewards.
WithdrawLiquidity
Withdraw liquidity calculated from specified lp_amount
Fields
ClaimYield
Claims accrued yield based on LP share allocation
StakeLp
Stake some existing LP tokens into xLP
None means stake all LP tokens.
UnstakeXlp
Begin unstaking xLP into LP
None means unstake all xLP tokens.
StopUnstakingXlp
Stop an ongoing xLP unstaking process.
CollectUnstakedLp
Collect any LP tokens that have been unstaked from xLP.
Crank
Crank a number of times
Fields
NftProxy
Nft proxy messages. Only allowed to be called by this market’s position_token contract
Fields
msg: ExecuteMsg
Message sent to the NFT proxy
LiquidityTokenProxy
liquidity token cw20 proxy messages. Only allowed to be called by this market’s liquidity_token contract
Fields
kind: LiquidityTokenKind
Whether this was the LP or xLP proxy.
msg: ExecuteMsg
Message sent to the liquidity token proxy.
TransferDaoFees
Transfer all available protocol fees to the dao account
CloseAllPositions
Begin force-closing all positions in the protocol.
This can only be performed by the market wind down wallet.
ProvideCrankFunds
Provide funds directly to the crank fees.
The person who calls this receives no benefits. It’s intended for the DAO to use to incentivize cranking.
SetManualPrice
Set manual price (mostly for testing)
Fields
price: PriceBaseInQuote
Price of the base asset in terms of the quote.
price_usd: PriceCollateralInUsd
Price of the collateral asset in terms of USD.
This is generally used for reporting of values like PnL and trade volume.
PerformDeferredExec
Perform a deferred exec
This should only ever be called from the market contract itself, any other call is guaranteed to fail.
Fields
id: DeferredExecId
Which ID to execute
Trait Implementations§
source§impl Clone for ExecuteMsg
impl Clone for ExecuteMsg
source§fn clone(&self) -> ExecuteMsg
fn clone(&self) -> ExecuteMsg
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ExecuteMsg
impl Debug for ExecuteMsg
source§impl<'de> Deserialize<'de> for ExecuteMsg
impl<'de> Deserialize<'de> for ExecuteMsg
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 ExecuteMsg
impl JsonSchema for ExecuteMsg
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 ExecuteMsg
impl PartialEq for ExecuteMsg
source§fn eq(&self, other: &ExecuteMsg) -> bool
fn eq(&self, other: &ExecuteMsg) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ExecuteMsg
impl Serialize for ExecuteMsg
impl StructuralPartialEq for ExecuteMsg
Auto Trait Implementations§
impl Freeze for ExecuteMsg
impl RefUnwindSafe for ExecuteMsg
impl Send for ExecuteMsg
impl Sync for ExecuteMsg
impl Unpin for ExecuteMsg
impl UnwindSafe for ExecuteMsg
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