yearn / yearn-protocol

Yearn smart contracts
https://yearn.finance
GNU Affero General Public License v3.0
441 stars 211 forks source link

Improvement on Vault version2 approve() #25

Closed t4sk closed 3 years ago

t4sk commented 3 years ago

https://github.com/iearn-finance/yearn-protocol/blob/e602e66f18875edf192f0f2a65aac4d2453470a3/contracts/Vault.vy#L167

This is just a suggestion. It might be good to add safety checks on the approve method to mitigate the problem described here https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol#L42

This safety check is present in curve.fi ERC20 token https://github.com/curvefi/curve-contract/blob/master/contracts/tokens/CurveTokenV2.vy

fubuloubu commented 3 years ago

@t4sk good catch!