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

Feat: Reintroduce segmented fees #455

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Feat: Reintroduce segmented fees #455

wants to merge 2 commits into from

Conversation

kinrezC
Copy link
Contributor

@kinrezC kinrezC commented Apr 26, 2024

  • reintroduces the concept of fee segmentation if invariant should be pushed > 0 in a swap
  • removes the priorityFee, pool controller no longer pays a priority fee but is still able to update params

The fact that the invariant was being pushed > 0 was almost certainly the root cause of the contracts breaking. By bounding the invariant you can insure that you will not reach the boundaries of the ppf (0, 1).

* k = Φ⁻¹(y/K) - Φ⁻¹(1-x) + σ√τ
* y = KΦ(Φ⁻¹(1-x) - σ√τ + k)
* x = 1 - Φ(Φ⁻¹(y/K) + σ√τ - k)

Note that in the above invariant the y reserve increases along with K leading to a scenario where the curve is trivially pushed to Φ⁻¹(y/K) where y > K thus breaching the ppf bounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant