Links

Integration Guide for Deri Lite

The contract interaction on the Deri Lite is done by calling the requestTrade method of the Router contract. Here is an explanation of the method's parameters:
function requestTrade(
address pool,
address asset,
int256 amount,
string calldata symbolName,
int256[] calldata tradeParams
) external payable
The parameters are explained as follows:
Please note that the requestTrade method is payable, which means that users need to send a certain amount of
  • pool: The address of the pool, specifying the Deri Arbitrum or BNB pool.
  • asset: The address of the asset used as collateral. If it's the zero address, it represents using ETH/BNB as collateral.
  • amount: The amount of collateral, where a positive value represents adding collateral and a negative value represents removing collateral.
  • symbolName: The symbolName of the trade, such as "BTCUSD" or "BTCUSD-40000-P".
  • tradeParams: An array of trade parameters containing two int256 values. The first value represents the trade volume, where a positive value represents a long position and a negative value represents a short position. The second value represents the price limit, which is used to limit the slippage of the trade.
Please note that the requestTrade method is payable, which means that users need to send a certain amount of ETH when invoking the method. This ETH amount must be equal to the execution fee specified by the router contract, and it is used to compensate the executor for executing the user's request.
Here are two examples:
  1. 1.
    The user adds 1000 USDC as collateral and opens a short position of 0.5468 BTCUSD:
requestTrade(
0xDE3447Eb47EcDf9B5F90E7A6960a14663916CeE8, // Deri Arbitrum pool address
0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8, // USDC address
1000000000, // 1000 USDC
"BTCUSD",
[-546800000000000000, 266805700000000000000000] // Short 0.5468 BTCUSD, average execution price not less than 26680.57
)
  1. 2.
    The user closes the position and withdraws all collateral:
requestTrade(
0xDE3447Eb47EcDf9B5F90E7A6960a14663916CeE8, // Deri Arbitrum pool address
0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8, // USDC address
-type(INT256).MAX, // Withdraw all collateral
"BTCUSD",
[546800000000000000, 300000000000000000000000] // Long 0.5468 BTCUSD, average execution price not higher than 30000.00
)