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

[bug]: Decimals cause the Price Oracle to have significant price deviations or failures. #1098

Closed
lukegao209 opened this issue Aug 21, 2024 · 4 comments · Fixed by #1059
Closed
Assignees
Labels
bug Something isn't working needs triage
Milestone

Comments

@lukegao209
Copy link
Contributor

When Assets have decimals, for example, USDT with 5 decimals, and BTC/USDT = 60,000,
then 1 unit of USDT = (1 BTC Sat) * 1,000 (msat) / (Price * decimal)

1 unit USDT = 100,000,000 * 1000 / (6000 * 100000) = 16.667 mSat.

Since the PriceOracle cannot return values below 1/1000 sat, after rounding, the result will be 17 mSat, the resulting price deviation can be quite significant.

For assets with more decimals or lower prices, it may no longer be possible to return 1 mSat.

if AssetA = 0.01 USDT , So 1 unit AssetA = 0.16667 mSat.

As a solution, since subject_asset_max_amount is already provided in the QueryRateTickRequest, could the Price Oracle return the total value instead of the unit price for the asset, thereby avoiding the issue described above?

@guggero
Copy link
Member

guggero commented Aug 21, 2024

This will be addressed by #1059 (and the changes following from it).

@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Taproot-Assets Project Board Aug 21, 2024
@dstadulis
Copy link
Collaborator

Will reopen issue and close once #1059 is merged

@Roasbeef
Copy link
Member

I think let's keep this open until #1117 (or the updated version of it) is merged.

@Roasbeef Roasbeef reopened this Sep 16, 2024
@Roasbeef
Copy link
Member

Fixed now with the latest RFQ revamp which will be release alongside v0.4.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
Status: ✅ Done
4 participants