Understanding Liquidity Strategies
Liquidity Strategies are modular contracts for different price discovery and liquidity mechanisms. The stock contracts shipped with the Uniswap Liquidity Launchpad deploy new Continuous Clearing Auction (CCA) auctions and create Uniswap v4 LP pools with the proceeds.
This is only one of many possible stratgies. We expect there to be many different strategies for different use cases.
LBPStrategyBase
The LBPStrategyBase is an abstract base contract for liquidity bootstrapping (LBP) strategies. It provides core functionality handling the deployment of auctions and LP pool initialization.
Overview
Contracts inheriting from this base contract will be able to:
- Deploy a new Continuous Clearing Auction (CCA) auction.
- Create a Uniswap v4 LP pool with the proceeds from the auction.
- Send the LP position to a specified
positionRecipient. - Sweep any leftover tokens or raised funds to a configured
operator.
The amount of tokens and currency used for the LP pool will vary depending on the final price of the auction and how much currency was raised.
The following functions are left virtual to be implemented by the inheriting contract:
_createPositionPlan: Creates the calldata for Uniswap v4 Position Manager (POSM)_getTokenTransferAmount: Calculates the amount of tokens to transfer to POSM_getCurrencyTransferAmount: Calculates the amount of currency to transfer to POSM
For example, if only a full range position is desired, the inheriting contract should simply create a full range position plan and transfer the full amount of tokens and currency to Position Manager. See FullRangeLBPStrategy for an example implementation.
Constructor parameters
The LBPStrategyBase constructor takes the following parameters:
/// LBPStrategyBase.constructor
constructor(
address _token,
uint128 _totalSupply,
MigratorParameters memory _migratorParams,
bytes memory _auctionParams,
IPositionManager _positionManager,
IPoolManager _poolManager
)
_token: The address of the token to be bootstrapped._totalSupply: The total amount of tokens to be used for both the auction and LP pool._migratorParams: The parameters for the pool migration._auctionParams: The parameters for the created auction._positionManager: The v4 position manager._poolManager: The v4 pool manager.
During construction, the contract will validate its parameters and calculate the number of tokens to send to the auction vs. reserve for the LP pool. This split is customizable within the MigratorParameters:
// src/types/MigratorParameters.sol
struct MigratorParameters {
uint64 migrationBlock;
address currency;
uint24 poolLPFee;
int24 poolTickSpacing;
uint24 tokenSplitToAuction;
address auctionFactory;
address positionRecipient;
uint64 sweepBlock;
address operator;
uint128 maxCurrencyAmountForLP;
}
migrationBlock: The block number whenmigrate()can be called.currency: The currency that the token will be paired with in the v4 pool (currency that the auction raised funds in).poolLPFee: The LP fee that the v4 pool will use.poolTickSpacing: The tick spacing that the v4 pool will use.tokenSplitToAuction: The percentage of the total supply of the token that will be sent to the auction, expressed in mps (1e7 = 100%).auctionFactory: The Auction factory that will be used to create the auction.positionRecipient: The address that will receive the position.sweepBlock: The block number when the operator can sweep currency and tokens from the pool.operator: The address that is able to sweep currency and tokens from the pool.maxCurrencyAmountForLP: The maximum amount of currency that can be used for LP.
migrate
The migrate() function is used to initialize the liquidity pool in v4. It validates that the auction has concluded, calculates the amount of tokens and currency to transfer to Position Manager, and finally calls POSM to create the pool and position.
This function can be called by anyone after the configured migrationBlock.