Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce gas costs in CToken#redeemFresh #140

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion contracts/CToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,13 @@ contract CToken is CTokenInterface, Exponential, TokenErrorReporter {
emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens);

/* We call the defense hook */
comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);
// unused function
// comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);

// Require tokens is zero or amount is also zero
if (vars.redeemTokens == 0 && vars.redeemAmount > 0) {
revert("redeemTokens zero");
}

return uint(Error.NO_ERROR);
}
Expand Down
8 changes: 5 additions & 3 deletions contracts/Comptroller.sol
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,12 @@ contract Comptroller is ComptrollerV5Storage, ComptrollerInterface, ComptrollerE
// Shh - currently unused
cToken;
redeemer;
redeemAmount;
redeemTokens;

// Require tokens is zero or amount is also zero
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The immutable tokens still need this, don't think we can get rid of redeemVerify until all cTokens are upgraded to not need it

if (redeemTokens == 0 && redeemAmount > 0) {
revert("redeemTokens zero");
// Shh - we don't ever want this hook to be marked pure
if (false) {
maxAssets = maxAssets;
}
}

Expand Down