When the recoverToken
function is called, it deletes the entire epoch data, preventing users who haven't yet claimed their tokens from ever being able to do so. This can result in permanent loss of user funds.
In the recoverToken
function, the epochId data is deleted:
delete epochs[epochId];
This operation removes all information related to the specified epoch from the contract's storage.
However, the claim
function relies heavily on the existence of epoch data:
EpochInfo storage info = epochs[epochId];
if (info.startTime == 0) { revert InvalidEpoch(); }
After epoch deletion, any attempt to claim tokens will result in an InvalidEpoch
error, as the startTime
for a deleted epoch will be 0.
User deposit information remains in the contract even after epoch deletion:
uint256 bidTokenAmount = depositors[msg.sender][epochId];
However, this information becomes inaccessible and unusable due to the epoch deletion.
Going be the documentation below, it expects depositors to be able to claim their tokens any time after an auction has ended:
"DAI depositors can claim their share of the TGOLD rewards after auction and also retroactively."
https://github.com/TempleDAO/temple/blob/templegold/protocol/contracts/templegold/README.md
But this won't be possible based on the above.
Users who haven't claimed their tokens before the recoverToken
function is called will permanently lose access to their funds.
Manual review
Create a separate mapping for claimable amounts: Instead of relying solely on epoch data, maintain a separate mapping of claimable amounts that persists even after epoch deletion.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.