ITradingCallbacksUtils
Interface for GNSTradingCallbacks facet (inherits types and also contains functions, events, and custom errors)
initializeCallbacks
Parameters
_vaultClosingFeeP
uint8
the % of closing fee going to vault
initializeTreasuryAddress
Initialize the treasury address
Parameters
_treasury
address
the treasury address
updateVaultClosingFeeP
Update the % of closing fee going to vault
Parameters
_valueP
uint8
the % of closing fee going to vault
updateTreasuryAddress
Updates the treasury address
Parameters
_treasury
address
the new treasury address
claimPendingGovFees
Claim the pending gov fees for all collaterals
openTradeMarketCallback
Executes a pending open trade market order
Parameters
_a
the price aggregator answer (order id, price, etc.)
closeTradeMarketCallback
Executes a pending close trade market order
Parameters
_a
the price aggregator answer (order id, price, etc.)
executeTriggerOpenOrderCallback
Executes a pending open trigger order (for limit/stop orders)
Parameters
_a
the price aggregator answer (order id, price, etc.)
executeTriggerCloseOrderCallback
Executes a pending close trigger order (for tp/sl/liq orders)
Parameters
_a
the price aggregator answer (order id, price, etc.)
updateLeverageCallback
Executes a pending update leverage order
Parameters
_a
the price aggregator answer (order id, price, etc.)
increasePositionSizeMarketCallback
Executes a pending increase position size market order
Parameters
_a
the price aggregator answer (order id, price, etc.)
decreasePositionSizeMarketCallback
Executes a pending decrease position size market order
Parameters
_a
the price aggregator answer (order id, price, etc.)
getVaultClosingFeeP
Returns the current vaultClosingFeeP value (%)
getPendingGovFeesCollateral
Returns the current pending gov fees for a collateral index (collateral precision)
validateTriggerOpenOrderCallback
Makes open trigger (STOP/LIMIT) checks like slippage, price impact, missed targets and returns cancellation reason if any
Parameters
_tradeId
the id of the trade
_orderType
enum ITradingStorage.PendingOrderType
the pending order type
_open
uint64
the open
value from an aggregator answer
_high
uint64
the high
value from an aggregator answer
_low
uint64
the low
value from an aggregator answer
validateTriggerCloseOrderCallback
Makes close trigger (SL/TP/LIQ) checks like slippage and price impact and returns cancellation reason if any
Parameters
_tradeId
the id of the trade
_orderType
enum ITradingStorage.PendingOrderType
the pending order type
_open
uint64
the open
value from an aggregator answer
_high
uint64
the high
value from an aggregator answer
_low
uint64
the low
value from an aggregator answer
VaultClosingFeePUpdated
Emitted when vaultClosingFeeP is updated
Parameters
valueP
uint8
the % of closing fee going to vault
PendingGovFeesClaimed
Emitted when gov fees are claimed for a collateral
Parameters
collateralIndex
uint8
the collateral index
amountCollateral
uint256
the amount of fees claimed (collateral precision)
MarketExecuted
Emitted when a market order is executed (open/close)
Parameters
orderId
struct ITradingStorage.Id
the id of the corresponding pending market order
user
address
trade user
index
uint32
trade index
t
struct ITradingStorage.Trade
the trade object
open
bool
true for a market open order, false for a market close order
oraclePrice
uint256
the oracle price without spread/impact (1e10 precision)
marketPrice
uint256
the price at which the trade was executed (1e10 precision)
liqPrice
uint256
trade liquidation price (1e10 precision)
priceImpactP
uint256
the price impact in percentage (1e10 precision)
percentProfit
int256
the profit in percentage (1e10 precision)
amountSentToTrader
uint256
the final amount of collateral sent to the trader
collateralPriceUsd
uint256
the price of the collateral in USD (1e8 precision)
LimitExecuted
Emitted when a limit/stop order is executed
Parameters
orderId
struct ITradingStorage.Id
the id of the corresponding pending trigger order
user
address
trade user
index
uint32
trade index
limitIndex
uint32
limit index
t
struct ITradingStorage.Trade
the trade object
triggerCaller
address
the address that triggered the limit order
orderType
enum ITradingStorage.PendingOrderType
the type of the pending order
oraclePrice
uint256
the oracle price without spread/impact (1e10 precision)
marketPrice
uint256
the price at which the trade was executed (1e10 precision)
liqPrice
uint256
trade liquidation price (1e10 precision)
priceImpactP
uint256
the price impact in percentage (1e10 precision)
percentProfit
int256
the profit in percentage (1e10 precision)
amountSentToTrader
uint256
the final amount of collateral sent to the trader
collateralPriceUsd
uint256
the price of the collateral in USD (1e8 precision)
exactExecution
bool
true if guaranteed execution was used
MarketOpenCanceled
Emitted when a pending market open order is canceled
Parameters
orderId
struct ITradingStorage.Id
order id of the pending market open order
trader
address
address of the trader
pairIndex
uint256
index of the trading pair
cancelReason
enum ITradingCallbacks.CancelReason
reason for the cancellation
MarketCloseCanceled
Emitted when a pending market close order is canceled
Parameters
orderId
struct ITradingStorage.Id
order id of the pending market close order
trader
address
address of the trader
pairIndex
uint256
index of the trading pair
index
uint256
index of the trade for trader
cancelReason
enum ITradingCallbacks.CancelReason
reason for the cancellation
TriggerOrderCanceled
Emitted when a pending trigger order is canceled
Parameters
orderId
struct ITradingStorage.Id
order id of the pending trigger order
triggerCaller
address
address of the trigger caller
orderType
enum ITradingStorage.PendingOrderType
type of the pending trigger order
cancelReason
enum ITradingCallbacks.CancelReason
reason for the cancellation
BorrowingFeeCharged
Parameters
trader
address
address of the trader
index
uint32
index of the trade
collateralIndex
uint8
index of the collateral
amountCollateral
uint256
amount charged (collateral precision)
Last updated