Liquidity Bootstrapping Pool
For advantages and use cases of Liquidity Bootstrapping Pools (LBPs), please refer to the standard documentation.
Some elements to consider when interfacing with Liquidity Bootstrapping Pools:
- Pool weights can be dynamic
- Pool swaps may be disabled by the pool owner. Typically this is to prevent swaps before the weight shifting occurs, but this can technically happen at any time.
- Pool weights range from 1% to 99%
- Pools have between 2 and 4 tokens
In addition to the common pool data, you will likely want the following data when interfacing with Liquidity Bootstrapping Pools:
Weights are stored at the pool level. For example, calling
pool.getNormalizedWeights()
returns something resembling
[800000000000000000, 200000000000000000]
which are the weights represented with 18 decimals. A pool with 80%/20% weights corresponds to [0.8, 0.2] after scaling for decimals. It is important to note that this method will only query instantaneous weights. If you are querying a pool that is actively changing weights, the pool weights can differ between off-chain query and weights at time of execution.
By combining the above instantaneous weight query with the weight-shifting parameters, we can calculate weights at a point in the future. Calling
pool.getGradualWeightUpdateParams()
returns something resembling
startTime : 1631523600
endTime : 1638781200
endWeights : [180010681315327688, 820004577706569009]
With these datapoints, you can calculate the weights at a given point in time by interpolating between the current weights and the final weights.
Pool owners may choose to enable/disable swaps based on what they're doing with their pool. Oftentimes, pool owners will have swaps paused before a weight-shifting event and enable them as the weight-shifting begins. Technically, however, pool owners can pause swaps whenever they like; therefore, it's important to check it swaps are enabled when dealing with these pools. Simply calling
pool.getSwapEnabled()
returns
True
or False
. Last modified 1yr ago