Closed larry0x closed 2 weeks ago
Ready for a review
Traits Integer
and MultiplyRatio
are missing for Signed
Some functions on Udec
like new_percent
, are not exposed via trait. This doesn't allow to implements these functions also for Signed<T>
where T
implements. Is it worth to handle these functions in traits? (e.g: MultiplyFraction
trait has been created for Uint
. Anyway it's also implemented for Signed<T>
)
Some functions on
Udec
likenew_percent
, are not exposed via trait. This doesn't allow to implements these functions also forSigned<T>
whereT
implements. Is it worth to handle these functions in traits? (e.g:MultiplyFraction
trait has been created forUint
. Anyway it's also implemented forSigned<T>
)
I think for now we just make them special cases like:
impl<U> Signed<Udec<U>>
where
// trait bounds...
{
pub fn new_percent(percent: impl Into<Uint<U>>) -> Self {
// ...
}
}
Add math types:
{Uint,Int,Decimal,SignedDecimal}{64,128,256,512}
.Compared to CosmWasm, which creates
Uint64
,Uint128
,Uint256
... separately, our approach is to create a single genericUint<T>
type, while the concrete types are just it with different generics:Decimal
would be a wrapper overUint
:A
Signed
type will allow integers and decimals to take on negative numbers: