-
Notifications
You must be signed in to change notification settings - Fork 1
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 SLOAD calls in _depositInVault #5
Conversation
IERC20Upgradeable _token = token; | ||
if(_token.allowance(address(this), address(v)) < _token.balanceOf(address(this))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some space
IERC20Upgradeable _token = token; | |
if(_token.allowance(address(this), address(v)) < _token.balanceOf(address(this))) { | |
IERC20Upgradeable _token = token; | |
if (_token.allowance(address(this), address(v)) < _token.balanceOf(address(this))) { |
token.safeApprove(address(v), type(uint256).max); | ||
IERC20Upgradeable _token = token; | ||
if(_token.allowance(address(this), address(v)) < _token.balanceOf(address(this))) { | ||
_token.safeApprove(address(v), type(uint256).max); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do this in initialize
, this way we wouldn't have to write all this if
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's covered here: code-423n4/2021-06-pooltogether-findings#95
if(maxLosses != 0) { | ||
vault.withdraw(yShares, address(this), maxLosses); | ||
uint256 _maxLosses = maxLosses; | ||
if(_maxLosses != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a space
if(_maxLosses != 0) { | |
if (_maxLosses != 0) { |
As a side note that should be addressed in another PR, we don't need to
Which would avoid us doing this check:
Fixed in this PR: #8 |
Not sure if it will lower gas consumption since
|
token.safeApprove(address(v), type(uint256).max); | ||
IERC20Upgradeable _token = token; | ||
if(_token.allowance(address(this), address(v)) < _token.balanceOf(address(this))) { | ||
_token.safeApprove(address(v), type(uint256).max); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's covered here: code-423n4/2021-06-pooltogether-findings#95
code-423n4/2021-06-pooltogether-findings#44