Creating a Perpetual Leverage Token
This page presents a sample guide on how to deploy a leverage token that uses Perp V2 on Optimism as the underlying source of leverage. Deploying the strategy will require technical knowledge on deploying smart contract instances. No Solidity coding is required if deployed as-is
Perpetuals and leveraged products come with additional risk of liquidation. Therefore, asset managers should be aware of choosing suitable parameters
Creating the SetToken
The first step to deploying your own leverage token is to create the SetToken which will custody perp positions and help you accept capital. Follow the guide in this section to create using the TokenSets UI.
Parameters
As Perp is USDC margined, we recommend creating the SetToken in 100% USDC to make it simple to initialize perp positions. Fill the component with the USDC address and units with the price of the Set you want to start with. USDC contains 6 decimals so
10000000
= 100 USDC = $100 Set priceModules should include the PerpV2LeverageModule (functionality for trading using perp) and SlippageIssuanceModule (functionality for issuing Sets with perp positions) at a minimum. If you want to charge streaming fees, you may also choose to enable the StreamingFeeModule
Set the manager address to your own deployer for now. This will be updated to the BaseManager later on
Deploy Strategies
Get started with Set V2 Strategies Deployments repo here
At a minimum, to set up a Perp leverage token, must deploy the BaseManager and PerpV2LeverageStrategy contract. Check out an example deploy script for an ETH2x token here.
Below are Parameters that are passed in during deployment that vary depending on your asset and parameters
BaseManager
PerpV2LeverageStrategy
ContractSettings
MethodologySettings
ExecutionSettings
IncentiveSettings
ExchangeSettings
Depositing a Set's USDC as collateral
After creating a new SetToken with 100% USDC as a default position, you can now deposit that USDC into a new account in Perpetual Protocol by using the PerpV2LeverageModule (see the deposit function in the contract docs).
After successfully depositing collateral into the Perp account, you are now able to open your desired vAsset positions that your SetToken will represent, using the trade function.
Engaging/Levering up the Set
Note: this is only possible if you have enabled the Strategy Extension to your BaseManager.
Engaging is defined as "levering" up a Set for the very first time. This step is required during the Set creation process to prepare the leverage ratios that are declared in the strategy.
Once you call the engage function in the Strategy Extension contract, the Set will be "engaged" to the Target Leverage Ratio. If the Set still returns a nonzero answer for the shouldRebalance getter (aka the SetToken still needs to be rebalanced) you can continue to call the engage function until the Set does not need to be rebalanced anymore.
Configuring a Perpetual Leverage Token's Manager Contracts
In other guides in the developer directory, you'll learn what configurations are available to help build your perfect Set. Perpetual Leverage Tokens can be configured just like an ordinary Set, meaning the following adapter contracts can be deployed to assist your Set:
A FeeSplit Extension contract to specify how the streaming, issuance and redemption fees which accumulate for the token should be split.
When building Perpetual Leverage Tokens, the PerpV2LeverageStrategyExtension is the most important contract to deploy.
The Strategy Extension contract describes operational parameters such as what leverage ratio the token should target and what incentives bots or other market participants have to keep the token operating close to an ideal leverage ratio under all market conditions.
Last updated