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

refactor prices+fees #259

Open
wants to merge 1 commit into
base: 0.7.0
Choose a base branch
from
Open

Conversation

henopied
Copy link

@henopied henopied commented Jan 20, 2025

Motivation

I noticed some inconsistencies with how pricing and fees work between different AMMs. This PR aims to unify them and solve a couple bugs I spotted.

Solution

  • All fees (except balancer) are specified to 1e6 (Uniswap v3 standard) as base
  • Fees are now included in costs
  • Removed fixed point calculations and replaced with f64 directly
  • Balancer fee must be u64 (bug fix)
  • Consistent error type for unsupported tokens
  • Uniswap v3 had the spot pricing backwards
  • Fix Uv3 price #257

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

- All fees (except balancer) are specified to `1e6` (Uniswap v3 standard) as base
- Fees are now included in costs
- Removed fixed point calculations and replaced with f64 directly
- Balancer fee must be u64 (bug fix)
- Consistent error type for unsupported tokens
- Uniswap v3 had the spot pricing backwards
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