DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: low
Invalid

Event Naming Inconsistency in `_transferToken` Function

Details:
In the _transferToken function, if the transfer of tokens to the intended recipient fails, the contract falls back to transferring the tokens to the treasury and emits an event named TokenTranferFailed. The event name is misleading because the fallback mechanism successfully redirects the funds rather than representing an unrecoverable failure. Additionally, there is a typo (“Tranfer” instead of “Transfer”) that could cause further confusion.


Root Cause:
The inconsistency arises from an unclear and possibly erroneous naming of the event. The contract’s design uses a fallback mechanism to ensure funds are not lost when a transfer to the recipient fails. However, the event name TokenTranferFailed does not accurately reflect the intended behavior (i.e., transferring the tokens to the treasury), which leads to ambiguity in off-chain monitoring and analysis.


Impact:

  • Confusion in Monitoring: Off-chain systems or auditors monitoring event logs may misinterpret the event as a critical failure rather than a controlled fallback.

  • Documentation and Debugging: The misleading event name could complicate debugging and result in incorrect assumptions about fund flows.

  • No Direct Security Risk: There is no direct risk to funds or overall contract security, as the fallback mechanism still ensures proper handling of tokens.


Recommendation:

  • Rename the Event: Change the event name from TokenTranferFailed to something more descriptive such as TokenTransferToTreasury to clearly indicate that the tokens are being redirected to the treasury as a fallback.

  • Correct the Typo: Fix the typo in the event name from “Tranfer” to “Transfer.”

  • Update Documentation: Ensure that any related documentation and off-chain monitoring systems are updated to reflect the new event name, reducing potential confusion.


Proof of Concept:

  1. Setup: Deploy the contract with a compliant ERC20 token and configure the treasury address.

  2. Simulate a Failure:

    • Use a token or modify conditions so that the collateralToken.transfer to the recipient fails (for example, by having the recipient contract revert or by using a token that intentionally fails transfers to certain addresses).

  3. Observe Behavior:

    • The fallback mechanism should trigger, transferring the tokens to the treasury.

    • An event (ideally renamed to TokenTransferToTreasury) will be emitted indicating that the tokens were redirected.

  4. Verify Logs:

    • Check the emitted event in the transaction logs to confirm that it accurately reflects the fallback action.

This PoC confirms that while the fallback mechanism works as intended, renaming the event would improve clarity and reduce potential misinterpretations.

Updates

Lead Judging Commences

n0kto Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

n0kto Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

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