mirror of
https://github.com/Instadapp/smart-contract.git
synced 2024-07-29 22:08:07 +00:00
removed fee
This commit is contained in:
parent
a51238f1cf
commit
7ee47ff3ae
|
@ -116,6 +116,10 @@ contract Helpers is DSMath {
|
||||||
zrxExchange = 0x080bf510FCbF18b91105470639e9561022937712;
|
zrxExchange = 0x080bf510FCbF18b91105470639e9561022937712;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAddressZRXERC20() public pure returns (address zrxerc20) {
|
||||||
|
zrxerc20 = 0x95E6F48254609A6ee006F7D493c8e5fB97094ceF;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev get ethereum address for trade
|
* @dev get ethereum address for trade
|
||||||
*/
|
*/
|
||||||
|
@ -338,12 +342,14 @@ contract CompoundSave is CompoundResolver {
|
||||||
redeemEth(ethToSwap);
|
redeemEth(ethToSwap);
|
||||||
ERC20Interface wethContract = ERC20Interface(getAddressWETH());
|
ERC20Interface wethContract = ERC20Interface(getAddressWETH());
|
||||||
wethContract.deposit.value(zrxEthAmt)();
|
wethContract.deposit.value(zrxEthAmt)();
|
||||||
wethContract.approve(getAddressZRXExchange(), zrxEthAmt);
|
wethContract.approve(getAddressZRXERC20(), zrxEthAmt);
|
||||||
getAddressZRXExchange().call(calldataHexString);
|
(bool swapSuccess,) = getAddressZRXExchange().call(calldataHexString);
|
||||||
if (address(this).balance > 0 && isKyber) {
|
assert(swapSuccess);
|
||||||
KyberInterface(getAddressKyberProxy()).trade.value(address(this).balance)(
|
uint remainEth = sub(ethToSwap, zrxEthAmt);
|
||||||
|
if (remainEth > 0 && isKyber) {
|
||||||
|
KyberInterface(getAddressKyberProxy()).trade.value(remainEth)(
|
||||||
getAddressETH(),
|
getAddressETH(),
|
||||||
address(this).balance,
|
remainEth,
|
||||||
getAddressUSDC(),
|
getAddressUSDC(),
|
||||||
address(this),
|
address(this),
|
||||||
2**255,
|
2**255,
|
||||||
|
@ -353,9 +359,6 @@ contract CompoundSave is CompoundResolver {
|
||||||
}
|
}
|
||||||
ERC20Interface usdcContract = ERC20Interface(getAddressUSDC());
|
ERC20Interface usdcContract = ERC20Interface(getAddressUSDC());
|
||||||
uint usdcBal = usdcContract.balanceOf(address(this));
|
uint usdcBal = usdcContract.balanceOf(address(this));
|
||||||
uint cut = wmul(2500000000000000, usdcBal);
|
|
||||||
usdcContract.transfer(getAddressAdmin(), cut);
|
|
||||||
usdcBal = sub(usdcBal, cut);
|
|
||||||
repayUsdc(usdcBal);
|
repayUsdc(usdcBal);
|
||||||
emit LogSaveCompoundUsdc(ethToSwap, usdcBal);
|
emit LogSaveCompoundUsdc(ethToSwap, usdcBal);
|
||||||
}
|
}
|
||||||
|
@ -376,18 +379,15 @@ contract CompoundSave is CompoundResolver {
|
||||||
usdcToSwap = usdcToSwap < usdcToBorrow ? usdcToSwap : usdcToBorrow;
|
usdcToSwap = usdcToSwap < usdcToBorrow ? usdcToSwap : usdcToBorrow;
|
||||||
borrow(usdcToSwap);
|
borrow(usdcToSwap);
|
||||||
ERC20Interface usdcContract = ERC20Interface(getAddressUSDC());
|
ERC20Interface usdcContract = ERC20Interface(getAddressUSDC());
|
||||||
uint usdcBal = usdcContract.balanceOf(address(this));
|
usdcContract.approve(getAddressZRXERC20(), zrxUsdcAmt);
|
||||||
uint cut = wmul(2500000000000000, usdcBal);
|
(bool swapSuccess,) = getAddressZRXExchange().call(calldataHexString);
|
||||||
usdcContract.transfer(getAddressAdmin(), cut);
|
assert(swapSuccess);
|
||||||
usdcBal = sub(usdcBal, cut);
|
uint usdcRemain = sub(usdcToSwap, zrxUsdcAmt);
|
||||||
usdcContract.approve(getAddressZRXExchange(), zrxUsdcAmt);
|
if (usdcRemain > 0 && isKyber) {
|
||||||
getAddressZRXExchange().call(calldataHexString);
|
usdcContract.approve(getAddressKyberProxy(), usdcRemain);
|
||||||
usdcBal = usdcContract.balanceOf(address(this));
|
KyberInterface(getAddressKyberProxy()).trade.value(uint(0))(
|
||||||
if (usdcBal > 0 && isKyber) {
|
|
||||||
usdcContract.approve(getAddressKyberProxy(), usdcBal);
|
|
||||||
KyberInterface(getAddressKyberProxy()).trade.value(address(this).balance)(
|
|
||||||
getAddressUSDC(),
|
getAddressUSDC(),
|
||||||
usdcBal,
|
usdcRemain,
|
||||||
getAddressETH(),
|
getAddressETH(),
|
||||||
address(this),
|
address(this),
|
||||||
2**255,
|
2**255,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user