DA0-DA0 / dao-dao-ui

InterChain DAO tooling UI.
https://daodao.zone
27 stars 21 forks source link

Compute Current Liquidatable Value (CLV) for tokens, not total value locked (TVL) #952

Open 0xekez opened 1 year ago

0xekez commented 1 year ago

as a DAO, i care little about my treasuries TVL outside of it being a vanity metric. what i care about is how much spending power my treasury grants me in terms of stable coins.

when displaying $USDC values in the DAO treasury page, we should do the AMM math and show TLV. we should do this across Osmosis and Junoswap liquidity pools.

there is complexity here if the token has multiple base pairs. for example, say there is a function TLV(token, pool) which calculates the TLV of a token in terms of USCD. If a token has TOKEN/USDC and TOKEN/OSMO pairs there is a recursive step where the TLV is TLV(TOKEN, TOKEN/USDC) + TLV(TLV(TOKEN, TOKEN/OSMO), OSMO/USDC) (naturally, if osmo has multiple base pairs, we also need to consider that so the recurrence here has a tree structure).

elsehow commented 1 year ago

Love this idea; memorializing some thoughts I shared with you out-of-band, plus a few new ones.

  1. I agree with you that it's critical that we only look at liquidity pools. A DAO (as a DAO) can only use LPs to liquidate - using a centralized exchange would require the custody of a DAO member. We can't in good faith consider that.
  2. I don't think stablecoins are important per se - I think what's important is that the number we compute has a unit - specifically, a currency against which we're comparing it. That number could be USDC, or it could be JUNO, or anything else - what's important is that we're asking what a DAO could turn its treasury into, a question that always requires a specific target currency.
  3. From (1) and (2), I deduce that we should never find an honest version of this figure in actual fiat; only in stablecoin at best.
  4. The tricky part here seems to be what you identified; we may need multiple swaps. I actually wrote a program a few years ago that modeled exchanges as a graph of relationships between assets, where edges represented markets/LPs (modeled either as an order book or a liquidity pool). We may want to consider reviving that software!

Finally, a nit. For ergonomics, I find TLV too similar to TVL. People could mistake one for the other on scan. I suggest CLV: current/contemporary liquidatable value. This metric is a snapshot in time of what a DAO could have liquidated. It also keeps the acronyms more distinct.