Skip to main content
Interface for GNSTradingInteractions facet (inherits types and also contains functions, events, and custom errors)

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

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

updateLeverage

Update trade leverage

Parameters

increasePositionSize

Increase trade position size

Parameters

decreasePositionSize

Decrease trade position size

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

MarketOrdersTimeoutBlocksUpdated

Emitted when marketOrdersTimeoutBlocks is updated

Parameters

ByPassTriggerLinkUpdated

Emitted when a user is allowed/disallowed to bypass the link cost of triggerOrder

Parameters

MarketOrderInitiated

Emitted when a market order is initiated

Parameters

OpenOrderPlaced

Emitted when a new limit/stop order is placed

Parameters

OpenLimitUpdated

Parameters

OpenLimitCanceled

Emitted when a limit/stop order is canceled (collateral sent back to trader)

Parameters

TriggerOrderInitiated

Emitted when a trigger order is initiated (tp/sl/liq/limit/stop orders)

Parameters

ChainlinkCallbackTimeout

Emitted when a pending market order is canceled due to timeout

Parameters

CouldNotCloseTrade

Emitted when a pending market order is canceled due to timeout and new closeTradeMarket() call failed

Parameters

NativeTokenWrapped

Emitted when a native token is wrapped

Parameters

NotWrappedNativeToken

DelegateNotApproved

PriceZero

AboveExposureLimits

CollateralNotActive

PriceImpactTooHigh

NoTrade

NoOrder

AlreadyBeingMarketClosed

ConflictingPendingOrder

WrongLeverage

WrongTp

WrongSl

WaitTimeout

PendingTrigger

NoSl

NoTp

NotYourOrder

DelegatedActionNotAllowed

InsufficientCollateral