I have written predicate code for my order book with the following logic.
In this predicate, I calc the token price where I consider that tokens decimals can be different so I have to convert the price to have decimals 9. I calculate price using this formula
amount1 * 10.pow(price_decimals + asset0_decimals - asset1_decimals) / amount0
But the U128 standard is implementing pow
and divide
functions with while
cycle usage, predicates are now allowed to use while
After that I decided to make the price decimal smaller in order to use u64, but there is no implementation of the point of view
function
Is there any ideas how to calc price in predicate with another way?