Tarun Chitra Profile picture
Jul 22, 2021 13 tweets 7 min read Read on X
⚠️ It’s 📰💧 time of the month again 🚨

Don’t want to read 100s of pages of CFMM literature? 

You’re in luck! We review the known theory of CFMMs (plus some new goodies!) for an upcoming *textbook* chapter on crypto + DeFi w/ two new authors:

(Paper: stanford.edu/~guillean/pape…)
First: Who are they?

Stephen Boyd is a renowned @Stanford researcher known for his oft cited textbook, multitude of INFORMS/IEEE awards, and advising BlackRock on convex analysis for manage trillions of dollars

He’s also @guilleangeris’s PhD advisor!

en.wikipedia.org/wiki/Stephen_P…
. @akshaykagarwal just defended his PhD under Boyd and is known for his work on visualizations of embeddings via his open-source package PyMDE (minimal distortion embedding)

He’s also a core developer of cvxpy (quant traders ♥️ him) and previously worked on TensorFlow 2
Unlike our other papers, which assume knowledge of crypto, DeFi, + convex analysis, this book chapter is pedagogical + from first principles 

Goal: Quant-y undergrads who know Multivariable Calc and Linear Algebra (with proofs, like Lang) *should* be able to pick up CFMM theory
We also show a few new nifty features of CFMMs

1/ Simplified proofs

a. Round-trip trades always lose (path deficiency)
b. Liquidity Provider (LP) share value ∝ ∇ϕ(R)’R [= ϕ(R) for 1-homogeneous functions; surprisingly simple!]
c. Input + output portfolios disjoint
2/ Explicit formulas for add/remove liquidity

Previous papers assumed reserves were constant

We provide a connection between the trading function gradient and the change to liquidity ▶️ helps improve concentrated liquidity formulas (e.g. @Uniswap V3)

e.g. result below:
3/ Exchange Functions

Our curvature paper only showed properties of liquidity (e.g. curvature at fixed reserve) are too state dependent

We elucidate some properties of changes to liquidity via _exchange functions_ which turn out to be concave/convex (*w/o* metric properties)
Their metric properties, which do depend on a particular parametrization and reserve, are shown to be easily computed numerically

This, again, is very useful for measuring impact to concentrated liquidity (e.g. you can extend by linearity exchange functions to piecewise convex)
Finally, exchange functions generalize the invariant calculation done by @CurveFinance to general CFMM curves

There's a simple Newton iteration (gradient descent) for computing trade size from exch. functions

[Remember when @samczsun found a bug in curve's Newton iteration?]
4/ Expected Utility Portfolio

We provide some LP strategies for different utility functions

If we view an LP’s contribution to a CFMM pool as a portfolio allocation, we explicitly find both linear and Markowitz convex programs for how to optimize LP allocation
These are *easily* solved on a laptop and we numerically show how LP allocations change as a function of risk-aversion (cvxpy code included!)

This should hopefully lead to more principled LP allocation (e.g. useful for @CharmFinance, @mellowprotocol, @sommfinance)
We hope that a clean presentation of these results can make the field more assessable to folks in theoretical CS, ML, statistics, and other quantitative fields

But what’s next? You’ll have to wait until next month ✌🏾

Paper: stanford.edu/~guillean/pape…
Oops wrong tag: I meant @akshaykagrawal 🙈🙈🙈

• • •

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

Keep Current with Tarun Chitra

Tarun Chitra 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 @tarunchitra

Mar 6
Three items are behind a wall and a solver is going to get one of them for you

Do you get a goat or a car, anon?

@malleshpai, @ks_kulk, @theo_diamandis and I show you that if solvers have to do more work to deliver the item to you, they're not going to show up to the auction https://arxiv.org/abs/2403.02525
There’s been a lot of talk about `intents’. What are they?

Simply put: they're markets for transaction execution where third parties called solvers compete to satisfy user orders (and any constraints those orders come with)

Question: What are the principal-agent problems here? Image
tl;dr: We find broad conditions for oligopoly in intent markets

What is oligopoly here?
1. Fewer bidders, k, than the maximum possible, n, participate (i.e. k/n → 0 as n → ∞ or k=o(n))
2. Users get *worse* prices even though the number of (potential) solvers increases! Image
Read 20 tweets
Jan 16, 2023
While @artgobblers isn't exactly my cup of tea, the novel NFT auction mechanism ford is cool from an auction theory perspective— but is it incentive compatible (IC) for both buyers and sellers?

tl;dr: It is *not* IC but can be modified to be IC!

people.eecs.berkeley.edu/~ksk/files/GDA…
Quick recap: A gradual dutch auction (GDA) is a sequence of n auctions whose initial prices a_1 < ... < a_n are increasing but where the price of an auction decays as a_i * p(t) where p is non-increasing (e.g. p(t) = exp(-t) in the original paper)

paradigm.xyz/2022/04/gda
Why would you use such an auction? If you have a series of NFT auctions (e.g. an edition, a daily @nounsdao auction, etc.), you want to incentivize users to pick bundles (e.g. any subset of items to buy) without forcing all of the supply on the market (reducing auction revenue)
Read 27 tweets
Nov 16, 2022
As someone way less cynical I’d counter with:

1. Winning mechanisms in DeFi come from where you don’t expect (e.g. Uniswap vs. bad copies of TradFi products badly)
2. MEV-aware designs take advantage of FHE/ZK improve efficiency/costs
3. Treasury management isn’t just a meme
Simplified definition of capital efficiency:

max amt of capital used for risk bearing ops / amount of locked capital needed to support those operations

DeFi: denominator is larger than it is in TradFi due to permissionless/censorship resistance

What’s missing to close the gap?
In traditional finance, the denominator can be split into:

capital available = capital from lenders / SPV / LPs + capital from the principal (yes, your GP commitment, Mr./Ms. underwater crypto VC)

Right now, DeFi protocols contribute 0 to the latter so LPs bear the capital cost
Read 14 tweets
Nov 11, 2022
The most amazing thing in the filings is how abysmal centralized lenders (incl. exchanges) were at 2 critical functions:
1. Dynamically setting loan-to-values
2. Liquidating bad loans

It’s embarrassing that @gauntletnetwork’s weekly DeFi governance proposals are faster than CeFi
The fact that Voyager never liquidated FTT or SRM and that exchanges were sitting on so much GBTC and *still* didn’t decrease loan-to-values for their largest customers is insanely irresponsible risk management — and it is 100x easier to adjust this as a CeFi lender than in DeFi
Even more embarrassing is the fact that most CeFi lenders didn’t do (as far I can tell) their own liquidations of collateral — they would simply send it to an OTC broker (like Alameda — who probably liquidated their own loans!) and hope things checked out 🫡
Read 6 tweets
Oct 12, 2022
One funny thing about DAO governance is that it makes it hard to manage assets held by a collective (why vote to sell the asset you're voting with?) — but for many collectives, asset management is more than pure yield optimization

Can we do better with a return to futarchy?
The goal of Aera is to make it possible for decentralized, censorship resistant treasury management to make it possible for DAOs to hedge their portfolios according to their own KPIs, goals, and objectives while also seeding new protocols with liquidity in a positive sum manner Image
I've spent a lot of time trying to understand why futarchy didn't work (I'd recommend this @VitalikButerin's post from 2014 for an intro) and tried to figure out if we've learned enough from DeFi over the last 3 years to overcome those failures

blog.ethereum.org/2014/08/21/int…
Read 10 tweets
Aug 18, 2022
🚨New Paper Alert🚨

There have been a number of proposals for sharing MEV revenue between particular block producers and the rest of the (staked) network. But is it safe?

@ks_kulk and I show there can be *positive externalities* from MEV redistribution!

people.eecs.berkeley.edu/~ksk/files/MEV…
What is MEV redistribution (also called MEV smoothing)?

💡: MEV profits split w/ x% go to all stakers and 100-x% to the validator themselves

Impossible to do in PoW, possible to do in PoS via Proposer-Builder Separation (see @ObadiaAlex/@taarushv's post) hackmd.io/@flashbots/mev…
Why would a validator agree to this & make off-chain agreements (OCAs) to avoid paying x%?

1. PBS makes this expensive (see @VitalikButerin’s heuristic analysis)
2. Restaking (@eigenlayer) enforce redistribution while reducing variance for validators

notes.ethereum.org/@vbuterin/pbs_…
Read 12 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

Don't want to be a Premium member but still want to support us?

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

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(