Message: CreateDecreasePerpOrder
This operation allows to add a market order to decrease a perpetual position. The message is rejected if the pool is in the stopped state.
The message must carry sufficient TON to cover for the minimum perpMinExecutionFee plus the createPerpOrderGas gas-cost parameters configured in the contract.
The order is assigned a unique incremental ID and inserted into the perpOrders map, ready to be executed.
Finally, an event signalling the order to off-chain observers is emitted, the totalExecutionFee amount of total fees collected to be paid to executors is increased, and any excess TON is returned to the message sender.
Inputs
The incoming message has the following structure:
executionFeeValidation: Must be sufficiently large to cover the minimum execution fee.
Impact: The fee to be paid to the executor for executing the order.
tokenIdValidation: None.
Impact: Specifies the token for which the order is being created.
isLongValidation: None.
Impact: Indicates whether the order is for a long or short position.
marginDeltaValidation: None (validation performed when the order is executed).
Impact: Specifies the amount the position margin is to be decreased by.
sizeDeltaValidation: None (validation performed when the order is executed).
Impact: Specifies the amount the position size is to be decreased by.
triggerPriceValidation: None.
Impact: Allows to specify a trigger condition for the order, which becomes executable only if the price crosses this threshold (above for long positions, below for short).
trxIdValidation: None.
Impact: Not used by the on-chain contract.
requestTimeValidation: None.
Impact: Not used by the on-chain contract.
Test coverage
Intended branches
Negative behavior