Puzzle: Introducing Megapools for Stablecoins

Puzzle Network
3 min readApr 19, 2023

--

Puzzle Swap was initially launched as a DeFi service introducing megapools. Today, we make a step further by proposing a model to launch megapools for stablecoins that could be more capital efficient, perfectly fit the current state of DeFi on the Waves blockchain, and bring fresh air to Puzzle Swap and Puzzle stakers.

Maths

Imagine a megapool as a composition of tokens t1,t2,…,tn, where n is a total number of tokens. Puzzle stablepool assumes that each token is 1:1 equal to every other one.

Thus, if traders swap amount a1 of token t1 to t2, they get the following amount out:

a2 = a1 * (1 — fee)

Meanwhile, liquidity providers can put any token into liquidity to earn fees. Their position can be exported as LP tokens. We can calculate an amount of LP tokens received using the following formula:

aLP = a1,

where a1 is an amount of tokens provided as liquidity. But, to withdraw liquidity, LPs will have to pay the fee, because this operation is basically the same as a swap function.

Limits

The 1:1 formula is rather risky, so extra measures are needed to prevent the megapool from draining, should some of the tokens depeg.

Hence, we introduce trust factor (TF), which is measured in percentage and can have any value from 1% to 500%. Using TF, the limit of each token in the megapool can be measured:

limit(t1) = TF(t1) / sum(t),

If t1 reaches its limit, it can’t be used to provide liquidity or sold to the pool.

For instance, there are DAI, BUSD, USDT and USDC in the pool. All of them have a trust factor (TF) = 200%. So, the limit for every token would be 200% / 4 = 50%. This means that the total share of the token in the pool can’t be more than 50% at any given time. In practice, this means that if, let’s say, USDC depegs to 0, megapool LPs won’t lose all their value and their exposure will be 50%.

Example: DAI, BUSD, USDT and USDC have 200% TF each, current balances in the pool are 100K, 100K, 100K, 300K. As we can calculate, the share of USDC in the pool is so far 300K/600K = 50%. According to its TF, the share’s limit is 50%. Thus, no more USDC can be sold or provided as liquidity to the pool.

Outro

Despite being rather risky compared to stablecoin pools utilising Curve.fi model, the proposed pools seem to be a perfect fit for the current setup on the Waves blockchain, where multiple stablecoins need to be traded between each other. If you take a look at the Pepe Bridge project, there will be about 12 stable USDs: BUSD,USDT,USDC,DAI on 3 chains. The Puzzle stable pool might be a good place for both traders and liquidity providers to spread these tokens.

A similar model was successfully utilised on one of the most successful DEXes on Avalanche blockchain called Platypus Finance, which has $40M in TVL as of the moment of writing.

_

Prototype smart contract is already published on the Waves Mainnet and Github.

Follow us on social media to make sure you don’t miss further updates! Thanks for staying with Puzzle.

_

Sources:

Platypus Finance whitepaper

Curve.fi whitepaper

Uniswap V3 whitepaper

_

Puzzle Chat: t.me/puzzle_network

Puzzle Announcements: t.me/puzzlenetworknews

Puzzle Twitter: twitter.com/puzzle_network

--

--

Puzzle Network

DEX 2.0 built on Waves to support mega pools and bring a new light to DeFi experience 🧩🏆