Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divergence protocol specification for DEX #14

Open
faffyswap opened this issue Jul 7, 2023 · 2 comments
Open

Divergence protocol specification for DEX #14

faffyswap opened this issue Jul 7, 2023 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@faffyswap
Copy link
Contributor

faffyswap commented Jul 7, 2023

Starting testing against a DEX makes it much easier for us. Indeed we don't have to deal with all the complexity associated with limit order books, hence allowing us to focus on the divergence tax mechanism in this first iteration.

  • Understand how the divergence protocol works
  • Determine when we apply the tax (before or after trade execution)
  • Identify potential issues with the trade execution / DEX
  • Determine an algo compatible with a DEX
  • Determine the outputs to report
@faffyswap
Copy link
Contributor Author

faffyswap commented Jul 8, 2023

One of the main issue we're hitting revolves around arbitrage.
If you tax or prevent people from selling, then price does not move. But you also prevent market activity. Basically you're just closing the shop.

As @413x45h4w mentioned that's perhaps why TFL ended up tweaking the algo parameters during the crash. It might seem counterintuitive but they were trying to keep markets functioning.

Problem of how the divergence tax is specified in the proposal is that it makes it not easy to deal with:

  • You lower the price aggressively for shorts wen depeg
  • Which means you'll also prevent arbers from arbing and basically your pools from functioning
  • Obviously also lowering volume and hence transaction fees
  • But also protecting against IL and further depeg
  • You basically do nothing, shop is closed

Below is an implementation proposal whereby we'd allow everything to happen as usual. But would then tax the output.
This solves a lots of technical issues, but is not as effective as described in the prop.
Seems like a good place to start though.

Long story short:

  • Arber trying to short 1M$ from 0.80$ on the DEX to buy back at 0.60$ on CEX
  • We let that happen
  • Trade generates 200k$ profit
  • We get 40k$ profit back and arber gets 160K$ profit
  • We can ofc be more aggressive with the tax / try different values or formulas (and I just learned that formula has 2 plural forms, formulas or formulae 😅)

image

@RedlineDrifter
Copy link

It's important we determine how trading fees are applied and collected across the various DEXs and CEXs if they are to be included with the divergence protocol.

  • DEXs which operate similar to Uniswap V1 and V2 will NOT be compatible with the divergence protocol as it could cause their liquidity providers to run heavy losses.

  • DEXs which use concentrated liquidity like Uniswap V3 and Pancakeswap are compatible.

  • DEXs which use orderbooks such as dYdX are compatible.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Development

No branches or pull requests

4 participants