QA Report #143
Labels
bug
Something isn't working
invalid
This doesn't seem right
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
safeApprove() is deprecated
Deprecated in favor of safeIncreaseAllowance() and safeDecreaseAllowance()
The contract made use of the deprecated SafeERC20.safeApprove() function. As noted in the SafeERC20 contract, the safeApprove() function was vulnerable to the same transaction reordering issue as the standard ERC20 approve() function, as detailed here[https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729]
Instances:
contracts/VeAssetDepositor.sol:162: IERC20(minter).safeApprove(_stakeAddress, _amount);
contracts/VE3DRewardPool.sol:287: IERC20(_rewardToken).safeApprove(rewardTokenInfo[_rewardToken].veAssetDeposits, 0);
contracts/VE3DRewardPool.sol:288: IERC20(_rewardToken).safeApprove(
contracts/VE3DRewardPool.sol:301: IERC20(rewardTokenInfo[_rewardToken].ve3Token).safeApprove(
contracts/VE3DRewardPool.sol:305: IERC20(rewardTokenInfo[_rewardToken].ve3Token).safeApprove(
contracts/VE3DLocker.sol:211: IERC20(rewardData[_rewardsToken].ve3Token).safeApprove(
contracts/VE3DLocker.sol:215: IERC20(rewardData[_rewardsToken].ve3Token).safeApprove(
contracts/VE3DLocker.sol:221: IERC20(_rewardsToken).safeApprove(rewardData[_rewardsToken].veAssetDeposits, 0);
contracts/VE3DLocker.sol:222: IERC20(_rewardsToken).safeApprove(
contracts/Booster.sol:374: IERC20(token).safeApprove(rewardContract, _amount);
contracts/VoterProxy.sol:101: IERC20(_token).safeApprove(_gauge, 0);
contracts/VoterProxy.sol:102: IERC20(_token).safeApprove(_gauge, balance);
contracts/VoterProxy.sol:152: IERC20(veAsset).safeApprove(escrow, 0);
contracts/VoterProxy.sol:153: IERC20(veAsset).safeApprove(escrow, _value);
contracts/VoterProxy.sol:160: IERC20(veAsset).safeApprove(escrow, 0);
contracts/VoterProxy.sol:161: IERC20(veAsset).safeApprove(escrow, _value);
Reference:
OpenZeppelin/openzeppelin-contracts#2219
Remediation:
The SafeERC20.safeIncreaseAllowance() function should be used in place of SafeERC20.safeApprove() function.
The text was updated successfully, but these errors were encountered: