← Back to home

AdaptivePools

Solidity

Hooks incentivizing concentrated liquidity at tick ranges benefitting LPs by increasing fees during volatile periods and minimizing price impact for user swaps via Just In Time liquidity provision from external lending pools

Screenshots

AdaptivePools screenshot 1
AdaptivePools screenshot 2
AdaptivePools screenshot 3
AdaptivePools screenshot 4

Problem Statement

Adaptive PoolsAdaptivePools:An adaptive implementation of Uniswap V4 Liquidity Pools via hooksWhy AdaptivePools?Liquidity Pools and AMM are a fundamental part of DeFi, but over time, their initial implementation starts to change to adapt to market needs.AdaptivePools helps liquidity providers to improve their rewards and traders to have enough liquidity to perform profitable and huge trades, leading to a win win situation by adapting the pool to the market momentum.Sounds good, but how?Uniswap V4 introduces hooks within their Liquidity Pools, therefore allowing us to interact with the contract based on constantly changing situations as liquidy supply, price market volatily and high or low trade demand.For it, we modify pool fee within a settable range to make 2 things:Under low trade demand, we can reduce the pool fee so best trade routing mechanisms like 1inch or Matcha will find our pool and the LP get more tradesUnder high trade demand, we can increase the pool fee as trades are gonna happen due to the momentum of the market, therefore, increasing liquidity providers rewardsAdditionally, this incentivize huge liquidity, this liquidity provided creates consistent trades where price impact is minimum, therefore, making healthier the user trades.

Solution

AdaptivePools uses Uniswap V4 Pools due to the flexibility of these pools. This is done in order to have hooks that allow different adaptive strategies to be used by the liquidity providers within the liquidity pools.It's important to say that we modified the binaries of solidity compiler to allow the usage of transient storage in solidity pragma version 0.8.22.Also, due to being using pragma version 0.8.22, we had to modify from all the Uniswap V4 core contracts all the pragma version ^0.8.24 to ^0.8.22.Regarding the different pieces within the code, we can separate the project into the following main pieces:Uniswap V4AdaptivePoolHook (main piece, inherits BaseHook)ExtendedPoolManager (extends Uniswap V4 PoolManager with some extra functionality)SimpleTSStore (helper contract to interact with Transient Storage)BaseFlashLoan (piece that would allow some flash liquidity scenarios for a better user experience)

Hackathon

ETHGlobal London

2024

Contributors