Skip to content

Commit

Permalink
contracts/CToken.sol: fix 0 amount
Browse files Browse the repository at this point in the history
  • Loading branch information
bun919tw committed Nov 19, 2021
1 parent 7ae4ccd commit 2586166
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions contracts/CToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -469,15 +469,6 @@ contract CToken is CTokenInterface, Exponential, TokenErrorReporter {
return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);
}

/*
* Return if borrowAmount is zero.
* Put behind `borrowAllowed` for accuring potential COMP rewards.
*/
if (borrowAmount == 0) {
accountBorrows[borrower].interestIndex = borrowIndex;
return uint256(Error.NO_ERROR);
}

/* Verify market's block number equals current block number */
if (accrualBlockNumber != getBlockNumber()) {
return fail(Error.MARKET_NOT_FRESH, FailureInfo.BORROW_FRESHNESS_CHECK);
Expand Down Expand Up @@ -596,15 +587,6 @@ contract CToken is CTokenInterface, Exponential, TokenErrorReporter {
);
}

/*
* Return if repayAmount is zero.
* Put behind `repayBorrowAllowed` for accuring potential COMP rewards.
*/
if (repayAmount == 0) {
accountBorrows[borrower].interestIndex = borrowIndex;
return (uint256(Error.NO_ERROR), 0);
}

/* Verify market's block number equals current block number */
if (accrualBlockNumber != getBlockNumber()) {
return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0);
Expand Down

0 comments on commit 2586166

Please sign in to comment.