fees removed

This commit is contained in:
Samyak Jain 2019-05-06 15:06:46 +05:30
parent f4e0ae0d36
commit 460d8bd74d

View File

@ -378,7 +378,6 @@ contract GetDetails is MakerHelpers {
colToFree = ethToSwap; colToFree = ethToSwap;
} }
(uint expectedRate,) = KyberInterface(getAddressKyber()).getExpectedRate(getAddressETH(), getAddressDAI(), colToFree); (uint expectedRate,) = KyberInterface(getAddressKyber()).getExpectedRate(getAddressETH(), getAddressDAI(), colToFree);
expectedRate = wdiv(wmul(expectedRate, 99750000000000000000), 100000000000000000000);
uint expectedDAI = wmul(colToFree, expectedRate); uint expectedDAI = wmul(colToFree, expectedRate);
if (expectedDAI < daiDebt) { if (expectedDAI < daiDebt) {
finalEthCol = sub(ethCol, colToFree); finalEthCol = sub(ethCol, colToFree);
@ -413,7 +412,6 @@ contract GetDetails is MakerHelpers {
debtToBorrow = daiToSwap; debtToBorrow = daiToSwap;
} }
(uint expectedRate,) = KyberInterface(getAddressKyber()).getExpectedRate(getAddressDAI(), getAddressETH(), debtToBorrow); (uint expectedRate,) = KyberInterface(getAddressKyber()).getExpectedRate(getAddressDAI(), getAddressETH(), debtToBorrow);
expectedRate = wdiv(wmul(expectedRate, 99750000000000000000), 100000000000000000000);
uint expectedETH = wmul(debtToBorrow, expectedRate); uint expectedETH = wmul(debtToBorrow, expectedRate);
if (ethCol != 0) { if (ethCol != 0) {
finalEthCol = add(ethCol, expectedETH); finalEthCol = add(ethCol, expectedETH);
@ -470,11 +468,9 @@ contract Save is GetDetails {
} }
uint thisBalance = address(this).balance; uint thisBalance = address(this).balance;
free(cdpID, colToFree); free(cdpID, colToFree);
uint ethToSwap = wdiv(wmul(colToFree, 99750000000000000000), 100000000000000000000); uint destAmt = KyberInterface(getAddressKyber()).trade.value(colToFree)(
getAddressAdmin().transfer(sub(colToFree, ethToSwap));
uint destAmt = KyberInterface(getAddressKyber()).trade.value(ethToSwap)(
getAddressETH(), getAddressETH(),
ethToSwap, colToFree,
getAddressDAI(), getAddressDAI(),
address(this), address(this),
daiDebt, daiDebt,
@ -488,7 +484,7 @@ contract Save is GetDetails {
lock(cdpID, balToLock); lock(cdpID, balToLock);
} }
emit LogSaveCDP(cdpID, ethToSwap, destAmt); emit LogSaveCDP(cdpID, colToFree, destAmt);
emit LogTrade( emit LogTrade(
0, 0,
@ -521,9 +517,7 @@ contract Save is GetDetails {
0, 0,
getAddressAdmin() getAddressAdmin()
); );
uint ethToDeposit = wdiv(wmul(destAmt, 99750000000000000000), 100000000000000000000); lock(cdpID, destAmt);
getAddressAdmin().transfer(sub(destAmt, ethToDeposit));
lock(cdpID, ethToDeposit);
emit LogLeverageCDP(cdpID, debtToBorrow, destAmt); emit LogLeverageCDP(cdpID, debtToBorrow, destAmt);