Kyber getRates code is unclear
`getSellRate` can be converted into one function to get the rates, which then for buy or sell can swap input and output tokens\\n`getBuyRate` uses a 3% slippage that is not documented.\\n```\\n   function getSellRate(address \\_srcAddr, address \\_destAddr, uint \\_srcAmount, bytes memory) public override view returns (uint rate) {\\n        (rate, ) = KyberNetworkProxyInterface(KYBER\\_INTERFACE)\\n            .getExpectedRate(IERC20(\\_srcAddr), IERC20(\\_destAddr), \\_srcAmount);\\n\\n        // multiply with decimal difference in src token\\n        rate = rate \\* (10\\*\\*(18 - getDecimals(\\_srcAddr)));\\n        // divide with decimal difference in dest token\\n        rate = rate / (10\\*\\*(18 - getDecimals(\\_destAddr)));\\n    }\\n\\n    /// @notice Return a rate for which we can buy an amount of tokens\\n    /// @param \\_srcAddr From token\\n    /// @param \\_destAddr To token\\n    /// @param \\_destAmount To amount\\n    /// @return rate Rate\\n    function getBuyRate(address \\_srcAddr, address \\_destAddr, uint \\_destAmount, bytes memory \\_additionalData) public override view returns (uint rate) {\\n        uint256 srcRate = getSellRate(\\_destAddr, \\_srcAddr, \\_destAmount, \\_additionalData);\\n        uint256 srcAmount = wmul(srcRate, \\_destAmount);\\n\\n        rate = getSellRate(\\_srcAddr, \\_destAddr, srcAmount, \\_additionalData);\\n\\n        // increase rate by 3% too account for inaccuracy between sell/buy conversion\\n        rate = rate + (rate / 30);\\n    }\\n```\\n
Refactoring the code to separate getting rate functionality with `getSellRate` and `getBuyRate`. Explicitly document any assumptions in the code ( slippage, etc)
```\\n   function getSellRate(address \\_srcAddr, address \\_destAddr, uint \\_srcAmount, bytes memory) public override view returns (uint rate) {\\n        (rate, ) = KyberNetworkProxyInterface(KYBER\\_INTERFACE)\\n            .getExpectedRate(IERC20(\\_srcAddr), IERC20(\\_destAddr), \\_srcAmount);\\n\\n        // multiply with decimal difference in src token\\n        rate = rate \\* (10\\*\\*(18 - getDecimals(\\_srcAddr)));\\n        // divide with decimal difference in dest token\\n        rate = rate / (10\\*\\*(18 - getDecimals(\\_destAddr)));\\n    }\\n\\n    /// @notice Return a rate for which we can buy an amount of tokens\\n    /// @param \\_srcAddr From token\\n    /// @param \\_destAddr To token\\n    /// @param \\_destAmount To amount\\n    /// @return rate Rate\\n    function getBuyRate(address \\_srcAddr, address \\_destAddr, uint \\_destAmount, bytes memory \\_additionalData) public override view returns (uint rate) {\\n        uint256 srcRate = getSellRate(\\_destAddr, \\_srcAddr, \\_destAmount, \\_additionalData);\\n        uint256 srcAmount = wmul(srcRate, \\_destAmount);\\n\\n        rate = getSellRate(\\_srcAddr, \\_destAddr, srcAmount, \\_additionalData);\\n\\n        // increase rate by 3% too account for inaccuracy between sell/buy conversion\\n        rate = rate + (rate / 30);\\n    }\\n```\\n