From 12ffa7dfcb8a94d3a6eef367aacc5b710eefa7e8 Mon Sep 17 00:00:00 2001 From: Samyak Jain Date: Mon, 24 Jun 2019 02:57:30 +0530 Subject: [PATCH] small code refactor --- contracts/ProxyLogics/InstaSave.sol | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/contracts/ProxyLogics/InstaSave.sol b/contracts/ProxyLogics/InstaSave.sol index 5f69881..3f49f18 100644 --- a/contracts/ProxyLogics/InstaSave.sol +++ b/contracts/ProxyLogics/InstaSave.sol @@ -370,6 +370,26 @@ contract GetDetails is MakerHelpers { ); } + function getLeverage( + uint cdpID, + uint daiToSwap + ) public view returns ( + uint finalEthCol, + uint finalDaiDebt, + uint finalColToUSD, + bool canLeverage + ) + { + bytes32 cup = bytes32(cdpID); + (uint ethCol, uint daiDebt, uint usdPerEth) = getCDPStats(cup); + (finalEthCol, finalDaiDebt, finalColToUSD, canLeverage) = checkLeverage( + ethCol, + daiDebt, + usdPerEth, + daiToSwap + ); + } + /** * @param isBest 0 is ETH2DAI, 1 is Kyber */ @@ -392,26 +412,6 @@ contract GetDetails is MakerHelpers { } } - function getLeverage( - uint cdpID, - uint daiToSwap - ) public view returns ( - uint finalEthCol, - uint finalDaiDebt, - uint finalColToUSD, - bool canLeverage - ) - { - bytes32 cup = bytes32(cdpID); - (uint ethCol, uint daiDebt, uint usdPerEth) = getCDPStats(cup); - (finalEthCol, finalDaiDebt, finalColToUSD, canLeverage) = checkLeverage( - ethCol, - daiDebt, - usdPerEth, - daiToSwap - ); - } - function checkSave( uint ethCol, uint daiDebt,