stack too deep error resolved

This commit is contained in:
Samyak Jain 2019-10-23 20:35:26 +05:30
parent 2f440bca2f
commit 46aec92337

View File

@ -214,6 +214,13 @@ contract Helper is DSMath {
dai = 0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359; dai = 0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359;
} }
/**
* @dev get MKR Address
*/
function getMKRAddress() public pure returns (address dai) {
dai = 0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2;
}
/** /**
* @dev get CDAI Address * @dev get CDAI Address
*/ */
@ -333,6 +340,14 @@ contract MakerResolver is InstaPoolResolver {
TubInterface(getSaiTubAddress()).give(bytes32(cdpNum), nextOwner); TubInterface(getSaiTubAddress()).give(bytes32(cdpNum), nextOwner);
} }
function setWipeAllowances(TubInterface tub) internal { // to solve stack to deep error
TokenInterface dai = tub.sai();
TokenInterface mkr = tub.gov();
setMakerAllowance(dai, getSaiTubAddress());
setMakerAllowance(mkr, getSaiTubAddress());
setMakerAllowance(dai, getUniswapDAIExchange());
}
/** /**
* @dev Pay CDP debt * @dev Pay CDP debt
*/ */
@ -341,18 +356,13 @@ contract MakerResolver is InstaPoolResolver {
TubInterface tub = TubInterface(getSaiTubAddress()); TubInterface tub = TubInterface(getSaiTubAddress());
UniswapExchange daiEx = UniswapExchange(getUniswapDAIExchange()); UniswapExchange daiEx = UniswapExchange(getUniswapDAIExchange());
UniswapExchange mkrEx = UniswapExchange(getUniswapMKRExchange()); UniswapExchange mkrEx = UniswapExchange(getUniswapMKRExchange());
TokenInterface dai = tub.sai();
TokenInterface mkr = tub.gov();
bytes32 cup = bytes32(cdpNum); bytes32 cup = bytes32(cdpNum);
(address lad,,,) = tub.cups(cup); (address lad,,,) = tub.cups(cup);
require(lad == address(this), "cup-not-owned"); require(lad == address(this), "cup-not-owned");
setMakerAllowance(dai, getSaiTubAddress()); setWipeAllowances(tub);
setMakerAllowance(mkr, getSaiTubAddress());
setMakerAllowance(dai, getUniswapDAIExchange());
(bytes32 val, bool ok) = tub.pep().peek(); (bytes32 val, bool ok) = tub.pep().peek();
// MKR required for wipe = Stability fees accrued in Dai / MKRUSD value // MKR required for wipe = Stability fees accrued in Dai / MKRUSD value
@ -370,7 +380,7 @@ contract MakerResolver is InstaPoolResolver {
daiFeeAmt, daiFeeAmt,
uint(999000000000000000000), uint(999000000000000000000),
uint(1899063809), // 6th March 2030 GMT // no logic uint(1899063809), // 6th March 2030 GMT // no logic
address(mkr) getMKRAddress()
); );
} }
@ -403,7 +413,6 @@ contract MakerResolver is InstaPoolResolver {
setMakerAllowance(dai, getSaiTubAddress()); setMakerAllowance(dai, getSaiTubAddress());
setMakerAllowance(mkr, getSaiTubAddress()); setMakerAllowance(mkr, getSaiTubAddress());
setMakerAllowance(dai, getUniswapDAIExchange());
(bytes32 val, bool ok) = tub.pep().peek(); (bytes32 val, bool ok) = tub.pep().peek();