js-monorepo
js-monorepo copied to clipboard
Add 'rounding down' support to `pow` to mimic our `powDecimal` function in solidity.
Wei's pow
uses Big.js pow which uses the currently set rounding mode. Default Big.js rounding mode is round up. This is a problem because our powDecimal
in solidity rounds down (truncation).
https://github.com/Synthetixio/js-monorepo/blob/7beca44d2b20274fe413d42eecbf83b23141382d/packages/wei/src/wei.ts#L218
https://github.com/Synthetixio/synthetix/blob/645a49c07c148d1cef91aafb95e0e05a0f103740/contracts/Math.sol#L17-L29