🧵/ @astroport_fi has been billed as a next-gen Automated Market Maker and is one of the most exciting projects coming to @terra_money

But what makes this AMM different?

✦ Astroport combines features from @Uniswap, @CurveFinance, and @BalancerLabs to create a unified super-AMM
1/ Astroport's AMM will offer 3 types of Liquidity Pools that each serve a specific function:

✦ Constant Product Pools
✦ Stableswap Invariant Pools
✦ Liquidity Bootstrapping Pools

This thread goes medium-depth about the mechanics of each pool type that @astroport_fi offers
2/ Before we dive deeper in to each pool type, let's start with the basics

A familiarity with these terms and a brief history of Decentralized Exchanges (DEXs) will help to convey the enormous scope of the Astroport team's ambitions
3/ History

In the early stages of Defi, all the way back in 2018 (we're early guys 😉), the crypto community was seeking ways to escape the fees and centralized nature of of CEXs (Centralized Exchanges) like Coinbase, Binance, and others
4/ Decentralized Exchanges, or DEXs, that utilized the CEX order book were popular at the time to facilitate P2P exchanges

However, the order book model was incredibly inefficient for decentralized P2P trading at scale, resulting in illiquid token markets and disuse
5/ Liquidity Pools

In 2018 @Bancor introduced the concept of liquidity pools, offering an alternative to P2P trading
6/ A Liquidity Pool is a pool of paired assets of equal value that allows for trading of each individual asset in a Peer-to-Contract AMM model

Example: if $LUNA is trading at $50, a balanced LUNA-UST pool would be 20 LUNA and 1000 UST
7/ s/o to @finematics 🚀
8/ What is an AMM?

An AMM is an algorithmically priced and executed DEX

The most popular DEXs in Defi today all utilize the AMM model including @Uniswap, @SushiSwap, @PancakeSwap, @mangomarkets
9/ xy = k

Uniswap popularized AMM trading with the introduction of Constant Product Pools which utilize the xy=k price curve for paired assets in 2018

This formula allowed for the creation of the defi infrastructure we see today and is a pivotal moment in cryptocurrency history
10/ xy = k

This formula simply means that the reserves of Token X and the reserves of Token Y in the LP will always multiply to a constant, k
11/ How does an AMM work?

In an AMM, the first liquidity provider (LP) sets the price for each asset in the pool and is incentivized to provide equal dollar values of each, like in our LUNA-UST pool example above

The first LP is usually the protocol team
12/ When the initial LP sets the price of each asset in the pool, the relative prices are theoretically arbitrary

However, the value of each will quickly come to match the real-world Fair Market Value (FMV) of the assets by way of arbitrage opportunities
13/ AMM Arbitrage

Any deviation by the AMM from the FMV price of each asset creates a profitable opportunity for arbitrageurs to buy an asset from the pool and sell it on a CEX or alternative DEX for a profit

This automatically brings the pool back into FMV balance
14/ Arb Example (not accounting for slippage)

Assume the following

Pool of 20,000 LUNA (x) and 1M UST (y) for a k value of 20B

Astro(AMM DEX) LUNA Price: $50.0

KuCoin(CEX)/FMV LUNA price: $50.1
15/ Arbitrage

If the CEX price of LUNA is $50.1, but it's available on Astro at $50.0, arbitrageurs will purchase LUNA from Astro and sell LUNA on the KuCoin as long as it is possible to do so, making money on the spread
16/ Arbitrage
17/ This arb opportunity exists as long as LUNA DEX price < CEX price

This can be calculated as follows:

$50.1/$50.0 = 1.002

1.002 - 1 = 0.002 = 0.2% total delta

0.02%/2 (# of assets in the pair) = 0.01% change in reserves for both assets in opposite directions to keep xy=k
18/ Because the opportunity exists to profitably buy LUNA, the reserves of LUNA will go down. The arb'er will purchase LUNA up to:

20,000 LUNA in the pool /1.001 = 19,980.02 LUNA remaining in the pool
19/ This means that the arb'er will buy 19.98 LUNA at $50 each for a total of ~$999, selling it on a CEX for $1001

Making $2 on the spread
20/ Oppositely, the UST reserve quantity will increase by 1.001 times in order to maintain xy=k

1M UST x 1.001 = 1,001,000 UST

The pool is now rebalanced at 1,001,000 UST (y) x 19,980.02 LUNA (x) = ~20B (k)
21/ ✦ Constant Product Pools (CPPs)

CPPs utilize the xy=k curve from the example above

They are the most widely used pool type and are the best way for AMMs to facilitate trades between relatively volatile assets as they are simple and adaptable to large market swings
22/ Constant Product Pools are the backbone of defi's most popular AMMs, including @Uniswap, @SushiSwap, @PancakeSwap, and is the pool type offered on @terraswap_io and @loop_finance
23/ ✦ Stableswap Invariant Pools

@CurveFinance realized that the xy = k model is inefficient for trading assets of a similar value such as assets in a UST-USDT or LUNA-bLUNA pool

The pool size required to achieve reasonable slippage between stableswaps is unfeasible via CPP
24/ Curve created a new model that operates between Constant Product Pools (CPPs)(xy=k) and Constant Price Pools (C$Ps)(x+y=D)

The stableswap invariant curve acts like a C$P between certain price ranges, allowing for little to no slippage between stable assets
25/ Stableswap invariant (SSI) pools utilize an amplification parameter (A) that determines how closely the curve mirrors that of either the CPP curve or the C$P curve

Higher values of A push the SSI curve closer to that of a C$P, resulting in a 1:1 exchange within a range
26/ D is a constant that represents the total number of tokens in the pool when token X and token Y have equal price

When A = 0, the SSI formula is identical to that of a CPP
27/ However, as A approaches infinity, the SSI curve becomes more and more identical to that of a C$P

This allows the SSI curve to be able to facilitate trading with minimal slippage within a range, while also giving it the flexibility to accommodate trades at the extremes
28/ You can read more about the Stableswap Invariant formula from the Curve whitepaper, here:

curve.fi/files/stablesw…
29/ ✦ Liquidity Bootstrapping Pools (LBPs)

An LBP is a token launch mechanism created to prevent bot front-running/sniping, promote fair access, and lower the amount of initial capital required to achieve reasonable slippage in an AMM IDO
30/ First introduced by the team at @BalancerLabs, LBPs work by adjusting the relative ‘weights’ of the two pooled tokens

The price is slowly lowered, spreading price discovery over a longer period as participants wait for a fair price to buy
31/ LBPs can be thought of as an AMM "Dutch auction"

Because the price of the token goes down gradually, there is little to no benefit to front-running the launch
32/ However, buying/selling activity increases/decreases the price of the asset in a way that alters the theoretical price path of the token shown in the curve above, coming to more closely resemble the path in the graph here:
33/ The LBP equation is a version of the constant product pool equation that allows for different weights applied to each token

Here Wx and Wy refer to the respective weights of token x and y

When Wx and Wy are both equal to 0.5, the LBP curve is identical to that of a CPP
34/ For a given balance of reserves, a weight of Wx > 0.5 results in a higher price for token X
35/ Example: if $ASTRO were to launch via LBP consisting of ASTRO-UST and Wx of $ASTRO > 0.5, this means that significantly less UST would be required to create meaningful liquidity and distribution for $ASTRO at launch
36/ You can read more about @BalancerLabs vision for Liquidity Bootstrapping Pools here
37/ In addition to the 3 pool types laid out in this thread, $ASTRO stakers will be able to add more pool types in the future via governance
38/ @lukedelphi has already suggested the ability for Astroport to integrate with Mirror to allow for a modified version of SSI pools to facilitate trades of relatively non-volatile assets (FAANG stocks) with reduced slippage
39/ This is just a single example of the new and innovative pool types that #lunatics will propose in order to make @astroport_fi the best DEX in all of Defi
40/ While this thread has covered just the different pool types available in Astroport, there are numerous other #LUNAtics that have given a more well-rounded overview of the protocol's tokenomics, roadmap, and vision
43/ @astroport_fi will be launching via a liquidity lockdrop beginning December 6th. You can read more about the 💧🔒 mechanism below:
44/ Incredibly excited for Astroport, a project that I believe will open the @terra_money ecosystem up to all of Defi
45/ S/o to some of the Terra gigabrains out there for exposing me to this ecosystem

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with aUSTin Suhr

aUSTin Suhr Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @austinsuhr

27 Oct
1/ With #TerraAutumn🍁 here, I'm diving into one of the ecosystem's most promising projects, @mars_protocol

Why am I so excited about Mars?

Mars provides two fundamental improvements to existing defi money markets:

✦ Uncollateralized Lending
✦ Dynamic Interest Rate Model
2/ Let's take a deep dive into Mars and how it works

TLDR: 🦧🔴

nfa
3/ Mars aims to be a decentralized bank controlled by its users and stakeholders

"Mars is a bank of the future: non-custodial, open-source, transparent, algorithmic and community-governed"
Read 36 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Thank you for your support!

Follow Us on Twitter!

:(