🚨 1/ The recent @warpfinance hack is the result of using vulnerable @UniswapProtocol 🦄 LP token prices.

The attacker was able to drain ~$7.8M worth of $DAI for smaller collateral.

#AlphaHomoraV2 uses a different LP pricing method that is safe against such attack vector. 👇
2/ The LP token pricing used is prone to the typical flash loan sandwich attack vector:

➡️ Flash loan and skew reserves
➡️ Fake LP price
➡️ Repay flash loan
➡️ Profit

So, how do we price an LP token in an unmanipulatable way?

Answer: **FAIR LP PRICING**
3/ What makes the **FAIR LP PRICE** safe from attacks?

There are two major components to the fair LP price that make the price safe:

① Fair Asset Prices
② Fair Asset Reserves
4/ Fair Asset Prices

There are many existing solutions to this, including
➡️ Decentralized price oracles e.g. @chainlink, @BandProtocol
➡️ On-chain oracles e.g. @kp3r_network
➡️ Centralized feed from e.g. @coingecko, @CoinMarketCap, @CryptoCompare
5/ Fair Asset Reserves

Leveraging on the fact that Uniswap’s spot price is the proportion of the underlying asset balances, we can work backwards the fair assets’ reserve ratio.

Together with the LP totalSupply, we can find the underlying assets’ fair reserves.
6/ The Formula !@#$%^&*()_+

Combining the Fair Asset Prices and Fair Asset Reserves, we get the following formula:
7/ This solution has already been implemented on Alpha Homora v2 contract, and we'd like to share with our community.

💻 Checkout our code here: github.com/AlphaFinanceLa…
8/ 📚 Or read in more details here: blog.alphafinance.io/fair-lp-token-…

If you have any questions, join our discord here to continue the discussion: discord.gg/BVtaG7s

• • •

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

Keep Current with Nipun | Alpha

Nipun | Alpha 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!

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 Become our Patreon

Thank you for your support!

Follow Us on Twitter!