borrow and send implemented

This commit is contained in:
Samyak Jain 2019-05-12 17:56:46 -04:00
parent f9a33dc7f6
commit a01b9c0370

View File

@ -117,6 +117,7 @@ contract CDPResolver is Helpers {
event LogLock(uint cdpNum, uint amtETH, uint amtPETH, address owner);
event LogFree(uint cdpNum, uint amtETH, uint amtPETH, address owner);
event LogDraw(uint cdpNum, uint amtDAI, address owner);
event LogDrawSend(uint cdpNum, uint amtDAI, address to);
event LogWipe(uint cdpNum, uint daiAmt, uint mkrFee, uint daiFee, address owner);
event LogShut(uint cdpNum);
@ -208,6 +209,19 @@ contract CDPResolver is Helpers {
}
}
function drawSend(uint cdpNum, uint _wad, address to) public {
bytes32 cup = bytes32(cdpNum);
if (_wad > 0) {
TubInterface tub = TubInterface(getSaiTubAddress());
tub.draw(cup, _wad);
tub.sai().transfer(to, _wad);
emit LogDraw(cdpNum, _wad, address(this));
emit LogDrawSend(cdpNum, _wad, to);
}
}
function wipe(uint cdpNum, uint _wad) public {
if (_wad > 0) {
TubInterface tub = TubInterface(getSaiTubAddress());