Leveraging
1. Initial Deposit and Leverage
The most common approach is to deposit and leverage in a single transaction. This is ideal for users who want to create a leveraged position from scratch.
Preparing for Leverage
Before leveraging, you need to:
Understand your target position: Determine the collateral asset, borrow asset, and desired leverage ratio.
Set an appropriate slippage tolerance: Typically 0.5-2% depending on asset volatility.
Approve the necessary contracts: Your collateral token must approve the Position Management contract.
Here's how to prepare the deposit and leverage transaction:
Constructing the LeverageStruct
The key to a successful leverage operation is properly constructing the LeverageStruct
:
Executing the Leverage Operation
With the LeverageStruct
prepared, execute the leverage operation:
2. Leveraging an Existing Position
If you already have collateral deposited, you can increase your leverage without an additional deposit:
Important Considerations
Position Health and Risk Management:
Monitor your position's health factor before and after leveraging.
Consider the maximum leverage ratio allowed by the protocol.
Be aware of liquidation risks when increasing leverage.
Calculate the minimum collateral required to maintain a safe position.
Swap Data Configuration:
The
swapData
must accurately reflect the desired swap route.Ensure the
inputAmount
matches theborrowAmount
in the leverage struct.Set appropriate slippage tolerance for the swap (typically 0.3-1% for stable pairs, 1-3% for volatile pairs).
Amount Calculations:
Ensure these amounts are properly calculated to achieve desired leverage ratio.
Consider protocol fees when calculating amounts.
Protocol-Specific Features:
Some protocols may require additional data in the
auxData
field.Check protocol documentation for specific requirements.
Last updated