Added: non-owners can't wipe / lock other's CDP.

This commit is contained in:
Sowmayjain 2019-04-12 17:29:47 +05:30
parent 75a0b3b312
commit 4f168a035a

View File

@ -125,13 +125,17 @@ contract CDPResolver is Helpers {
}
function lock(uint cdpNum) public payable {
bytes32 cup = bytes32(cdpNum);
address tubAddr = getSaiTubAddress();
if (msg.value > 0) {
bytes32 cup = bytes32(cdpNum);
address tubAddr = getSaiTubAddress();
TubInterface tub = TubInterface(tubAddr);
TokenInterface weth = tub.gem();
TokenInterface peth = tub.skr();
(address lad,,,) = tub.cups(cup);
require(lad == address(this), "cup-not-owned");
weth.deposit.value(msg.value)();
uint ink = rdiv(msg.value, tub.per());
@ -188,6 +192,9 @@ contract CDPResolver is Helpers {
bytes32 cup = bytes32(cdpNum);
(address lad,,,) = tub.cups(cup);
require(lad == address(this), "cup-not-owned");
setAllowance(dai, getSaiTubAddress());
setAllowance(mkr, getSaiTubAddress());
setAllowance(dai, getUniswapDAIExchange());