Leveraged long and short tokens are just shares of a collateral pool. Traders can mint new tokens by adding collateral, or burn existing tokens to redeem collateral. Traders can also exchange the tokens on secondary markets.
Tokens can have leveraged returns because of the way pools are structured. Each pool has two sides, long and short. In this design, long and short traders are opposite each other; they are counterparties whose profit is equal to the other's loss, and vice versa. The two parties have an agreement: they will update the amount of collateral in each side of the pool based on the price of another asset. If the price goes up, the long side gets a percentage of the short side's collateral. If the price goes down, the short side gets a percentage of the long side's collateral.
This agreement could use any transfer function. That's to say, the amount a side gets when the pools update may be calculated in any way. If the goal is to have leveraged tokens that don't expire and can't be liquidated, a transfer function called power leverage works best.
The amount a side gets from the other is known as the value transfer. Power leverage is one way to calculate the value transfer.
where P is the price of the underlying asset over time.
Power leverage amplifies a pool's value transfer relative to the price change. This type of leverage is different from linear leverage where the value transfer is a multiple of the price change. Instead, the transfer is one minus the inverse of the price change "to the power of" a set leverage. This calculation prevents a side from ever losing 100% or more of its collateral. See graph below:
Value transfer for times leverage “(x)” and power leverage “(p)” functions in a 2 leverage pool.
The value transfer is calculated when a pool updates. A pool update moves collateral from one side to the other and adds any new collateral to the pool. It's also when traders can redeem their collateral and fees are taken.
An update is also called the rebalancing event because it serves to rebalance the collateral between long and short sides in the correct proportion. The rebalancing event happens every hour in Perpetual Pools V1.0, but parties could specify a percent price change (or any arbitrary condition for that matter) to trigger the rebalance.
Pools need a keeper to perform the rebalance. Because they require the new price for the value transfer, pools employ a keeper to tell them when it's time to fetch the price, transfer collateral, and mint/burn pool tokens. In reality, the keeper is an bot that automates the rebalancing event for a fee.
When traders mint pool tokens, they are given shares that represent their claim on the collateral in the pool. These shares are leveraged tokens. Shares of the long side are called L-tokens and shares of the short side are called S-tokens.
Traders queue to mint and burn tokens with a pool. Once they've placed an order, they cannot leave the queue. They have to place their order at least five minutes before the upcoming rebalancing event or their orders don't settle until the following update. This five minute exclusion from the upcoming rebalance is called the front running interval. Importantly, traders can still place orders during the front running interval but these orders will not be filled until the following update.
There has to be a front running interval because leveraged tokens are created (and destroyed) during a rebalancing event. Without it, some traders could get a better rate by waiting until right before the update to place their order.
The rate traders get for tokens is determined by the value transfer. Pools fill queued mint and burn orders so that the post-rebalance proportion of tokens to collateral stays constant. For new pools, this proportion is 1:1.
Pools don't necessarily hold equal amounts of collateral in each side. The rebalancing event will actually 'unbalance' the collateral between sides if it was at parity to begin with.
Any collateral discrepancy in a pool is called skew. Skew indicates excess demand for positions in one side over positions in the other. As a natural consequence of this demand, the side with more collateral pays an effective rate to the side with less. In other words, the value transfer is affected by a multiplier called the rebalancing rate.
The Perpetual Pools mechanism is so simple it is not aware of this effect. Instead, this rate manifests as polarised leveraged gains. If the rebalancing rate is positive (collateral is skewed to the long side), long side gains are less than the rate quoted by the power leverage function and short side gains are greater. For a negative rebalancing rate (short side skew), the opposite is true. The function below can be used to calculate a side’s gain:
Because the side with less collateral has asymmetric upside (in other words, it has amplified gains relative to losses), traders have incentive to mint into it. Like the funding rate in Perpetual Swaps, the rebalancing rate in Perpetual Pools will tend towards 0 as traders take advantage of these excess returns.
If pools maintain equal collateral between sides, i.e. the rebalancing rate is 0, leveraged tokens will simulate the expected returns of a constantly rebalancing leveraged portfolio. Returns will diverge from this expectation as the value transfer grows more infrequent.