diff --git a/contracts/protocols/uniswapV2.sol b/contracts/protocols/uniswapV2.sol index 2b11a37..81f1bd9 100644 --- a/contracts/protocols/uniswapV2.sol +++ b/contracts/protocols/uniswapV2.sol @@ -143,16 +143,6 @@ contract UniswapHelpers is Helpers { unitAmt = wmul(unitAmt, add(WAD, slippage)); } - function getMinAmount( - TokenInterface token, - uint amt, - uint slippage - ) internal view returns(uint minAmt) { - uint _amt18 = convertTo18(token.decimals(), amt); - minAmt = wmul(_amt18, sub(WAD, slippage)); - minAmt = convert18ToDec(token.decimals(), minAmt); - } - function _getWithdrawUnitAmts( TokenInterface tokenA, TokenInterface tokenB, @@ -189,19 +179,19 @@ contract UniswapHelpers is Helpers { contract Resolver is UniswapHelpers { function getBuyAmount(address buyAddr, address sellAddr, uint sellAmt, uint slippage) - public view returns (uint expectedRate, uint unitAmt) + public view returns (uint buyAmt, uint unitAmt) { (TokenInterface _buyAddr, TokenInterface _sellAddr) = changeEthAddress(buyAddr, sellAddr); - expectedRate = getExpectedBuyAmt(address(_buyAddr), address(_sellAddr), sellAmt); - unitAmt = getBuyUnitAmt(_buyAddr, expectedRate, _sellAddr, sellAmt, slippage); + buyAmt = getExpectedBuyAmt(address(_buyAddr), address(_sellAddr), sellAmt); + unitAmt = getBuyUnitAmt(_buyAddr, buyAmt, _sellAddr, sellAmt, slippage); } function getSellAmount(address buyAddr, address sellAddr, uint buyAmt, uint slippage) - public view returns (uint expectedRate, uint unitAmt) + public view returns (uint sellAmt, uint unitAmt) { (TokenInterface _buyAddr, TokenInterface _sellAddr) = changeEthAddress(buyAddr, sellAddr); - expectedRate = getExpectedSellAmt(address(_buyAddr), address(_sellAddr), buyAmt); - unitAmt = getSellUnitAmt(_sellAddr, expectedRate, _buyAddr, buyAmt, slippage); + sellAmt = getExpectedSellAmt(address(_buyAddr), address(_sellAddr), buyAmt); + unitAmt = getSellUnitAmt(_sellAddr, sellAmt, _buyAddr, buyAmt, slippage); } function getDepositAmount(