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

Proposal: ensure symmetric ratios for orderbook #1766

Closed
wants to merge 1 commit into from

Conversation

lemunozm
Copy link
Contributor

@lemunozm lemunozm commented Mar 11, 2024

Description

We want to avoid issues with asymmetric prices, ensuring we only work internally on-chain with symmetric prices.

This is a simple proposal to achieve this while maintaing the Oracle requirement:

  • Any feeder can feed anything without restrictions at that point.

How it works:

Order book will only look for ratios when the first currency argument is "less" than the second currency argument. It means the currency value compared by PartialOrd is less than the second one. If the asking price is the inverse, then orderbook will compute the reciprocal ratio. It means that feeders must feed using first the currency with "less" value in the ConversionRatio(CurrencyId, CurrencyId) type in order to be a valid ratio used in orderbook.

Possible problems:

  • Can UI easly determine currency_a < currency_b?
    • I think it could, first checking variant order and later checking variant value (which is always an integer).

@lemunozm lemunozm added I3-annoyance The code behaves as expected, but "expected" is an issue. P2-nice-to-have Issue is worth doing. labels Mar 11, 2024
@lemunozm lemunozm self-assigned this Mar 11, 2024
@lemunozm
Copy link
Contributor Author

Not required by now

@lemunozm lemunozm closed this Mar 26, 2024
@lemunozm
Copy link
Contributor Author

Would we want this @mustermeiszer?

@mustermeiszer
Copy link
Collaborator

Not for now I think. Not in the order book at least

@lemunozm lemunozm deleted the orderbook/ensure-symmetric-ratios branch March 26, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I3-annoyance The code behaves as expected, but "expected" is an issue. P2-nice-to-have Issue is worth doing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants