mirror of
https://github.com/Instadapp/smart-contract.git
synced 2024-07-29 22:08:07 +00:00
Added: non-owners can't wipe / lock other's CDP.
This commit is contained in:
parent
75a0b3b312
commit
4f168a035a
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue
Block a user