TempleGold

TempleDAO
Foundry
25,000 USDC
View results
Submission Details
Severity: low
Invalid

Unnecessary Revert in Token Recovery Process

Summary

In the recoverToken function of the contract, when recovering Temple Gold tokens, the function reverts if the requested amount exceeds the total auction token amount. This could be inefficient and may prevent the recovery of the maximum available tokens.

Vulnerability Details

The relevant code snippet is:

if (amount > _totalAuctionTokenAmount) {
revert CommonEventsAndErrors.InvalidAmount(token, amount);
}

Instead of reverting, the function could transfer the maximum available amount (_totalAuctionTokenAmount) when the requested amount exceeds it.

Impact

The current implementation may lead to:

  • Unnecessary transaction failures when trying to recover all available tokens.

  • Additional gas costs for users who have to retry the recovery with the exact amount.

  • Potential for tokens to remain locked if the exact amount is not known or if multiple recovery attempts are needed.

Tools Used

Manual

Recommendations

uint256 amountToRecover = amount > _totalAuctionTokenAmount ? _totalAuctionTokenAmount : amount;
delete epochs[epochId];
unchecked {
nextAuctionGoldAmount += _totalAuctionTokenAmount - amountToRecover;
}
emit CommonEventsAndErrors.TokenRecovered(to, token, amountToRecover);
templeGold.safeTransfer(to, amountToRecover);
Updates

Lead Judging Commences

inallhonesty Lead Judge
about 1 year ago
inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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