ripple-lib-extensions
ripple-lib-extensions copied to clipboard
What's the point of having XRPValue and IOUValue?
I thought the unit of XRPValue was drops. But it is not.
The only difference this makes is that when either of them is multiplied or divided by an XRPValue, that XRPValue is turned into drops before actually doing the multiplication or division. And this is not right.
Amount.prototype.ratio_human from the old ripple-lib core api had to work around this by multiplying the numerator by 1e6 if the denominator is XRPValue. This doesn't make sense to me.
And multiplying an IOUValue by 1e6 can cause the resulted value exceeds the max value for IOUValue.
However, I did find that in some places the unit is drops. For example, in the data returns from ripple-lib-orderbook's trade event.
But the fact that XRPValue is turned into drops before doing multiplication or division seems to suggest that it should not be in drops.
This is super confusing.