Closed snd closed 6 years ago
Existence of this functions is related to #6 - ethabi doesn't use proper numeric types, so we need to do conversions ourselves.
*_to_wei
is pretty verbosesol::Wei::from_ether(5)
instead?
I would avoid trait since it has to be imported.
which trait are you referring to?
sol::Wei::from_ether(5)
i like it. it's understandable without additional context which ether(5)
isn't imho. sol::unit::ether_to_wei(5)
seems similarly verbose though. maybe sol::from_ether(5)
? makes clear that it's converting from ether and one can guess that it's converting to wei.
which trait are you referring to?
Sorry for some reason I interpreted your enum proposal as trait.
I'd prefer to keep the wei
and not pollute sol
interface:
sol::wei::from_ether(5);
// or
use std::wei;
wei::from_ether(5);
i really like that. can i go ahead and implement this? are you ok with the from_*
functions taking a T: Into<U256>
. then one can pass in byte arrays, u64, etc directly.
Sure, go ahead.
resolved in https://github.com/paritytech/sol-rs/pull/18
there are some unit conversion functions in
sol::unit
: https://github.com/paritytech/sol-rs/blob/aed4bb377db6bf7459e5ee3792e1d7cddfb45cef/solaris/src/unit.rsi have some thoughts on improving them:
ether
,shannon
, etcether_to_wei
, etcusize
as argument type to the functionsU256
or takeT: Into<U256>
convert
function somewhere else or remove italternatively we could model it similar to this:
would love some feedback