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

YearnV2YieldSource save gas with pre-approval #95

Closed
code423n4 opened this issue Jun 23, 2021 · 3 comments
Closed

YearnV2YieldSource save gas with pre-approval #95

code423n4 opened this issue Jun 23, 2021 · 3 comments

Comments

@code423n4
Copy link
Contributor

Handle

cmichel

Vulnerability details

YearnV2YieldSource._depositInVault can save gas by caching token in memory instead of accessing it 3 times from storage.

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Jun 23, 2021
code423n4 added a commit that referenced this issue Jun 23, 2021
@asselstine
Copy link
Collaborator

We considered this, but it's possible for a malicious user to "drain" the approval of the contract, so there would need to be checks to see if approval dropped below a certain level. We opted to leave out the complexity.

@asselstine
Copy link
Collaborator

Actually, we'll tackle this. We will:

  1. approve max on init
  2. provide a function to approve max again

@kamescg kamescg self-assigned this Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants