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

Gas Optimizations #15

Open
code423n4 opened this issue Apr 29, 2022 · 2 comments
Open

Gas Optimizations #15

code423n4 opened this issue Apr 29, 2022 · 2 comments
Assignees
Labels
bug Something isn't working G (Gas Optimization)

Comments

@code423n4
Copy link
Contributor

Consider removing safeMath library.

Source:
OpenZeppelin/openzeppelin-contracts@24a0bc2#diff-f4b1737177aad965d94530b54ac4001a2e1f5fe6e4e34bafe023310cea599eca

Remove;
https://github.com/pooltogether/aave-v3-yield-source/blob/e63d1b0e396a5bce89f093630c282ca1c6627e44/contracts/AaveV3YieldSource.sol#L26

Change;
https://github.com/pooltogether/aave-v3-yield-source/blob/e63d1b0e396a5bce89f093630c282ca1c6627e44/contracts/AaveV3YieldSource.sol#L361

    return _supply == 0 ? _tokens : _tokens.mul(_supply).div(aToken.balanceOf(address(this)));

For:

    return _supply == 0 ? _tokens : (_tokens *_supply) / aToken.balanceOf(address(this));

Change:
https://github.com/pooltogether/aave-v3-yield-source/blob/e63d1b0e396a5bce89f093630c282ca1c6627e44/contracts/AaveV3YieldSource.sol#L373

    return _supply == 0 ? _shares : _shares.mul(aToken.balanceOf(address(this))).div(_supply);

For:

    return _supply == 0 ? _shares : (_shares * aToken.balanceOf(address(this))) / _supply;
@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Apr 29, 2022
code423n4 added a commit that referenced this issue Apr 29, 2022
@PierrickGT PierrickGT self-assigned this May 2, 2022
@PierrickGT
Copy link
Member

Duplicate of #11

@PierrickGT PierrickGT marked this as a duplicate of #11 May 2, 2022
@PierrickGT PierrickGT added the duplicate This issue or pull request already exists label May 2, 2022
@PierrickGT
Copy link
Member

Detailed report by the warden, should get extra points.

@JeeberC4 JeeberC4 removed the duplicate This issue or pull request already exists label May 6, 2022
@JeeberC4 JeeberC4 reopened this May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working G (Gas Optimization)
Projects
None yet
Development

No branches or pull requests

3 participants