tradingActivated
tradingActivatedOrCloseOnly
initializeCallbacks
updateVaultClosingFeeP
updateTreasuryAddress
claimPendingGovFees
openTradeMarketCallback
closeTradeMarketCallback
executeTriggerOpenOrderCallback
executeTriggerCloseOrderCallback
updateLeverageCallback
increasePositionSizeMarketCallback
decreasePositionSizeMarketCallback
getVaultClosingFeeP
getPendingGovFeesCollateral
validateTriggerOpenOrderCallback
validateTriggerCloseOrderCallback
_getSlot
_getStorage
_getMultiCollatDiamond
_registerTrade
Parameters
| Name | Type | Description |
|---|---|---|
| _trade | ITradingStorage.Trade | Trade to register |
| _pendingOrder | ITradingStorage.PendingOrder | Corresponding pending order |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | ITradingStorage.Trade | Final registered trade |
_unregisterTrade
Parameters
| Name | Type | Description |
|---|---|---|
| _trade | ITradingStorage.Trade | Trade to unregister |
| _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
| Name | Type | Description |
|---|---|---|
| tradeValueCollateral | uint256 | Amount of collateral sent to trader, collateral + pnl (collateral precision) |
_openTradePrep
Parameters
| Name | Type | Description |
|---|---|---|
| _trade | ITradingStorage.Trade | trade input |
| _executionPrice | uint256 | execution price (1e10 precision) |
| _oraclePrice | uint256 | oracle price (1e10 precision) |
| _spreadP | uint256 | spread % (1e10 precision) |
| _maxSlippageP | uint256 | max slippage % (1e3 precision) |
_getPendingOrder
Parameters
| Name | Type | Description |
|---|---|---|
| _orderId | ITradingStorage.Id | Order ID |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | ITradingStorage.PendingOrder | Pending order |
_getCollateralPriceUsd
Parameters
| Name | Type | Description |
|---|---|---|
| _collateralIndex | uint8 | Collateral index |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | Collateral price in USD |
_getTrade
Parameters
| Name | Type | Description |
|---|---|---|
| _trader | address | Trader address |
| _index | uint32 | Trade index |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | ITradingStorage.Trade | Trade |
_getTradeInfo
Parameters
| Name | Type | Description |
|---|---|---|
| _trader | address | Trader address |
| _index | uint32 | Trade index |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | ITradingStorage.TradeInfo | TradeInfo |
