I would like to define a function like this:
function convert(ufixed x) external pure returns (uint256 result) {
result = x * 1e18;
}
Unfortunately, the code above does not compile:
TypeError: type ufixed128x18 is not implicitly convertible to expected type uint256.
I went ahead and casted x
to uint256
:
result = uint256(x) * 1e18;
But this didn't work either:
UnimplementedFeatureError: Fixed point types not implemented.
I have read the docs, and I understand that fixed-point types cannot be assigned to or from. However, all I want is to multiply them by a pre-factor.
Is this still not possible to do in Solidity just yet?