initializeTrading
Parameters
| Name | Type | Description |
|---|---|---|
| _marketOrdersTimeoutBlocks | uint16 | The number of blocks after which a market order is considered timed out |
| _usersByPassTriggerLink | address[] |
updateMarketOrdersTimeoutBlocks
Parameters
| Name | Type | Description |
|---|---|---|
| _valueBlocks | uint16 | blocks after which a market order times out |
updateByPassTriggerLink
Parameters
| Name | Type | Description |
|---|---|---|
| _users | address[] | array of addresses that can bypass the link cost of triggerOrder |
| _shouldByPass | bool[] | whether each user should bypass the link cost |
setTradingDelegate
Parameters
| Name | Type | Description |
|---|---|---|
| _delegate | address | the new delegate address |
removeTradingDelegate
delegatedTradingAction
Parameters
| Name | Type | Description |
|---|---|---|
| _trader | address | the trader address to execute the trading action for |
| _callData | bytes | the data to be executed (open trade/close trade, etc.) |
openTrade
Parameters
| Name | Type | Description |
|---|---|---|
| _trade | ITradingStorage.Trade | the trade to be opened |
| _maxSlippageP | uint16 | the maximum allowed slippage % when open the trade (1e3 precision) |
| _referrer | address | the address of the referrer (can only be set once for a trader) |
openTradeNative
Parameters
| Name | Type | Description |
|---|---|---|
| _trade | ITradingStorage.Trade | the trade to be opened |
| _maxSlippageP | uint16 | the maximum allowed slippage % when open the trade (1e3 precision) |
| _referrer | address | the address of the referrer (can only be set once for a trader) |
updateMaxClosingSlippageP
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint32 | index of trade |
| _maxSlippageP | uint16 | new max closing slippage % (1e3 precision) |
closeTradeMarket
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint32 | the index of the trade of caller |
| _expectedPrice | uint64 | expected closing price, used to check max slippage (1e10 precision) |
updateOpenOrder
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint32 | index of limit/stop order of caller |
| _triggerPrice | uint64 | new trigger price of limit/stop order (1e10 precision) |
| _tp | uint64 | new tp of limit/stop order (1e10 precision) |
| _sl | uint64 | new sl of limit/stop order (1e10 precision) |
| _maxSlippageP | uint16 | new max slippage % of limit/stop order (1e3 precision) |
cancelOpenOrder
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint32 | index of limit/stop order of caller |
updateTp
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint32 | index of open trade of caller |
| _newTp | uint64 | new tp of open trade (1e10 precision) |
updateSl
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint32 | index of open trade of caller |
| _newSl | uint64 | new sl of open trade (1e10 precision) |
triggerOrder
Parameters
| Name | Type | Description |
|---|---|---|
| _packed | uint256 | the packed data of the trigger order (orderType, trader, index) |
cancelOrderAfterTimeout
Parameters
| Name | Type | Description |
|---|---|---|
| _orderIndex | uint32 | the id of the pending order to cancel |
updateLeverage
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint32 | index of trade |
| _newLeverage | uint24 | new leverage (1e3) |
increasePositionSize
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint32 | index of trade |
| _collateralDelta | uint120 | collateral to add (collateral precision) |
| _leverageDelta | uint24 | partial trade leverage (1e3) |
| _expectedPrice | uint64 | expected price of execution (1e10 precision) |
| _maxSlippageP | uint16 | max slippage % (1e3) |
decreasePositionSize
Parameters
| Name | Type | Description |
|---|---|---|
| _index | uint32 | index of trade |
| _collateralDelta | uint120 | collateral to remove (collateral precision) |
| _leverageDelta | uint24 | leverage to reduce by (1e3) |
| _expectedPrice | uint64 | expected closing price, used to check max slippage (1e10 precision) |
getWrappedNativeToken
isWrappedNativeToken
Parameters
| Name | Type | Description |
|---|---|---|
| _token | address | token address |
getTradingDelegate
Parameters
| Name | Type | Description |
|---|---|---|
| _trader | address | address of the trader |
getMarketOrdersTimeoutBlocks
getByPassTriggerLink
Parameters
| Name | Type | Description |
|---|---|---|
| _user | address | address of the user |
MarketOrdersTimeoutBlocksUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| newValueBlocks | uint256 | the new value of marketOrdersTimeoutBlocks |
ByPassTriggerLinkUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| user | address | address of the user |
| bypass | bool | whether the user can bypass the link cost of triggerOrder |
MarketOrderInitiated
Parameters
| Name | Type | Description |
|---|---|---|
| orderId | struct ITradingStorage.Id | price aggregator order id of the pending market order |
| trader | address | address of the trader |
| pairIndex | uint16 | index of the trading pair |
| open | bool | whether the market order is for opening or closing a trade |
OpenOrderPlaced
Parameters
| Name | Type | Description |
|---|---|---|
| trader | address | address of the trader |
| pairIndex | uint16 | index of the trading pair |
| index | uint32 | index of the open limit order for caller |
OpenLimitUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| trader | address | address of the trader |
| pairIndex | uint16 | index of the trading pair |
| index | uint32 | index of the open limit/stop order for caller |
| newPrice | uint64 | new trigger price (1e10 precision) |
| newTp | uint64 | new tp (1e10 precision) |
| newSl | uint64 | new sl (1e10 precision) |
| maxSlippageP | uint64 | new max slippage % (1e3 precision) |
OpenLimitCanceled
Parameters
| Name | Type | Description |
|---|---|---|
| trader | address | address of the trader |
| pairIndex | uint16 | index of the trading pair |
| index | uint32 | index of the open limit/stop order for caller |
TriggerOrderInitiated
Parameters
| Name | Type | Description |
|---|---|---|
| orderId | struct ITradingStorage.Id | price aggregator order id of the pending trigger order |
| trader | address | address of the trader |
| pairIndex | uint16 | index of the trading pair |
| byPassesLinkCost | bool | whether the caller bypasses the link cost |
ChainlinkCallbackTimeout
Parameters
| Name | Type | Description |
|---|---|---|
| pendingOrderId | struct ITradingStorage.Id | id of the pending order |
| pairIndex | uint256 | index of the trading pair |
CouldNotCloseTrade
Parameters
| Name | Type | Description |
|---|---|---|
| trader | address | address of the trader |
| pairIndex | uint16 | index of the trading pair |
| index | uint32 | index of the open trade for caller |
NativeTokenWrapped
Parameters
| Name | Type | Description |
|---|---|---|
| trader | address | address of the trader |
| nativeTokenAmount | uint256 | amount of native token wrapped |
