TradingInteractionsUtils

GNSTradingInteractions facet internal library

tradingActivated

modifier tradingActivated()

Modifier to only allow trading action when trading is activated (= revert if not activated)

tradingActivatedOrCloseOnly

modifier tradingActivatedOrCloseOnly()

Modifier to only allow trading action when trading is activated or close only (= revert if paused)

notDelegatedAction

modifier notDelegatedAction()

Modifier to prevent calling function from delegated action

initializeTrading

function initializeTrading(uint16 _marketOrdersTimeoutBlocks, address[] _usersByPassTriggerLink) internal

Check ITradingInteractionsUtils interface for documentation

updateMarketOrdersTimeoutBlocks

Check ITradingInteractionsUtils interface for documentation

Check ITradingInteractionsUtils interface for documentation

setTradingDelegate

Check ITradingInteractionsUtils interface for documentation

removeTradingDelegate

Check ITradingInteractionsUtils interface for documentation

delegatedTradingAction

Check ITradingInteractionsUtils interface for documentation

openTrade

Check ITradingInteractionsUtils interface for documentation

openTradeNative

Check ITradingInteractionsUtils interface for documentation

updateMaxClosingSlippageP

Check ITradingInteractionsUtils interface for documentation

closeTradeMarket

Check ITradingInteractionsUtils interface for documentation

updateOpenOrder

Check ITradingInteractionsUtils interface for documentation

cancelOpenOrder

Check ITradingInteractionsUtils interface for documentation

updateTp

Check ITradingInteractionsUtils interface for documentation

updateSl

Check ITradingInteractionsUtils interface for documentation

updateLeverage

Check ITradingInteractionsUtils interface for documentation

increasePositionSize

Check ITradingInteractionsUtils interface for documentation

decreasePositionSize

Check ITradingInteractionsUtils interface for documentation

triggerOrder

Check ITradingInteractionsUtils interface for documentation

cancelOrderAfterTimeout

Check ITradingInteractionsUtils interface for documentation

getWrappedNativeToken

Check ITradingInteractionsUtils interface for documentation

isWrappedNativeToken

Check ITradingInteractionsUtils interface for documentation

getTradingDelegate

Check ITradingInteractionsUtils interface for documentation

getMarketOrdersTimeoutBlocks

Check ITradingInteractionsUtils interface for documentation

Check ITradingInteractionsUtils interface for documentation

_getSlot

Returns storage slot to use when fetching storage relevant to library

_getStorage

Returns storage pointer for storage struct in diamond contract, at defined slot

_getMultiCollatDiamond

Returns current address as multi-collateral diamond interface to call other facets functions.

_openTrade

Internal function for openTrade and openTradeNative

Parameters

Name
Type
Description

_trade

trade data

_maxSlippageP

uint16

max slippage percentage (1e3 precision)

_referrer

address

referrer address

_isNative

bool

if true we skip the collateral transfer from user to contract

_checkNoPendingTrigger

Revert if there is an active pending order for the trade

Parameters

Name
Type
Description

_tradeId

trade id

_orderType

enum ITradingStorage.PendingOrderType

order type

_getPriceTriggerOrder

Initiate price aggregator request for trigger order

Parameters

Name
Type
Description

_orderId

order id

_orderType

enum ITradingStorage.PendingOrderType

order type

_positionSizeCollateral

uint256

position size in collateral tokens (collateral precision)

_wrapNativeToken

Receives native token and sends back wrapped token to user

Parameters

Name
Type
Description

_collateralIndex

uint8

index of the collateral

_msgSender

Returns the caller of the transaction (overriden by trader address if delegatedAction is called)

Last updated

Was this helpful?