Skip to content

Entrypoint Contract Interface

0xb3395EeeA7701E0037bBC6Ab52953C6fB0c3326c

Entrypoint.sol serves as the entrypoint for all trading actions

openTrade

solidity
function openTrade(
    ITradingStorage.Trade memory t,
    ISettlement.TradeType orderType,
    uint256 slippageP,
    bytes[] calldata priceUpdateData
) external payable

Allows a user to open a new trade (market or limit order).

Parameters

NameTypeDescription
tITradingStorage.TradeThe trade parameters.
orderTypeISettlement.TradeTypeThe order type (market or limit).
slippagePuint256The allowed slippage percentage (for market orders only).
priceUpdateDatabytes[] calldataThe price update data from the oracle.

closeTradeMarket

solidity
function closeTradeMarket(
    uint256 pairIndex,
    uint256 index,
    bytes[] calldata priceUpdateData
) external payable

Allows a user to close an existing trade using a market order.

Parameters

NameTypeDescription
pairIndexuint256The index of the trading pair.
indexuint256The index of the trade to close.
priceUpdateDatabytes[] calldataThe price update data from the oracle.

updateOpenLimitOrder

solidity
function updateOpenLimitOrder(
    uint256 pairIndex,
    uint256 index,
    uint256 newPrice,
    uint256 tp,
    uint256 sl,
    bytes[] calldata priceUpdateData
) external payable

Allows a user to update an open limit order.

Parameters

NameTypeDescription
pairIndexuint256The index of the trading pair.
indexuint256The index of the limit order to update.
newPriceuint256The new limit price.
tpuint256The new take profit price.
sluint256The new stop loss price.
priceUpdateDatabytes[] calldataThe price update data from the oracle.

cancelOpenLimitOrder

solidity
function cancelOpenLimitOrder(
    uint256 pairIndex,
    uint256 index
) external

Allows a user to cancel an open limit order.

Parameters

NameTypeDescription
pairIndexuint256The index of the trading pair.
indexuint256The index of the limit order to cancel.

updateTp

solidity
function updateTp(
    uint256 pairIndex,
    uint256 index,
    uint256 newTp
) external

Allows a user to update the take profit price of an open trade.

Parameters

NameTypeDescription
pairIndexuint256The index of the trading pair.
indexuint256The index of the trade to update.
newTpuint256The new take profit price.

updateSl

solidity
function updateSl(
    uint256 pairIndex,
    uint256 index,
    uint256 newSl,
    bytes[] calldata priceUpdateData
) external payable

Allows a user to update the stop loss price of an open trade.

Parameters

NameTypeDescription
pairIndexuint256The index of the trading pair.
indexuint256The index of the trade to update.
newSluint256The new stop loss price.
priceUpdateDatabytes[] calldataThe price update data from the oracle.

executeLimitOrder

solidity
function executeLimitOrder(
    ITradingStorage.LimitOrder orderType,
    address trader,
    uint256 pairIndex,
    uint256 index,
    bytes[] calldata priceUpdateData
) external payable

Allows a user to execute a limit order (open, close, TP, SL, or liquidation).

Parameters

NameTypeDescription
orderTypeITradingStorage.LimitOrderThe type of the limit order.
traderaddressThe address of the trader.
pairIndexuint256The index of the trading pair.
indexuint256The index of the limit order.
priceUpdateDatabytes[] calldataThe price update data from the oracle.

pythConfig

solidity
function pythConfig() external view returns (PythConfig memory)

Returns the current Pyth configuration settings.

Returns

TypeDescription
PythConfigPyth configuration settings.