In margin trade, a user inputs their deposit token amount and target leverage . Using these values, the protocol can identify how much target token needs to be borrowed in the flash loan. if user chooses to long SUI/USDC.Then:
USDC is borrowed
USDC is swapped to SUI
SUI is supplied in Current-Lend
USDC is borrowed against SUI
Borrowed USDC is used to repay the initial flash loan
Position is open at target leverage
How to open a Margin Trade Position
Step 1:Select Token Pair, Long/Short and Leverage.