Always-In-Range Liquidity Position
(Aka an AIR-LP)
TelxIP - TyAkemi
The following is a high-level concept and will require some smart contract and off-chain development work in order to implement the proposed mechanism.
V1 – Initial draft Mar2025 – wip for consultation with the TAO (Amir)
V2 – 2nd draft April 2025 – for submission to the forum
V3 – amended after community and council feedback – Apr 2025
- Introduction
It is helpful for the reader of this proposal to have a basic understanding of how Uniswap V3 & V4 pools function, if not, further information can be found in the Uniswap blog.
Put simply, one of the key advantages (called “Concentrated Liquidity”) of using a V3 or a V4 pool, is you can specify a MIN-MAX price range in which your liquidity “position” will operate. As long as the relative price of the 2 tokens in the pool remain within that price range – you earn “fees”. How much you actually earn depends on a number of variables:
a) the amount of Liquidity you are providing; (more LP provided = greater share of fees)
b) the “fee tier” you choose when opening a new position (usually 0.3%, but user can specify)
c) how concentrated your range position is (the MIN-MAX range)
d) how much other Liquidity is being provided at any particular Price Point /Tick within your range – (see Appendix A – for an explanation of what a Tick is in this context)
e) the volume of transactions being handled by the Pool at that Tick (more Vol = more fees)
– so “fees” are not constant but vary depending on the complex interaction of these 5 key variables
Generally,
- A narrow range earns a relatively greater share of the fees than a broad range. However, once your position falls outside of that range - you stop earning fees. You will earn fees again if & when the relative price of your two tokens comes back into your specified range.
However, that could be some time and while your position is Out-of-Range – 3 aspects are working against you:
- you are not earning fees, so your average apr% is dropping;
- the impact of Impermanent Loss increases;
- The relative price could be drifting further apart and if that happens, the time taken to get back into range (if at all), before you start earning fees again will be longer.
On the plus side, (unless MIN=0 and MAX=∞ in which case fees are equivalent to a V2 pool), when In-Range, your position’s share of fees earned / transaction processed by a V3-V4 pool, is higher than when providing LP to a V2 pool.
It must also be clearly understood that when a MIN or MAX range is breached, all of your liquidity, will be represented by only one of the tokens and that number of tokens will remain static while your liquidity position is Out-of-Range. In real terms, you are holding on to one coin that is decreasing in relative value, at the expense of having no tokens in the other coin which is increasing in relative value.
This fact, combined with the 3 negative aspects above, leads to a disadvantageous situation, so as soon as a position goes Out-of-Range your Liquidity is not being put to its most effective use. Unless something is done, the situation could deteriorate, and at this point – you have moved away from a prudent investment and are really gambling with your Liquidity!
It should also be noted that you can only specify the range when a position is first opened. The range cannot be changed after that and the MIN-MAX limits remain in place until that position is closed.
1.1. V3-V4 Pool Specifics
With a V3-V4 pool – the user has the following dilemma:
- Pick a range wide enough to keep the position In Range – but in doing so earn less fees per transaction handled by the pool you are in;
or
- Narrow the range to facilitate a greater fee earing capacity - but periodically fall Out-of-Range” and while out of range – no fees are earnt and you run the additional risk of being Out-of-Range for long periods of time and potentially further price drift.
Now, how often your position goes Out-of-Range is dependent on (a) the size of your price range for any position; (b) market volatility (c) how closely the relative price of the two tokens in the pool are generally correlated under “normal” market conditions.
However, when your position does go Out-of-Range you really only have 2 options:
- Close the position, and potentially open another position with a different MIN-MAX range setting; (the best option)
- Keep the position open and hope that the relative prices move back In-Range (the gambler’s option)
However, to execute option 1 – the best option - requires the Liquidity Provider to closely monitor the position and take the appropriate manual action when required.
1.2. V4 Pool Specifics
With the latest release of Uniswap V4 Liquidity pools, comes a feature (called a “Hook”) which enables a Liquidity Provider to add a customised smart contract which affects how a liquidity position operates under certain situations. Obviously if a user does not want to use this feature, they can still open a position and NOT attach any hook – so using a hook will always be entirely at the user’s discretion.
1.3 Basis of this Proposal
The initial idea behind this proposal was to develop a “Hook” which will always keep your position in Range, and (“AIR-Hook”) and so always earn fees. However, after consultation with TAO, who are currently investing how to apply V4 hooks, it was felt the best solution is a combination of the following:
-
Employ a “Hook” which will detect immediately when a position goes Out-of-Range and then have this hook call another piece of customised software (off chain) – a “Bot”
-
In summary, this Bot (“AIR-Bot”) will do the following:
a. Determine the range “GAP” which is MAX Limit – MIN Limit from the now Out-of-Range position
b. Immediately Close the current Out-of-Range position, before any price drift becomes significant. Remember – because one of the limits has been breached – you are left with only one of the tokens (plus a dusting of accumulated fees in both tokens)
c. Swap a portion of that one token for the other to enable the $value of closing liquidity from your previous position to be used, to give approximately a 50-50 split again of the two tokens
d. Open a new position (same tokens) with the same size of range GAP (but different actual MIN – MAX values)
i. New MIN-limit = CurrentPrice-1/2 GAP (barring any rounding …see Uniswap info on range limits)
ii. New MAX-limit = CurrentPrice+1/2GAP (barring any rounding …see Uniswap info on range limits)
e. Attach the same Air-Hook, to this new position.
What this provides is an automatic mechanism to consistently ensure a liquidity position is Always in Range – so constantly earning fees and minimising the risk of significant price drift between the two tokens. That way you can set the range (from the first position that you manually open), at a level that you feel comfortable with.
1.4 Cost Recovery /Passive TA Income
Using this mechanism, maximises fee earning capacity, prevents the problems associated with being Out-Of-Range, and removes the need for manual monitoring of a liquidity position (set and forget).
Since this would provide a direct financial benefit to the LP provider (increased ROI), it is proposed that for any “swaps” undertaken by the hook, a portion of the transaction fee (tbd) is channelled back to the Telcoin Association to help recover development costs and/or provide a pool for marketing or other initiatives (for example help towards listing fees, or onboarding TAN developers).
- Benefits
There are a number of significant benefits to this AIR-LP
2.1. Maximising Fee Generation in a fast-moving market
There is a major advantage which may not become immediately obvious but is very likely to happen in reality. Especially in these relatively early days of employing customised hooks
Although I have no current information of the number of V4 positions which utilise hooks, I get the impression that, generally speaking, hooks are not used by the retail public since they may contain malicious code and therefore are generally avoided. Therefore, liquidity positions in a V4 pool must be manually controlled, which is not ideal since opportunities can be missed.
If most positions are opened and closed manually, in a fast-moving, high-volatility market situations; changes in relative price could mean a lot of the concentrated liquidity (in other positions) will periodically move outside of their ranges and therefore be excluded from generating fees - until they are manually adjusted, or the market returns to the normal ranges. Also in a fast-moving market, the overall transaction volume increases with a lot more trades happening as people and bots try to keep up…and this leads to a bigger share and increased fee generation for those positions which are in range.
So, it’s a “double whammy” – you are in a situation where most of the concentrated liquidity is out of range, and at the same time the potential for fee generation, if you were in range, is High due to increased transaction volume.
That is exactly the opportunity where you should be in range and so maximizing your overall returns.
First mover advantage is huge in this case, until the market catches up !!. Which, from my own experience may only take a few hours, but being out of the market at that crucial time can be costly to your position and eventual overall financial return.
Now, if a hook was deployed which always kept your liquidity position in Range, one would be able to always have a relatively narrow range set.
It would not matter having a narrow range since when you went out of range, the hook would shift the position (closing the Out-of-Range position and opening a new position – with the same narrow range). This would allow the user to generate Maximum fees since all your liquidity would be concentrated in that narrow range - a much narrower range than could optimally be maintained under a manual system. There would of course be additional transaction fees incurred by the hook in closing, swapping, and opening a new position – but these are relatively insignificant when compared to the overall fees earned
2.2. Driving Liquidity through TelX Pools whilst ensuring maximum returns
There is also a Significant Benefit to the Tel ecosystem and associated Telx Liquidity Miners.
Having a mechanism that ensures maximum fee generation to a liquidity position greatly off sets the fear of Impermanent Loss, which is often a prohibiting factor for potential miners. NOTE: I stress offset the fear of IL, not that it will remove IL. You can never remove Impermanent Loss. However, when fee generation is significant, the higher fees help offset, and in many cases completely, remove, the negative impact that Impermanent Loss has which of course is realised when the position is Closed. The key factors here are the size of the MIN-MAX range (impacts the level of fee generation), and the time the position is In Range (generating fees) without falling Out-of-Range.
2.3. Examining the Impact of Impermanent Loss
I investigate the impact of IL versus Fee Generation in greater detail in Appendix 2 using an established market simulator of a Uniswap V3 pool (Eth-Tel) and show that for a position with a reasonable range, if the position stays in range for just 2 days (under average market conditions) - fee generation will be such that even if the position then goes Out-of-Range and you end up with 0 Tel (in this example) then your position will be in profit (at that point in time) . Obviously if you leave the position Open, and there is further price drift, your IL would increase (since the relative price of Tel is increasing), so the timing of when the position is closed is crucial in locking in Profit (or Loss) and minimising/containing IL.
2.4. Strategy behind providing Liquidity
It should be noted that how you manage Liquidity in a V3 -V4 pool does varies from a V2 pool.
With a V2 pool, you do not have a range, so you can more or less forget about close monitoring of the position. And if that pool is incentivised with additional Tel rewards, it is more or less a “set and forget” strategy.
With a V3-V4 pool, you have to think about what your medium to long term strategy is. It’s certainly not set and forget since the size of range matters. You also have to be aware of potentially “losing” all the tokens in one of your pairs. So, if your long-term strategy is to accumulate Tel, and you enter a V3-V4 pool with a narrow range (in order to maximise fees) and the price of Tel rises, your Tel will be converted into the other Token.
It is not the purpose of this proposal to delve into the different types of strategy! Nor is it to advise on what pool-pair you should invest in. That is up to the provider to make an informed decision.
2.5. Exclusivity
It is envisaged that this AIR-Hook / AIR-Bot will be constructed to only function for authorised Telx V4 pools – not just any old Uniswap pool. This proposal provides a mechanism which would encourage miners to provide liquidity to authorised Telx pools to give them a higher-than-average ROI, using a safe, authorised, and audited TAO designed add-in.
This would channel other market Liquidity providers to the Telx V4 pools, in order to get higher returns with minimal risk. This in turn will increase overall liquidity which only benefits the Telx ecosystem, so providing less slippage, less manipulation and better price stabilisation.
2.6. Non-Enforcement
It is entirely up to the Liquidity Provider whether or not to use this mechanism. If the AIR-Hook is not attached by the user to the position, when first opened. Nothing “automatic” will happen. The user will have manual control – just like now.
The user must decide which pool to invest in, how much liquidity/tokens to provide, what fee tier to use and what the size of the initial trading range will be. All under the miner’s full control and no decisions are being made on behalf of the user, apart from when the position goes Out-of-Range.
Even with the AIR-Hook attached, the user has full control as to when to manually close the position if desired, and halt the whole process. There is no “lock-in”. Once started, the process can be stopped anytime at the user’s discretion. However, once the AIR-Hook is attached, the process of range shifting will be automatic until stopped.
- Specification of the Solution
The Air Hook, will need to determine when either the MIN or MAX limit has been breached. That will be the trigger for the Air Bot
The Air Bot will need to calculate, or be presented with the GAP = MAX-MIN (used later to help calculate the new range for a new position
The hook will also need to capture the position’s closing “$value”, since that will be the $amount of liquidity available to be used when the next position is opened.
When a MAX breach occurs, the following generally needs to happen:
- CLOSE the liquidity position, and assuming you are in the TEL-ETH pool you will then get back TEL (LP + fees) tokens, and a small amount of ETH (accumulated fees only)
- SWAP half the TEL you have received for ETH (not sure if you can open a new position with only one token, so UNISWAP does a ZAP !) – that needs to be established
- OPEN a new position in the same pool TEL-ETH using these tokens and SET a new range with the following values:
a. New MIN-limit = CP-1/2 GAP (barring any rounding …see Uniswap info on range limits)
b. New MAX-limit = CP+1/2GAP (barring any rounding …see Uniswap info on range limits)
- ATTACH the Air hook to that new position!
NOTE – the $value of total Liquidity used to open the new position will be approximately the closing value of the old position minus any transaction fees.
When a MIN breach occurs, the only difference is that the process(2) needs to SWAP half the ETH, since in that situation there will be no TEL left – only ETH.
NOTEs:
1 Gas and account balances may need to be checked first to ensure there is enough for the above steps to be executed
Note, also because of the way the range GAP is calculated, once the new position is opened, it will be In-Range for a period of time since there are new MIN-MAX values set.
However, the user will need to ensure there is enough gas available in his wallet to cover the on-going transaction costs
The Air hook is effectively enabling your liquidity position to shift according to market conditions and more or less have a position always generating fees. As soon as a breach happens, ie a MIN or MAX level is hit, the position is closed and a new position opened with a different range, but with the same size of GAP. Minimising IL and always generating fees as shown below:
You only have one position open at a time (barring possibly the transition state) with the remaining liquidity plus accumulated fees from the position being closed, repatriated to the user’s wallet, and being re-used when the next position is opened.
3.1. Actual Example
The above screenshot represents such a position (V3 Tel-Eth on Eth) which has been open for only 12 hrs IN a highly active market
The extrapolated apr% is approx.:
$62 in fees /12 hrs $124 / day $45,260 / yr == $45,260/$1,915 = 2,363% apr !!!
Now, there is no way you would generate that level of fees consistently over a year, much less over a whole day !
However, this is an example of the level of fee generation over a short period of time when transaction volume is high and a position is in the “sweet spot” regarding the range of concentrated liquidity.
I would argue that’s an opportunity too good to be missed and an opportunity than can be exploited with an AIR-Hook AIR-Bot functioning as described.
If accepted, I envisage this proposal will bring major benefits to both the Tel eco-system and Liquidity Miners in particular. It is totally aligned to Telcoin’s mission statement and value proposition by bringing new and exciting, reliable and compliant Defi products to the end-user.
3.2. Development Hints
The Air-Bot will need to establish what the returns are from the position – just before it is closed by the Air-Bot. Remember – once a MIN-MAX breach has occurred – there will be zero tokens of one of the pair (X), and a small amount in reward fees of that same token (x). The majority of the holding will be in the other token, namely token(Y) + reward fees(y). When the position is closed x+Y+y will be returned to the user’s wallet.
½ of (Y+y) will need to be swapped (or ZAPed) to X(new)…so you will be left with Y(new) and X(new) which will constitute the opening token amounts for the new position. That’s assuming you can CLOSE, SWAP, OPEN from within the bot. If not, as mentioned above – you will have to OPEN new then CLOSE old and use a working balance of X & Y from the user’s wallet and it is up to the user to ensure there is enough spare coin for this to happen. Ideally a SWAP into X should also after Y+y have been repatriated into the wallet to ensure the working balances of X & Y are maintained for next time!
Further Potential developments
- Can there be a check on the current gas price and pause required transaction processing until gas price is more reasonable (under normal operation) and maybe use a higher gas price limit under market stress conditions – high volatility ?
- but not sure how you could determine what is normal and what is stressed!!
NOTE It is in these high volatility situations that you want the close and reopen to happen so maybe forget about 1 for the time being !!..but what I’m trying to say is that under normal market conditions, if the gas price is high – then it’s OK to wait until it becomes more reasonable….but in high volatility – even if the gas price is high – execution should happen!
- Can a transaction log be maintained to track opening / closing positions and relevant swaps so user can record, audit and analyse how his strategies are performing!
- Obviously, for tax accounting purposes, this would be beneficial but since all transactions are going through the user’s wallet, this is considered a nice-to-have.
This is pertinent info on accessing date from range orders (for Amir)
Range Orders | Uniswap
Still to be provided by TAO
- Resource needs
- Financial requirements – cost
- Timeline (milestones and significant target dates)
Appendix A – What is a Tick
In Uniswap v3 & v4, “ticks” represent discrete price ranges, allowing liquidity providers to concentrate their capital around specific price levels, improving capital efficiency and potentially reducing price impact for trades.
Ticks act like markers on a price scale, similar to positions on a speedometer. Each tick has a unique place on the scale, representing a specific price point in a Uniswap pool. A tick defines the price ratio between two tokens, which changes incrementally as the tick number increases or decreases.
Ticks can be visualised as follows:
Here’s a more detailed breakdown:
• Price Ranges:
Uniswap v3 pools are structured with a series of price ranges, each defined by a “tick”.
• Tick Spacing:
The distance between these ticks, known as “tick spacing,” determines the granularity of the price ranges and is related to the pool’s fee tier.
• Liquidity Concentration:
Liquidity providers can choose to deposit their assets within specific price ranges (ticks), focusing their liquidity where they anticipate the price to be.
• Active Liquidity:
When the price moves, the pool switches to a new tick, activating liquidity within positions that have a boundary at the newly active tick.
• Fee Correlation:
Lower fee tiers allow for closer tick spacing, enabling more granular liquidity provisioning and potentially lower price impact for trades.
• Tick Range:
Uniswap v3 pools have a tick range from a minimum of -887272 to a maximum of 887272, which functionally equate to a token price between 0 and infinity.
• Tick and Bip:
A single tick and a single basis point (bip) are interchangeable, with a change of 1 tick representing a price change of 0.01% from the current price.
• Tick as a Boundary:
Ticks serve as boundaries between discrete price ranges, and the liquidity available for a swap does not change inside a position, but when crossing into the next position.
Appendix B – Simulating a Uniswap V3 Pool
During my research for this proposal, I have come across several “V3 pool simulators” which provide all sorts of useful information on the estimated performance of a position. Most offer a Pro/Paid subscription option for advanced features but even the free versions give some very interesting analytics. The one I’m using to illustrate the effect of Impermanent Loss is called Poolfish.xyz:
As an aside, Uniswap have published papers on how the (very complex) mathematics of a V3 & V4 pool operate, on which these simulators are based, and the more detailed information on the math can be found in the Uniswap blog, if you have a mind to investigate further !
Here is an example of a simulated position in the TEL/ETH V3 pool (on Eth chain). This is for illustrative purposes only but hopefully will convey the points I’m trying to make:
This above shows that $1000 invested in this pool with a range gap of 64,937 would generate on average $12.48 in fees over a 24hr period, which equates to an annual apr% >455% !
If the position always stays In-Range (which of course it very unlikely to do).
In this simulation:
Current price of Tel (PT) is $0.004836 and
Current price of Eth (PE) is $1,569.81
The following tells us current price (CP) for the pool is derived from how much Tel you get for 1 ETH, so
CP = PE/PT; or 1,569.81/0.004836 = 324,584
(note in the simulation the red line assumes the most active price over the month but that is just a guide level)
Because this position is range bound, if relative price of Tel increases compared to Eth, we know that when it reaches the MIN range – we will have No TEL left and we will stop earning fees! But what would the price of Tel be at that MIN limit (assuming the price of Eth remained constant)
PT(min)=PE/MIN or 1569.81/297,757 = $0.005272
Now, putting this (future) price of Tel into the Impermanent Loss Calculator, illustrates a couple of important points, for this particular position:
If the price of Eth stays the same and Tel increases from $0.004836 to $0.005272 (an increase of approx. 9%) you will have (approx) No Tel left and 0.64931 Eth. This sets a value (nett of any fees) on your position at $1,019.35 – an Impermanent loss of -1.94%. However, the above calculator shows that if the position stays In Range for just 2 days, then the fees earned will offset that IL as shown below, and you will end up with a small profit:
NOTE: Under normal market conditions, Tel and Eth are fairly closely correlated so as they both move up and down, the CP value does change but as you would expect, at a slower rate. It’s only if the relative price sharply diverges (Tel jumps, Eth Drops, or vice versa) would you get that rapid pace of change in CP. However, in the example, if that did happen, at the point of going Out-of-Range, your maximum actual loss if the position was closed at that point with no fees earned, would be a loss of $20.20 or 1.94%. (nett of any transaction costs). However, note also that if the pair is not closely correlated (as in Tel with USDC or another stablecoin), the impact of IL becomes more significant and you would need to be earning fees for longer to offset the IL risk.
If you did not close the position and let it run, and the price continued to drift against you – then the situation quickly changes. Assume the price of TEL continues to rise to say $0.006272 (a 22.88% increase), then your IL increases from 1.94% to 9.82% and further drift to $0.007272 (a 33.48% increase) and IL jumps to 16.52%, as shown below:
NOTE: as Tel price increases (and Eth remained static), and an Out-of-Range position remains open, your overall Impermanent Loss increases.
So, to limit potential effects of IL, the position should be closed as soon as it goes Out of Range.
That way – you may have to accept a loss sometimes, if there is a rapid price shift soon after you first enter the position, but the loss is manageable and if your position stays In-Range (earning fees) for a relatively short period of time, you soon arrive at a breakeven point and anything after that is profit (again assuming the position is closed when either a MIN-MAX limit is breached.
That is why you need the Air Hook and Air Bot to manage the position!