Fixed problem in shut() when no debt.

This commit is contained in:
Sowmayjain 2019-04-11 01:07:40 +05:30
parent 5692a86d51
commit fa5ec877bf

View File

@ -146,11 +146,10 @@ contract CDPResolver is Helpers {
} }
function free(uint cdpNum, uint jam) public { function free(uint cdpNum, uint jam) public {
if (jam > 0) {
bytes32 cup = bytes32(cdpNum); bytes32 cup = bytes32(cdpNum);
address tubAddr = getSaiTubAddress(); address tubAddr = getSaiTubAddress();
if (jam > 0) {
TubInterface tub = TubInterface(tubAddr); TubInterface tub = TubInterface(tubAddr);
TokenInterface peth = tub.skr(); TokenInterface peth = tub.skr();
TokenInterface weth = tub.gem(); TokenInterface weth = tub.gem();
@ -180,8 +179,7 @@ contract CDPResolver is Helpers {
} }
function wipe(uint cdpNum, uint _wad) public { function wipe(uint cdpNum, uint _wad) public {
require(_wad > 0, "no-wipe-no-dai"); if (_wad > 0) {
TubInterface tub = TubInterface(getSaiTubAddress()); TubInterface tub = TubInterface(getSaiTubAddress());
UniswapExchange daiEx = UniswapExchange(getUniswapDAIExchange()); UniswapExchange daiEx = UniswapExchange(getUniswapDAIExchange());
UniswapExchange mkrEx = UniswapExchange(getUniswapMKRExchange()); UniswapExchange mkrEx = UniswapExchange(getUniswapMKRExchange());
@ -215,6 +213,7 @@ contract CDPResolver is Helpers {
tub.wipe(cup, _wad); tub.wipe(cup, _wad);
} }
}
function setAllowance(TokenInterface token_, address spender_) private { function setAllowance(TokenInterface token_, address spender_) private {
if (token_.allowance(address(this), spender_) != uint(-1)) { if (token_.allowance(address(this), spender_) != uint(-1)) {