No deadline.

This commit is contained in:
Sowmayjain 2019-03-30 04:02:59 +05:30
parent 31d6b27eae
commit d7ae8becc7

View File

@ -1,26 +1,6 @@
pragma solidity ^0.5.0; pragma solidity ^0.5.0;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "Assertion Failed");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "Assertion Failed");
uint256 c = a / b;
return c;
}
}
contract DSMath { contract DSMath {
function add(uint x, uint y) internal pure returns (uint z) { function add(uint x, uint y) internal pure returns (uint z) {
@ -115,9 +95,6 @@ contract UniswapExchange {
contract Helpers is DSMath { contract Helpers is DSMath {
using SafeMath for uint;
using SafeMath for uint256;
/** /**
* @dev get MakerDAO CDP engine * @dev get MakerDAO CDP engine
*/ */
@ -152,7 +129,7 @@ contract Helpers is DSMath {
* @dev get DAI address * @dev get DAI address
*/ */
function getDAIAddress() public pure returns (address ude) { function getDAIAddress() public pure returns (address ude) {
ude = 0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359; ude = 0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359;
} }
/** /**
@ -233,20 +210,20 @@ contract Helpers is DSMath {
* @dev swapping given DAI with MKR * @dev swapping given DAI with MKR
* @param reqDAI is the DAI to swap with MKR * @param reqDAI is the DAI to swap with MKR
*/ */
function swapMKRviaDAI(uint feesMKR, uint maxDAItoPay, uint deadline) public returns(uint daiSold) { function swapMKR(uint feesMKR) public returns(uint daiSold) {
UniswapExchange daiExchange = UniswapExchange(getUniswapDAIExchange()); UniswapExchange daiExchange = UniswapExchange(getUniswapDAIExchange());
TokenInterface daiContract = TokenInterface(getDAIAddress()); // TokenInterface daiContract = TokenInterface(getDAIAddress());
// (SOWMAY) - Add Allowance and approve check for DAI with maxDAItoPay and transferFrom function // (SOWMAY) - Add Allowance and approve check for DAI with maxDAItoPay and transferFrom function
daiSold = daiExchange.tokenToExchangeSwapOutput( daiSold = daiExchange.tokenToExchangeSwapOutput(
feesMKR, feesMKR,
maxDAItoPay, feesMKR, // (SAMYAK) coz we are reading price via getDAIRequired() in single txn
2**255, 2**255,
deadline, add(now, 100), // deadline is 100 seconds after this txn gets confirmed (i.e. no deadline)
getUniswapMKRExchange() getUniswapMKRExchange()
); );
// (SOWMAY) - Pay MKR to Maker contract // (SOWMAY) - Pay MKR to Maker contract
uint daiToReturn = maxDAItoPay - daiSold; // uint daiToReturn = maxDAItoPay - daiSold;
daiContract.transfer(msg.sender, daiToReturn); // daiContract.transfer(msg.sender, daiToReturn);
} }
/** /**
@ -262,7 +239,7 @@ contract Helpers is DSMath {
tub.sai().approve(_otc, uint(-1)); tub.sai().approve(_otc, uint(-1));
} }
tub.sai().transferFrom(msg.sender, address(this), saiGovAmt); tub.sai().transferFrom(msg.sender, address(this), saiGovAmt);
swapMKRviaETH(saiGovAmt); // swap DAI with MKR swapMKR(saiGovAmt); // swap DAI with MKR
} }
} }