cut implemented

This commit is contained in:
Samyak Jain 2019-06-24 02:52:16 +05:30
parent 3969d4af74
commit 39cbd004e8

View File

@ -602,16 +602,10 @@ contract Save is SaveResolver {
uint thisBalance = address(this).balance; uint thisBalance = address(this).balance;
free(cdpID, colToFree); free(cdpID, colToFree);
uint destAmt = saveSwap(colToFree, daiDebt); uint destAmt = saveSwap(colToFree, daiDebt);
// uint destAmt = KyberInterface(getAddressKyber()).trade.value(colToFree)( uint cut = wmul(destAmt, 2000000000000000);
// getAddressETH(), TokenInterface(getAddressDAI()).transfer(getAddressAdmin(), cut);
// colToFree, uint wipeAmt = sub(destAmt, cut);
// getAddressDAI(), wipe(cdpID, wipeAmt);
// address(this),
// daiDebt,
// 0,
// getAddressAdmin()
// );
wipe(cdpID, destAmt);
if (thisBalance < address(this).balance) { if (thisBalance < address(this).balance) {
uint balToLock = sub(address(this).balance, thisBalance); uint balToLock = sub(address(this).balance, thisBalance);
@ -641,7 +635,10 @@ contract Save is SaveResolver {
debtToBorrow = daiToSwap; debtToBorrow = daiToSwap;
} }
draw(cdpID, debtToBorrow); draw(cdpID, debtToBorrow);
uint destAmt = loopSwap(debtToBorrow); uint cut = wmul(debtToBorrow, 2000000000000000);
uint swapAmt = sub(debtToBorrow, cut);
TokenInterface(getAddressDAI()).transfer(getAddressAdmin(), cut);
uint destAmt = loopSwap(swapAmt);
lock(cdpID, destAmt); lock(cdpID, destAmt);
emit LogLeverageCDP(cdpID, debtToBorrow, destAmt); emit LogLeverageCDP(cdpID, debtToBorrow, destAmt);