You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a reason not to implement From<DecimalRangeExceeded> for StdError? Doing so would remove the requirement to map the error. If we do this we should also remember to do it for Decimal256RangeExceeded, SignedDecimalRangeExceeded and SignedDecimal256RangeExceeded.
Is there a reason not to simply implement From<Uint128> for Decimal, etc? I assume almost everyone doing these conversions are interested in doing from_atomics(x,0) rather than from_atomics (x,18) so it would be a good choice in my opinion.
The text was updated successfully, but these errors were encountered:
Thanks for bringing this up again. I think it got kindof lost for no good reason.
Here is my latest cheat sheet. Turns out there is no good reason other than from_atomics(n, 0) is doing the job. But I agree, there can be a TryFrom implementation doing that. @aumetra could you look into that?
Regarding the error type: no strong reason other than adding everything to StdError got a bit ugly over time.
As mentioned in the below comment:
Decimal256::from_atomics(weight,0).map_err(|e| StdError::generic_err("Decimal256RangeExceeded"))?
Originally posted by @FrankBoltzmann in #1186 (comment)
I have two questions here:
From<DecimalRangeExceeded>
forStdError
? Doing so would remove the requirement to map the error. If we do this we should also remember to do it forDecimal256RangeExceeded
,SignedDecimalRangeExceeded
andSignedDecimal256RangeExceeded
.From<Uint128>
forDecimal
, etc? I assume almost everyone doing these conversions are interested in doingfrom_atomics(x,0)
rather thanfrom_atomics (x,18)
so it would be a good choice in my opinion.The text was updated successfully, but these errors were encountered: