code-423n4 / 2021-11-badgerzaps-findings

0 stars 0 forks source link

Calculate balance of twice as part of an important function #57

Closed code423n4 closed 2 years ago

code423n4 commented 3 years ago

Handle

pants

Vulnerability details

At the function _renZapToIbbtc of IbbtcVaultZap You call RENCRV_TOKEN.balanceOf(address(this)) twice while you could save the value of the first call and use it to compute the value of the second call and save gas of calling external contract and reading its storage value.

GalloDaSballo commented 3 years ago

Finding is invalid, we check the balance once

0xleastwood commented 2 years ago

Agree with sponsor. RENCRV_TOKEN.balanceOf(address(this)) and RENCRV_VAULT.balanceOf(address(this)) are both only called once from within _renZapToIbbtc