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
Mainnet: OPUL/ALGO Pool Returning Wrong Quote #13
Comments
I think the issue here is due to the differing number of decimals per asset. All amounts and prices in the SDK are expressed in terms of the microunits of the assets. The prices/amounts you see displayed in the Tinyman UI are adjusted according to the defined number of decimals for the asset. All internal calculation on the blockchain and in the SDKs use the microunit integer representation. When you write Opul has 10 decimals so 1000 in microunits for example is actually 0.0000001 Opul. While the display price or ratio between the assets might be 1:0.2955 the actual ratio of their microunits could be 1:2955 due to the difference in the number of decimals. |
Hi, this seems to be an issue in v1.1. I understand @fergalwalsh's comment on differing decimals and "adjust" for this after I get the quote from the pool, but it seems that |
@albertshin, Can you please share an example? It would be great to share an example code with expected and real values. Sorry, you have already did. |
Microunits don't have an decimal place. Microunit should be an integer, so your expectation
I think, you don't need to consider decimal place in this calculation, since microunits don't have an decimal place. |
I see what you mean. Re-reading Fergal's original reply that everything is expressed in microunits makes more sense now. Thanks! |
Running the following on mainnet:
returns, for example, 2955 as
quote
.In reality, this is actually 0.2955, so the quote is actually is off by exactly 10000 for some reason.
The text was updated successfully, but these errors were encountered: