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 repeated checks in the SupplyLogic.sol #847

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tanliwei
Copy link

@tanliwei tanliwei commented May 5, 2023

Merge two if branches into a two-level if branches to save gas without changing the logic.

The only case in this PR not covered is when the passed-in parameter params.amount equal to userBalance that is IAToken(reserveCache.aTokenAddress).scaledBalanceOf(msg.sender).rayMul(reserveCache.nextLiquidityIndex);

This pr is ok if only the value type(uint256).max stands for withdraw all asset.

Merge two `if` branches into two-level `if` branches to save gas without changing the logic.
@height
Copy link

height bot commented May 5, 2023

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

@tanliwei tanliwei requested a review from sakulstra as a code owner May 5, 2023 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant