👓Use Cases
Last updated
Last updated
The creation of marginal limit order
Alice creates 1000$ order.
If it’s the 5X leverage, our smart contract borrows 4000$.
5000$ is transferred to the Uniswap LP.
As soon as liquidity is transferred to the necessary asset (ETH), Executor withdraws liquidity and transfers ETH to Alice. Executor gets execution fee, and Alice gets the reward from Uniswap for providing liquidity to the pool.
Marginal limit order is created.
The closing of marginal limit order.
Suppose ETH increases in price, and Alice wants to sell ETH.
ETH is transferred to the Uniswap LP.
As soon as liquidity is converted to the necessary asset (USDT), Executor withdraws liquidity and transfers USDTs to Alice. Executor receives execution fee, and Alice gets the reward from Uniswap for providing liquidity to the pool. Alice also pays borrow fee.
Marginal limit order is closed.
Creation of margin market order
Alice has 1000 USDC, and she wants to open a Long position in the ETH/USDC pair with 5X leverage.
She creates an order, TheTrade smart contracts processes it and borrows 4000 USDC from TheTrade LP for Alice.
Unlike the limit order work, TheTrade has isolated LPs for margin trading. Having 5000 USDC on hand, the smart contract swaps USDC for 5X ETH.
The Long position with 5X leverage is created at the moment.
Closing of margin market order
Market price increases up to 1500 USDC per ETH, and Alice wants to close the position.
She closes the position on TheTrade interface. Smart contract processes Alices request in its turn and goes to the Uniswap V3 pool to exchange 5 ETH for 7500 USDC.
Then smart contract returns 4000 USDC borrowed for Alice and rewards the liquidity provider of TheTrade pool.
In the end, Alices profit is returned considering TheTrade commission.
Liquidation of margin market position
ETH market price falls up to 820 USDC per ETH.
Liquidator sends request to TheTrade smart contracts for the liquidation of Alice’s order position.
Smart contract processes Alice’s request and goes to the Uniswap V3 pool to exchange 5 ETH for 4100 USDC.
After that smart contract returns 4000 USDC borrowed for Alice before and rewards the liquidity provider of TheTrade pool and Liquidator for the work performed.
The position is liquidated.
Implementation
With the initial release, TheTrade will offer leverage up to x5 for both Long and Short positions.
TheTrade uses its own liquidity pools, enabling leveraging on various asset pairs. Leverage will be available for main currencies from the start. Later on, and especially after the launch of DAO, TheTrade platform will allow the listing of any token if there is enough liquidity. Higher leverage options, up to x100, will be added as well.
TheTrade achieves decentralized margin trading by using its own liquidity pools and limit order mechanics. For leveraged order creation, TheTrade contracts borrow the liquidity from TheTrade liquidity pool and swap the assets on the market. This process allows users to profit from lesser deposits but increases the risks. Both long and short positions can get liquidated by any participant of trading platform. Any TheTrade user can take on the role of Liquidator and receive a commission for helping the protocol uphold precise timings on all leveraged positions.
Executor ensures the correct marginal limit order process performance and gets execution fee for withdrawing the liquidity and transferring it to a user. Thus, Executor takes participates in the transferring part of both the creation and closing of marginal limit orders.
For instance, opening x5 Long position requires TheTrade platform to borrow four times the deposit amount from the liquidity pool to swap the provided token to the desired one. Traders can close the position anytime to take a profit or fix losses. If the price goes down and there is no deposit coverage (i.e., approximately -18%), trading platform opens the possibility of liquidating the position. Now, any Ethereum account can call the liquidation. TheTrade platform checks the liquidation conditions and swaps the desired asset for the borrowed one. After the swap, the smart contract repays a borrowed amount, withholds liquidator and protocol fees, and returns the remaining amount to the trader.