From b5aae2f7c904709a3c62f27a0713971b5733358c Mon Sep 17 00:00:00 2001 From: Samyak Jain <34437877+KaymasJain@users.noreply.github.com> Date: Wed, 8 Jul 2020 21:22:48 +1000 Subject: [PATCH 1/2] minor edits --- contracts/protocols/uniswapV2.sol | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contracts/protocols/uniswapV2.sol b/contracts/protocols/uniswapV2.sol index 362a213..b038653 100644 --- a/contracts/protocols/uniswapV2.sol +++ b/contracts/protocols/uniswapV2.sol @@ -189,19 +189,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( From 59c66d0186dc5d87ccd0abc128bc9891401975e0 Mon Sep 17 00:00:00 2001 From: Samyak Jain <34437877+KaymasJain@users.noreply.github.com> Date: Wed, 8 Jul 2020 21:47:20 +1000 Subject: [PATCH 2/2] removed unnecessary function --- contracts/protocols/uniswapV2.sol | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/contracts/protocols/uniswapV2.sol b/contracts/protocols/uniswapV2.sol index b038653..31849c2 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,