Boosted Pools
Boosted Pools Intro
Boosted Pools are pools containing ERC4626 yield bearing tokens. These allow for highly capital efficient pools (up to 100%). For example a stable pool could be 100% boosted by containing waUSDC and waDAI.
The Vault enables gas-efficient swaps by leveraging the underlying ERC4626 tokens (e.g., DAI and USDC in the previous 100% boosted example). This is accomplished through the use of ERC4626 Liquidity Buffers, an internal mechanism of the Vault designed to optimize efficiency.
When a swap involves an underlying token, the Vault automatically utilizes the available liquidity buffer, bypassing the need to wrap or unwrap tokens through the lending protocol. This significantly reduces gas costs. If no suitable buffer is available, the Vault will default to wrapping or unwrapping tokens as needed to complete the swap.
Any type of pool can be boosted and any ERC4626 token can be used.
As an example, consider two pools:
- WETH/USDC
- waUSDC/waDAI
We can now facilitate a gas efficient swap from WETH to DAI which would take the following steps:
- Swap WETH to USDC through pool 1
- Use buffer to swap USDC to waUSDC
- Swap waUSDC to waDAI through pool 2
- Use buffer to swap waDAI to DAI
Coding A Swap
The swapper has the responsibility to decide whether a specific swap route should use buffers. In the SwapPathStep struct the boolean isBuffer should be set true and the pool param is the ERC4626 token address:
struct SwapPathStep {
address pool; // Should be ERC4626 token address
IERC20 tokenOut;
bool isBuffer; // Should be set to true
}
In the case of trading DAI to USDC via a waDAI/waUSDC boosted pool the SwapPathExactAmountIn would look like:
SwapPathExactAmountIn({
tokenIn: address(DAI),
steps: [
SwapPathStep({ // Buffer/Wrap step, DAI > waDAI
pool: address(waDAI),
tokenOut: address(waDAI),
isBuffer: true
}),
SwapPathStep({ // Swap step, waDAI > waUSDC
pool: address(boostedPool),
tokenOut: address(waUSDC),
isBuffer: false
}),
SwapPathStep({ // Buffer/Unwrap step, waUSDC > USDC
pool: address(waUSDC),
tokenOut: address(USDC),
isBuffer: true
})
],
exactAmountIn: myExactAmountIn, // your defined amount
minAmountOut: myMinAmountOut // min amount out
})
The trade will execute regardless of whether the Buffer has enough liquidity or not. Remember: If the buffer does not have enough liquidity it will simply additionally wrap or unwrap (and incur additional gas cost).
Pricing buffer steps
A buffer step is a wrap or unwrap at the ERC4626 token's current rate. To quote it off-chain, use the wrapped token's convertToShares / convertToAssets (or previewDeposit / previewRedeem) for the amount in question; the Vault uses the same ERC4626 conversion. Buffer balances can be read from the Vault with getBufferBalance(wrappedToken), and change on the LiquidityAddedToBuffer / LiquidityRemovedFromBuffer and Wrap / Unwrap events.