Skip to main content
Facet #7: Trading (user interactions)

constructor

initializeTrading

Initializes the trading facet

Parameters

updateMarketOrdersTimeoutBlocks

Updates marketOrdersTimeoutBlocks

Parameters

Updates the users that can bypass the link cost of triggerOrder

Parameters

setTradingDelegate

_Sets delegate as the new delegate of caller (can call delegatedAction)

Parameters

removeTradingDelegate

Removes the delegate of caller (can’t call delegatedAction)

delegatedTradingAction

_Caller executes a trading action on behalf of trader using delegatecall

Parameters

openTrade

Opens a new trade/limit order/stop order

Parameters

openTradeNative

Wraps native token and opens a new trade/limit order/stop order

Parameters

updateMaxClosingSlippageP

Updates existing trade’s max closing slippage % for caller

Parameters

closeTradeMarket

Closes an open trade (market order) for caller

Parameters

updateOpenOrder

Updates an existing limit/stop order for caller

Parameters

cancelOpenOrder

Cancels an open limit/stop order for caller

Parameters

updateTp

Updates the tp of an open trade for caller

Parameters

updateSl

Updates the sl of an open trade for caller

Parameters

updateLeverage

Update trade leverage

Parameters

increasePositionSize

Increase trade position size

Parameters

decreasePositionSize

Decrease trade position size

Parameters

triggerOrder

Initiates a new trigger order (for tp/sl/liq/limit/stop orders)

Parameters

cancelOrderAfterTimeout

Safety function in case oracles don’t answer in time, allows caller to cancel a pending order and if relevant claim back any stuck collateral Only allowed for MARKET_OPEN, MARKET_CLOSE, UPDATE_LEVERAGE, MARKET_PARTIAL_OPEN, and MARKET_PARTIAL_CLOSE orders

Parameters

getWrappedNativeToken

Returns the wrapped native token or address(0) if the current chain, or the wrapped token, is not supported.

isWrappedNativeToken

Returns true if the token is the wrapped native token for the current chain, where supported.

Parameters

getTradingDelegate

Returns the address a trader delegates his trading actions to

Parameters

getMarketOrdersTimeoutBlocks

Returns the current marketOrdersTimeoutBlocks value
Returns whether a user bypasses trigger link costs

Parameters