Skip to main content
Facet #5: Trading storage

constructor

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