Staking rewards cannot be updated due to incorrect usage of SafeERC20.safeApprove
#42
Labels
bug
Something isn't working
SafeERC20.safeApprove
#42
Github username: @aviggiano
Submission hash (on-chain): 0xc73327d922227ef04633cf85d0cc9855f74499615581a3b5bf6f4c8064544332
Severity: medium severity
Description:
Staking rewards cannot be updated due to incorrect usage of
SafeERC20.safeApprove
In 4bc89a3051dd4db80415933425b7d51e3d9a9240, a commit change introduced another issue on the
ExternalRewardDistributor.beginStakingReward
function.By using
IERC20(underlying).safeApprove(stakingContract, type(uint).max);
, the manager will not be able to update staking rewards, assafeApprove
reverts when changing allowance from non-zero to non-zero.Severity
Medium. Manager cannot update staking rewards.
Proof of Concept
Please review the following test
Recommendation
SafeERC20.safeApprove
has been deprecated. Its usage is discouraged. Do not useSafeERC20.safeApprove
, but ratherSafeERC20.safeIncreaseAllowance
.See a similar issue here.
The text was updated successfully, but these errors were encountered: