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

initializeTradingStorage

Initializes the trading storage facet

Parameters

updateTradingActivated

Updates the trading activated state

Parameters

addCollateral

Adds a new supported collateral

Parameters

toggleCollateralActiveState

Toggles the active state of a supported collateral

Parameters

updateGToken

Updates the contracts of a supported collateral trading stack

Parameters

storeTrade

Stores a new trade (trade/limit/stop)

Parameters

updateTradeMaxClosingSlippageP

Updates an existing trade max closing slippage %

Parameters

updateTradeCollateralAmount

Updates an open trade collateral

Parameters

updateTradePosition

Updates an open trade collateral

Parameters

updateOpenOrderDetails

Updates an open order details (limit/stop)

Parameters

updateTradeTp

Updates the take profit of an open trade

Parameters

updateTradeSl

Updates the stop loss of an open trade

Parameters

closeTrade

Marks an open trade/limit/stop as closed

Parameters

storePendingOrder

Stores a new pending order

Parameters

closePendingOrder

Closes a pending order

Parameters

getCollateral

Returns collateral data by index

Parameters

isCollateralActive

Returns whether can open new trades with a collateral

Parameters

isCollateralListed

Returns whether a collateral has been listed

Parameters

getCollateralsCount

Returns the number of supported collaterals

getCollaterals

Returns the supported collaterals

getCollateralIndex

Returns the index of a supported collateral

Parameters

getTradingActivated

Returns the trading activated state

getTraderStored

Returns whether a trader is stored in the traders array

Parameters

getTradersCount

Returns the length of the traders array

getTraders

Returns all traders that have open trades using a pagination system

Parameters

getTrade

Returns open trade/limit/stop order

Parameters

getTrades

Returns all open trades/limit/stop orders for a trader

Parameters

getAllTradesForTraders

Returns all trade/limit/stop orders using a pagination system

Parameters

getAllTrades

Returns all trade/limit/stop orders using a pagination system. Calls getAllTradesForTraders internally with all traders.

Parameters

getTradeInfo

Returns trade info of an open trade/limit/stop order

Parameters

getTradeInfos

Returns all trade infos of open trade/limit/stop orders for a trader

Parameters

getAllTradeInfosForTraders

Returns all trade infos of open trade/limit/stop orders using a pagination system

Parameters

getAllTradeInfos

Returns all trade infos of open trade/limit/stop orders using a pagination system. Calls getAllTradeInfosForTraders internally with all traders.

Parameters

getPendingOrder

Returns a pending ordeer

Parameters

getPendingOrders

Returns all pending orders for a trader

Parameters

getAllPendingOrdersForTraders

Returns all pending orders using a pagination system

Parameters

getAllPendingOrders

Returns all pending orders using a pagination system Calls getAllPendingOrdersForTraders internally with all traders.

Parameters

getTradePendingOrderBlock

Returns the block number of the pending order for a trade (0 = doesn’t exist)

Parameters

getCounters

Returns the counters of a trader (currentIndex / open count for trades/tradeInfos and pendingOrders mappings)

Parameters

getCountersForTraders

Returns the counters for a list of traders

Parameters

getGToken

Returns the address of the gToken for a collateral stack

Parameters

getTradeLiquidationParams

Returns the liquidation params for a trade

Parameters

getTradesLiquidationParams

Returns all trade liquidation params of open trade/limit/stop orders for a trader

Parameters

getAllTradesLiquidationParamsForTraders

Returns all trade liquidation params of open trade/limit/stop orders using a pagination system

Parameters

getAllTradesLiquidationParams

Returns all trade liquidation params of open trade/limit/stop orders using a pagination system Calls getAllTradesLiquidationParamsForTraders internally with all traders.

Parameters

getCurrentContractsVersion

Returns the current contracts version

TradingActivatedUpdated

Emitted when the trading activated state is updated

Parameters

CollateralAdded

Emitted when a new supported collateral is added

Parameters

CollateralUpdated

Emitted when an existing supported collateral active state is updated

Parameters

CollateralDisabled

Emitted when an existing supported collateral is disabled (can still close trades but not open new ones)

Parameters

GTokenUpdated

Emitted when the contracts of a supported collateral trading stack are updated

Parameters

TradeStored

Emitted when a new trade is stored

Parameters

TradeMaxClosingSlippagePUpdated

Emitted when the max closing slippage % of an open trade is updated

Parameters

TradeCollateralUpdated

Emitted when an open trade collateral is updated

Parameters

TradePositionUpdated

Emitted when an open trade collateral is updated

Parameters

OpenOrderDetailsUpdated

Emitted when an existing trade/limit order/stop order is updated

Parameters

TradeTpUpdated

Emitted when the take profit of an open trade is updated

Parameters

TradeSlUpdated

Emitted when the stop loss of an open trade is updated

Parameters

TradeClosed

Emitted when an open trade is closed

Parameters

PendingOrderStored

Emitted when a new pending order is stored

Parameters

PendingOrderClosed

Emitted when a pending order is closed

Parameters

MissingCollaterals

CollateralAlreadyActive

CollateralAlreadyDisabled

TradePositionSizeZero

TradeOpenPriceZero

TradePairNotListed

TradeTpInvalid

TradeSlInvalid

MaxSlippageZero

TradeInfoCollateralPriceUsdZero