initializeTradingStorage
Parameters
| Name | Type | Description |
|---|---|---|
| _gns | address | address of the gns token |
| _gnsStaking | address | address of the gns staking contract |
| _collaterals | address[] | |
| _gTokens | address[] |
updateTradingActivated
Parameters
| Name | Type | Description |
|---|---|---|
| _activated | enum ITradingStorage.TradingActivated | the new trading activated state |
addCollateral
Parameters
| Name | Type | Description |
|---|---|---|
| _collateral | address | the address of the collateral |
| _gToken | address | the gToken contract of the collateral |
toggleCollateralActiveState
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | index of the collateral |
updateGToken
Parameters
| Name | Type | Description |
|---|---|---|
| _collateral | address | address of the collateral |
| _gToken | address | the gToken contract of the collateral |
storeTrade
Parameters
| Name | Type | Description |
|---|---|---|
| _trade | ITradingStorage.Trade | trade to be stored |
| _tradeInfo | ITradingStorage.TradeInfo | trade info to be stored |
updateTradeMaxClosingSlippageP
Parameters
| Name | Type | Description |
|---|---|---|
| _tradeId | ITradingStorage.Id | id of the trade |
| _maxSlippageP | uint16 | new max slippage % (1e3 precision) |
updateTradeCollateralAmount
Parameters
| Name | Type | Description |
|---|---|---|
| _tradeId | ITradingStorage.Id | id of updated trade |
| _collateralAmount | uint120 | new collateral amount value (collateral precision) |
updateTradePosition
Parameters
| Name | Type | Description |
|---|---|---|
| _tradeId | ITradingStorage.Id | id of updated trade |
| _collateralAmount | uint120 | new collateral amount value (collateral precision) |
| _leverage | uint24 | new leverage value |
| _openPrice | uint64 | new open price value |
| _isPartialIncrease | bool | refreshes trade liquidation params if true |
| _isPnlPositive | bool | whether the pnl is positive (only relevant when closing) |
updateOpenOrderDetails
Parameters
| Name | Type | Description |
|---|---|---|
| _tradeId | ITradingStorage.Id | id of updated trade |
| _openPrice | uint64 | new open price (1e10) |
| _tp | uint64 | new take profit price (1e10) |
| _sl | uint64 | new stop loss price (1e10) |
| _maxSlippageP | uint16 | new max slippage % value (1e3) |
updateTradeTp
Parameters
| Name | Type | Description |
|---|---|---|
| _tradeId | ITradingStorage.Id | the trade id |
| _newTp | uint64 | the new take profit (1e10 precision) |
updateTradeSl
Parameters
| Name | Type | Description |
|---|---|---|
| _tradeId | ITradingStorage.Id | the trade id |
| _newSl | uint64 | the new sl (1e10 precision) |
closeTrade
Parameters
| Name | Type | Description |
|---|---|---|
| _tradeId | ITradingStorage.Id | the trade id |
| _isPnlPositive | bool | whether the pnl is positive |
storePendingOrder
Parameters
| Name | Type | Description |
|---|---|---|
| _pendingOrder | ITradingStorage.PendingOrder | the pending order to be stored |
closePendingOrder
Parameters
| Name | Type | Description |
|---|---|---|
| _orderId | ITradingStorage.Id | the id of the pending order to be closed |
getCollateral
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint8 | the index of the supported collateral |
isCollateralActive
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint8 | the index of the collateral to check |
isCollateralListed
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint8 | the index of the collateral to check |
getCollateralsCount
getCollaterals
getCollateralIndex
Parameters
| Name | Type | Description |
|---|---|---|
| _collateral | address | the address of the collateral |
getTradingActivated
getTraderStored
Parameters
| Name | Type | Description |
|---|---|---|
| _trader | address | trader to check |
getTradersCount
getTraders
Parameters
| Name | Type | Description |
|---|---|---|
| _offset | uint32 | start index in the traders array |
| _limit | uint32 | end index in the traders array |
getTrade
Parameters
| Name | Type | Description |
|---|---|---|
| _trader | address | address of the trader |
| _index | uint32 | index of the trade for trader |
getTrades
Parameters
| Name | Type | Description |
|---|---|---|
| _trader | address | address of the trader |
getAllTradesForTraders
Parameters
| Name | Type | Description |
|---|---|---|
| _traders | address[] | list of traders to return trades for |
| _offset | uint256 | index of first trade to return |
| _limit | uint256 | index of last trade to return |
getAllTrades
getAllTradesForTraders internally with all traders.
Parameters
| Name | Type | Description |
|---|---|---|
| _offset | uint256 | index of first trade to return |
| _limit | uint256 | index of last trade to return |
getTradeInfo
Parameters
| Name | Type | Description |
|---|---|---|
| _trader | address | address of the trader |
| _index | uint32 | index of the trade for trader |
getTradeInfos
Parameters
| Name | Type | Description |
|---|---|---|
| _trader | address | address of the trader |
getAllTradeInfosForTraders
Parameters
| Name | Type | Description |
|---|---|---|
| _traders | address[] | list of traders to return tradeInfo for |
| _offset | uint256 | index of first tradeInfo to return |
| _limit | uint256 | index of last tradeInfo to return |
getAllTradeInfos
getAllTradeInfosForTraders internally with all traders.
Parameters
| Name | Type | Description |
|---|---|---|
| _offset | uint256 | index of first tradeInfo to return |
| _limit | uint256 | index of last tradeInfo to return |
getPendingOrder
Parameters
| Name | Type | Description |
|---|---|---|
| _orderId | ITradingStorage.Id | id of the pending order |
getPendingOrders
Parameters
| Name | Type | Description |
|---|---|---|
| _user | address | address of the trader |
getAllPendingOrdersForTraders
Parameters
| Name | Type | Description |
|---|---|---|
| _traders | address[] | list of traders to return pendingOrder for |
| _offset | uint256 | index of first pendingOrder to return |
| _limit | uint256 | index of last pendingOrder to return |
getAllPendingOrders
getAllPendingOrdersForTraders internally with all traders.
Parameters
| Name | Type | Description |
|---|---|---|
| _offset | uint256 | index of first pendingOrder to return |
| _limit | uint256 | index of last pendingOrder to return |
getTradePendingOrderBlock
Parameters
| Name | Type | Description |
|---|---|---|
| _tradeId | ITradingStorage.Id | id of the trade |
| _orderType | enum ITradingStorage.PendingOrderType | pending order type to check |
getCounters
Parameters
| Name | Type | Description |
|---|---|---|
| _trader | address | address of the trader |
| _type | enum ITradingStorage.CounterType | the counter type (trade/pending order) |
getCountersForTraders
Parameters
| Name | Type | Description |
|---|---|---|
| _traders | address[] | the list of traders |
| _type | enum ITradingStorage.CounterType | the counter type (trade/pending order) |
getGToken
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | the index of the supported collateral |
getTradeLiquidationParams
Parameters
| Name | Type | Description |
|---|---|---|
| _trader | address | address of the trader |
| _index | uint32 | index of the trade for trader |
getTradesLiquidationParams
Parameters
| Name | Type | Description |
|---|---|---|
| _trader | address | address of the trader |
getAllTradesLiquidationParamsForTraders
Parameters
| Name | Type | Description |
|---|---|---|
| _traders | address[] | list of traders to return liq params for |
| _offset | uint256 | index of first liq param to return |
| _limit | uint256 | index of last liq param to return |
getAllTradesLiquidationParams
getAllTradesLiquidationParamsForTraders internally with all traders.
Parameters
| Name | Type | Description |
|---|---|---|
| _offset | uint256 | index of first liq param to return |
| _limit | uint256 | index of last liq param to return |
getCurrentContractsVersion
TradingActivatedUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| activated | enum ITradingStorage.TradingActivated | the new trading activated state |
CollateralAdded
Parameters
| Name | Type | Description |
|---|---|---|
| collateral | address | the address of the collateral |
| index | uint8 | the index of the supported collateral |
| gToken | address | the gToken contract of the collateral |
CollateralUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| index | uint8 | the index of the supported collateral |
| isActive | bool | the new active state |
CollateralDisabled
Parameters
| Name | Type | Description |
|---|---|---|
| index | uint8 | the index of the supported collateral |
GTokenUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| collateral | address | the address of the collateral |
| index | uint8 | the index of the supported collateral |
| gToken | address | the gToken contract of the collateral |
TradeStored
Parameters
| Name | Type | Description |
|---|---|---|
| user | address | trade user |
| index | uint32 | trade index |
| trade | struct ITradingStorage.Trade | the trade stored |
| tradeInfo | struct ITradingStorage.TradeInfo | the trade info stored |
| liquidationParams | struct IPairsStorage.GroupLiquidationParams | the trade liquidation params stored |
TradeMaxClosingSlippagePUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| user | address | trade user |
| index | uint32 | trade index |
| maxClosingSlippageP | uint16 | new max closing slippage % value (1e3 precision) |
TradeCollateralUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| user | address | trade user |
| index | uint32 | trade index |
| collateralAmount | uint120 | new collateral value (collateral precision) |
TradePositionUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| user | address | trade user |
| index | uint32 | trade index |
| collateralAmount | uint120 | new collateral value (collateral precision) |
| leverage | uint24 | new leverage value if present |
| openPrice | uint64 | new open price value if present |
| newTp | uint64 | |
| newSl | uint64 | |
| isPartialIncrease | bool | true if trade liquidation params were refreshed |
| isPnlPositive | bool | true if trade pnl is positive (only relevant when closing) |
OpenOrderDetailsUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| user | address | trade user |
| index | uint32 | trade index |
| openPrice | uint64 | new open price value (1e10) |
| tp | uint64 | new take profit value (1e10) |
| sl | uint64 | new stop loss value (1e10) |
| maxSlippageP | uint16 | new max slippage % value (1e3) |
TradeTpUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| user | address | trade user |
| index | uint32 | trade index |
| newTp | uint64 | the new take profit (1e10 precision) |
TradeSlUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| user | address | trade user |
| index | uint32 | trade index |
| newSl | uint64 | the new sl (1e10 precision) |
TradeClosed
Parameters
| Name | Type | Description |
|---|---|---|
| user | address | trade user |
| index | uint32 | trade index |
| isPnlPositive | bool | true if trade pnl is positive |
PendingOrderStored
Parameters
| Name | Type | Description |
|---|---|---|
| pendingOrder | struct ITradingStorage.PendingOrder | the pending order stored |
PendingOrderClosed
Parameters
| Name | Type | Description |
|---|---|---|
| orderId | struct ITradingStorage.Id | the id of the pending order closed |
