diff --git a/contracts/CEther.sol b/contracts/CEther.sol index 2d3a51158..2aafb9025 100644 --- a/contracts/CEther.sol +++ b/contracts/CEther.sol @@ -135,8 +135,7 @@ contract CEther is CToken, CEtherInterface { function doTransferOut(address payable to, uint amount) internal { // Send the Ether and revert on failure - (bool success, ) = to.call.value(amount)(""); - require(success, "doTransferOut failed"); + to.transfer(amount); } function requireNoError(uint errCode, string memory message) internal pure { diff --git a/contracts/CToken.sol b/contracts/CToken.sol index f8d872421..b7bc82d57 100644 --- a/contracts/CToken.sol +++ b/contracts/CToken.sol @@ -703,6 +703,10 @@ contract CToken is CTokenInterface, Exponential, TokenErrorReporter { // EFFECTS & INTERACTIONS // (No safe failures beyond this point) + /* We write previously calculated values into storage */ + totalSupply = vars.totalSupplyNew; + accountTokens[redeemer] = vars.accountTokensNew; + /* * We invoke doTransferOut for the redeemer and the redeemAmount. * Note: The cToken must handle variations between ERC-20 and ETH underlying. @@ -711,10 +715,6 @@ contract CToken is CTokenInterface, Exponential, TokenErrorReporter { */ doTransferOut(redeemer, vars.redeemAmount); - /* We write previously calculated values into storage */ - totalSupply = vars.totalSupplyNew; - accountTokens[redeemer] = vars.accountTokensNew; - /* We emit a Transfer event, and a Redeem event */ emit Transfer(redeemer, address(this), vars.redeemTokens); emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens); @@ -803,6 +803,11 @@ contract CToken is CTokenInterface, Exponential, TokenErrorReporter { // EFFECTS & INTERACTIONS // (No safe failures beyond this point) + /* We write the previously calculated values into storage */ + accountBorrows[borrower].principal = vars.accountBorrowsNew; + accountBorrows[borrower].interestIndex = borrowIndex; + totalBorrows = vars.totalBorrowsNew; + /* * We invoke doTransferOut for the borrower and the borrowAmount. * Note: The cToken must handle variations between ERC-20 and ETH underlying. @@ -811,11 +816,6 @@ contract CToken is CTokenInterface, Exponential, TokenErrorReporter { */ doTransferOut(borrower, borrowAmount); - /* We write the previously calculated values into storage */ - accountBorrows[borrower].principal = vars.accountBorrowsNew; - accountBorrows[borrower].interestIndex = borrowIndex; - totalBorrows = vars.totalBorrowsNew; - /* We emit a Borrow event */ emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);