Open Position

About Open Position

A full description will be soon

Schema of Open Position

The next image shows a flowchart detailing the steps a trader takes to open a position with leverage, involving multiple transfers and actions among various entities.

Example

Input information:

Trader opens position in ETH for 1000 USDT with leverage x10.

The market exchange rate is 2000 USDT for 1 ETH.

Start Balances:

  • Balance controlled by D4X main smart contract:

    • Balance of external Lending protocol in ETH: 0 ETH

  • Balance controlled by ALP:

    • Balance of external Lending protocol in USDT: 9000 USDT (from Lenders deposits)

  • Balance of Trader: 1000 USDT

Actions:

  1. Trader

    • Action 1: The trader orders to open a position with 10x leverage.

      • Transfer 1. from Trader: The trader transfers 1000 USDT to the D4X smart contract.

  2. D4X Smart Contract

    • Action 2: D4X makes a leverage request to ALP.

  3. Auto Leverage Pool (ALP)

    • Action 3: There's a request for receiving stored funds.

      • Transfer 3.1 from External Lending protocol: 9000 USDT is transferred from the External Lending Protocol to the ALP.

      • Transfer 3.2 to D4X smart contract: Subsequently, 9000 USDT is transferred to the D4X contract as part of the leverage process, making it a total of 10000 USDT (1000 initial + 9000 leverage).

  4. D4X Smart Contract and DEX

    • Action 4: D4X starts exchange at an external Decentralized Exchange (DEX).

      The exchange rate for the transaction is 2000 USDT for 1 ETH

      • Transfer 4.1: The total 10000 USDT (from the trader's 1000 and 9000 leverage) is transferred to the external DEXes.

      • Transfer 4.2: In return, 5.0 ETH is received from the external DEXes, indicating the leverage has been used to purchase ETH.

    • Action 5: D4X initiates sending received from DEX funds to External Lending Protocol.

      • Transfer 5 to External Lending protocol: The 5.0 ETH is then transferred to the lending protocol to be stored.

End Balances:

  • Balance controlled by D4X main smart contract:

    • Balance of external Lending protocol in ETH: 5.0 ETH (opened position)

  • Balance controlled by ALP:

    • Balance of external Lending protocol in USDT: 0 USDT

  • Balance of Trader: 0 USDT (all gone to position)

Result:

  • Result for Trader: The trader received control of position in 5.0 ETH (with the aim of potential gain with x10 leverage), sent his own 1000 USDT, and borrowed 9000 USDT.

  • Result for ALP: The pool lends 9000 USDT to the trader to earn interest.

Tutorial video

The upcoming video provides a step-by-step guide on how to initiate opening position within the application.

Last updated