What's the correct way to multiply a number in
ray (1e27) with a number in
wad (1e18) to get the result in
wad? E.g., I have an interest rate [ray] and a balance [wad] that I am multiplying to get a balance [wad].
I'm using DS-Math
uint256 amount = wmul(balances[owner], rate);
I'm seeing the result come out to
1000000000000000000000000000000 (1e27 / ray)
Should I just divide by 1e9 or is there a better, out-of-the-box way?