Sitemap
Vladimir Zhuravlev

Vladimir Zhuravlev

Puzzle Network

Inventing Ranges

7 min readAug 7, 2025

--

Press enter or click to view image in full size

Have you ever thought about how fake the landscape of finances actually is? I’m thinking about it pretty often. Smart but unempathetic entrepreneurs, from real estate agents selling mortgages in the 2000s to Wall Street boys in present days, are building short-term unsustainable schemes seeking a quick profit. Especially in DeFi, which is now almost fully based on printings of new tokens and fake APYs. I’m tired of this bullshit; tired of the need to run somewhere 24/7, jumping from one ponzi to another, in order to make my portfolio perform. I want to believe in a sustainable DeFi; a DeFi which can generate real yield and compete with rotten financial structures having a pure math as an advantage, without fake ponzinomics.

Do you remember SushiSwap? They launched in 2020 as a competitor of Uniswap, with an exact same model and one single competitive advantage: they printed their own token to attract liquidity providers. It worked: LPs moved from Uniswap to Sushi to farm the brand new SUSHI token. A so-called “vampire attack”. What happened next? Bull run ended, SUSHI dumped to the bottom, and LPs moved to newer DEXes with newer tokens… SushiSwap TVL steadily drowned from $8,000m to $120m:

Press enter or click to view image in full size
SushiSwap TVL. Source: DefiLlama

Chains are using the same strategy to attract liquidity during launches and explain their high valuation. For example Berachain; they announced a brand new token as a reward for liquidity provision in freaking “points”, and it worked to attract liquidity. But as soon as BERA value got diluted, the liquidity flew away.

Press enter or click to view image in full size
Berachain TVL. Source: DefiLlama

What I mean here is that this strategy: launch a product, airdrop tokens for using it, make money from people using it, disappear — repeats itself.

This shitty flow can’t last forever. We should come up with an end-game setup of DeFi, particularly in DEXes; we need a sustainable DEX model which manages to get a high organic APY for liquidity providers.

The only way to raise organic APY is optimize liquidity’s ability to generate commissions from swaps.

For the last 3+ years, together with the team, I’ve been working on a potential solution for this — megapools — liquidity pools consisting of multiple tokens. Our hypothesis was that such pools can generate a decent APY organically, purely from swap fees. The logic is very simple here: the more tokens we have in one pool, the more trading combinations there are, hence the pool gets used more often and liquidity providers earn more fees. Based on the experience of our product, Puzzle, this hypothesis eventually got confirmed, showing hundreds of pools generating 10–200% APY.

Press enter or click to view image in full size
Puzzle Swap megapools

I’m proud of Puzzle’s achievements. We managed to build a DEX which doesn’t need additional token rewards to decently stimulate liquidity provision.

Meanwhile, the success of alternative AMMs utilizing concentrated liquidity models (Uniswap v3, Traderjoe, Meteora) inspired me to do additional research on how megapools can be combined with concentrated liquidity. I came up with my initial thoughts on the potential of this combination last year: Medium article.

Since then, we’ve done a lot of R&D on this topic (“concentrated megapools”) the key takeaways of which I’m gonna share in this article about what we called “RANGES”.

Ranges

In the AMM model, it’s all about the underlying formula. You, guys, know the Uniswap V2 formula, don’t you?

K = B1 * B2

Balance of token 1 multiplied by Balance of token 2 is equal to a constant. As simple as that. It works well for simple pairs even now, 7 years later. However it is not enough to generate enough revenue for liquidity providers. In 2019, it was further developed by Balancer team:

K = B1**w1 * B2**w2 * … * Bn**wn

This formula was used as a fundament for Puzzle megapools enabling creation of liquidity pools with up to 10 tokens (1…n) with different weights (w1…wn). It worked better because of more trading combinations and more efficient liquidity provision. B1…Bn are balances of the tokens inside the pool.

The key pivot happened about a year ago when during a development a situation appeared in which those balance variables didn’t exactly refer to factual balances of the tokens: in one of my own megapools on Puzzle I manually leased a half of WAVES tokens.

Get Vladimir Zhuravlev’s stories in your inbox

Join Medium for free to get updates from this writer.

Interestingly, the pool kept working as if it would have the full amount of WAVES, in fact having access to just half of it. That’s how I came up with the virtual balance term, not necessarily connected to fact(ual) balance:

B = virtual balance

F = fact balance

These two variables are assigned to each token and are not connected. Moreover, their ratio is very meaningful:

B / F = leverage (L), from 1x to infinity

Leverage is showing how leveraged is the token balance, similarly to perpetual exchanges. Meanwhile, there is also a reversed ratio:

1 / L = F / B = concentration, from 0% to 100%

After coming up with these ratios and their meaningfulness I came up to a conclusion that this might be something completely NEW and FRESH to the entire DeFi space. At the end we called megapools with virtual balances RANGES.

Leverage and Concentration are good navigation variables which can be used to visualize the liquidity pool setup, but don’t have much practical functionality in the smart contract itself. What really matters is the question of how swaps operate. In megapools amount you receive during swap (so called amount out, Ao) after sending amount in (Ai) of another token, is calculated as:

Ao = Bo * ( 1 — (Bi / (Bi + Ai))**(wi/wo) )

You could guess that in RANGES this formula remains in the same appearance, with only two notices: B is now virtual balance, not equal to fact balance, AND there is an exception if there is not enough fact balance of “token out” to complete the swap. Hence, we can extend the formula to the system of two equations:

{ Ao < Fo; Ao = Bo * ( 1 — (Bi / (Bi + Ai))**(wi/wo) ),

{ Ao >= Fo; Ao = Fo.

Which means, if the fact balance is less than the amount out, the range will send whatever is left. If the fact balance is 0, the range is stopping purchase operations for this token. In other words:

Range is working as if its balance is B until it runs out of F, after which it just stops.

Leverage at its purest.

The F limitation might sound scary, but it’s not, especially if we calculate the operation range: min price and max price for each token in which its B is operational.

I spent a few days doing these calculations, which ended up being much more complex than the main formula.

Press enter or click to view image in full size
I love sketching and math equations

Maybe, in one of the points of time in future I will explain deeply how the equations were solved, but as this article is getting too long for an easily readable one, I will come straight to the solution:

p_min = ((B1 — F1) / (B2 * (B1 / (B1 — F1))**(w1/w2))) * (w2/w1)

p_max = (B1 * (B2 / (B2 — F2))**(w2/w1) / (B2 — F2)) * (w2/w1)

These equations prove that the price range can be calculated based on the leverages, and probably this should be the correct approach to design UI/UX, for users to choose leverages for all the tokens and see min/max price later.

Example

Let me show you an example of a test range we launched at the private testing phase.

Press enter or click to view image in full size
Range screenshot #1

It consists of 6 tokens in unequal shares (far right column). USDTu is chosen as a base token, and all other ranges are nominated in this asset, calculated based on F, B of USDT and F, B of a particular asset. Btw, with green A the staking functionality of underlying assets is highlighted.

Press enter or click to view image in full size
Range screenshot #2

Additionally the concentration (or leverage) parameter may be calculated and visualized for all assets, which is done in a spider chart. The further the value for a token is from 0%, the more fact liquidity it actually has.

This range is working for around 8 days at the moment of writing this and made 2182$ in fees.

I think we’ve built something. This new model for concentrated liquidity has a huge unexplored potential. Together with the team, we are now working on an official launch of RANGES and I will keep you updated with the results on this experiment. Let’s build sustainable DeFi!

--

--