Replies: 1 comment
-
Thoughts:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The current scheme for encoding exchange rates for a trade is to find an atomic unit that works such that exchange rates can be encoded as an integer (the message rate) via use of a
RateEncodingFactor = 1e8
. For example, trading 100 atoms of base asset DCR for 10 atoms of quote asset BTC, would give a message rate of10 / 100 * 1e8 = 1e7
. This mitigates floating-point error that might accumulate during encoding and decoding to and from msgjson types. But this scheme has some limitations. We've already seen this in our EVM assets, where we can't use the real atomic unit,1 Wei = 1e-18 ETH
, and instead we have to use our own "atomic unit"1 Gwei = 1e-9 ETH
. This actually creates a lot of headaches for us as we have to carefully handle conversions in our wallet and server backend packages.So... Should we switch to another scheme? I think the obvious one is to use big types in Go, and encode to
string
in JSON.This change would echo through everything. It's not trivial. But if it's the right move, I think we should. Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions