diff --git a/contracts/protocols/MoatKyber.sol b/contracts/protocols/MoatKyber.sol index 4b0f337..10475e9 100644 --- a/contracts/protocols/MoatKyber.sol +++ b/contracts/protocols/MoatKyber.sol @@ -76,8 +76,8 @@ contract Trade is Registry { uint ethQty; uint feecut; if (fees > 0) { - feecut = div(srcAmt, fees); - sellQty = sub(srcAmt, feecut); + feecut = srcAmt.div(fees); + sellQty = srcAmt.sub(feecut); } // fetch token & deduct fees diff --git a/contracts/protocols/MoatMaker.sol b/contracts/protocols/MoatMaker.sol index ff54860..be7337a 100644 --- a/contracts/protocols/MoatMaker.sol +++ b/contracts/protocols/MoatMaker.sol @@ -79,7 +79,7 @@ contract IssueLoan is GlobalVar { event OpenedNewCDP(address borrower, bytes32 cdpBytes); function pethPEReth(uint ethNum) public view returns (uint rPETH) { - rPETH = div(mul(ethNum, 10 ** 27), loanMaster.per()); + rPETH = (ethNum.mul(10 ** 27)).div(loanMaster.per()); } function borrow(uint daiDraw) public payable { @@ -105,13 +105,13 @@ contract IssueLoan is GlobalVar { loanMaster.draw(cdps[msg.sender], daiDraw); uint feecut = deductFees(daiDraw); IERC20 daiTkn = IERC20(getAddress("dai")); - daiTkn.transfer(msg.sender, sub(daiDraw, feecut)); + daiTkn.transfer(msg.sender, daiDraw.sub(feecut)); emit LoanedDAI(msg.sender, daiDraw, feecut); } function deductFees(uint volume) internal returns(uint brokerage) { if (fees > 0) { - brokerage = div(volume, fees); + brokerage = volume.div(fees); IERC20 daiTkn = IERC20(getAddress("dai")); daiTkn.transfer(getAddress("admin"), brokerage); } @@ -174,7 +174,7 @@ contract BorrowTasks is RepayLoan { PriceInterface ethRate = PriceInterface(getAddress("price")); bytes32 ethrate; (ethrate, ) = ethRate.peek(); - return div(uint(ethrate), 10**18); + return uint(ethrate).div(10**18); } function getCDPID(address borrower) public view returns (uint) {