mirror of
https://github.com/Instadapp/smart-contract.git
synced 2024-07-29 22:08:07 +00:00
Split Swap bug resolved
This commit is contained in:
parent
404aeee97d
commit
c76cb12850
|
@ -170,7 +170,8 @@ contract Helpers is DSMath {
|
||||||
* @dev get admin address
|
* @dev get admin address
|
||||||
*/
|
*/
|
||||||
function getAddressSplitSwap() public pure returns (address payable splitSwap) {
|
function getAddressSplitSwap() public pure returns (address payable splitSwap) {
|
||||||
splitSwap = 0x1E3A60112f600cb623087bd2C98c7842085a8c3F;
|
splitSwap = // ADDRESS SPLIT SWAP;
|
||||||
|
// splitSwap = 0x1E3A60112f600cb623087bd2C98c7842085a8c3F;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -390,7 +391,6 @@ contract GetDetails is MakerHelpers {
|
||||||
if (ethToSwap < colToFree) {
|
if (ethToSwap < colToFree) {
|
||||||
colToFree = ethToSwap;
|
colToFree = ethToSwap;
|
||||||
}
|
}
|
||||||
// (uint expectedRate,) = KyberInterface(getAddressKyber()).getExpectedRate(getAddressETH(), getAddressDAI(), colToFree);
|
|
||||||
(, uint expectedDAI) = SplitSwapInterface(getAddressSplitSwap()).getBest(getAddressETH(), getAddressDAI(), colToFree);
|
(, uint expectedDAI) = SplitSwapInterface(getAddressSplitSwap()).getBest(getAddressETH(), getAddressDAI(), colToFree);
|
||||||
if (expectedDAI < daiDebt) {
|
if (expectedDAI < daiDebt) {
|
||||||
finalEthCol = sub(ethCol, colToFree);
|
finalEthCol = sub(ethCol, colToFree);
|
||||||
|
@ -484,16 +484,10 @@ contract Save is GetDetails {
|
||||||
if (colToSwap < colToFree) {
|
if (colToSwap < colToFree) {
|
||||||
colToFree = colToSwap;
|
colToFree = colToSwap;
|
||||||
}
|
}
|
||||||
uint thisBalance = address(this).balance;
|
|
||||||
free(cdpID, colToFree);
|
free(cdpID, colToFree);
|
||||||
uint destAmt = SplitSwapInterface(getAddressSplitSwap()).ethToDaiSwap.value(colToFree)(splitAmt, slippageAmt);
|
uint destAmt = SplitSwapInterface(getAddressSplitSwap()).ethToDaiSwap.value(colToFree)(splitAmt, slippageAmt);
|
||||||
wipe(cdpID, destAmt);
|
wipe(cdpID, destAmt);
|
||||||
|
|
||||||
if (thisBalance < address(this).balance) {
|
|
||||||
uint balToLock = sub(address(this).balance, thisBalance);
|
|
||||||
lock(cdpID, balToLock);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit LogSaveCDP(cdpID, colToFree, destAmt);
|
emit LogSaveCDP(cdpID, colToFree, destAmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,8 @@ contract SplitResolver is SplitHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
function swapKyber(address src, address dest, uint srcAmt) internal returns (uint destAmt) {
|
function swapKyber(address src, address dest, uint srcAmt) internal returns (uint destAmt) {
|
||||||
destAmt = KyberInterface(kyberAddr).trade.value(srcAmt)(
|
uint ethAmt = src == ethAddr ? srcAmt : 0;
|
||||||
|
destAmt = KyberInterface(kyberAddr).trade.value(ethAmt)(
|
||||||
src,
|
src,
|
||||||
srcAmt,
|
srcAmt,
|
||||||
dest,
|
dest,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user