From 831101d9650a0d1528776d35651fd0e9959e211a Mon Sep 17 00:00:00 2001 From: Sowmayjain Date: Sun, 28 Oct 2018 09:43:36 +0530 Subject: [PATCH] Fixed standard errors. --- contracts/protocols/MoatMaker.sol | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/contracts/protocols/MoatMaker.sol b/contracts/protocols/MoatMaker.sol index 684bae5..469c29f 100644 --- a/contracts/protocols/MoatMaker.sol +++ b/contracts/protocols/MoatMaker.sol @@ -88,7 +88,7 @@ contract GlobalVar is Registry { address public cdpAddr = 0xa71937147b55Deb8a530C7229C442Fd3F31b7db2; MakerCDP loanMaster = MakerCDP(cdpAddr); - mapping (address => bytes32) public CDPs; // borrower >>> CDP Bytes + mapping (address => bytes32) public cdps; // borrower >>> CDP Bytes } @@ -97,16 +97,17 @@ contract IssueLoan is GlobalVar { event LockedETH(address borrower, uint lockETH, uint lockPETH); event LoanedDAI(address borrower, uint loanDAI, uint fees); - event OpenedNewCDP(address borrower, bytes32 CDPBytes); + event OpenedNewCDP(address borrower, bytes32 cdpBytes); function borrow( address borrower, uint ethLock, uint daiDraw - ) public payable onlyUserOrResolver(borrower) { - if (CDPs[borrower] == 0x0000000000000000000000000000000000000000000000000000000000000000) { - CDPs[borrower] = loanMaster.open(); - emit OpenedNewCDP(borrower, CDPs[borrower]); + ) public payable onlyUserOrResolver(borrower) + { + if (cdps[borrower] == 0x0000000000000000000000000000000000000000000000000000000000000000) { + cdps[borrower] = loanMaster.open(); + emit OpenedNewCDP(borrower, cdps[borrower]); } if (ethLock > 0) { lockETH(borrower, ethLock); @@ -121,12 +122,12 @@ contract IssueLoan is GlobalVar { wethFunction.deposit.value(ethLock)(); // ETH to WETH uint pethToLock = ratioedPETH(ethLock); loanMaster.join(pethToLock); // WETH to PETH - loanMaster.lock(CDPs[borrower], pethToLock); // PETH to CDP + loanMaster.lock(cdps[borrower], pethToLock); // PETH to CDP emit LockedETH(borrower, ethLock, pethToLock); } function drawDAI(address borrower, uint daiDraw) public onlyUserOrResolver(borrower) { - loanMaster.draw(CDPs[borrower], daiDraw); + loanMaster.draw(cdps[borrower], daiDraw); uint fees = deductFees(daiDraw); token tokenFunctions = token(dai); tokenFunctions.transfer(getAddress("resolver"), daiDraw - fees); @@ -159,25 +160,26 @@ contract RepayLoan is IssueLoan { address borrower, uint daiWipe, uint ethFree - ) public onlyUserOrResolver(borrower) { + ) public onlyUserOrResolver(borrower) + { if (daiWipe > 0) { wipeDAI(borrower, daiWipe); } if (ethFree > 0) { - UnlockETH(borrower, ethFree); + unlockETH(borrower, ethFree); } } function wipeDAI(address borrower, uint daiWipe) public { token tokenFunction = token(dai); tokenFunction.transferFrom(msg.sender, address(this), daiWipe); - loanMaster.wipe(CDPs[borrower], daiWipe); + loanMaster.wipe(cdps[borrower], daiWipe); emit WipedDAI(borrower, daiWipe); } - function UnlockETH(address borrower, uint ethFree) public onlyUserOrResolver(borrower) { + function unlockETH(address borrower, uint ethFree) public onlyUserOrResolver(borrower) { uint pethToUnlock = ratioedPETH(ethFree); - loanMaster.free(CDPs[borrower], pethToUnlock); // CDP to PETH + loanMaster.free(cdps[borrower], pethToUnlock); // CDP to PETH loanMaster.exit(pethToUnlock); // PETH to WETH WETHFace wethFunction = WETHFace(weth); wethFunction.withdraw(ethFree); // WETH to ETH @@ -190,13 +192,14 @@ contract RepayLoan is IssueLoan { } + contract BorrowTasks is RepayLoan { // transfer existing CDP 2 txn process function claimCDP(address nextOwner) public { require(nextOwner != 0, "Invalid Address."); - loanMaster.give(CDPs[msg.sender], nextOwner); + loanMaster.give(cdps[msg.sender], nextOwner); } function approveERC20() public {