Incorrect token decimal conversions can lead to loss of funds
The `_convert()` function in `DAOfiV1Pair` is used to accommodate tokens with varying `decimals()` values. There are three cases in which it implicitly returns 0 for any `amount`, the most notable of which is when `token.decimals() == resolution`.\\nAs a result of this, `getQuoteOut()` reverts any time either `baseToken` or `quoteToken` have `decimals == INTERNAL_DECIMALS` (currently hardcoded to 8).\\n`getBaseOut()` also reverts in most cases when either `baseToken` or `quoteToken` have `decimals() == INTERNAL_DECIMALS`. The exception is when `getBaseOut()` is called while `supply` is 0, as is the case in `deposit()`. This causes `getBaseOut()` to succeed, returning an incorrect value.\\nThe result of this is that no swaps can be performed in one of these pools, and the `deposit()` function will return an incorrect `amountBaseOut` of `baseToken` to the depositor, the balance of which can then be withdrawn by the `pairOwner`.\\n```\\nfunction \\_convert(address token, uint256 amount, uint8 resolution, bool to) private view returns (uint256 converted) {\\n    uint8 decimals = IERC20(token).decimals();\\n    uint256 diff = 0;\\n    uint256 factor = 0;\\n    converted = 0;\\n    if (decimals > resolution) {\\n        diff = uint256(decimals.sub(resolution));\\n        factor = 10 \\*\\* diff;\\n        if (to && amount >= factor) {\\n            converted = amount.div(factor);\\n        } else if (!to) {\\n            converted = amount.mul(factor);\\n        }\\n    } else if (decimals < resolution) {\\n        diff = uint256(resolution.sub(decimals));\\n        factor = 10 \\*\\* diff;\\n        if (to) {\\n            converted = amount.mul(factor);\\n        } else if (!to && amount >= factor) {\\n            converted = amount.div(factor);\\n        }\\n    }\\n}\\n```\\n
The `_convert()` function should return `amount` when `token.decimals() == resolution`. Additionally, implicit return values should be avoided whenever possible, especially in functions that implement complex mathematical operations.\\n`BancorFormula.power(baseN, baseD, _, _)` does not support `baseN < baseD`, and checks should be added to ensure that any call to the `BancorFormula` conforms to the expected input ranges.
```\\nfunction \\_convert(address token, uint256 amount, uint8 resolution, bool to) private view returns (uint256 converted) {\\n    uint8 decimals = IERC20(token).decimals();\\n    uint256 diff = 0;\\n    uint256 factor = 0;\\n    converted = 0;\\n    if (decimals > resolution) {\\n        diff = uint256(decimals.sub(resolution));\\n        factor = 10 \\*\\* diff;\\n        if (to && amount >= factor) {\\n            converted = amount.div(factor);\\n        } else if (!to) {\\n            converted = amount.mul(factor);\\n        }\\n    } else if (decimals < resolution) {\\n        diff = uint256(resolution.sub(decimals));\\n        factor = 10 \\*\\* diff;\\n        if (to) {\\n            converted = amount.mul(factor);\\n        } else if (!to && amount >= factor) {\\n            converted = amount.div(factor);\\n        }\\n    }\\n}\\n```\\n