Configuring a Perpetual Leverage Token's Parameters
A PerpetualLeverageToken's strategy is parameterized during deployment and can be reconfigured at any time using setter methods on the Strategy contract.
Below we show how you might set these through the Etherscan write transaction UI. The setters require that arguments are entered in array format. The order of the array elements corresponds to the order of the properties enumerated in the struct definitions on the previous page.
NOTE: All BigNumber values in the array must be entered as quoted strings, e.g one 10^18 whole unit is represented as:
- the target leverage of their token
- lower and upper bounds the leverage ratio is allowed to range between in normal operation.
Ratio quantities and speeds are denominated in 10^18 units, time is denominated in seconds
The screenshot below shows the methodology settings being configured via the Etherscan UI write panel, with:
86400(one day in seconds)
- _targetLeverageRatio: The ideal balance between the underlying asset and the borrowing asset (i.e. for a 2X FLI - the ratio is 2 to 1). Over the long term, FLI products are programmed to rebalance back towards the Target Leverage Ratio and float in a range between the min and max leverage ratios as the price of the underlying asset varies.
- _minLeverageRatio: The safe minimum leverage ratio. If current leverage is below, rebalance target is this ratio.
- _maxLeverageRatio: The safe maximum leverage ratio. If current leverage is above, rebalance target is this ratio
- _recenteringSpeed: Rate at which the leverage ratio can adjust on a daily basis in order to revert back to the Target Leverage Ratio. Measured as a proportional percentage of the target leverage ratio.
- _twapCoolDownPeriod: specifies the amount of time that FLI contracts must wait to initiate another rebalance transaction. The unit of measure for the Cooldown Period is seconds and it is compared to the timestamp of the last transaction. Delaying consecutive rebalance transactions allows the liquidity pool to be arbitraged back to the correct price before placing the next trade, which has a favorable effect on price impact and slippage for the relative liquidity pools.
These parameters are set on the PerpV2LeverageStrategyExtension contract using the setExecutionSettings method. They describe the trade execution settings that should be used for regular day-to-day rebalances.
Slippage tolerance percentage is denominated in 10^18 units where 1 * 10^18 is 100%. TWAP times are denominated in seconds.
The screenshot below shows the execution settings being configured via the Etherscan UI write panel, with:
- _slippageTolerance: Percent to price min token receive amount from trade quantities. This setting helps limit exposure sandwich attacks during trading.
- _twapCoolDownPeriod: Delay period in seconds between trades for regular rebalances. Limits the trade size for rebalance transactions in order to avoid excessive price impact and slippage to adjust leverage during volatile price swings.
Incentive settings apply to ripcord transactions. Ripcord transactions only occur when the leverage ratio is dangerously outside the bounds of the safe range and leveraged positions are at risk of liquidation. The ripcord function is publicly callable and incentivized by an ETH reward so that anyone can initiate deleveraging if a FLI product is operating outside the bounds of its safe leverage ratio. Rewards and Leverage ratios are denominated in 10^18 units. Slippage tolerance percentage is denominated in 10^18 units where 1 * 10^18 is 100%. TWAP times are denominated in seconds.
The screenshot below shows the incentive settings being configured via the Etherscan UI write panel, with:
- _etherReward: ETH reward for incentivized rebalances
- _incentivizedLeverageRatio: Leverage ratio for incentivized rebalances. (This is higher than the target leverage ratio, making it possible to aggressively delever the product)
- _incentivizedSlippageTolerance: Slippage tolerance percentage for incentivized rebalances. (This is higher than normal slippage tolerance percentages to encourage trades even when they have an adverse price impact on the pool)
- _incentivizedTwapCoolDownPeriod: TWAP delay period in seconds between trades for incentivized rebalances. This is shorter than the typical trade interval to enable rapid rebalancing in volatile markets.
The Max Trade Size limits the trade size for rebalance transactions in order to avoid excessive price impact and slippage to adjust leverage during volatile price swings. When swapping the Perp virtual asset through Perp markets, there is an upper limit denominated in the underlying token that rebalance transactions cannot exceed. In practice, if the total trade amount required for rebalancing exceeds the Max Trade Size, the sum will be broken down into multiple transactions (aka iterateRebalance transactions).
Example: Say we have a leverage ratio of 2.3x and a max trade size of 200 vETH. When a rebalance is initiated, the smart contract will delever by selling (or buying if short) vETH for vUSDC through the Perp UniswapV3 ClearingHouse contraact. If the amount of vETH to be swapped is less than 200, then the entire rebalance trade will be processed as a single transaction. But, if the amount of vETH to be swapped exceeds 200 (ex. v275 ETH), then one trade will be initiated with v200 ETH and a subsequent trade will be made with 75 vETH after a short cooldown period.
What this means: the Max Trade Size is one of the critical parameters for leveraging and deleveraging FLI products. When markets are volatile, it is important to be able to reduce leverage as quickly as possible in order to avoid liquidation. If the Max Trade Size is too small relative to the total AUM, it could take an excessive amount of trades (and time) to delever FLI products. For this reason, Max Trade Size and Supply Cap are often adjusted in tandem.
Max trade sizes are denominated in 10^18 units.
The screenshot below shows the exchange settings being configured via the Etherscan UI write panel, with:
10 base token whole units (ex: 10 vETH)
20 base token whole units (ex 20 vETH)
- _twapMaxTradeSize: Max trade size in base asset base units. Always a positive number.
- _incentivizedTwapMaxTradeSize: Max trade size for incentivized rebalances in base asset units. Always a positive number.