Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: low
Invalid

Use of `approve` Instead of `safeApprove`

Issue Description

The approve function from the IERC20 interface is used in several part of the protocole. However, the use of approve is not recommended due to potential security risks and edge cases. Instead, the safeApprove function should be used to ensure safer token approvals.

Code Snippet:

https://github.com/Cyfrin/2025-01-zaros-part-2/blob/35deb3e92b2a32cd304bf61d27e6071ef36e446d/src/market-making/branches/VaultRouterBranch.sol#L354

https://github.com/Cyfrin/2025-01-zaros-part-2/blob/35deb3e92b2a32cd304bf61d27e6071ef36e446d/src/market-making/branches/CreditDelegationBranch.sol#L662

https://github.com/Cyfrin/2025-01-zaros-part-2/blob/35deb3e92b2a32cd304bf61d27e6071ef36e446d/src/market-making/branches/CreditDelegationBranch.sol#L747

https://github.com/Cyfrin/2025-01-zaros-part-2/blob/35deb3e92b2a32cd304bf61d27e6071ef36e446d/src/market-making/branches/CreditDelegationBranch.sol#L847

Risk Level:

  • Severity: Low/Informational

  • Impact: While the use of approve may not immediately lead to a vulnerability, it can cause issues in certain scenarios, such as when the spender's allowance is not properly reset before setting a new one. This can lead to unexpected behavior or potential loss of funds.

Recommendation:

Replace all approve function with safeApprove to mitigate potential risks. The safeApprove function ensures that the allowance is set to zero before updating it to a new value, preventing potential issues with token approvals.

Updates

Lead Judging Commences

inallhonesty Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.