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

Add Rate Slippage Per Token for Provider Orders #398

Open
chibie opened this issue Jan 23, 2025 · 7 comments · May be fixed by #415
Open

Add Rate Slippage Per Token for Provider Orders #398

chibie opened this issue Jan 23, 2025 · 7 comments · May be fixed by #415

Comments

@chibie
Copy link
Contributor

chibie commented Jan 23, 2025

User Story
As a provider, I want to set a slippage percentage for each token I offer, to have more granular control over price fluctuations and protect my margins per currency pair.

Acceptance Criteria

  1. GIVEN a provider is updating a token's settings
    WHEN they include a rate_slippage value
    THEN the value is saved as a decimal on that ProviderOrderToken

  2. GIVEN a provider retrieves their profile
    WHEN viewing token details
    THEN they can see the rate_slippage value for each token

  3. GIVEN a provider configures a new token
    WHEN no rate_slippage is specified
    THEN it defaults to 0

  4. GIVEN a provider configures a new token
    WHEN the rate_slippage is more than 20% of the currency market rate
    THEN it returns an error message

  5. GIVEN a lock payment order is being assigned
    WHEN checking rate matches with providers
    THEN use the provider's token-specific slippage instead of hardcoded 0.5

Tech Details

  • Add rate_slippage field to ProviderOrderToken entity schema using decimal.Decimal type
  • Update the token handling section in UpdateProviderProfile to process rate_slippage
  • Update GetProviderProfile to include rate_slippage in token response data
  • Add rate_slippage to ProviderOrderTokenPayload type
  • Update AssignLockPaymentOrder in PriorityQueueService to:
  • Query provider's token slippage during rate matching
  • Use token slippage instead of hardcoded 0.5 value
  • Handle case where token has default 0 slippage
  • Add error logging for slippage lookup failures

Notes/Assumptions

  • The field should allow only positive values
  • Existing ProviderOrderTokens will have rate_slippage defaulted to 0
  • rate_slippage must be <= 20% of the market rate of the fiat currency

Open Questions

  • Should we have a system-wide default slippage if token slippage lookup fails?
@chibie chibie changed the title Add Rate Slippage for Provider's Local Currency Rate Add Rate Slippage Per Token for Provider Orders Jan 23, 2025
@Amizeey
Copy link

Amizeey commented Jan 23, 2025

Let me handle this issue!

@Supa-mega
Copy link

May I handle this issue? first time contributor

@caxtonacollins
Copy link

I'd like to handle this task.

@Emeka000
Copy link

Would love to tackle this!

@Atanda1
Copy link
Collaborator

Atanda1 commented Jan 30, 2025

@caxtonacollins Are you still gonna work on this? Or, should I reassign it?

@gelluisaac
Copy link

Can I jump on this task?

@JuViquez
Copy link

JuViquez commented Feb 3, 2025

Can I try solving this issue?

@sundayonah sundayonah self-assigned this Feb 4, 2025
@sundayonah sundayonah linked a pull request Feb 4, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants