TradingCallbacksUtils
GNSTradingCallbacks facet internal library
tradingActivated
Modifier to only allow trading action when trading is activated (= revert if not activated)
tradingActivatedOrCloseOnly
Modifier to only allow trading action when trading is activated or close only (= revert if paused)
initializeCallbacks
Check ITradingCallbacksUtils interface for documentation
updateVaultClosingFeeP
Check ITradingCallbacksUtils interface for documentation
updateTreasuryAddress
Check ITradingCallbacksUtils interface for documentation
claimPendingGovFees
Check ITradingCallbacksUtils interface for documentation
openTradeMarketCallback
Check ITradingCallbacksUtils interface for documentation
closeTradeMarketCallback
Check ITradingCallbacksUtils interface for documentation
executeTriggerOpenOrderCallback
Check ITradingCallbacksUtils interface for documentation
executeTriggerCloseOrderCallback
Check ITradingCallbacksUtils interface for documentation
updateLeverageCallback
Check ITradingCallbacksUtils interface for documentation
increasePositionSizeMarketCallback
Check ITradingCallbacksUtils interface for documentation
decreasePositionSizeMarketCallback
Check ITradingCallbacksUtils interface for documentation
getVaultClosingFeeP
Check ITradingCallbacksUtils interface for documentation
getPendingGovFeesCollateral
Check ITradingCallbacksUtils interface for documentation
validateTriggerOpenOrderCallback
Check ITradingCallbacksUtils interface for documentation
validateTriggerCloseOrderCallback
Check ITradingCallbacksUtils 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.
_registerTrade
Registers a trade in storage, and handles all fees and rewards
Parameters
Return Values
_unregisterTrade
Unregisters a trade from storage, and handles all fees and rewards
Parameters
_profitP
int256
Profit percentage (1e10)
_orderType
enum ITradingStorage.PendingOrderType
pending order type
_oraclePrice
uint256
oracle price without closing spread/impact (1e10)
_liqPrice
uint256
trade liquidation price (1e10)
Return Values
tradeValueCollateral
uint256
Amount of collateral sent to trader, collateral + pnl (collateral precision)
_openTradePrep
Makes pre-trade checks: price impact, if trade should be cancelled based on parameters like: PnL, leverage, slippage, etc.
Parameters
_executionPrice
uint256
execution price (1e10 precision)
_oraclePrice
uint256
oracle price (1e10 precision)
_spreadP
uint256
spread % (1e10 precision)
_maxSlippageP
uint256
max slippage % (1e3 precision)
_getPendingOrder
Returns pending order from storage
Parameters
Return Values
_getCollateralPriceUsd
Returns collateral price in USD
Parameters
_collateralIndex
uint8
Collateral index
Return Values
[0]
uint256
Collateral price in USD
_getTrade
Returns trade from storage
Parameters
_trader
address
Trader address
_index
uint32
Trade index
Return Values
_getTradeInfo
Returns trade info from storage
Parameters
_trader
address
Trader address
_index
uint32
Trade index
Return Values
Last updated