GNSTradingCallbacks

Facet #8: Callbacks (to execute actions after receiving median price from price aggregator)

constructor

constructor() public

initializeCallbacks

function initializeCallbacks(uint8 _vaultClosingFeeP) external

Parameters

Name
Type
Description

_vaultClosingFeeP

uint8

the % of closing fee going to vault

initializeTreasuryAddress

function initializeTreasuryAddress(address _treasury) external

Initialize the treasury address

Parameters

Name
Type
Description

_treasury

address

the treasury address

updateVaultClosingFeeP

Update the % of closing fee going to vault

Parameters

Name
Type
Description

_valueP

uint8

the % of closing fee going to vault

updateTreasuryAddress

Updates the treasury address

Parameters

Name
Type
Description

_treasury

address

the new treasury address

claimPendingGovFees

Claim the pending gov fees for all collaterals

openTradeMarketCallback

Executes a pending open trade market order

Parameters

Name
Type
Description

_a

the price aggregator answer (order id, price, etc.)

closeTradeMarketCallback

Executes a pending close trade market order

Parameters

Name
Type
Description

_a

the price aggregator answer (order id, price, etc.)

executeTriggerOpenOrderCallback

Executes a pending open trigger order (for limit/stop orders)

Parameters

Name
Type
Description

_a

the price aggregator answer (order id, price, etc.)

executeTriggerCloseOrderCallback

Executes a pending close trigger order (for tp/sl/liq orders)

Parameters

Name
Type
Description

_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)

updateLeverageCallback

Executes a pending update leverage order

Parameters

Name
Type
Description

_a

the price aggregator answer (order id, price, etc.)

increasePositionSizeMarketCallback

Executes a pending increase position size market order

Parameters

Name
Type
Description

_a

the price aggregator answer (order id, price, etc.)

decreasePositionSizeMarketCallback

Executes a pending decrease position size market order

Parameters

Name
Type
Description

_a

the price aggregator answer (order id, price, etc.)

validateTriggerOpenOrderCallback

Makes open trigger (STOP/LIMIT) checks like slippage, price impact, missed targets and returns cancellation reason if any

Parameters

Name
Type
Description

_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

Name
Type
Description

_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

Last updated

Was this helpful?